Merge pull request #1856 from jhff/pane_grid_split_with_dragged_pane

[Feature] Enhance PaneGrid to split panes by drag & drop
This commit is contained in:
Héctor Ramón 2023-05-19 17:16:22 +02:00 committed by GitHub
commit 640e13943c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 196 additions and 18 deletions

View file

@ -108,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) => {
@ -255,6 +256,7 @@ fn handle_hotkey(key_code: keyboard::KeyCode) -> Option<Message> {
}
}
#[derive(Clone, Copy)]
struct Pane {
id: usize,
pub is_pinned: bool,