InteractableElement
Subclasses of this are able to receive click and hover events inside of an ElementView
. These subclasses must implement getInteractionPath and the individual instances must have a non-null onClick or onHoverChanged handler set. These events are dispatched to the "top"-most element in the tree that would be able to fire, which occludes other elements below it.
Only elements with a set handler occlude other elements (so it may sometimes be useful to set a handler that no-ops to mask off another element's touch). Additionally, click and hover occlusion are handled separately, so an element with a click handler but not a hover handler will not block hover events below it.
Note that the term "hover" is often different between platforms. The built-in ElementView
s try to bridge this gap, and include both true hover (a mouse pointer over the element, un-pressed) as well as the press or drag state (a mouse pointer on the element, pressed; or, a touch) as hover states. This enables use of hover as a pre-selection indicator on mobile devices.
Inheritors
Properties
This is a delicate API that exposes the raw attribute backing without any type safety. This is frequently used by the internals of Krayon, but is likely something you shouldn't use as a library consumer. That said, it's still exposed for the cases where it's necessary. When using this, be very careful not to clobber existing attributes.
Functions
The path used for hit detection.
Set the ClickHandler for this element.
Set the HoverHandler for this element.