Members
-
<static> isPointerDown :boolean
-
Flag specifying whether a mouse button or finger is pushing the button or has been pushing the button and is still held down (but may have moved outside the button's rectangle).
Type:
- boolean
-
<static> isPointerInside :boolean
-
Flag specifying whether a mouse button or finger is inside the button's rectangle.
Type:
- boolean
Methods
-
isClicked() → {boolean}
-
Determine whether the button has just been clicked.
Returns:
True if the button has been clicked, false otherwise.- Type
- boolean
-
isDoubleClicked() → {boolean}
-
Determine whether the button has just been double clicked.
Returns:
True if the button has been double clicked, false otherwise.- Type
- boolean
-
isHeldDown() → {boolean}
-
Determine whether the button has just been held longer than cuiTimeUntilHold.
Returns:
True if the button has just been held down long enough, false otherwise.- Type
- boolean
-
process(event, x, y, width, height, text, imageNormal, imageFocused, imagePressed) → {boolean}
-
Either process the event (if event != null) and return true if the event has been processed, or draw the appropriate image for the button state in the rectangle with a text string on top of it (if event == null) and return false. This function is usually called by cuiPage.process of a cuiPage.
Parameters:
Name Type Description event
Object An object describing a user event by its "type", coordinates in page coordinates ("eventX" and "eventY"), an "identifier" for touch events, and optionally "buttons" to specify which mouse buttons are depressed. If null, the function should redraw the button. x
number The x coordinate of the top, left corner of the button's rectangle. y
number The y coordinate of the top, left corner of the button's rectangle. width
number The width of the button's rectangle. height
number The height of the button's rectangle. text
string A text that is written at the center of the rectangle. (May be null). imageNormal
Object An image to be drawn inside the button's rectangle if there are no user interactions. (May be null.) imageFocused
Object An image to be drawn inside the button's rectangle if the mouse hovers over the button's rectangle or a touch point moves into it. (May be null.) imagePressed
Object An image to be drawn inside the button's rectangle if a mouse button is pushed or the button is touched. (May be null.) Returns:
True if event != null and the event has been processed (implying that no other GUI elements should process it). False otherwise.- Type
- boolean