Fix ratio calculation on resize in PaneGrid
This commit is contained in:
parent
ec334bdd36
commit
a373682fa4
1 changed files with 4 additions and 8 deletions
|
|
@ -131,19 +131,15 @@ impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer> {
|
||||||
let ratio = match axis {
|
let ratio = match axis {
|
||||||
Axis::Horizontal => {
|
Axis::Horizontal => {
|
||||||
let position =
|
let position =
|
||||||
cursor_position.y - bounds.y + rectangle.y;
|
cursor_position.y - bounds.y - rectangle.y;
|
||||||
|
|
||||||
(position / (rectangle.y + rectangle.height))
|
(position / rectangle.height).max(0.1).min(0.9)
|
||||||
.max(0.1)
|
|
||||||
.min(0.9)
|
|
||||||
}
|
}
|
||||||
Axis::Vertical => {
|
Axis::Vertical => {
|
||||||
let position =
|
let position =
|
||||||
cursor_position.x - bounds.x + rectangle.x;
|
cursor_position.x - bounds.x - rectangle.x;
|
||||||
|
|
||||||
(position / (rectangle.x + rectangle.width))
|
(position / rectangle.width).max(0.1).min(0.9)
|
||||||
.max(0.1)
|
|
||||||
.min(0.9)
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue