Reintroduce pane_grid::Split
as an identifier
This commit is contained in:
parent
b55746b1e1
commit
db441a64b1
@ -2,11 +2,13 @@ mod axis;
|
||||
mod direction;
|
||||
mod node;
|
||||
mod pane;
|
||||
mod split;
|
||||
mod state;
|
||||
|
||||
pub use axis::Axis;
|
||||
pub use direction::Direction;
|
||||
pub use pane::Pane;
|
||||
pub use split::Split;
|
||||
pub use state::{Focus, State};
|
||||
|
||||
use crate::{
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
pane_grid::{Axis, Pane},
|
||||
pane_grid::{Axis, Pane, Split},
|
||||
Rectangle, Size,
|
||||
};
|
||||
|
||||
@ -8,7 +8,7 @@ use std::collections::HashMap;
|
||||
#[derive(Debug, Clone, Hash)]
|
||||
pub enum Node {
|
||||
Split {
|
||||
id: usize,
|
||||
id: Split,
|
||||
axis: Axis,
|
||||
ratio: u32,
|
||||
a: Box<Node>,
|
||||
@ -33,7 +33,7 @@ impl Node {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn split(&mut self, id: usize, axis: Axis, new_pane: Pane) {
|
||||
pub fn split(&mut self, id: Split, axis: Axis, new_pane: Pane) {
|
||||
*self = Node::Split {
|
||||
id,
|
||||
axis,
|
||||
|
2
native/src/widget/pane_grid/split.rs
Normal file
2
native/src/widget/pane_grid/split.rs
Normal file
@ -0,0 +1,2 @@
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct Split(pub(super) usize);
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
input::keyboard,
|
||||
pane_grid::{node::Node, Axis, Direction, Pane},
|
||||
pane_grid::{node::Node, Axis, Direction, Pane, Split},
|
||||
Hasher, Point, Rectangle, Size,
|
||||
};
|
||||
|
||||
@ -107,13 +107,13 @@ impl<T> State<T> {
|
||||
Pane(self.internal.last_id)
|
||||
};
|
||||
|
||||
let split_id = {
|
||||
let new_split = {
|
||||
self.internal.last_id = self.internal.last_id.checked_add(1)?;
|
||||
|
||||
self.internal.last_id
|
||||
Split(self.internal.last_id)
|
||||
};
|
||||
|
||||
node.split(split_id, axis, new_pane);
|
||||
node.split(new_split, axis, new_pane);
|
||||
|
||||
let _ = self.panes.insert(new_pane, state);
|
||||
self.focus(&new_pane);
|
||||
|
Loading…
x
Reference in New Issue
Block a user