Create a new GenericClickHelper
The Widget aggregating this helper
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 pointerPos, but only updated when a hold state begins.
Useful for implementing draggable widgets.
Protected
widgetNormalise pointer coordinates inside a rectangle
Returns normalised coordinates
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
Updates the current clickState given an event, as well as focus, pointerStyle, wasClick and clickStateChanged flags.
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.
Returns true if [pX, pY] is inside the rectangle, else, false
Pointer X coordinate, normalised
Pointer Y coordinate, normalised
Check if a point, in pixels, is inside a rectangle.
Returns true if [pX, pY] is inside the rectangle, else, false
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
Set clickState and update lastClickState if current one differs. Updates wasClick and clickStateChanged flags.
Generated using TypeDoc
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.