diff options
author | 2023-10-24 05:34:03 +0200 | |
---|---|---|
committer | 2024-02-02 02:24:45 +0100 | |
commit | f4d66486016076bb339a338bc589645119962d1e (patch) | |
tree | bbb9c4d996216893296cf4323857323542d6e757 /widget/src/pane_grid.rs | |
parent | a6e91d13d5d43796d0e6bb570fb4f010cf27921a (diff) | |
download | iced-f4d66486016076bb339a338bc589645119962d1e.tar.gz iced-f4d66486016076bb339a338bc589645119962d1e.tar.bz2 iced-f4d66486016076bb339a338bc589645119962d1e.zip |
Introduce `with_transformation` to `Renderer` trait
Diffstat (limited to 'widget/src/pane_grid.rs')
-rw-r--r-- | widget/src/pane_grid.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/widget/src/pane_grid.rs b/widget/src/pane_grid.rs index f76c6088..24389462 100644 --- a/widget/src/pane_grid.rs +++ b/widget/src/pane_grid.rs @@ -43,7 +43,7 @@ use crate::core::widget; use crate::core::widget::tree::{self, Tree}; use crate::core::{ Clipboard, Element, Layout, Length, Pixels, Point, Rectangle, Shell, Size, - Vector, Widget, + Transformation, Vector, Widget, }; /// A collection of panes distributed using either vertical or horizontal splits @@ -962,9 +962,11 @@ 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), + let translation = cursor_position + - Point::new(bounds.x + origin.x, bounds.y + origin.y); + + renderer.with_transformation( + Transformation::translate(translation.x, translation.y), |renderer| { renderer.with_layer(bounds, |renderer| { draw_pane( |