summaryrefslogblamecommitdiffstats
path: root/wgpu/src/renderer/widget/panes.rs
blob: 74e588953d490cefb3707ab13d7d31c64ef9a5e5 (plain) (tree)
1
2
3
4
5
6
7
8






                                                              
                                                              









                                                        
                                                
                                                           
                                                                               












                                                            
use crate::{Primitive, Renderer};
use iced_native::{panes, Element, Layout, MouseCursor, Point};

impl panes::Renderer for Renderer {
    fn draw<Message>(
        &mut self,
        defaults: &Self::Defaults,
        content: &[(panes::Pane, Element<'_, Message, Self>)],
        layout: Layout<'_>,
        cursor_position: Point,
    ) -> Self::Output {
        let mut mouse_cursor = MouseCursor::OutOfBounds;

        (
            Primitive::Group {
                primitives: content
                    .iter()
                    .zip(layout.children())
                    .map(|((_, pane), layout)| {
                        let (primitive, new_mouse_cursor) =
                            pane.draw(self, defaults, layout, cursor_position);

                        if new_mouse_cursor > mouse_cursor {
                            mouse_cursor = new_mouse_cursor;
                        }

                        primitive
                    })
                    .collect(),
            },
            mouse_cursor,
        )
    }
}