diff options
Diffstat (limited to 'examples/pane_grid/src')
-rw-r--r-- | examples/pane_grid/src/main.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/pane_grid/src/main.rs b/examples/pane_grid/src/main.rs index c9f1376c..2ffdcc69 100644 --- a/examples/pane_grid/src/main.rs +++ b/examples/pane_grid/src/main.rs @@ -1,14 +1,16 @@ use iced::alignment::{self, Alignment}; +use iced::event::{self, Event}; use iced::executor; use iced::keyboard; +use iced::subscription; use iced::theme::{self, Theme}; use iced::widget::pane_grid::{self, PaneGrid}; -use iced::widget::{button, column, container, row, scrollable, text}; +use iced::widget::{ + button, column, container, responsive, row, scrollable, text, +}; use iced::{ Application, Color, Command, Element, Length, Settings, Size, Subscription, }; -use iced_lazy::responsive; -use iced_native::{event, subscription, Event}; pub fn main() -> iced::Result { Example::run(Settings::default()) @@ -106,8 +108,9 @@ impl Application for Example { Message::Dragged(pane_grid::DragEvent::Dropped { pane, target, + region, }) => { - self.panes.swap(&pane, &target); + self.panes.split_with(&target, &pane, region); } Message::Dragged(_) => {} Message::TogglePin(pane) => { @@ -253,6 +256,7 @@ fn handle_hotkey(key_code: keyboard::KeyCode) -> Option<Message> { } } +#[derive(Clone, Copy)] struct Pane { id: usize, pub is_pinned: bool, |