Skip to content

Conversation

@nathansobo
Copy link
Contributor

This PR adds a new MouseEventHandler that tracks whether the element is hovered or clicked and relays this state to an FnOnce so it can be used to inform the appearance of element. MouseEventHandler depends on a new ValueHandle facility that I added to AppContext. Value handles allow mouse handler elements with the same id to store and retrieve ephemeral state across different frames. This is needed because elements are reconstructed on every frame.

This PR adds:

  • Showing the close button on tab hover
  • Highlighting the button on button hover
  • Highlighting the button with a lighter color when the mouse is down
  • Closing the tab on button click (but not if the mouse up event happens outside the button)

nathansobo and others added 12 commits April 26, 2021 21:24
I'll use this in the mouse event handler to track hover and click state.
Still need to give elements the ability to re-render their parent view. Once that is in place, I think we can implement hoverable close tab buttons.
Co-Authored-By: Antonio Scandurra <[email protected]>
Co-Authored-By: Max Brunsfeld <[email protected]>
This provides the sampler with a bit more data when positioning sprites at subpixel positions.

Co-Authored-By: Antonio Scandurra <[email protected]>
Co-Authored-By: Antonio Scandurra <[email protected]>
…g a scene

This ensures that we correctly update the hover state of elements whose position has changed relative to the mouse cursor even though the mouse hasn't actually moved.

Co-Authored-By: Antonio Scandurra <[email protected]>
Co-Authored-By: Max Brunsfeld <[email protected]>
@nathansobo nathansobo merged commit 9277529 into master Apr 28, 2021
@nathansobo nathansobo deleted the close-tabs branch April 28, 2021 19:19
Anthony-Eid pushed a commit to Anthony-Eid/zed that referenced this pull request Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants