diff options
Diffstat (limited to '')
-rw-r--r-- | widget/src/canvas.rs | 6 | ||||
-rw-r--r-- | widget/src/pane_grid.rs | 31 | ||||
-rw-r--r-- | widget/src/qr_code.rs | 11 |
3 files changed, 24 insertions, 24 deletions
diff --git a/widget/src/canvas.rs b/widget/src/canvas.rs index b95e6206..0eda0191 100644 --- a/widget/src/canvas.rs +++ b/widget/src/canvas.rs @@ -15,7 +15,7 @@ use crate::core::mouse; use crate::core::renderer; use crate::core::widget::tree::{self, Tree}; use crate::core::{ - Clipboard, Element, Length, Rectangle, Shell, Size, Vector, Widget, + Clipboard, Element, Length, Rectangle, Shell, Size, Transformation, Widget, }; use crate::graphics::geometry; @@ -207,8 +207,8 @@ where let state = tree.state.downcast_ref::<P::State>(); - renderer.with_translation( - Vector::new(bounds.x, bounds.y), + renderer.with_transformation( + Transformation::translate(bounds.x, bounds.y), |renderer| { renderer.draw( self.program.draw(state, renderer, theme, bounds, cursor), diff --git a/widget/src/pane_grid.rs b/widget/src/pane_grid.rs index f76c6088..4f9a265a 100644 --- a/widget/src/pane_grid.rs +++ b/widget/src/pane_grid.rs @@ -962,22 +962,21 @@ pub fn draw<Theme, Renderer, T>( if let Some(cursor_position) = cursor.position() { let bounds = layout.bounds(); - renderer.with_translation( - cursor_position - - Point::new(bounds.x + origin.x, bounds.y + origin.y), - |renderer| { - renderer.with_layer(bounds, |renderer| { - draw_pane( - pane, - renderer, - default_style, - layout, - pane_cursor, - viewport, - ); - }); - }, - ); + let translation = cursor_position + - Point::new(bounds.x + origin.x, bounds.y + origin.y); + + renderer.with_translation(translation, |renderer| { + renderer.with_layer(bounds, |renderer| { + draw_pane( + pane, + renderer, + default_style, + layout, + pane_cursor, + viewport, + ); + }); + }); } } diff --git a/widget/src/qr_code.rs b/widget/src/qr_code.rs index 91c0a97b..6a748e63 100644 --- a/widget/src/qr_code.rs +++ b/widget/src/qr_code.rs @@ -119,11 +119,12 @@ impl<'a, Message, Theme> Widget<Message, Theme, Renderer> for QRCode<'a> { }); }); - let translation = Vector::new(bounds.x, bounds.y); - - renderer.with_translation(translation, |renderer| { - renderer.draw(vec![geometry]); - }); + renderer.with_translation( + bounds.position() - Point::ORIGIN, + |renderer| { + renderer.draw(vec![geometry]); + }, + ); } } |