From 34939cfb6962d835a9c06c1373c24d645a4cdba9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 28 Feb 2021 13:26:14 +0000 Subject: [PATCH] angle: Actually copy angle when we get a piece update Signed-off-by: Ian Jackson --- src/gamestate.rs | 1 + src/updates.rs | 1 + templates/script.ts | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/gamestate.rs b/src/gamestate.rs index 6fef4f9c..5d03737d 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -278,6 +278,7 @@ impl GPiece { svg : pri.make_defs(self, &p)?, z : self.zlevel.z.clone(), zg : self.zlevel.zg, + angle : pri.angle(self).to_compass(), pinned : self.pinned, uos : pri.ui_operations(self, p)?, } diff --git a/src/updates.rs b/src/updates.rs index 41297a2e..c68ca80e 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -83,6 +83,7 @@ pub struct PreparedPieceState { pub held: Option, pub z: ZCoord, pub zg: Generation, + pub angle: CompassAngle, pub pinned: bool, pub uos: Vec, } diff --git a/templates/script.ts b/templates/script.ts index cfad75fd..d54a00a5 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -1032,6 +1032,7 @@ type PreparedPieceState = { z: ZCoord, zg: Generation, pinned: boolean, + angle: number, uos: UoDescription[], } @@ -1061,6 +1062,7 @@ function piece_modify(piece: PieceId, p: PieceInfo, info: PreparedPieceState, p.uelem.setAttributeNS(null, "y", info.pos[1]+""); p.held = info.held; p.pinned = info.pinned; + p.angle = info.angle; p.uos = info.uos; piece_set_zlevel(piece,p, (oldtop_piece)=>{ p.z = info.z; -- 2.30.2