Skip to main content

View

Classes

View

Base View class

Constants

INITIAL_FLAGS : ViewFlags | number

View

Base View class

Kind: global class

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

ParamType
vboolean

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

ParamType
flagnumber | ViewFlags

view.clearFlag(flag) ⇒ void

Kind: instance method of View

ParamType
flagnumber | ViewFlags

view.writeFlag(flag, value)

Kind: instance method of View

ParamType
flagnumber | ViewFlags
valueboolean

view.getFlag(flag) ⇒ boolean

Kind: instance method of View

ParamType
flagnumber | ViewFlags

intended as initialization point when view becomes linked to the visible tree

Kind: instance method of View

Finalization point, release all used resources and cleanup listeners

Kind: instance method of View

view.addChildren(children)

Kind: instance method of View

ParamType
childrenArray.<View>

view.addChild(child) ⇒ View

Kind: instance method of View

ParamType
childView

view.computePlacement(size, targetX, targetY, alignmentX, alignmentY, result)

Kind: instance method of View

ParamTypeDescription
sizeVector2
targetXnumbernormalized horizontal position for setting child's position. 0 represents left-most , 1 right-most
targetYnumbernormalized vertical position for setting child's position. 0 represents top-most , 1 bottom-most
alignmentXnumber
alignmentYnumber
resultVector2

view.addChildAt(child, targetX, targetY, alignmentX, alignmentY)

Kind: instance method of View

ParamTypeDescription
childView
targetXnumbernormalized horizontal position for setting child's position. 0 represents left-most , 1 right-most
targetYnumbernormalized vertical position for setting child's position. 0 represents top-most , 1 bottom-most
alignmentXnumber
alignmentYnumber

view.removeChild(child) ⇒ boolean

Kind: instance method of View

ParamType
childView

view.hasChild(child) ⇒ boolean

Kind: instance method of View

ParamType
childView

view.expandToFit(aabb, offsetX, offsetY)

Kind: instance method of View

ParamType
aabbAABB2
offsetXnumber
offsetYnumber

view.computeBoundingBox([result]) ⇒ AABB2

Kind: instance method of View

ParamType
[result]AABB2

view.positionLocalToGlobal(input, result) ⇒ Vector2

Kind: instance method of View
Returns: Vector2 - result, same as parameter

ParamType
inputVector2
resultVector2

view.positionGlobalToLocal(input, result) ⇒ Vector2

Kind: instance method of View
Returns: Vector2 - result, same as parameter

ParamType
inputVector2
resultVector2

view.computeGlobalScale(result)

Kind: instance method of View

ParamType
resultVector2

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

ParamType
signalSignal
handlerfunction
[context]*

view.unbindSignal(signal, handler, [context]) ⇒ boolean

Kind: instance method of View
Returns: boolean - true if binding existed and was removed, false otherwise

ParamType
signalSignal
handlerfunction
[context]*

view.addClass(name)

Add CSS class to View's dom element

NOTE: Idempotent

Kind: instance method of View

ParamType
namestring

view.addClasses(names)

Add multiple CSS calsses to the View's dom element

Kind: instance method of View

ParamType
namesArray.<string>

view.removeClass(name)

Remove CSS class from View's dom element

NOTE: Idempotent

Kind: instance method of View

ParamType
namestring

view.removeClassesByPattern(rx) ⇒ Array.<string>

Remove classes that match the given regular expression

Kind: instance method of View
Returns: Array.<string> - removed classes

ParamType
rxRegExp

view.setClass(name, flag) ⇒ View

Toggle CSS class of the View's dom element ON or OFF

NOTE: Idempotent

Kind: instance method of View

ParamTypeDescription
namestring
flagbooleanif true, will add class, if false will remove it

view.css(hash)

Kind: instance method of View

ParamType
hashObject

view.attr(hash)

Kind: instance method of View

ParamType
hashObject

view.followSize(size, [padding])

Kind: instance method of View

ParamType
sizeVector2
[padding]Vector2

ViewFlags : enum

Kind: global enum

INITIAL_FLAGS : ViewFlags | number

Kind: global constant
Read only: true