Last updated

API / geotoolkit / scene / LayeredNode / LayeredNode

Class: LayeredNode<T>

scene.LayeredNode.LayeredNode

This class defines a LayeredNode, an extension of the composite node that introduces additional rendering layers. It provides support for rendering content both "before" and "after" the main content, offering greater flexibility in organizing visual elements.

  • Base Layers: A collection of nodes rendered before all other layers and after the background, serving as the foundational visual layer.
  • Overlay Layers: A collection of nodes rendered on top of all other layers, ensuring they appear in the foreground.
This structure allows for a clean separation of visual elements, enabling complex rendering hierarchies while maintaining clarity and control.

Type parameters

NameType
Textends Node = Node

Hierarchy

Table of contents

Constructors
Methods
addBaseLayeraddChildaddCssClass
addInvalidateHandleraddOverlayadjustPosition
applyOpacityapplyResponsiveStylechangeBaseLayerOrder
changeChildOrderchangeOverlayOrdercheckCollision
clearBaseLayersclearChildrenclearOverlays
cloneconnectStylecopyConstructor
disconnectStyledisposeenableClipping
enableEventPropagationenumerateNodesexecute
filtergetAnimationStylegetBaseLayer
getBaseLayersgetBaseLayersCountgetBounds
getChildgetChildrengetChildrenCount
getClassNamegetClipStylegetContentsArea
getContentsTransformgetCssgetCssClass
getCssClassesgetCssTransformgetDeviceLimits
getIdgetInfiniteModegetInvalidateMethod
getLocalTransformgetMarginsStylegetModelLimits
getNamegetOpacitygetOpacityBlendMode
getOverlaygetOverlayAtgetOverlays
getOverlaysCountgetParentgetProperties
getPropertygetPropertyKeysgetRenderingFilter
getResponsiveStylegetRootgetScaleScrollStrategy
getSceneTransformgetTaggetVisible
getVisibleDeviceLimitsgetVisibleModelLimitsgetWorldTransform
getZIndexhasCssClasshasEventListener
indexOfBaseLayerindexOfChildindexOfOverlay
insertBaseLayerinsertChildinsertOverlay
invalidateinvalidateParentisClippingEnabled
isDisposedisEventPropagationEnabledisHorizontalFlip
isNotificationEnabledisSelectableisSilent
isVerticalFlipmoveTonotify
notifyRootoffon
onChildAddedonChildRemovedonParentChanged
onVisibilityChangedpostRenderingpreRendering
registerAnimationStyleremoveBaseLayerremoveChild
removeCssClassremoveInvalidateHandlerremoveOverlay
renderrenderAsyncrenderBaseLayers
renderBaseLayersAsyncrenderChildrenrenderChildrenAsync
renderContentrenderContentAsyncrenderOverlays
renderOverlaysAsyncrotatescale
setAnimationStylesetChildsetClipStyle
setCsssetCssClasssetCssTransform
setIdsetInfiniteModesetLocalTransform
setMarginsStylesetNamesetNotification
setOpacitysetPropertiessetProperty
setRenderingFiltersetResponsiveStylesetScaleScrollStrategy
setSelectablesetSilentsetTag
setVisiblesetVisibleModelLimitssetZIndex
sheartoStringtranslate
unregisterAnimationStyleupdateSceneTransformationupdateState
updateTimeStampenableSceneGraphNotificationfindParent
getClassNameisSceneGraphNotificationEnabled
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 LayeredNode&lt;T&amp;gt;(options)

new LayeredNode<T>(options?)

Create layered node

Type parameters

NameType
Textends Node<T> = Node

Parameters

Name Type Description
Optional optionsOptions<T>options

Overrides

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

Methods

addBaseLayer

addBaseLayer(baseLayer): LayeredNode<T>

Add baseLayer to container

Parameters

Name Type Description
baseLayerNode | Node[]baseLayer to be added

Returns

LayeredNode<T>

this


addChild

addChild(node): LayeredNode<T>

Add a child node

Parameters

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

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.addChild


addCssClass

addCssClass(cssclass): LayeredNode<T>

Adds new css class to node

Parameters

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

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.addCssClass


addInvalidateHandler

addInvalidateHandler(handler): LayeredNode<T>

Add invalidate handler

Deprecated

since 4.0, use Node.on instead

Parameters

Name Type Description
handlerFunctionhandler to be notified about invalidation

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.addInvalidateHandler


addOverlay

addOverlay(overlay): LayeredNode<T>

Add overlay to container

Parameters

Name Type Description
overlayNode | Node[]overlay to be added

Returns

LayeredNode<T>

this


adjustPosition

adjustPosition(area?, vAlign?, hAlign?): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.adjustPosition


applyOpacity

Protected applyOpacity(context): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.applyOpacity


applyResponsiveStyle

Protected applyResponsiveStyle(): void

Apply a responsive style rules it is exists

Returns

void

Inherited from

CompositeNode.applyResponsiveStyle


changeBaseLayerOrder

changeBaseLayerOrder(overlay, order, anchor?): LayeredNode<T>

Changes the z-order of the baseLayer.

Parameters

Name Type Description
overlayNode
orderNodeOrderposition to be added
Optional anchorNodeanchor node to specify changeOrder with respect to this node

Returns

LayeredNode<T>

this


changeChildOrder

changeChildOrder(node, order, anchor?): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.changeChildOrder


changeOverlayOrder

changeOverlayOrder(overlay, order, anchor?): LayeredNode<T>

Changes the z-order of the overlay.

Parameters

Name Type Description
overlayNodechild overlay
orderNodeOrderposition to be added
Optional anchorNodeanchor node to specify changeOrder with respect to this node

Returns

LayeredNode<T>

this


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


clearBaseLayers

clearBaseLayers(disposeBaseLayers?): LayeredNode<T>

Remove all child baseLayers from group

Parameters

Name Type Description
Optional disposeBaseLayersbooleanautomatically dispose baseLayers. If it is true then method dispose is called for each baseLayer, false by default

Returns

LayeredNode<T>

this


clearChildren

clearChildren(disposeChildren?): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.clearChildren


clearOverlays

clearOverlays(disposeOverlays?): LayeredNode<T>

Remove all child overlays from group

Parameters

Name Type Description
Optional disposeOverlaysbooleanautomatically dispose overlays. If it is true then method dispose is called for each overlay, false by default

Returns

LayeredNode<T>

this


clone

clone(): LayeredNode<T>

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

Returns

LayeredNode<T>

clone

Overrides

CompositeNode.clone


connectStyle

connectStyle(style, type, callback): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.connectStyle


copyConstructor

Protected copyConstructor(src, deepCopy?): LayeredNode<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
srcLayeredNode<T>Source to copy from
Optional deepCopybooleandeep copy

Returns

LayeredNode<T>

this

Overrides

CompositeNode.copyConstructor


disconnectStyle

disconnectStyle(style, type, callback): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.disconnectStyle


dispose

dispose(): void

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

Returns

void

Overrides

CompositeNode.dispose


enableClipping

enableClipping(doClip): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.enableClipping


enableEventPropagation

enableEventPropagation(enable): LayeredNode<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

LayeredNode<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): LayeredNode<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: LayeredNode<T>) => voidFunction to execute

Returns

LayeredNode<T>

The result if any or this

Inherited from

CompositeNode.execute

execute<T>(delegate): T

Type parameters

Name
T

Parameters

Name Type
delegate(this: LayeredNode<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


getBaseLayer

getBaseLayer(index): Node

Return baseLayer at specified index

Parameters

Name Type Description
indexnumberindex at which to get the baseLayer for

Returns

Node

track


getBaseLayers

getBaseLayers<S>(predicate, modify?): Iterator<Node>

Return iterator by baseLayers nodes

Type parameters

NameType
Sextends Node<S>

Parameters

Name Type Description
predicate(value: Node) => 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<Node>

getBaseLayers(filter?, modify?): Iterator<Node>

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

Example

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

Parameters

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

Returns

Iterator<Node>

An iterator for child overlays.


getBaseLayersCount

getBaseLayersCount(): number

Returns amount of baseLayers

Returns

number


getBounds

getBounds(): Rect

Gets bounds in the parent coordinates

Returns

Rect

Inherited from

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


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

Return model limits. (By default it returns null)

Returns

Rect

Inherited from

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


getOverlay

getOverlay(index): Node

Return overlay at specified index

Parameters

Name Type Description
indexnumberindex at which to get the overlay for

Returns

Node

track


getOverlayAt

getOverlayAt(index): Node

Return overlay at specified index

Deprecated

since 4.2 use getOverlay instead

Parameters

Name Type Description
indexnumberindex at which to get the overlay for

Returns

Node

track


getOverlays

getOverlays<S>(predicate, modify?): Iterator<Node>

Return iterator by overlays nodes

Type parameters

NameType
Sextends Node<S>

Parameters

Name Type Description
predicate(value: Node) => 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<Node>

getOverlays(filter?, modify?): Iterator<Node>

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

Example

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

Parameters

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

Returns

Iterator<Node>

An iterator for child overlays.


getOverlaysCount

getOverlaysCount(): number

Returns amount of overlays

Returns

number


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

Overrides

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


indexOfBaseLayer

indexOfBaseLayer(baseLayer): number

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

Parameters

Name Type Description
baseLayerNodebaseLayer to check index

Returns

number


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


indexOfOverlay

indexOfOverlay(overlay): number

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

Parameters

Name Type Description
overlayNodeoverlay to check index

Returns

number


insertBaseLayer

insertBaseLayer(index, baseLayer): LayeredNode<T>

Insert child baseLayer at specified index

Parameters

Name Type Description
indexnumberspecified index
baseLayerNodea baseLayer to add

Returns

LayeredNode<T>

this


insertChild

insertChild(index, node): LayeredNode<T>

Insert child node at specified index

Parameters

Name Type Description
indexnumberspecified index
nodeTa child node to add

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.insertChild


insertOverlay

insertOverlay(index, overlay): LayeredNode<T>

Insert child overlay at specified index

Parameters

Name Type Description
indexnumberspecified index
overlayNodea overlay to add

Returns

LayeredNode<T>

this


invalidate

invalidate(bounds?, force?): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.invalidate


invalidateParent

Protected invalidateParent(bounds?, force?): LayeredNode<T>

Invalidate parent and notify all listeners. NOTE: Don't keep arguments of the event, because instance can be changed

Fires

Events.Invalidate

Parameters

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

Returns

LayeredNode<T>

this

Inherited from

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?): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.moveTo


notify

notify<E>(event, source, args?): LayeredNode<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

LayeredNode<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?): LayeredNode<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: LayeredNode<T>, args: EventMap<Node>[E]) => voidfunction to be called

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.off


on

on<E>(type, callback): LayeredNode<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: LayeredNode<T>, args: EventMap<Node>[E]) => voidto be called

Returns

LayeredNode<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): LayeredNode<T>

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

Parameters

Name Type Description
nodeTnode to change parent

Returns

LayeredNode<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


removeBaseLayer

removeBaseLayer(baseLayer): LayeredNode<T>

Remove child baseLayer

Parameters

Name Type Description
baseLayerNode | Node[]baseLayer or array of nodes to be removed

Returns

LayeredNode<T>

this


removeChild

removeChild(node, disposeChildren?): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.removeChild


removeCssClass

removeCssClass(cssclass): LayeredNode<T>

Removes css class from node

Parameters

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

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.removeCssClass


removeInvalidateHandler

removeInvalidateHandler(handler): LayeredNode<T>

Remove invalidate handler

Deprecated

since 4.0, use Node.off instead

Parameters

Name Type Description
handlerFunctionhandler to be notified about invalidation

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.removeInvalidateHandler


removeOverlay

removeOverlay(overlay): LayeredNode<T>

Remove child overlay

Parameters

Name Type Description
overlayNode | Node[]overlay or array of nodes to be removed

Returns

LayeredNode<T>

this


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


renderBaseLayers

Protected renderBaseLayers(context): LayeredNode<T>

Render baseLayers on bottom of cache. This method does nothing, but can be implemented to render graphics on bottom of cache and between borders

Parameters

Name Type Description
contextRenderingContextcontext to render baseLayers

Returns

LayeredNode<T>

this


renderBaseLayersAsync

Protected renderBaseLayersAsync(context, callback): void

Render baseLayers on bottom of cache in asynchronous mode. This method calls renderBaseLayers

Parameters

Name Type Description
contextRenderingContextcontext to render overlays
callback() => voidcallback function

Returns

void


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


renderOverlays

Protected renderOverlays(context): LayeredNode<T>

Render overlays on top of cache. This method does nothing, but can be implemented to render graphics on top of cache and between borders

Parameters

Name Type Description
contextRenderingContextcontext to render overlays

Returns

LayeredNode<T>

this


renderOverlaysAsync

Protected renderOverlaysAsync(context, callback): void

Render overlays on top of cache in asynchronous mode. This method calls renderOverlays

Parameters

Name Type Description
contextRenderingContextcontext to render overlays
callback() => voidcallback function

Returns

void


rotate

rotate(theta, x, y): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.rotate


scale

scale(xx, yy): LayeredNode<T>

Scale node

Parameters

Name Type Description
xxnumberx scale factor
yynumbery scale factor

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.scale


setAnimationStyle

setAnimationStyle(animationStyle): LayeredNode<T>

Sets animation style

Parameters

Name Type Description
animationStyleTypeanimation style

Returns

LayeredNode<T>

Inherited from

CompositeNode.setAnimationStyle


setChild

setChild(index, node): LayeredNode<T>

Replace child node by index

Parameters

Name Type Description
indexnumberindex of the node
nodeTnode

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setChild


setClipStyle

setClipStyle(style): LayeredNode<T>

Sets a new clipping style

Parameters

Name Type Description
styleGraphicsPath | ClipStyle | Optionsa new clipping style

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setClipStyle


setCss

setCss(style, merge?): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.setCss


setCssClass

setCssClass(name): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.setCssClass


setCssTransform

setCssTransform(transform): LayeredNode<T>

Set CSS transformation

Parameters

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

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setCssTransform


setId

setId(id): LayeredNode<T>

Allows the user to associate any identifier

Parameters

Name Type Description
idstring | numberobject id

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setId


setInfiniteMode

setInfiniteMode(infinityMode): LayeredNode<T>

Set infinity mode flag to draw composite without collision check

Parameters

Name Type Description
infinityModebooleaninfinity mode flag

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setInfiniteMode


setLocalTransform

setLocalTransform(localTransform, force?): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.setLocalTransform


setMarginsStyle

setMarginsStyle(margins, merge?): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.setMarginsStyle


setName

setName(name): LayeredNode<T>

Sets name of the node

Parameters

Name Type Description
namestringThe node name

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setName


setNotification

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

set notification state

Parameters

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

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setNotification


setOpacity

setOpacity(opacity, blendMode?): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.setOpacity


setProperties

setProperties(properties?): LayeredNode<T>

Sets all the properties pertaining to this object

Parameters

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

Returns

LayeredNode<T>

this

Overrides

CompositeNode.setProperties


setProperty

setProperty(name, value): LayeredNode<T>

Sets dynamic property by name

Parameters

Name Type Description
namestringproperty name
valueanyproperty value

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setProperty


setRenderingFilter

setRenderingFilter(filter): LayeredNode<T>

Sets filter to be applied before rendering and picking

Parameters

Name Type Description
filterIFilterfilter to set

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setRenderingFilter


setResponsiveStyle

setResponsiveStyle(style): LayeredNode<T>

Sets responsive style.

Parameters

Name Type Description
styleOptions | ResponsiveStyleresponsive style

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setResponsiveStyle


setScaleScrollStrategy

setScaleScrollStrategy(strategy?): LayeredNode<T>

Sets scale scroll strategy

Parameters

Name Type Description
Optional strategyDelegatescale scroll strategy

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setScaleScrollStrategy


setSelectable

setSelectable(selectable): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.setSelectable


setSilent

setSilent(bool): LayeredNode<T>

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setSilent


setTag

setTag(tag): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.setTag


setVisible

setVisible(value): LayeredNode<T>

Sets visibility of the node. Send event Events.VisibilityChanged

Parameters

Name Type Description
valuebooleanflag specifying visibility of the node

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setVisible


setVisibleModelLimits

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

Set visible model limits

Parameters

Name Type Description
visibleModelBoundsRectvisible model limits or bounds
Optional deviceBoundsRectdevice bounds

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setVisibleModelLimits


setZIndex

setZIndex(value): LayeredNode<T>

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

Parameters

Name Type Description
valuenumberindex determining node z-position

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.setZIndex


shear

shear(shx, shy): LayeredNode<T>

Shear this node's bounds

Parameters

Name Type Description
shxnumberx-axis shear
shynumbery-axis shear

Returns

LayeredNode<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): LayeredNode<T>

Translate bounds

Parameters

Name Type Description
txnumberx translation
tynumbery translation

Returns

LayeredNode<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(): LayeredNode<T>

Update scene transformation

Returns

LayeredNode<T>

this

Inherited from

CompositeNode.updateSceneTransformation


updateState

updateState(regions?, changes?): LayeredNode<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

LayeredNode<T>

this

Inherited from

CompositeNode.updateState


updateTimeStamp

Protected updateTimeStamp(): LayeredNode<T>

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

Returns

LayeredNode<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