diff --git a/CHANGELOG.md b/CHANGELOG.md index 2580913ca..7b69a0ada 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,10 +36,9 @@ Please only add new entries below the [Unreleased](#unreleased---releasedate) he - **core**: Nodes created by a class implementation may not be disposed of when switching to another class. (#637 @M-Adoo) - **core**: When merge multiple `MixBuiltin` widgets, there may be a premature dropping of the outer `MixBuiltin` before it should occur. (#639 @M-Adoo) - **core**: `watch!` does not notify the initial value. (#640 @M-Adoo) - - **core**: fix watch multi builtin events not work (#641 @wjian23) - - **core**: fix widget layout when h_algin and v_align are embedded in each other (#641 @wjian23) +- **painter**: fix elements may not be painted after window resize. (#644 @M-Adoo) ### Breaking diff --git a/painter/src/painter.rs b/painter/src/painter.rs index a1054b5d3..c44cc6f63 100644 --- a/painter/src/painter.rs +++ b/painter/src/painter.rs @@ -18,7 +18,6 @@ use crate::{ /// X-axis values progress toward the right edge of the canvas, while Y-axis /// values increase towards the bottom edge of the canvas. pub struct Painter { - viewport: Rect, init_state: PainterState, state_stack: Vec, commands: Vec, @@ -178,7 +177,6 @@ impl Painter { init_state, commands: vec![], path_builder: Path::builder(), - viewport, } } @@ -191,11 +189,11 @@ impl Painter { self.reset(); } - pub fn viewport(&self) -> &Rect { &self.viewport } + pub fn viewport(&self) -> &Rect { &self.init_state.bounds } /// Change the bounds of the painter can draw.But it won't take effect until /// the next time you call [`Painter::reset`]!. - pub fn set_viewport(&mut self, bounds: Rect) { self.viewport = bounds; } + pub fn set_viewport(&mut self, bounds: Rect) { self.init_state.bounds = bounds; } pub fn intersection_paint_bounds(&self, rect: &Rect) -> Option { self.paint_bounds().intersection(rect)