Round sidebar panels' widths to whole numbers of pixels
Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
de9a7b1927
commit
dc465839e1
1 changed files with 6 additions and 4 deletions
|
@ -106,10 +106,12 @@ impl Sidebar {
|
||||||
.with_cursor_style(CursorStyle::ResizeLeftRight)
|
.with_cursor_style(CursorStyle::ResizeLeftRight)
|
||||||
.on_drag(move |delta, cx| {
|
.on_drag(move |delta, cx| {
|
||||||
let prev_width = *actual_width.borrow();
|
let prev_width = *actual_width.borrow();
|
||||||
match side {
|
*custom_width.borrow_mut() = 0f32
|
||||||
Side::Left => *custom_width.borrow_mut() = 0f32.max(prev_width + delta.x()),
|
.max(match side {
|
||||||
Side::Right => *custom_width.borrow_mut() = 0f32.max(prev_width - delta.x()),
|
Side::Left => prev_width + delta.x(),
|
||||||
}
|
Side::Right => prev_width - delta.x(),
|
||||||
|
})
|
||||||
|
.round();
|
||||||
|
|
||||||
cx.notify();
|
cx.notify();
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue