From 741a6ab45ea22b925d24ffeab753eeb160ce780e Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 7 Jun 2022 16:27:16 +0800 Subject: [PATCH] fix dynamic resize redraw bug for some reason I was setting the state of a canvas to not drawable when the clip rectangle was being reset, causing dynamic dialog boxes to become static if the content inside changes size. I think this is an artifact of a previous generation of this code, so commenting that out, but left a breadcrumb is case I'm wrong. --- services/gam/src/canvas.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/gam/src/canvas.rs b/services/gam/src/canvas.rs index 730d0fc4b..a33198e71 100644 --- a/services/gam/src/canvas.rs +++ b/services/gam/src/canvas.rs @@ -78,7 +78,13 @@ impl Canvas { } pub fn pan_offset(&self) -> Point { self.pan_offset } pub fn clip_rect(&self) -> Rectangle { self.clip_rect } - pub fn set_clip(&mut self, cr: Rectangle) { self.clip_rect = cr; *self.state.borrow_mut() = CanvasState::OffScreenDrawable } + pub fn set_clip(&mut self, cr: Rectangle) { + self.clip_rect = cr; + // I think this line is in error -- I don't remember *why* we would set this, but with this line here, + // any box that dynamically updates size would become instantly not drawable, with no way to restore that state. + // log::info!("set_clip would side effect {:?} to OffScreenDrawable", self.state.borrow()); + // *self.state.borrow_mut() = CanvasState::OffScreenDrawable + } pub fn gid(&self) -> Gid { self.gid } pub fn trust_level(&self) -> u8 { self.trust_level } pub fn set_trust_level(&mut self, level: u8) {self.trust_level = level;}