Class: cuiTransformable

cuiTransformable

Transformable objects can be translated, rotated, and scaled with one- and two-finger gestures.

new cuiTransformable()

Create a new cuiTransformable.
Source:

Members

<static> isPointerDown0 :boolean

Flag specifying whether a mouse button or first finger is pushing the object or has been pushing the object and is still held down (but may have moved outside the object's rectangle).
Type:
  • boolean
Source:

<static> isPointerDown1 :boolean

Flag specifying whether a second finger is pushing the object or has been pushing the object and is still held down (but may have moved outside the object's rectangle).
Type:
  • boolean
Source:

<static> isPointerInside0 :boolean

Flag specifying whether a mouse button or first finger is inside the object's rectangle.
Type:
  • boolean
Source:

<static> isProcessingOuterEvents :boolean

Flag to specify whether to process events even if they are outside of the rectangle. If true, it will consume many more events and therefore should only be used for background objects.
Type:
  • boolean
Source:

<static> rotation :number

Clockwise rotation angle in degrees by which the object has been rotated.
Type:
  • number
Source:

<static> scale :number

Scaling factor by which the object has been magnified.
Type:
  • number
Source:

<static> translationX :number

Difference in x coordinate by which the centre of the transformable has been moved relative to its initial position (specified by x + 0.5 * width with the arguments of cuiTransformable#process).
Type:
  • number
Source:

<static> translationY :number

Difference in y coordinate by which the centre of the transformable has been moved relative to its initial position (specified by y + 0.5 * height with the arguments of cuiTransformable#process).
Type:
  • number
Source:

Methods

isClicked() → {boolean}

Returns whether the transformable has just been clicked.
Source:
Returns:
True if the draggable has been clicked, false otherwise.
Type
boolean

isDoubleClicked() → {boolean}

Determine whether the button has just been double clicked.
Source:
Returns:
True if the button has been double clicked, false otherwise.
Type
boolean

isHeldDown0() → {boolean}

Determine whether first pointer has just been held down longer than cuiTimeUntilHold.
Source:
Returns:
True if the first pointer has just been held down long enough, false otherwise.
Type
boolean

isHeldDown1() → {boolean}

Determine whether second pointer has just been held down longer than cuiTimeUntilHold.
Source:
Returns:
True if the second pointer has just been held down long enough, false otherwise.
Type
boolean

process(event, x, y, width, height, text, imageNormal, imageFocused, imagePressed0, imagePressed1, interactionBits) → {boolean}

Either process the event (if event != null) and return true if the event has been processed, or draw the appropriate image for the object 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 object.
x number The x coordinate of the top, left corner of the object's rectangle.
y number The y coordinate of the top, left corner of the object's rectangle.
width number The width of the object's rectangle.
height number The height of the object'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 object's rectangle if there are no user interactions. (May be null.)
imageFocused Object An image to be drawn inside the object's rectangle if the mouse hovers over the object's rectangle or a touch point moves into it. (May be null.)
imagePressed0 Object An image to be drawn inside the object's rectangle if a mouse button is pushed or the object is touched once. (May be null.)
imagePressed1 Object An image to be drawn inside the object's rectangle if a mouse button is pushed or the object is touched twice. (May be null.)
interactionBits number The forms of interaction, either cuiConstants.none or a bitwise-or of other constants in cuiConstants, e.g. cuiConstants.isDraggableWithOneFinger | cuiConstants.isTransformableWithTwoFingers.
Source:
Returns:
True if event != null and the event has been processed (implying that no other GUI elements should process it). False otherwise.
Type
boolean