Class: Node

lime.Node

new lime.Node()

Node. Abstract drawable object in lime.
Source:

Extends

  • goog.events.EventTarget

Summary

Members
allow3DCSSTransform_ :boolean
Allow translate3d and other css optimizations
<private> customEvent_ :boolean
<private> eventHandlers_ :Object
Hash of active event handlers
inTree_ :boolean
Node has been added to DOM tree
supportedRenderers :Array.<lime.Renderer>
Supported renderers for Node
transitionsAdd_
type {Object.}
transitionsClear_
type {Object.}
Methods
<static> compareNode(n1, n2) → {number}
Compare two node positions in the tree
<static> getPropertyForTransition(transition) → {string}
Return CSS property name for transition constant
addEventListener()
addTransition(property, value, duration, ease)
Register transition property. Use through animations.
appendChild(child, opt_pos) → {lime.Node}
Append element to the end of childrens array
calcRelativeQuality()
Calculates relative quality change from the parent objects quality
clearTransition(property)
Clear previously set transition
createDomElement()
Create DOM element to render the node
getAnchorPoint() → {goog.math.Vec2}
Returns anchor point for the element.
getAutoResize() → {number}
Returns autoresize rules bitmask.
getBoundingBox(opt_frame) → {goog.math.Box}
Returns bounding box for element in parents coordinate space.
getChildAt(index) → {lime.Node|Element|null}
Return the child at defined index.
getChildIndex(child) → {number}
Return the index position of a child.
getCSS3DTransformsAllowed() → {boolean}
Returns css 3d transforms flag
getDeepestDomElement() → {Element}
Return deepest element in DOM tree that is used for drawing the Node.
getDeepestParentWithDom() → {lime.Node}
Return deepest parent node that requires DOM element for drawing on screen.
getDirector() → {lime.Director}
Return the Director instance related to the node. Returns null if no director connection.
getDirty() → {number}
Return a bitmask of dirty values that need to be updated before next drawing The bitmask parts are values of lime.Dirty enum
getFrame() → {goog.math.Box}
Returns a bounding box for the element in its own coordinate space
getHidden() → {boolean}
Returns true if element currently not visible
getMask() → {lime.Node}
Returns element used as a mask for current element
getNumberOfChildren() → {number}
Return number of childnodes current element has.
getOpacity() → {number}
Returns the opacity value of the Node. 0.0=100% trasparent, 1.0=100% opaque
getParent() → {lime.Node}
Return the parent object. Returns null in not in tree
<private> getParentStack_() → {Array.<lime.Node>}
Return array of parent nodes until scene object
getPosition() → {goog.math.Coordinate}
Returns element's position coordinate
getQuality() → {number}
Returns elements quality value.
getRelativeQuality() → {number}
Return cumulative quality value relative to screen full quality.
getRotation() → {number}
Returns rotation angle for element in degrees
getScale() → {goog.math.Vec2}
Returns scale vector for the element. 1,1 means no scale.
getScene() → {lime.Scene}
Returns the Scene instance related to the node. Returns null if no scene connection.
getSize() → {goog.math.Size}
Returns elements dimension
hitTest(e) → {boolean}
Checks if event should fire on element based on the position. Before returning true this function should set the position property of the event to the hit position in elements coordinate space
localToNode(coord, node) → {goog.math.Coordinate}
Convert coordinate in node space to other nodes coordinate space
localToParent(coord) → {goog.math.Coordinate}
Convert coordinate from current node space to parent node space
localToScreen(coord) → {goog.math.Coordinate}
Convert coordinate in node space to screen coordinate
measureContents() → {goog.math.Box}
Return box containing current element and all its children
needsDomElement() → {boolean}
Does node require DOM element for drawing?
parentToLocal(coord) → {goog.math.Coordinate}
Covert coordinate form parent node space to current node space
removeAllChildren() → {lime.Node}
Removes all children of a node.
removeChild(child) → {lime.Node}
Remove element from the childrens array
removeChildAt(index) → {lime.Node}
Remove element at a given index from the childrens array
removeDomElement()
Remove DOM element connected to teh node
removeEventListener()
runAction(action)
Add Node to action targets list and start the animation
screenToLocal(coord) → {goog.math.Coordinate}
Convert screen coordinate to node coordinate space
setAllow3DCSSTransforms(value) → {lime.Node}
Sets css 3d transforms rule (for DOM renderer). XXX: This hack is required to fix a mobile Safari rendering bug. It should only be used on nodes that are affected by the bug! 3D acceleration in css transforms is enabled by default and applied for iOS and Playbook.
setAnchorPoint(value, opt_y) → {lime.Node}
Sets elements anchor point to new value. Anchor point is used when positioning the element to position coordinate. [0,0] means top left corner, [1,1] bottom right, [.5,.5] means that element is position by the center. You can also pass in 2 numbers.
setAutoResize(value) → {lime.Node}
Sets new autoresixe rules. NOT IMPLEMENTED!
setChildIndex(child, index) → {lime.Node}
Move a child to another index in the childrens array.
setDirty(value, opt_pass, opt_nextframe) → {lime.Node}
Sets a dirty value true. This means that object needs that kind of updates before next draw.
setHidden(value) → {lime.Node}
Sets if element is visible or not
setMask(value) → {lime.Node}
Sets element as a mask for current element
setOpacity(value) → {lime.Node}
Sets the opacity value of the Node object
setPosition(value, opt_y) → {lime.Node}
Sets new position for element. Also accepts 2 numbers(x and y value)
setQuality(value) → {lime.Node}
Sets quality value used while drawing. Not all rendermodes can draw more effectively on lower quality. 1.0 full quality, 0.5 half quality. Setting this walue larger than 1.0 almost never does anything good.
setRenderer(value) → {lime.Node}
Set renderer for the node. Renderer defines what lower level technology will be used for drawing node on screen
setRotation(value) → {lime.Node}
Rotates element to specific angle in degrees
setScale(value, opt_y) → {lime.Node}
Sets new scale vector for element. This function also accepts 2 numbers or 1 number that would be coverted to vector before use
setSize(value, opt_height) → {lime.Node}
Sets dimensions for element. This funciton also accepts 2 numbers: width,height
update(opt_pass)
Update modified dirty parameters to visible elements properties
updateDomElement()
Update DOM element connected to the node
updateLayout()
Update node's layout (tree relations)
wasAddedToTree()
Handle adding Node to the DOM tree
wasRemovedFromTree()
Handle removing Node from DOM tree

Members

allow3DCSSTransform_ :boolean

Allow translate3d and other css optimizations
Source:

<private> customEvent_ :boolean

Source:

<private> eventHandlers_ :Object

Hash of active event handlers
Source:

inTree_ :boolean

Node has been added to DOM tree
Source:

supportedRenderers :Array.<lime.Renderer>

Supported renderers for Node
Source:

transitionsAdd_

type {Object.}
Source:

transitionsClear_

type {Object.}
Source:

Methods

<static> compareNode(n1, n2) → {number}

Compare two node positions in the tree
Parameters:
Name Type Description
n1 lime.Node First node.
n2 lime.Node Second node.
Source:
Returns:
Comparison result.
Type
number

<static> getPropertyForTransition(transition) → {string}

Return CSS property name for transition constant
Parameters:
Name Type Description
transition number Transition constant.
Source:
Returns:
Property name.
Type
string

addEventListener()

Source:

addTransition(property, value, duration, ease)

Register transition property. Use through animations.
Parameters:
Name Type Description
property number Transition property constant.
value * New value.
duration number Transition duration.
ease Array.<*> Easing function.
Source:

appendChild(child, opt_pos) → {lime.Node}

Append element to the end of childrens array
Parameters:
Name Type Argument Description
child lime.Node | Element | Node Child node.
opt_pos number <optional>
Position of new child.
Source:
Returns:
obejct itself.
Type
lime.Node

calcRelativeQuality()

Calculates relative quality change from the parent objects quality
Source:

clearTransition(property)

Clear previously set transition
Parameters:
Name Type Description
property number Transition property.
Source:

createDomElement()

Create DOM element to render the node
Source:

getAnchorPoint() → {goog.math.Vec2}

Returns anchor point for the element.
Source:
Returns:
Anchorpoint vector.
Type
goog.math.Vec2

getAutoResize() → {number}

Returns autoresize rules bitmask.
Source:
Returns:
Autoresize bitmask.
Type
number

getBoundingBox(opt_frame) → {goog.math.Box}

Returns bounding box for element in parents coordinate space.
Parameters:
Name Type Description
opt_frame goog.math.Box Optional frame box for element.
Source:
Returns:
Bounding box.
Type
goog.math.Box

getChildAt(index) → {lime.Node|Element|null}

Return the child at defined index.
Parameters:
Name Type Description
index number Child index.
Source:
Returns:
Child element.
Type
lime.Node | Element | null

getChildIndex(child) → {number}

Return the index position of a child.
Parameters:
Name Type Description
child lime.Node | Element Child to search.
Source:
Returns:
Index number.
Type
number

getCSS3DTransformsAllowed() → {boolean}

Returns css 3d transforms flag
Source:
Returns:
Type
boolean

getDeepestDomElement() → {Element}

Return deepest element in DOM tree that is used for drawing the Node.
Source:
Returns:
Deepest DOM element.
Type
Element

getDeepestParentWithDom() → {lime.Node}

Return deepest parent node that requires DOM element for drawing on screen.
Source:
Returns:
Deepest parent.
Type
lime.Node

getDirector() → {lime.Director}

Return the Director instance related to the node. Returns null if no director connection.
Source:
Returns:
Current director.
Type
lime.Director

getDirty() → {number}

Return a bitmask of dirty values that need to be updated before next drawing The bitmask parts are values of lime.Dirty enum
Source:
Returns:
Dirty propertiest bitmask.
Type
number

getFrame() → {goog.math.Box}

Returns a bounding box for the element in its own coordinate space
Source:
Returns:
Contents frame in node space.
Type
goog.math.Box

getHidden() → {boolean}

Returns true if element currently not visible
Source:
Returns:
True if node is hidden.
Type
boolean

getMask() → {lime.Node}

Returns element used as a mask for current element
Source:
Returns:
Mask node.
Type
lime.Node

getNumberOfChildren() → {number}

Return number of childnodes current element has.
Source:
Returns:
Number of children.
Type
number

getOpacity() → {number}

Returns the opacity value of the Node. 0.0=100% trasparent, 1.0=100% opaque
Source:
Returns:
Opacity value.
Type
number

getParent() → {lime.Node}

Return the parent object. Returns null in not in tree
Source:
Returns:
Parent node.
Type
lime.Node

<private> getParentStack_() → {Array.<lime.Node>}

Return array of parent nodes until scene object
Source:
Returns:
Array of parents.
Type
Array.<lime.Node>

getPosition() → {goog.math.Coordinate}

Returns element's position coordinate
Source:
Returns:
Current position coordinate.
Type
goog.math.Coordinate

getQuality() → {number}

Returns elements quality value.
Source:
Returns:
Quality value.
Type
number

getRelativeQuality() → {number}

Return cumulative quality value relative to screen full quality.
Source:
Returns:
Quality value.
Type
number

getRotation() → {number}

Returns rotation angle for element in degrees
Source:
Returns:
Rotation angle.
Type
number

getScale() → {goog.math.Vec2}

Returns scale vector for the element. 1,1 means no scale.
Source:
Returns:
scale vector.
Type
goog.math.Vec2

getScene() → {lime.Scene}

Returns the Scene instance related to the node. Returns null if no scene connection.
Source:
Returns:
Current scene.
Type
lime.Scene

getSize() → {goog.math.Size}

Returns elements dimension
Source:
Returns:
Current element dimensions.
Type
goog.math.Size

hitTest(e) → {boolean}

Checks if event should fire on element based on the position. Before returning true this function should set the position property of the event to the hit position in elements coordinate space
Parameters:
Name Type Description
e lime.events.Event Event object.
Source:
Returns:
If node should handle the event.
Type
boolean

localToNode(coord, node) → {goog.math.Coordinate}

Convert coordinate in node space to other nodes coordinate space
Parameters:
Name Type Description
coord goog.math.Coordinate Local coordinate.
node lime.Node Node for new coordinate space.
Source:
Returns:
Coordinate in node space.
Type
goog.math.Coordinate

localToParent(coord) → {goog.math.Coordinate}

Convert coordinate from current node space to parent node space
Parameters:
Name Type Description
coord goog.math.Coordinate Local coordinate.
Source:
Returns:
Parent coordinate.
Type
goog.math.Coordinate

localToScreen(coord) → {goog.math.Coordinate}

Convert coordinate in node space to screen coordinate
Parameters:
Name Type Description
coord goog.math.Coordinate Local coordinate.
Source:
Returns:
Screen coordinate.
Type
goog.math.Coordinate

measureContents() → {goog.math.Box}

Return box containing current element and all its children
Source:
Returns:
Bounding box.
Type
goog.math.Box

needsDomElement() → {boolean}

Does node require DOM element for drawing?
Source:
Returns:
True if DOM is required.
Type
boolean

parentToLocal(coord) → {goog.math.Coordinate}

Covert coordinate form parent node space to current node space
Parameters:
Name Type Description
coord goog.math.Coordinate Parent coordinate.
Source:
Returns:
Local coordinate.
Type
goog.math.Coordinate

removeAllChildren() → {lime.Node}

Removes all children of a node.
Source:
Returns:
object itself.
Type
lime.Node

removeChild(child) → {lime.Node}

Remove element from the childrens array
Parameters:
Name Type Description
child lime.Node | Element Child node.
Source:
Returns:
object itself.
Type
lime.Node

removeChildAt(index) → {lime.Node}

Remove element at a given index from the childrens array
Parameters:
Name Type Description
index number Index of element to remove.
Source:
Returns:
object itself.
Type
lime.Node

removeDomElement()

Remove DOM element connected to teh node
Source:

removeEventListener()

Source:

runAction(action)

Add Node to action targets list and start the animation
Parameters:
Name Type Description
action lime.animation.Animation Animation to run.
Source:

screenToLocal(coord) → {goog.math.Coordinate}

Convert screen coordinate to node coordinate space
Parameters:
Name Type Description
coord goog.math.Coordinate Screen coordinate.
Source:
Returns:
Local coordinate.
Type
goog.math.Coordinate

setAllow3DCSSTransforms(value) → {lime.Node}

Sets css 3d transforms rule (for DOM renderer). XXX: This hack is required to fix a mobile Safari rendering bug. It should only be used on nodes that are affected by the bug! 3D acceleration in css transforms is enabled by default and applied for iOS and Playbook.
Parameters:
Name Type Description
value boolean allow(true) or disable(false).
Source:
Returns:
object itself.
Type
lime.Node

setAnchorPoint(value, opt_y) → {lime.Node}

Sets elements anchor point to new value. Anchor point is used when positioning the element to position coordinate. [0,0] means top left corner, [1,1] bottom right, [.5,.5] means that element is position by the center. You can also pass in 2 numbers.
Parameters:
Name Type Argument Description
value goog.math.Vec2 | number AnchorPoint vector.
opt_y number <optional>
Optionaly set anchorpoint with x,y.
Source:
Returns:
object itself.
Type
lime.Node

setAutoResize(value) → {lime.Node}

Sets new autoresixe rules. NOT IMPLEMENTED!
Parameters:
Name Type Description
value number New autoresize bitmask.
Source:
Returns:
object itself.
Type
lime.Node

setChildIndex(child, index) → {lime.Node}

Move a child to another index in the childrens array.
Parameters:
Name Type Description
child lime.Node Child node.
index number New index for the child.
Source:
Returns:
object itself.
Type
lime.Node

setDirty(value, opt_pass, opt_nextframe) → {lime.Node}

Sets a dirty value true. This means that object needs that kind of updates before next draw.
Parameters:
Name Type Argument Description
value number Values to be added to the bitmask.
opt_pass number <optional>
Pass number (0-1).
opt_nextframe boolean <optional>
Register for next frame.
Source:
Returns:
Node itself.
Type
lime.Node

setHidden(value) → {lime.Node}

Sets if element is visible or not
Parameters:
Name Type Description
value boolean Hide(true) or show(false).
Source:
Returns:
object itself.
Type
lime.Node

setMask(value) → {lime.Node}

Sets element as a mask for current element
Parameters:
Name Type Description
value lime.Node Mask node.
Source:
Returns:
object itself.
Type
lime.Node

setOpacity(value) → {lime.Node}

Sets the opacity value of the Node object
Parameters:
Name Type Description
value number New opacity value(0-1).
Source:
Returns:
The node object itself.
Type
lime.Node

setPosition(value, opt_y) → {lime.Node}

Sets new position for element. Also accepts 2 numbers(x and y value)
Parameters:
Name Type Argument Description
value goog.math.Coordinate | number Position coordinate.
opt_y number <optional>
Optionaly set position using x,y.
Source:
Returns:
object itself.
Type
lime.Node

setQuality(value) → {lime.Node}

Sets quality value used while drawing. Not all rendermodes can draw more effectively on lower quality. 1.0 full quality, 0.5 half quality. Setting this walue larger than 1.0 almost never does anything good.
Parameters:
Name Type Description
value number New quality value.
Source:
Returns:
object itself.
Type
lime.Node

setRenderer(value) → {lime.Node}

Set renderer for the node. Renderer defines what lower level technology will be used for drawing node on screen
Parameters:
Name Type Description
value lime.Renderer Renderer object.
Source:
Returns:
Node itself.
Type
lime.Node

setRotation(value) → {lime.Node}

Rotates element to specific angle in degrees
Parameters:
Name Type Description
value number New rotation angle.
Source:
Returns:
object itself.
Type
lime.Node

setScale(value, opt_y) → {lime.Node}

Sets new scale vector for element. This function also accepts 2 numbers or 1 number that would be coverted to vector before use
Parameters:
Name Type Argument Description
value goog.math.Vec2 | number New scale vector.
opt_y number <optional>
Optionaly set scale using x,y.
Source:
Returns:
Node itself.
Type
lime.Node

setSize(value, opt_height) → {lime.Node}

Sets dimensions for element. This funciton also accepts 2 numbers: width,height
Parameters:
Name Type Argument Description
value goog.math.Size | number Elements new size.
opt_height number <optional>
Optionaly use widht,height as parameter.
Source:
Returns:
object itself.
Type
lime.Node

update(opt_pass)

Update modified dirty parameters to visible elements properties
Parameters:
Name Type Argument Description
opt_pass number <optional>
Pass number.
Source:

updateDomElement()

Update DOM element connected to the node
Source:

updateLayout()

Update node's layout (tree relations)
Source:

wasAddedToTree()

Handle adding Node to the DOM tree
Source:

wasRemovedFromTree()

Handle removing Node from DOM tree
Source: