From c10d8a8110077213f61160b706bb68f123ae0187 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 4 Dec 2023 16:40:53 -0500 Subject: [PATCH] Fix cursor styles not displaying properly (#3493) This PR fixes an issue where an element with a cursor style set would not update the cursor when hovering over it. Previously the cursor style would only appear by interacting with the element in some way, for instance, by clicking on the element or by having a `.hover` with some other style being applied. Release Notes: - N/A --- crates/gpui2/src/elements/div.rs | 1 + crates/storybook2/src/stories/cursor.rs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/gpui2/src/elements/div.rs b/crates/gpui2/src/elements/div.rs index 68dca4c9d144a571d894f63f382c2d9489f7251c..3d7feee21b632ee69df47d7cc192c8487c939fb2 100644 --- a/crates/gpui2/src/elements/div.rs +++ b/crates/gpui2/src/elements/div.rs @@ -866,6 +866,7 @@ impl Interactivity { } if self.hover_style.is_some() + || self.base_style.mouse_cursor.is_some() || cx.active_drag.is_some() && !self.drag_over_styles.is_empty() { let bounds = bounds.intersect(&cx.content_mask().bounds); diff --git a/crates/storybook2/src/stories/cursor.rs b/crates/storybook2/src/stories/cursor.rs index d160fa4f4a0c15e86e4a5b91c7f011d4b5005d6e..7d4cf8145a034906bb87bb944ae926fff5ab9f3a 100644 --- a/crates/storybook2/src/stories/cursor.rs +++ b/crates/storybook2/src/stories/cursor.rs @@ -102,7 +102,6 @@ impl Render for CursorStory { .w_64() .h_8() .bg(gpui::red()) - .hover(|style| style.bg(gpui::blue())) .active(|style| style.bg(gpui::green())) .text_sm() .child(Story::label(name)),