Style resize handles

We want the draggable area to be larger than the visual appearance, so we added a padding facility to MouseEventHandler that enlarges the "hit area" by the specified padding.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Nathan Sobo
2021-09-07 13:22:21 -06:00
co-authored by Max Brunsfeld
parent 8085e74b98
commit 13143e64a2
4 changed files with 32 additions and 11 deletions
+2 -1
View File
@@ -23,7 +23,8 @@ text = "$text.0"
padding = { left = 10, right = 10 }
[workspace.sidebar.resize_handle]
margin = { left = 6 }
padding = { left = 1 }
background = "$surface.1"
[workspace.sidebar.icon]
color = "$text.2.color"
+5
View File
@@ -158,6 +158,11 @@ impl Sidebar {
.with_style(&self.theme(settings).resize_handle)
.boxed()
})
.with_padding(Padding {
left: 4.,
right: 4.,
..Default::default()
})
.with_cursor_style(CursorStyle::ResizeLeftRight)
.on_drag(move |delta, cx| {
let prev_width = *width.borrow();