View
Classes
- View
Base View class
Constants
- INITIAL_FLAGS :
ViewFlags
|number
View
Base View class
Kind: global class
- View
- .flags :
ViewFlags
|number
- .position :
Vector2
- .rotation :
Vector1
- .scale :
Vector2
- .size :
Vector2
- .transformOrigin :
Vector2
- .children :
Array.<View>
- .parent :
View
|null
- .el :
Element
|NodeDescription
|null
- .isLinked ⇒
boolean
- .isDestroyed ⇒
boolean
- .visible
- .visible ⇒
boolean
- .isView :
boolean
- .setFlag(flag) ⇒
void
- .clearFlag(flag) ⇒
void
- .writeFlag(flag, value)
- .getFlag(flag) ⇒
boolean
- .link()
- .unlink()
- .addChildren(children)
- .addChild(child) ⇒
View
- .computePlacement(size, targetX, targetY, alignmentX, alignmentY, result)
- .addChildAt(child, targetX, targetY, alignmentX, alignmentY)
- .removeChild(child) ⇒
boolean
- .hasChild(child) ⇒
boolean
- .expandToFit(aabb, offsetX, offsetY)
- .computeBoundingBox([result]) ⇒
AABB2
- .positionLocalToGlobal(input, result) ⇒
Vector2
- .positionGlobalToLocal(input, result) ⇒
Vector2
- .computeGlobalScale(result)
- .bindSignal(signal, handler, [context]) ⇒
View
- .unbindSignal(signal, handler, [context]) ⇒
boolean
- .addClass(name)
- .addClasses(names)
- .removeClass(name)
- .removeClassesByPattern(rx) ⇒
Array.<string>
- .setClass(name, flag) ⇒
View
- .css(hash)
- .attr(hash)
- .followSize(size, [padding])
- .flags :
view.flags : ViewFlags
| number
Kind: instance property of View
view.position : Vector2
Kind: instance property of View
Read only: true
view.rotation : Vector1
Kind: instance property of View
Read only: true
view.scale : Vector2
Kind: instance property of View
Read only: true
view.size : Vector2
Kind: instance property of View
Read only: true
view.transformOrigin : Vector2
Origin from which rotation and scaling is applied
Kind: instance property of View
Read only: true
view.children : Array.<View>
Kind: instance property of View
view.parent : View
| null
Kind: instance property of View
view.el : Element
| NodeDescription
| null
Kind: instance property of View
view.isLinked ⇒ boolean
Kind: instance property of View
view.isDestroyed ⇒ boolean
Kind: instance property of View
view.visible
Kind: instance property of View
Param | Type |
---|---|
v | boolean |
view.visible ⇒ boolean
Kind: instance property of View
view.isView : boolean
Kind: instance property of View
Read only: true
view.setFlag(flag) ⇒ void
Kind: instance method of View
Param | Type |
---|---|
flag | number | ViewFlags |
view.clearFlag(flag) ⇒ void
Kind: instance method of View
Param | Type |
---|---|
flag | number | ViewFlags |
view.writeFlag(flag, value)
Kind: instance method of View
Param | Type |
---|---|
flag | number | ViewFlags |
value | boolean |
view.getFlag(flag) ⇒ boolean
Kind: instance method of View
Param | Type |
---|---|
flag | number | ViewFlags |
view.link()
intended as initialization point when view becomes linked to the visible tree
Kind: instance method of View
view.unlink()
Finalization point, release all used resources and cleanup listeners
Kind: instance method of View
view.addChildren(children)
Kind: instance method of View
Param | Type |
---|---|
children | Array.<View> |
view.addChild(child) ⇒ View
Kind: instance method of View
Param | Type |
---|---|
child | View |
view.computePlacement(size, targetX, targetY, alignmentX, alignmentY, result)
Kind: instance method of View
Param | Type | Description |
---|---|---|
size | Vector2 | |
targetX | number | normalized horizontal position for setting child's position. 0 represents left-most , 1 right-most |
targetY | number | normalized vertical position for setting child's position. 0 represents top-most , 1 bottom-most |
alignmentX | number | |
alignmentY | number | |
result | Vector2 |
view.addChildAt(child, targetX, targetY, alignmentX, alignmentY)
Kind: instance method of View
Param | Type | Description |
---|---|---|
child | View | |
targetX | number | normalized horizontal position for setting child's position. 0 represents left-most , 1 right-most |
targetY | number | normalized vertical position for setting child's position. 0 represents top-most , 1 bottom-most |
alignmentX | number | |
alignmentY | number |
view.removeChild(child) ⇒ boolean
Kind: instance method of View
Param | Type |
---|---|
child | View |
view.hasChild(child) ⇒ boolean
Kind: instance method of View
Param | Type |
---|---|
child | View |
view.expandToFit(aabb, offsetX, offsetY)
Kind: instance method of View
Param | Type |
---|---|
aabb | AABB2 |
offsetX | number |
offsetY | number |
view.computeBoundingBox([result]) ⇒ AABB2
Kind: instance method of View
Param | Type |
---|---|
[result] | AABB2 |
view.positionLocalToGlobal(input, result) ⇒ Vector2
Kind: instance method of View
Returns: Vector2
- result, same as parameter
Param | Type |
---|---|
input | Vector2 |
result | Vector2 |
view.positionGlobalToLocal(input, result) ⇒ Vector2
Kind: instance method of View
Returns: Vector2
- result, same as parameter
Param | Type |
---|---|
input | Vector2 |
result | Vector2 |
view.computeGlobalScale(result)
Kind: instance method of View
Param | Type |
---|---|
result | Vector2 |
view.bindSignal(signal, handler, [context]) ⇒ View
Will create signal binding that is automatically linked/unlinked along with the view Useful for observing state changes when the view is live
Kind: instance method of View
Returns: View
- returns self, for call chaining
Param | Type |
---|---|
signal | Signal |
handler | function |
[context] | * |
view.unbindSignal(signal, handler, [context]) ⇒ boolean
Kind: instance method of View
Returns: boolean
- true if binding existed and was removed, false otherwise
Param | Type |
---|---|
signal | Signal |
handler | function |
[context] | * |
view.addClass(name)
Add CSS class to View's dom element
NOTE: Idempotent
Kind: instance method of View
Param | Type |
---|---|
name | string |
view.addClasses(names)
Add multiple CSS calsses to the View's dom element
Kind: instance method of View
Param | Type |
---|---|
names | Array.<string> |
view.removeClass(name)
Remove CSS class from View's dom element
NOTE: Idempotent
Kind: instance method of View
Param | Type |
---|---|
name | string |
view.removeClassesByPattern(rx) ⇒ Array.<string>
Remove classes that match the given regular expression
Kind: instance method of View
Returns: Array.<string>
- removed classes
Param | Type |
---|---|
rx | RegExp |
view.setClass(name, flag) ⇒ View
Toggle CSS class of the View's dom element ON or OFF
NOTE: Idempotent
Kind: instance method of View
Param | Type | Description |
---|---|---|
name | string | |
flag | boolean | if true, will add class, if false will remove it |
view.css(hash)
Kind: instance method of View
Param | Type |
---|---|
hash | Object |
view.attr(hash)
Kind: instance method of View
Param | Type |
---|---|
hash | Object |
view.followSize(size, [padding])
Kind: instance method of View
Param | Type |
---|---|
size | Vector2 |
[padding] | Vector2 |
ViewFlags : enum
Kind: global enum
INITIAL_FLAGS : ViewFlags
| number
Kind: global constant
Read only: true