Change summary
gpui/src/elements/container.rs | 11 +++++++++++
gpui/src/elements/mouse_event_handler.rs | 3 ++-
zed/src/workspace/pane.rs | 1 +
3 files changed, 14 insertions(+), 1 deletion(-)
Detailed changes
@@ -348,6 +348,17 @@ enum Spacing {
},
}
+impl Padding {
+ pub fn uniform(padding: f32) -> Self {
+ Self {
+ top: padding,
+ left: padding,
+ bottom: padding,
+ right: padding,
+ }
+ }
+}
+
impl ToJson for Padding {
fn to_json(&self) -> serde_json::Value {
let mut value = json!({});
@@ -116,7 +116,8 @@ impl Element for MouseEventHandler {
let hit_bounds = RectF::from_points(
bounds.origin() - vec2f(self.padding.left, self.padding.top),
bounds.lower_right() + vec2f(self.padding.right, self.padding.bottom),
- );
+ )
+ .round_out();
self.state.update(cx, |state, cx| match event {
Event::MouseMoved {
@@ -292,6 +292,7 @@ impl Pane {
}
},
)
+ .with_padding(Padding::uniform(4.))
.with_cursor_style(CursorStyle::PointingHand)
.on_click(move |cx| {
cx.dispatch_action(CloseItem(item_id))