Last updated

API / geotoolkit / scene / Layer / Layer

Class: Layer<T>

scene.Layer.Layer

Define a composite node, which always has the same bounds and model limits as its parent

Type parameters

NameType
Textends Node = Node

Hierarchy

Table of contents

Constructors
Methods
addChildaddCssClassaddInvalidateHandler
adjustPositionapplyOpacityapplyResponsiveStyle
changeChildOrdercheckCollisionclearChildren
cloneconnectStylecopyConstructor
disconnectStyledisposeenableClipping
enableEventPropagationenumerateNodesexecute
filtergetAnimationStylegetAutoModelLimitsStrategy
getBoundsgetChildgetChildren
getChildrenCountgetClassNamegetClipStyle
getContentsAreagetContentsTransformgetCss
getCssClassgetCssClassesgetCssTransform
getDeviceLimitsgetIdgetInfiniteMode
getInvalidateMethodgetIsInfinitegetLocalTransform
getMarginsStylegetModelLimitsgetName
getOpacitygetOpacityBlendModegetParent
getPropertiesgetPropertygetPropertyKeys
getRenderingFiltergetResponsiveStylegetRoot
getScaleScrollStrategygetSceneTransformgetTag
getVisiblegetVisibleDeviceLimitsgetVisibleModelLimits
getWorldTransformgetZIndexhasCssClass
hasEventListenerindexOfChildinsertChild
invalidateinvalidateParentisClippingEnabled
isDisposedisEventPropagationEnabledisHorizontalFlip
isNotificationEnabledisSelectableisSilent
isVerticalFlipmoveTonotify
notifyRootoffon
onChildAddedonChildRemovedonParentChanged
onVisibilityChangedpostRenderingpreRendering
registerAnimationStyleremoveChildremoveCssClass
removeInvalidateHandlerrenderrenderAsync
renderChildrenrenderChildrenAsyncrenderContent
renderContentAsyncrotatescale
setAnimationStylesetAutoModelLimitsStrategysetChild
setClipStylesetCsssetCssClass
setCssTransformsetIdsetInfiniteMode
setIsInfinitesetLocalTransformsetMarginsStyle
setNamesetNotificationsetOpacity
setPropertiessetPropertysetRenderingFilter
setResponsiveStylesetScaleScrollStrategysetSelectable
setSilentsetTagsetVisible
setVisibleModelLimitssetZIndexshear
toStringtranslateunregisterAnimationStyle
updateSceneTransformationupdateStateupdateTimeStamp
enableSceneGraphNotificationfindParentgetClassName
isSceneGraphNotificationEnabled
Css Properties
Name Type Description
clippingbooleanEnable clipping, this does not consider the clipstyle, it is related to bounds-clipping
clipstyleClipStyleClipping style
clipstyle-evenoddbooleanTrue if evenodd mode is on (&#x27;nonzero&#x27; mode otherwise)
clipstyle-geometryGraphicsPathClipping geometry
clipstyle-geometry-boundsRectBounds
clipstyle-geometry-bounds-heightnumberHeight
clipstyle-geometry-bounds-readonlybooleanReadonly
clipstyle-geometry-bounds-widthnumberWidth
clipstyle-geometry-bounds-xnumberLeft
clipstyle-geometry-bounds-ynumberTop
clipstyleGraphicsPathClipping style
cssclassstringThe css class name of this node
csscursorstringCSS cursor associated with node
cssstylestringCSS style to be applied to inserted elements
idstring | numberId of the node, its a unique identifier
infinitybooleanMode to render outside the model limits
localtransformTransformationLocal transformation
localtransform-dxnumberX axis translation
localtransform-dynumberY axis translation
localtransform-xxnumberX scale
localtransform-xynumberXy skew
localtransform-yxnumberYx skew
localtransform-yynumberY scale
marginsnumber | stringIt has properties for specifying the margins for each side
namestringName of the node. It is often used for debugging purposes or to simplify queries
opacitynumberNode opacity (from 0 to 1). If it is undefined or null it inherits property from the parent. It changes globalAlpha on the rendering context
opacityblendmodeBlendModeNode opacity mode to blend it
scalescrollstrategyScaleScrollStrategyScale scroll strategy
scalescrollstrategy-enabledbooleanEnable flag
selectablebooleanSelectable node, a boolean to determine if selection should consider this node
taganyCustom information associated with node. It is a user object which can be used by client code to store information or attach an application object to the shape
transformstringAdditional CSS transformation applied to node or &#x27;none&#x27;
transformTransformationAdditional CSS transformation applied to node or &#x27;none&#x27;
visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
z-indexnumberDefine node z-index

Contents

Constructors

new Layer&lt;T&amp;gt;(options)

new Layer<T>(options?)

Creates layer

Type parameters

NameType
Textends Node<T> = Node

Parameters

Name Type Description
Optional optionsOptions<T>layer options

Overrides

CompositeNode&lt;T&amp;gt;.constructor

Methods

addChild

addChild(node): Layer<T>

Add a child node

Parameters

Name Type Description
nodeT | T[] | Iterator<T>the child node to be added

Returns

Layer<T>

this

Inherited from

CompositeNode.addChild


addCssClass

addCssClass(cssclass): Layer<T>

Adds new css class to node

Parameters

Name Type Description
cssclassstring | string[]css class name('s)

Returns

Layer<T>

this

Inherited from

CompositeNode.addCssClass


addInvalidateHandler

addInvalidateHandler(handler): Layer<T>

Add invalidate handler

Deprecated

since 4.0, use Node.on instead

Parameters

Name Type Description
handlerFunctionhandler to be notified about invalidation

Returns

Layer<T>

this

Inherited from

CompositeNode.addInvalidateHandler


adjustPosition

adjustPosition(area?, vAlign?, hAlign?): Layer<T>

Adjust position of node to specified area

Parameters

Name Type Description
Optional areaRectspecified area. Default to Parent Model Limits
Optional vAlignstringvertical alignment. It can be "top", "bottom", "center". Defaults to "top".
Optional hAlignstringhorizontal alignment It can be "left", "right", "center". Defaults to "left".

Returns

Layer<T>

this

Inherited from

CompositeNode.adjustPosition


applyOpacity

Protected applyOpacity(context): Layer<T>

This method is called to apply opacity if it is specified on the rendering context. The default implementation sets global alpha on the rendering context

Parameters

Name Type Description
contextRenderingContextRendering Context

Returns

Layer<T>

this

Inherited from

CompositeNode.applyOpacity


applyResponsiveStyle

Protected applyResponsiveStyle(): void

Apply a responsive style rules it is exists

Returns

void

Inherited from

CompositeNode.applyResponsiveStyle


changeChildOrder

changeChildOrder(node, order, anchor?): Layer<T>

changes the z-order of the nodes being rendered.

Parameters

Name Type Description
nodeTany child added in the Composite node
orderNodeOrderposition to be added
Optional anchorTanchor node to specify changeOrder with respect to this node

Returns

Layer<T>

this

Inherited from

CompositeNode.changeChildOrder


checkCollision

checkCollision(context): boolean

Check culling Returns true if object is inside of renderable area

Parameters

Name Type Description
contextRenderingContextRendering Context

Returns

boolean

true if node is collided

Inherited from

CompositeNode.checkCollision


clearChildren

clearChildren(disposeChildren?): Layer<T>

Remove all child nodes from this composite group

Parameters

Name Type Description
Optional disposeChildrenbooleanautomatically dispose children. If it is true then method dispose is called for each child.

Returns

Layer<T>

this

Inherited from

CompositeNode.clearChildren


clone

clone(): Layer<Node>

All subclasses should override copyConstructor or provide custom implementation for this method

Returns

Layer<Node>

clone

Overrides

CompositeNode.clone


connectStyle

connectStyle(style, type, callback): Layer<T>

Connects style.

This convenience method subscribes a listener to given style for the specified type.
And automatically un-subscribes listener if node is disposed to prevent memory leaks

Parameters

Name Type Description
styleEventDispatcherconnect style
typestringtype of event or property
callbackAttributeCallback<EventDispatcher>function to be called

Returns

Layer<T>

this

Inherited from

CompositeNode.connectStyle


copyConstructor

Protected copyConstructor(src, deepCopy?): Layer<T>

Copy constructor function.
Function used as part of the cloning mechanism.
Implementations should copy the given instance state to this instance.

Parameters

Name Type Description
srcLayer<Node>Source to copy from
Optional deepCopybooleandeep copy

Returns

Layer<T>

this

Overrides

CompositeNode.copyConstructor


disconnectStyle

disconnectStyle(style, type, callback): Layer<T>

Disconnect style
This convenience method un-subscribes a listener to given style for the specified type.

Parameters

Name Type Description
styleEventDispatcherconnect style
typestringtype of event or property
callbackAttributeCallback<EventDispatcher>function to be called

Returns

Layer<T>

this

Inherited from

CompositeNode.disconnectStyle


dispose

dispose(): void

Dispose node. Clear all listeners and disconnect style to avoid memory leaks

Returns

void

Inherited from

CompositeNode.dispose


enableClipping

enableClipping(doClip): Layer<T>

Enables or disables clipping of this node. If enabled, shapes will not be rendered outside of its bounds.

Parameters

Name Type Description
doClipbooleanenable clipping on this node

Returns

Layer<T>

this

Inherited from

CompositeNode.enableClipping


enableEventPropagation

enableEventPropagation(enable): Layer<T>

Enable event propagation from the node hierarchy from bottom to top

This option is similar to DOM Event bubbling, which allows to get any event from child node. By default it is disabled for better performance.

Example

import {Group} from '@int/geotoolkit/scene/Group';
import {Events as SceneEvents} from '@int/geotoolkit/scene/Node';
const parentGroup = new Group()
.setName('ParentGroup')
.enableEventPropagation(true);
const childGroup = new Group()
.setName('ChildGroup');

parentGroup.addChild(childGroup);
parentGroup.on(SceneEvents.Invalidate, (eventName, sender, args) => {
// Got notifications from all children of parent group
});
childGroup.invalidate();

Parameters

Name Type Description
enablebooleanenable

Returns

Layer<T>

this

Inherited from

CompositeNode.enableEventPropagation


enumerateNodes

enumerateNodes(callback, target?): void

Executes a provided function once for each child node

Parameters

Name Type Description
callbackCallback<Node>provided function
Optional targetQueryBuilder<any>target to pass to callback as a second parameter

Returns

void

Inherited from

CompositeNode.enumerateNodes


execute

execute(delegate): Layer<T>

Executes delegate and return the result. It allows us to keep all initialization calls in one place,
and we do not need to scroll up or down in IDE to find how and where it was initialized.

Example

// All setters (.setName() for example) returns reference to the this.
// In order to modify inner object like LineStyle or Pattern, to get this object (property) we should call getter to get object reference.
// Then modify it as shown below in Option 1 or you can use execute methods shown in Option 2.
import {Group} from '@int/geotoolkit/scene/Group';
import {Rect} from '@int/geotoolkit/util/Rect';
// Option 1
const group = new Group()
.setName('MyGroup')
.setBounds(new Rect(0, 0, 42, 16))
.enableClipping(true)
.setTag({'type': 'sometype'});

group.getLineStyle().setPattern('pattern');
return group;

// Options 2 ( using execute method )
return group
.execute(function () {
this.getLineStyle()
.setPattern("pattern");
});

Parameters

Name Type Description
delegate(this: Layer<T>) => voidFunction to execute

Returns

Layer<T>

The result if any or this

Inherited from

CompositeNode.execute

execute<T>(delegate): T

Type parameters

Name
T

Parameters

Name Type
delegate(this: Layer<T>) => T

Returns

T

Inherited from

CompositeNode.execute


filter

Protected filter(context): boolean

Filter node

Parameters

Name Type Description
contextRenderingContextRendering Context

Returns

boolean

flag filter flag ("true" to render node; "false" otherwise)

Inherited from

CompositeNode.filter


getAnimationStyle

getAnimationStyle(): AnimationStyle

Return animation style

Returns

AnimationStyle

animationStyle current animation style

Inherited from

CompositeNode.getAnimationStyle


getAutoModelLimitsStrategy

getAutoModelLimitsStrategy(): ModelLimitsStrategy

Get a strategy for calculating model limits

Returns

ModelLimitsStrategy

strategy If it is null, the limits of the parent model are used.


getBounds

getBounds(): Rect

Returns parent bounds

Returns

Rect

bounds

Overrides

CompositeNode.getBounds


getChild

getChild(i): T

Return node by index

Parameters

Name Type Description
inumberindex of the node

Returns

T

Inherited from

CompositeNode.getChild


getChildren

getChildren<S>(predicate, modify?): Iterator<S>

Return iterator by child nodes

Type parameters

NameType
Sextends Node<S>

Parameters

Name Type Description
predicate(value: T) => value is Sa filter function
Optional modifybooleanAn option to specify if the iterator supports adding/removing items from the collection. false by default.

Returns

Iterator<S>

Inherited from

CompositeNode.getChildren

getChildren(filter?, modify?): Iterator<T>

Returns an iterator for child nodes. The iterator does not support adding or deleting items from children by default. If it is necessary to modify a collection of children, pass true as the last parameter.

Example

// Gets a writable iterator
const it = node.getChildren(null, true);

Parameters

Name Type Description
Optional filter(node: T) => booleanA filter function. Returns all nodes if null.
Optional modifybooleanAn option to specify if the iterator supports adding/removing items from the collection. false by default.

Returns

Iterator<T>

An iterator for child nodes.

Inherited from

CompositeNode.getChildren


getChildrenCount

getChildrenCount(): number

Return number of child nodes

Returns

number

Inherited from

CompositeNode.getChildrenCount


getClassName

getClassName(): string

Returns

string

Inherited from

CompositeNode.getClassName


getClipStyle

getClipStyle(): ClipStyle

Gets the current clipping style

Returns

ClipStyle

clipping style

Inherited from

CompositeNode.getClipStyle


getContentsArea

getContentsArea(transformation?): Rect

Return area of content. By default it is equal to bounds.

Parameters

Name Type Description
Optional transformationTransformationscene transformation

Returns

Rect

Inherited from

CompositeNode.getContentsArea


getContentsTransform

getContentsTransform(): Transformation

Transformation of inner contents to content area

Returns

Transformation

Inherited from

CompositeNode.getContentsTransform


getCss

getCss(): CssStyle

Return CSS style

Returns

CssStyle

Inherited from

CompositeNode.getCss


getCssClass

getCssClass(): string

Returns css class name to be used to apply CSS style

Returns

string

the css class name

Inherited from

CompositeNode.getCssClass


getCssClasses

getCssClasses(): string[]

Gets list of css class names which applied to this node

Returns

string[]

Inherited from

CompositeNode.getCssClasses


getCssTransform

getCssTransform(): string

Returns CSS transformation

Returns

string

Inherited from

CompositeNode.getCssTransform


getDeviceLimits

getDeviceLimits(): Rect

Return device limits

Returns

Rect

Inherited from

CompositeNode.getDeviceLimits


getId

getId(): string | number

Returns the associated identifier of the node

Returns

string | number

The node's id

Inherited from

CompositeNode.getId


getInfiniteMode

getInfiniteMode(): boolean

Return infinity mode flag

Returns

boolean

flag

Inherited from

CompositeNode.getInfiniteMode


getInvalidateMethod

Protected getInvalidateMethod(): AttributeCallback<EventDispatcher>

Gets invalidate method

Returns

AttributeCallback<EventDispatcher>

method to invalidate this object

Inherited from

CompositeNode.getInvalidateMethod


getIsInfinite

getIsInfinite(): boolean

Returns infinite flag, flag that indicates infinite limits of the layer

Returns

boolean


getLocalTransform

getLocalTransform(): Transformation

Retrieves the transformation of bounds to parent

Returns

Transformation

transform the local transform.

Inherited from

CompositeNode.getLocalTransform


getMarginsStyle

getMarginsStyle(): SpaceStyle<string | number>

Return margins style

Returns

SpaceStyle<string | number>

Inherited from

CompositeNode.getMarginsStyle


getModelLimits

getModelLimits(): Rect

Returns parent model limits

Returns

Rect

Overrides

CompositeNode.getModelLimits


getName

getName(): string

Returns the node name

Returns

string

The node name

Inherited from

CompositeNode.getName


getOpacity

getOpacity(): number

Returns current node opacity

Returns

number

opacity

Inherited from

CompositeNode.getOpacity


getOpacityBlendMode

getOpacityBlendMode(): BlendMode

Returns current node opacity

Returns

BlendMode

opacity blend mode

Inherited from

CompositeNode.getOpacityBlendMode


getParent

getParent(): Node

Return parent node

Returns

Node

parent node

Inherited from

CompositeNode.getParent


getProperties

getProperties(context?): OptionsOut<T>

Gets all the properties pertaining to this object

Parameters

Name Type Description
Optional contextISerializationContextserialization context

Returns

OptionsOut<T>

properties object

Inherited from

CompositeNode.getProperties


getProperty

getProperty(name): any

Gets dynamic property by name. These properties can be used as a property bags

Parameters

Name Type Description
namestringproperty name

Returns

any

Inherited from

CompositeNode.getProperty


getPropertyKeys

getPropertyKeys(): string[]

Returns known properties keys

Returns

string[]

Inherited from

CompositeNode.getPropertyKeys


getRenderingFilter

getRenderingFilter(): IFilter

Return filter to be used for rendering and picking

Returns

IFilter

current filter

Inherited from

CompositeNode.getRenderingFilter


getResponsiveStyle

getResponsiveStyle(): ResponsiveStyle

Return responsive style

Returns

ResponsiveStyle

Inherited from

CompositeNode.getResponsiveStyle


getRoot

getRoot(): Node

Returns root node.
If node doesn't have parent then it returns itself.

Returns

Node

the root node

Inherited from

CompositeNode.getRoot


getScaleScrollStrategy

getScaleScrollStrategy(): Delegate

Gets scale scroll strategy

Returns

Delegate

scale scroll strategy

Inherited from

CompositeNode.getScaleScrollStrategy


getSceneTransform

getSceneTransform(): Transformation

Returns transformation from node to root scene

Returns

Transformation

a transformation from node to root scene

Inherited from

CompositeNode.getSceneTransform


getTag

getTag(): any

Returns the object associated with the node by user.

Returns

any

The node's user-object

Inherited from

CompositeNode.getTag


getVisible

getVisible(): boolean

Return visibility of the node

Returns

boolean

true if node is visible

Inherited from

CompositeNode.getVisible


getVisibleDeviceLimits

getVisibleDeviceLimits(ignoreModelLimits?): Rect

Return visible device limits

Parameters

Name Type Description
Optional ignoreModelLimitsbooleanflag defines whether to ignore ModelLimits or not

Returns

Rect

Inherited from

CompositeNode.getVisibleDeviceLimits


getVisibleModelLimits

getVisibleModelLimits(ignoreModelLimits?): Rect

Return visible model limits

Parameters

Name Type Description
Optional ignoreModelLimitsbooleanflag defines whether to ignore ModelLimits or not

Returns

Rect

Inherited from

CompositeNode.getVisibleModelLimits


getWorldTransform

getWorldTransform(): Transformation

Retrieves the local transformation of the node which represents multiplication of parent to bounds and contents transformations.

Returns

Transformation

Inherited from

CompositeNode.getWorldTransform


getZIndex

getZIndex(): number

Returns node z-index (null if not set)

Returns

number

Inherited from

CompositeNode.getZIndex


hasCssClass

hasCssClass(cssClass): boolean

Check if node has specified css class

Parameters

Name Type Description
cssClassstringcss class name

Returns

boolean

Inherited from

CompositeNode.hasCssClass


hasEventListener

hasEventListener(type, callback?): boolean

Check if a list of event listeners for this type contains this listener

Parameters

Name Type Description
typestringtype of event or property
Optional callbackFunctionto be called, if null, check if any callback is registered

Returns

boolean

Inherited from

CompositeNode.hasEventListener


indexOfChild

indexOfChild(node): number

Return index of child ( index of the specified child or -1 if node is not found)

Parameters

Name Type Description
nodeTnode to check index

Returns

number

Inherited from

CompositeNode.indexOfChild


insertChild

insertChild(index, node): Layer<T>

Insert child node at specified index

Parameters

Name Type Description
indexnumberspecified index
nodeTa child node to add

Returns

Layer<T>

this

Inherited from

CompositeNode.insertChild


invalidate

invalidate(bounds?, force?): Layer<T>

Invalidate area of the shape. This method invalidates parent by default. invalidated from parent to root node.

Parameters

Name Type Description
Optional boundsRectbounds of the invalid rectangle in the inner node coordinates
Optional forcebooleantrue if parent should be invalidated immediately if null is provided then cache (if any will be completely refreshed) otherwise only specified rect or node.bounds will be refreshed

Returns

Layer<T>

this

Inherited from

CompositeNode.invalidate


invalidateParent

invalidateParent(bounds?, force?): Layer<T>

Invalidate parent and notify all listeners.

Parameters

Name Type Description
Optional boundsRectbounds of the invalid rectangle in the inner node coordinates
Optional forcebooleanforce invalidate

Returns

Layer<T>

this

Overrides

CompositeNode.invalidateParent


isClippingEnabled

isClippingEnabled(): boolean

Returns if clipping is enabled or not for this node.

Returns

boolean

Inherited from

CompositeNode.isClippingEnabled


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

CompositeNode.isDisposed


isEventPropagationEnabled

isEventPropagationEnabled(): boolean

Return true if event propagation is enabled from child to parent

Returns

boolean

Inherited from

CompositeNode.isEventPropagationEnabled


isHorizontalFlip

isHorizontalFlip(): boolean

Return true if the representation is flipped horizontally

Returns

boolean

Inherited from

CompositeNode.isHorizontalFlip


isNotificationEnabled

isNotificationEnabled(): boolean

return state of notification

Returns

boolean

current notification state

Inherited from

CompositeNode.isNotificationEnabled


isSelectable

isSelectable(): boolean

Returns true if node can be picked/selected.

Returns

boolean

The selectable flag

Inherited from

CompositeNode.isSelectable


isSilent

isSilent(): boolean

Return true if the event dispatcher doesn't notify any events

Returns

boolean

Inherited from

CompositeNode.isSilent


isVerticalFlip

isVerticalFlip(): boolean

Return true if the representation is flipped vertically

Returns

boolean

Inherited from

CompositeNode.isVerticalFlip


moveTo

moveTo(area, vAlign?, hAlign?): Layer<T>

MoveTo position of node to specified area

Parameters

Name Type Description
areaRectspecified area
Optional vAlignstringvertical alignment. It can be "top", "bottom", "center".
Optional hAlignstringhorizontal alignment It can be "left", "right", "center".

Returns

Layer<T>

this

Inherited from

CompositeNode.moveTo


notify

notify<E>(event, source, args?): Layer<T>

Notify listeners of the Node

Type parameters

NameType
Eextends string

Parameters

Name Type Description
eventEtype of event
sourceCompositeNode<Node>source who called the event
Optional argsEventMap<Node>[E]event arguments

Returns

Layer<T>

this

Inherited from

CompositeNode.notify


notifyRoot

Protected notifyRoot(event, source, args?): Node

Notify an even to root node

Parameters

Name Type Description
eventstringtype of event
sourceNodesource who called the event
Optional argsanyevent arguments

Returns

Node

this

Inherited from

CompositeNode.notifyRoot


off

off<E>(type?, callback?): Layer<T>

Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
Optional typeEtype of the event
Optional callback(eventType: E, sender: Layer<T>, args: EventMap<Node>[E]) => voidfunction to be called

Returns

Layer<T>

this

Inherited from

CompositeNode.off


on

on<E>(type, callback): Layer<T>

Attach listener on event that will be called whenever the specified event is delivered to the target

If the callback function is already in the list of event listeners for this target, the function is not added a second time.

If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEtype of event or property
callback(eventType: E, sender: Layer<T>, args: EventMap<Node>[E]) => voidto be called

Returns

Layer<T>

this

Inherited from

CompositeNode.on


onChildAdded

Protected onChildAdded(child): void

This method is called it child or children are added

Parameters

Name Type Description
childNode | Iterator<Node>added child

Returns

void

Inherited from

CompositeNode.onChildAdded


onChildRemoved

Protected onChildRemoved(child): void

This method is called it child or children are removed

Parameters

Name Type Description
childNoderemoved child

Returns

void

Inherited from

CompositeNode.onChildRemoved


onParentChanged

Protected onParentChanged(node): Layer<T>

This method is called when parent changes. Do not call it directly.

Parameters

Name Type Description
nodeTnode to change parent

Returns

Layer<T>

this

Inherited from

CompositeNode.onParentChanged


onVisibilityChanged

Protected onVisibilityChanged(): void

This method is called if visibility is changed. Send event Events.VisibilityChanged

Returns

void

Inherited from

CompositeNode.onVisibilityChanged


postRendering

Protected postRendering(context, callback?): void

To be called after rendering, used for PDF output

Parameters

Name Type Description
contextRenderingContextRendering Context
Optional callback() => voidcallback to be called after rendering

Returns

void

Inherited from

CompositeNode.postRendering


preRendering

Protected preRendering(context, callback?): void

Occurs before child rendering

Parameters

Name Type Description
contextRenderingContextRendering Context
Optional callback() => voidcallback to be called after rendering of geometry

Returns

void

Inherited from

CompositeNode.preRendering


registerAnimationStyle

registerAnimationStyle(root): void

Register animation style.

Parameters

Name Type Description
rootNoderoot node for node

Returns

void

Inherited from

CompositeNode.registerAnimationStyle


removeChild

removeChild(node, disposeChildren?): Layer<T>

Remove child node

Parameters

Name Type Description
nodeT | T[]node or array of nodes to be removed
Optional disposeChildrenbooleanautomatically dispose children. If it is true then method dispose is called for each child.

Returns

Layer<T>

this

Inherited from

CompositeNode.removeChild


removeCssClass

removeCssClass(cssclass): Layer<T>

Removes css class from node

Parameters

Name Type Description
cssclassstring | string[]css class name('s)

Returns

Layer<T>

this

Inherited from

CompositeNode.removeCssClass


removeInvalidateHandler

removeInvalidateHandler(handler): Layer<T>

Remove invalidate handler

Deprecated

since 4.0, use Node.off instead

Parameters

Name Type Description
handlerFunctionhandler to be notified about invalidation

Returns

Layer<T>

this

Inherited from

CompositeNode.removeInvalidateHandler


render

render(context): void

Render composite node and children

Parameters

Name Type Description
contextRenderingContextRendering Context

Returns

void

Inherited from

CompositeNode.render


renderAsync

renderAsync(context, callback): void

Render node in asynchronous mode

Parameters

Name Type Description
contextRenderingContextThe rendering context to be used to draw the node
callback() => voidcallback function

Returns

void

Inherited from

CompositeNode.renderAsync


renderChildren

Protected renderChildren(context): void

Render children

Parameters

Name Type Description
contextRenderingContextRendering Context

Returns

void

Inherited from

CompositeNode.renderChildren


renderChildrenAsync

Protected renderChildrenAsync(context, callback): void

Render children async

Parameters

Name Type Description
contextRenderingContextRendering Context
callback() => voidcallback function to be called then all children are rendered

Returns

void

Inherited from

CompositeNode.renderChildrenAsync


renderContent

Protected renderContent(context): void

render to specified context. This method calls preRendering, renderChildren, postRendering

Parameters

Name Type Description
contextRenderingContextRendering Context

Returns

void

Inherited from

CompositeNode.renderContent


renderContentAsync

Protected renderContentAsync(context, callback): void

Render children in asynchronous mode

Parameters

Name Type Description
contextRenderingContextThe rendering context to be used to draw the node
callback() => voidcallback function to be called then all children are rendered

Returns

void

Inherited from

CompositeNode.renderContentAsync


rotate

rotate(theta, x, y): Layer<T>

Rotate bounds around a given coordinate

Parameters

Name Type Description
thetanumberangle to rotate node, in radians
xnumberx coordinate to rotate around
ynumbery coordinate to rotate around

Returns

Layer<T>

this

Inherited from

CompositeNode.rotate


scale

scale(xx, yy): Layer<T>

Scale node

Parameters

Name Type Description
xxnumberx scale factor
yynumbery scale factor

Returns

Layer<T>

this

Inherited from

CompositeNode.scale


setAnimationStyle

setAnimationStyle(animationStyle): Layer<T>

Sets animation style

Parameters

Name Type Description
animationStyleTypeanimation style

Returns

Layer<T>

Inherited from

CompositeNode.setAnimationStyle


setAutoModelLimitsStrategy

setAutoModelLimitsStrategy(strategy): Layer<T>

Set a strategy for calculating model limits. If it is null, the limits of the parent model are used.

Parameters

Name Type Description
strategyModelLimitsStrategyModel Limits logic strategy to use

Returns

Layer<T>

this


setChild

setChild(index, node): Layer<T>

Replace child node by index

Parameters

Name Type Description
indexnumberindex of the node
nodeTnode

Returns

Layer<T>

this

Inherited from

CompositeNode.setChild


setClipStyle

setClipStyle(style): Layer<T>

Sets a new clipping style

Parameters

Name Type Description
styleGraphicsPath | ClipStyle | Optionsa new clipping style

Returns

Layer<T>

this

Inherited from

CompositeNode.setClipStyle


setCss

setCss(style, merge?): Layer<T>

Sets CSS style. This style will be applied for all inserted elements

Parameters

Name Type Description
styleTypeCSS style to be applied to inserted elements
Optional mergebooleanmerge flag

Returns

Layer<T>

this

Inherited from

CompositeNode.setCss


setCssClass

setCssClass(name): Layer<T>

Sets css class name of the node to be used to apply CSS style

Parameters

Name Type Description
namestringcss class name of the node

Returns

Layer<T>

this

Inherited from

CompositeNode.setCssClass


setCssTransform

setCssTransform(transform): Layer<T>

Set CSS transformation

Parameters

Name Type Description
transformstring | Transformationtransformation css transformation instruction or Transformation instance

Returns

Layer<T>

this

Inherited from

CompositeNode.setCssTransform


setId

setId(id): Layer<T>

Allows the user to associate any identifier

Parameters

Name Type Description
idstring | numberobject id

Returns

Layer<T>

this

Inherited from

CompositeNode.setId


setInfiniteMode

setInfiniteMode(infinityMode): Layer<T>

Set infinity mode flag to draw composite without collision check

Parameters

Name Type Description
infinityModebooleaninfinity mode flag

Returns

Layer<T>

this

Inherited from

CompositeNode.setInfiniteMode


setIsInfinite

setIsInfinite(infinite): Layer<T>

Set infinite flag, this flag indicates that the layer has infinite limits

Parameters

Name Type Description
infinitebooleaninfinite flag

Returns

Layer<T>

this


setLocalTransform

setLocalTransform(localTransform, force?): Layer<T>

Sets local transformation to be used to transform from local to parent coordinate

Parameters

Name Type Description
localTransformTransformationlocal transformation for this node
Optional forcebooleanboolean flag to force update event if transformations are equal, false by default

Returns

Layer<T>

this

Inherited from

CompositeNode.setLocalTransform


setMarginsStyle

setMarginsStyle(margins, merge?): Layer<T>

Sets margins style

Parameters

Name Type Description
marginsType<string | number>margins style
Optional mergebooleantrue if you want to merge marginsStyle with existing attribute, false by default

Returns

Layer<T>

this

Inherited from

CompositeNode.setMarginsStyle


setName

setName(name): Layer<T>

Sets name of the node

Parameters

Name Type Description
namestringThe node name

Returns

Layer<T>

this

Inherited from

CompositeNode.setName


setNotification

setNotification(notify, force?): Layer<T>

set notification state

Parameters

Name Type Description
notifybooleanflag set to invalidate parent or not
Optional forcebooleantrue if parent should be invalidated immediately

Returns

Layer<T>

this

Inherited from

CompositeNode.setNotification


setOpacity

setOpacity(opacity, blendMode?): Layer<T>

Sets node opacity

Parameters

Name Type Description
opacitynumbernode opacity from 0 to 1
Optional blendModeBlendModeopacity blend mode. If it is normal, opacity will be replaced.

Returns

Layer<T>

this

Inherited from

CompositeNode.setOpacity


setProperties

setProperties(properties?): Layer<T>

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptions<T>An object containing the properties to set

Returns

Layer<T>

this

Inherited from

CompositeNode.setProperties


setProperty

setProperty(name, value): Layer<T>

Sets dynamic property by name

Parameters

Name Type Description
namestringproperty name
valueanyproperty value

Returns

Layer<T>

this

Inherited from

CompositeNode.setProperty


setRenderingFilter

setRenderingFilter(filter): Layer<T>

Sets filter to be applied before rendering and picking

Parameters

Name Type Description
filterIFilterfilter to set

Returns

Layer<T>

this

Inherited from

CompositeNode.setRenderingFilter


setResponsiveStyle

setResponsiveStyle(style): Layer<T>

Sets responsive style.

Parameters

Name Type Description
styleOptions | ResponsiveStyleresponsive style

Returns

Layer<T>

this

Inherited from

CompositeNode.setResponsiveStyle


setScaleScrollStrategy

setScaleScrollStrategy(strategy?): Layer<T>

Sets scale scroll strategy

Parameters

Name Type Description
Optional strategyDelegatescale scroll strategy

Returns

Layer<T>

this

Inherited from

CompositeNode.setScaleScrollStrategy


setSelectable

setSelectable(selectable): Layer<T>

Allows to select node. If node is not selectable then child node is not selectable.

Parameters

Name Type Description
selectablebooleanflag to allow node selection

Returns

Layer<T>

this

Inherited from

CompositeNode.setSelectable


setSilent

setSilent(bool): Layer<T>

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

Layer<T>

this

Inherited from

CompositeNode.setSilent


setTag

setTag(tag): Layer<T>

Allows the user to associate any arbitrary object with the node.

Parameters

Name Type Description
taganyThe object to be associated with the node.

Returns

Layer<T>

this

Inherited from

CompositeNode.setTag


setVisible

setVisible(value): Layer<T>

Sets visibility of the node. Send event Events.VisibilityChanged

Parameters

Name Type Description
valuebooleanflag specifying visibility of the node

Returns

Layer<T>

this

Inherited from

CompositeNode.setVisible


setVisibleModelLimits

setVisibleModelLimits(visibleModelBounds, deviceBounds?): Layer<T>

Set visible model limits

Parameters

Name Type Description
visibleModelBoundsRectvisible model limits or bounds
Optional deviceBoundsRectdevice bounds

Returns

Layer<T>

this

Inherited from

CompositeNode.setVisibleModelLimits


setZIndex

setZIndex(value): Layer<T>

Sets z-index for node (set null for default)

Parameters

Name Type Description
valuenumberindex determining node z-position

Returns

Layer<T>

this

Inherited from

CompositeNode.setZIndex


shear

shear(shx, shy): Layer<T>

Shear this node's bounds

Parameters

Name Type Description
shxnumberx-axis shear
shynumbery-axis shear

Returns

Layer<T>

this

Inherited from

CompositeNode.shear


toString

toString(): string

Returns a string representation of this object (generally the classname)

Returns

string

A string representation

Inherited from

CompositeNode.toString


translate

translate(tx, ty): Layer<T>

Translate bounds

Parameters

Name Type Description
txnumberx translation
tynumbery translation

Returns

Layer<T>

this

Inherited from

CompositeNode.translate


unregisterAnimationStyle

unregisterAnimationStyle(root): void

Unregister animation style.

Parameters

Name Type Description
rootAnimatedNoderoot node for node

Returns

void

Inherited from

CompositeNode.unregisterAnimationStyle


updateSceneTransformation

updateSceneTransformation(): Layer<T>

Update scene transformation

Returns

Layer<T>

this

Inherited from

CompositeNode.updateSceneTransformation


updateState

updateState(regions?, changes?): Layer<T>

Update state. These methods reset node state and update state for children. this method is useful to refresh a scene graph

Parameters

Name Type Description
Optional regionsRect[]optional array to return invalid rectangles in the parent coordinates
Optional changesStateChangesoptional parameter to specify a reason of changes

Returns

Layer<T>

this

Inherited from

CompositeNode.updateState


updateTimeStamp

Protected updateTimeStamp(): Layer<T>

Update time stamp to indicate that Node or Children has been changed.

Returns

Layer<T>

this

Inherited from

CompositeNode.updateTimeStamp


enableSceneGraphNotification

Static enableSceneGraphNotification(enabled): void

Enable / disable all notifications

Parameters

Name Type Description
enabledbooleansets if this object sends notifications

Returns

void

Inherited from

CompositeNode.enableSceneGraphNotification


findParent

Static findParent<T>(node, classType, filter?): InstanceType<T>

Find root of the node with specified type

Type parameters

NameType
Textends Constructor<any>

Parameters

Name Type Description
nodeNodenode to start search
classTypeTtype of the class to search for
Optional filter(node: Node) => booleanadditional filter to apply

Returns

InstanceType<T>

Inherited from

CompositeNode.findParent

Static findParent(node, classType, filter?): Node

Find root of the node with specified type

Parameters

Name Type Description
nodeNodenode to start search
classTypestringinterface name to search for
Optional filter(node: Node) => booleanadditional filter to apply

Returns

Node

Inherited from

CompositeNode.findParent


getClassName

Static getClassName(): string

Returns

string

Inherited from

CompositeNode.getClassName


isSceneGraphNotificationEnabled

Static isSceneGraphNotificationEnabled(): boolean

Return status of the global notification for all nodes.

Returns

boolean

Inherited from

CompositeNode.isSceneGraphNotificationEnabled