chiark / gitweb /
Provide and plumb multigtab piece property from Rust to JS
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 18 Apr 2022 09:10:37 +0000 (10:10 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 18 Apr 2022 12:30:12 +0000 (13:30 +0100)
Currently nothing sets this (on the Rust side) nor uses it (on the JS
side).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/gamestate.rs
src/pcrender.rs
src/updates.rs
templates/script.ts

index 1eaf95b14a4515ec4d1e4cb057ca0e70f871b6b1..83a5f2aba92608c0303af755db445c703d9fcf72 100644 (file)
@@ -295,6 +295,7 @@ pub type PieceSpecLoadedOccultable =
 #[derive(Debug,Clone,Default,Serialize,Deserialize)]
 pub struct PieceSpecialProperties {
   pub rendering: Option<SpecialClientRendering>,
+  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);
index c29b338723315d4c57cfe4cf2f3291b25d1971c1..2111e096137a3ccb8f4ec8ac603a030deff9284b 100644 (file)
@@ -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),
index 1587cd7372813dbcadbd973ce5d8bc89cd29723e..f627de5622b31c209eea3168c476fbb1619cea01 100644 (file)
@@ -121,6 +121,7 @@ pub struct PreparedPieceState {
   pub pinned: bool,
   pub moveable: PieceMoveable,
   pub rotateable: bool,
+  pub multigrab: bool,
   pub uos: Vec<UoDescription>,
   pub occregion: Option<JsonString<Region>>,
   pub bbox: Rect,
index 7007b4735249e6f7df27d441700d7af9083b44d2..f21513abc1db3d46ce669ee636b1167552d18f6a 100644 (file)
@@ -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);