You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In many user interfaces, a "click" on an element only occurs if the mouse was pressed and released within the bounds of the element, even if the mouse has moved outside of that element:
I'm not really sure how to replicate this behavior with clay today. OnHover fires only if the cursor is within the bounds of the element, which means that you could replicate most of the functionality with what we have today:
However, to achieve this required manually tracking whether or not the click started within the element, as well as extra logic in the layout phase to reset the clickStarted state if hover ends (which is not actually desired, since we really want the click to continue until the next time the mouse is released)
Some ideas that might help:
OnMouseEnter and OnMouseExit events that are called when the mouse enters or exits the region
A built-in OnClick event that tracks pointer start and stop for you, so that we don't have to store this extra state for each element
Being able to request the element id (or list of element ids) that the click originated on, and perhaps the coordinates of that click
The text was updated successfully, but these errors were encountered:
In many user interfaces, a "click" on an element only occurs if the mouse was pressed and released within the bounds of the element, even if the mouse has moved outside of that element:
I'm not really sure how to replicate this behavior with clay today. OnHover fires only if the cursor is within the bounds of the element, which means that you could replicate most of the functionality with what we have today:
However, to achieve this required manually tracking whether or not the click started within the element, as well as extra logic in the layout phase to reset the clickStarted state if hover ends (which is not actually desired, since we really want the click to continue until the next time the mouse is released)
Some ideas that might help:
OnMouseEnter and OnMouseExit events that are called when the mouse enters or exits the region
A built-in OnClick event that tracks pointer start and stop for you, so that we don't have to store this extra state for each element
Being able to request the element id (or list of element ids) that the click originated on, and perhaps the coordinates of that click
We could create some macros, but OnMouseEnter is really just checking the hover, thats actually implemented. For checking the clocked "button", just store a variable yourself when pointerInfo.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME inside the onhover callback of an element. Clay allows both of the above described behaviours, it's program side task to handle it
In many user interfaces, a "click" on an element only occurs if the mouse was pressed and released within the bounds of the element, even if the mouse has moved outside of that element:
I'm not really sure how to replicate this behavior with clay today. OnHover fires only if the cursor is within the bounds of the element, which means that you could replicate most of the functionality with what we have today:
However, to achieve this required manually tracking whether or not the click started within the element, as well as extra logic in the layout phase to reset the clickStarted state if hover ends (which is not actually desired, since we really want the click to continue until the next time the mouse is released)
Some ideas that might help:
The text was updated successfully, but these errors were encountered: