mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-28 11:29:25 +00:00
Ensure sidebar width never goes below 0
This commit is contained in:
parent
30ce7f6122
commit
2cd21d1da8
1 changed files with 3 additions and 2 deletions
|
@ -127,9 +127,10 @@ impl Sidebar {
|
||||||
.boxed()
|
.boxed()
|
||||||
})
|
})
|
||||||
.on_drag(move |delta, cx| {
|
.on_drag(move |delta, cx| {
|
||||||
|
let prev_width = *width.borrow();
|
||||||
match side {
|
match side {
|
||||||
Side::Left => *width.borrow_mut() += delta.x(),
|
Side::Left => *width.borrow_mut() = 0f32.max(prev_width + delta.x()),
|
||||||
Side::Right => *width.borrow_mut() -= delta.x(),
|
Side::Right => *width.borrow_mut() = 0f32.max(prev_width - delta.x()),
|
||||||
}
|
}
|
||||||
|
|
||||||
cx.notify();
|
cx.notify();
|
||||||
|
|
Loading…
Reference in a new issue