Files
oak-gpui/crates
Mikayla Maki f6b64dc67a Add click out events to GPUI (#2659)
This PR adds a new mouse event type for catching when a click happens
outside of a given region.

This was added because I noticed a 'race condition' between the context
menu and the buttons which deploy a context menu. Buttons use on
an`on_click()` handler to deploy the context menu, but the context menu
was closing itself with an `on_down_out()` handler. This meant that the
order of operations was:

0. Context menu is open
1. User presses down on the button, _outside of the context menu_ 
2. `on_down_out()` is fired, closing the context menu
3. User releases the mouse
4. `click()` is fired, checks the state of the context menu, finds that
it's closed, and so opens it

You can see this behavior demonstrated with this video with a long-click
here:


https://github.com/zed-industries/zed/assets/2280405/588234c3-1567-477f-9a12-9e6a70643527

~~Switching from `on_down_out()` to `on_click_out()` means that the
click handler for the button can close the menu before the context menu
gets a chance to close itself.~~

~~However, GPUI does not have an `on_click_out()` event, hence this
PR.~~

~~Here's an example of the new behavior, with the same long-click
action:~~


https://github.com/zed-industries/zed/assets/2280405/a59f4d6f-db24-403f-a281-2c1148499413

Unfortunately, this `click_out` is the incorrect event for this to
happen on. This PR now adds a mechanism for delaying the firing of a
cancel action so that toggle buttons can signal that this on_down event
should not result in a menu closure.

Release Notes:

* Made context menus deployed from buttons toggle, instead of
hide-and-re-show, visibility on click
2023-06-29 17:33:37 -07:00
..
2023-06-28 12:09:49 +02:00
2023-06-02 22:02:19 -04:00
2023-06-29 22:39:33 +03:00
2023-06-20 16:05:23 -07:00
WIP
2023-05-22 23:11:27 -06:00
fmt
2023-06-28 16:35:57 -07:00
2023-06-29 22:39:18 +03:00
fmt
2023-06-27 19:25:46 -07:00
2023-06-26 17:07:33 +02:00
2023-06-02 22:02:19 -04:00
2023-06-02 22:02:19 -04:00
2023-06-29 22:25:49 +03:00
2023-06-29 22:39:33 +03:00
2023-06-02 22:02:19 -04:00
2023-06-02 22:02:19 -04:00
2023-06-29 22:39:17 +03:00
2023-06-27 04:15:55 -06:00
fmt
2023-06-29 17:19:35 -07:00
2023-06-22 18:06:52 +02:00
2023-06-28 17:06:50 -04:00