From 55ff72655fe7bc0eeaa839edd8813f1280d6e333 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 1 Apr 2021 12:40:02 +0100 Subject: [PATCH] updates: Provide facehint in PreparedUpdateEntry Signed-off-by: Ian Jackson --- src/pcrender.rs | 8 ++++++++ src/updates.rs | 1 + 2 files changed, 9 insertions(+) diff --git a/src/pcrender.rs b/src/pcrender.rs index f5c889a0..2e1fa00d 100644 --- a/src/pcrender.rs +++ b/src/pcrender.rs @@ -129,6 +129,7 @@ impl PieceRenderInstructions { pinned : gpc.pinned, uos : pri.ui_operations(gs, gpc, ipc)?, moveable : gpc.moveable(), + facehint : pri.facehint(gpc), occregion, }; dbgc!(pri, ipc, gpc, r); @@ -155,6 +156,13 @@ impl PieceRenderInstructions { } } + pub fn facehint(&self, gpc: &GPiece) -> Option { + match self.occulted { + PriOcculted::Visible(_) => Some(gpc.face), + PriOcculted::Occulted | PriOcculted::Displaced(..) => None, + } + } + pub fn pos_zlevel<'r>(&'r self, gpc: &'r GPiece) -> (Pos, &'r ZLevel) { use PriOcculted as PO; match &self.occulted { diff --git a/src/updates.rs b/src/updates.rs index 61e9509a..830f3bb2 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -100,6 +100,7 @@ pub struct PreparedPieceUpdateGeneral { pub struct PreparedPieceState { pub pos: Pos, pub svg: Html, + pub facehint: Option, pub held: Option, pub z: ZCoord, pub zg: Generation, -- 2.30.2