Fix ratio calculation on resize in PaneGrid
This commit is contained in:
parent
ec334bdd36
commit
a373682fa4
@ -131,19 +131,15 @@ impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer> {
|
||||
let ratio = match axis {
|
||||
Axis::Horizontal => {
|
||||
let position =
|
||||
cursor_position.y - bounds.y + rectangle.y;
|
||||
cursor_position.y - bounds.y - rectangle.y;
|
||||
|
||||
(position / (rectangle.y + rectangle.height))
|
||||
.max(0.1)
|
||||
.min(0.9)
|
||||
(position / rectangle.height).max(0.1).min(0.9)
|
||||
}
|
||||
Axis::Vertical => {
|
||||
let position =
|
||||
cursor_position.x - bounds.x + rectangle.x;
|
||||
cursor_position.x - bounds.x - rectangle.x;
|
||||
|
||||
(position / (rectangle.x + rectangle.width))
|
||||
.max(0.1)
|
||||
.min(0.9)
|
||||
(position / rectangle.width).max(0.1).min(0.9)
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user