summaryrefslogtreecommitdiffstats
path: root/native/src/widget/pane_grid/split.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-14 06:32:56 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-14 06:32:56 +0100
commita79603e4ca5e0cee46a737ef0b1af5c69ddb49b6 (patch)
tree30c794fe0f767dafe710034bd57402f98f3e74d5 /native/src/widget/pane_grid/split.rs
parent00c2b55b569ea2ff2fc9de9bbf02475c6ede7e42 (diff)
downloadiced-a79603e4ca5e0cee46a737ef0b1af5c69ddb49b6.tar.gz
iced-a79603e4ca5e0cee46a737ef0b1af5c69ddb49b6.tar.bz2
iced-a79603e4ca5e0cee46a737ef0b1af5c69ddb49b6.zip
Rename `Split` to `Axis`
Diffstat (limited to 'native/src/widget/pane_grid/split.rs')
-rw-r--r--native/src/widget/pane_grid/split.rs54
1 files changed, 0 insertions, 54 deletions
diff --git a/native/src/widget/pane_grid/split.rs b/native/src/widget/pane_grid/split.rs
deleted file mode 100644
index ca9ed5e1..00000000
--- a/native/src/widget/pane_grid/split.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-use crate::Rectangle;
-
-#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
-pub enum Split {
- Horizontal,
- Vertical,
-}
-
-impl Split {
- pub(super) fn apply(
- &self,
- rectangle: &Rectangle,
- ratio: f32,
- halved_spacing: f32,
- ) -> (Rectangle, Rectangle) {
- match self {
- Split::Horizontal => {
- let width_left =
- (rectangle.width * ratio).round() - halved_spacing;
- let width_right = rectangle.width - width_left - halved_spacing;
-
- (
- Rectangle {
- width: width_left,
- ..*rectangle
- },
- Rectangle {
- x: rectangle.x + width_left + halved_spacing,
- width: width_right,
- ..*rectangle
- },
- )
- }
- Split::Vertical => {
- let height_top =
- (rectangle.height * ratio).round() - halved_spacing;
- let height_bottom =
- rectangle.height - height_top - halved_spacing;
-
- (
- Rectangle {
- height: height_top,
- ..*rectangle
- },
- Rectangle {
- y: rectangle.y + height_top + halved_spacing,
- height: height_bottom,
- ..*rectangle
- },
- )
- }
- }
- }
-}