The Widget aggregating this helper
Protected
Readonly
listenersWhich pointer button should count as a click? Left button by default
Last pointer position in normalised coordinates ([0,0] to [1,1]). If there is no last pointer position, such as after a leave event, this will be null. If pointer position was outside box, it will be beyond the [0,0] to [1,1] range.
Like ClickHelper#pointerPos, but only updated when a hold state begins.
Useful for implementing draggable widgets.
Protected
widgetThe current click state
Listen to events from this helper. Duplicate listeners allowed.
Protected
dispatchDispatch an event to all listeners.
Protected
dispatchDispatch an event to a specific listener. Listener does not have to be added
Normalise pointer coordinates inside a rectangle
Pointer X coordinate, in pixels
Pointer Y coordinate, in pixels
Rectangle's left coordinate, in pixels
Rectangle's right coordinate, in pixels
Rectangle's top coordinate, in pixels
Rectangle's bottom coordinate, in pixels
Returns normalised coordinates
Updates the current GenericClickHelper#clickState given an event, as well as focus, and requests pointer styles when necessary.
A 4-tuple containing, respectively, left coordinate, right coordinate, top coordinate and bottom coordinate of clickable area, in pixels
Check if a normalised point is inside a rectangle.
Since the coordinates are normalised, you don't have to define the coordinates of the rectangle, which may seem counterintuitive.
Pointer X coordinate, normalised
Pointer Y coordinate, normalised
Returns true if [pX, pY] is inside the rectangle, else, false
Check if a point, in pixels, is inside a rectangle.
Pointer X coordinate, in pixels
Pointer Y coordinate, in pixels
Rectangle's left coordinate, in pixels
Rectangle's right coordinate, in pixels
Rectangle's top coordinate, in pixels
Rectangle's bottom coordinate, in pixels
Returns true if [pX, pY] is inside the rectangle, else, false
Stop listening to events from this helper. If a duplicate listener is removed, only one is removed.
True if a listener was removed, false otherwise.
Sets GenericClickHelper#clickState and dispatches events if current one differs.
An aggregate helper class for widgets that can be clicked.
Keeps its current click state as well as its last click state, last pointer position and whether the last click state change resulted in an actual click.