The Widget aggregating this helper
The current click state
Did the last click event handle result in a click state change?
Last click state
Which 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.
Did the last click state change result in a click?
Protected
widgetSignal to this click helper that you are done processing changes in state. This simply resets the BaseClickHelper#clickStateChanged flag.
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, GenericClickHelper#wasClick and GenericClickHelper#clickStateChanged flags, 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
Reset the click helper to its default state, except for the clickStateChanged flag, which is set to true. Only call this if absolutely necessary, such as when the owner Widget is re-activated (this way, hover states don't linger when a Widget is disabled).
You may be looking for BaseClickHelper#doneProcessing instead.
Set GenericClickHelper#clickState and update GenericClickHelper#lastClickState if current one differs. Updates GenericClickHelper#wasClick and GenericClickHelper#clickStateChanged flags.
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.