Rename regions and splits in pane_grid::Node

This commit is contained in:
Héctor Ramón Jiménez 2020-06-30 00:32:55 +02:00
parent 1bc69e7a8a
commit cb530ccf2f
3 changed files with 14 additions and 12 deletions

View File

@ -288,7 +288,7 @@ impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer> {
if let Some((split, _)) = self.state.picked_split() {
let bounds = layout.bounds();
let splits = self.state.splits(
let splits = self.state.split_regions(
f32::from(self.spacing),
Size::new(bounds.width, bounds.height),
);
@ -410,7 +410,7 @@ where
let limits = limits.width(self.width).height(self.height);
let size = limits.resolve(Size::ZERO);
let regions = self.state.regions(f32::from(self.spacing), size);
let regions = self.state.pane_regions(f32::from(self.spacing), size);
let children = self
.elements
@ -453,7 +453,7 @@ where
cursor_position.y - bounds.y,
);
let splits = self.state.splits(
let splits = self.state.split_regions(
f32::from(self.spacing),
Size::new(bounds.width, bounds.height),
);
@ -590,7 +590,7 @@ where
let splits = self
.state
.splits(f32::from(self.spacing), bounds.size());
.split_regions(f32::from(self.spacing), bounds.size());
hovered_split(
splits.iter(),

View File

@ -48,7 +48,7 @@ impl Node {
///
/// [`Pane`]: struct.Pane.html
/// [`Node`]: enum.Node.html
pub fn regions(
pub fn pane_regions(
&self,
spacing: f32,
size: Size,
@ -75,7 +75,7 @@ impl Node {
///
/// [`Split`]: struct.Split.html
/// [`Node`]: enum.Node.html
pub fn splits(
pub fn split_regions(
&self,
spacing: f32,
size: Size,

View File

@ -154,8 +154,10 @@ impl<T> State<T> {
/// [`Pane`]: struct.Pane.html
/// [`State::active`]: struct.State.html#method.active
pub fn adjacent(&self, pane: &Pane, direction: Direction) -> Option<Pane> {
let regions =
self.internal.layout.regions(0.0, Size::new(4096.0, 4096.0));
let regions = self
.internal
.layout
.pane_regions(0.0, Size::new(4096.0, 4096.0));
let current_region = regions.get(pane)?;
@ -362,20 +364,20 @@ impl Internal {
}
}
pub fn regions(
pub fn pane_regions(
&self,
spacing: f32,
size: Size,
) -> HashMap<Pane, Rectangle> {
self.layout.regions(spacing, size)
self.layout.pane_regions(spacing, size)
}
pub fn splits(
pub fn split_regions(
&self,
spacing: f32,
size: Size,
) -> HashMap<Split, (Axis, Rectangle, f32)> {
self.layout.splits(spacing, size)
self.layout.split_regions(spacing, size)
}
pub fn focus(&mut self, pane: &Pane) {