From: Ian Jackson Date: Mon, 18 Apr 2022 09:10:37 +0000 (+0100) Subject: Provide and plumb multigtab piece property from Rust to JS X-Git-Tag: otter-1.1.0~481 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=85974a115f064406a98489edc1a4c193ecd2ed23;p=otter.git Provide and plumb multigtab piece property from Rust to JS Currently nothing sets this (on the Rust side) nor uses it (on the JS side). Signed-off-by: Ian Jackson --- diff --git a/src/gamestate.rs b/src/gamestate.rs index 1eaf95b1..83a5f2ab 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -295,6 +295,7 @@ pub type PieceSpecLoadedOccultable = #[derive(Debug,Clone,Default,Serialize,Deserialize)] pub struct PieceSpecialProperties { pub rendering: Option, + pub multigrab: bool, } #[typetag::serde(tag="type")] @@ -454,6 +455,10 @@ impl GPiece { if self.occult.is_active() { false } else { self.rotateable } } + pub fn multigrab(&self, ipc: &IPiece) -> bool { + if self.occult.is_active() { false } + else { ipc.special.multigrab } + } pub fn dummy() -> Self { let gen_dummy = Generation(1); diff --git a/src/pcrender.rs b/src/pcrender.rs index c29b3387..2111e096 100644 --- a/src/pcrender.rs +++ b/src/pcrender.rs @@ -136,6 +136,7 @@ impl PieceRenderInstructions { angle : pri.angle(gpc).to_compass(), pinned : gpc.pinned, rotateable : gpc.rotateable(), + multigrab : gpc.multigrab(ipc), uos : pri.ui_operations(gs, gpc, ipc)?, moveable : gpc.moveable(), facehint : pri.facehint(gpc), diff --git a/src/updates.rs b/src/updates.rs index 1587cd73..f627de56 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -121,6 +121,7 @@ pub struct PreparedPieceState { pub pinned: bool, pub moveable: PieceMoveable, pub rotateable: bool, + pub multigrab: bool, pub uos: Vec, pub occregion: Option>, pub bbox: Rect, diff --git a/templates/script.ts b/templates/script.ts index 7007b473..f21513ab 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -78,6 +78,7 @@ type PieceInfo = { pinned: boolean, moveable: PieceMoveable, rotateable: boolean, + multigrab: boolean, uos : UoDescription[], uelem : SVGGraphicsElement, delem : SVGGraphicsElement, @@ -1754,6 +1755,7 @@ type PreparedPieceState = { uos: UoDescription[], moveable: PieceMoveable, rotateable: boolean, + multigrab: boolean, occregion: string | null, bbox: Rect, } @@ -1867,6 +1869,7 @@ function piece_modify_core(piece: PieceId, p: PieceInfo, p.pinned = info.pinned; p.moveable = info.moveable; p.rotateable = info.rotateable; + p.multigrab = info.multigrab; p.angle = info.angle; p.bbox = info.bbox; piece_set_zlevel_from(piece,p,info);