diff options
Diffstat (limited to 'wgpu/src/renderer/column.rs')
-rw-r--r-- | wgpu/src/renderer/column.rs | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/wgpu/src/renderer/column.rs b/wgpu/src/renderer/column.rs index c83a7de1..cac6da77 100644 --- a/wgpu/src/renderer/column.rs +++ b/wgpu/src/renderer/column.rs @@ -1,5 +1,5 @@ use crate::{Primitive, Renderer}; -use iced_native::{column, Column, Layout, Point}; +use iced_native::{column, Column, Layout, MouseCursor, Point}; impl column::Renderer for Renderer { fn draw<Message>( @@ -8,15 +8,27 @@ impl column::Renderer for Renderer { layout: Layout<'_>, cursor_position: Point, ) -> Self::Output { - Primitive::Group { - primitives: column - .children - .iter() - .zip(layout.children()) - .map(|(child, layout)| { - child.draw(self, layout, cursor_position) - }) - .collect(), - } + let mut mouse_cursor = MouseCursor::OutOfBounds; + + ( + Primitive::Group { + primitives: column + .children + .iter() + .zip(layout.children()) + .map(|(child, layout)| { + let (primitive, new_mouse_cursor) = + child.draw(self, layout, cursor_position); + + if new_mouse_cursor > mouse_cursor { + mouse_cursor = new_mouse_cursor; + } + + primitive + }) + .collect(), + }, + mouse_cursor, + ) } } |