Skip to content
Last updated

API / geotoolkit / controls / shapes / Label / Label

Class: Label

shapes.Label.Label

Defines text label with background.

Hierarchy

Table of contents

Constructors
  • [new Label(options)](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.controls.shapes-1.label.label.md#new label(options))
Methods
addCssClassaddInvalidateHandlerapplyOpacity
applyResponsiveStylecheckCollisionclone
connectStylecopyConstructordisconnectStyle
disposeenableEventPropagationexecute
filtergetAlignmentgetAnchor
getAnchorTypegetAnchorXgetAnchorY
getAnimationStylegetBoundsgetCenterX
getCenterYgetClassNamegetClipStyle
getCornerRadiusgetCssgetCssClass
getCssClassesgetCssTransformgetFillStyle
getHeightgetIdgetInvalidateMethod
getLayoutStylegetLineStylegetLocalTransform
getMarginsStylegetNamegetOpacity
getOpacityBlendModegetPaddingStylegetParent
getPropertiesgetPropertygetPropertyKeys
getRenderingFiltergetResponsiveStylegetRoot
getRotationAnglegetScaleScrollStrategygetSceneTransform
getSizegetSizeIsInDeviceSpacegetTag
getTextgetTextStylegetVisible
getWidthgetWorldTransformgetX
getYgetZIndexhasCssClass
hasEventListenerinvalidateinvalidateLayout
invalidateParentisDisposedisEventPropagationEnabled
isNotificationEnabledisSelectableisSilent
notifyoffon
onParentChangedonRectChangedonVisibilityChanged
postRenderingpreRenderingregisterAnimationStyle
removeCssClassremoveInvalidateHandlerrender
renderAsyncrenderContentrotate
scalesetAlignmentsetAnchor
setAnchorTypesetAnchorXsetAnchorY
setAnimationStylesetBoundssetClipStyle
setCornerRadiussetCsssetCssClass
setCssTransformsetFillStylesetId
setLayoutStylesetLineStylesetLocalTransform
setMarginsStylesetNamesetNotification
setOpacitysetPaddingStylesetParent
setPropertiessetPropertysetRect
setRenderingFiltersetResponsiveStylesetRotationAngle
setScaleScrollStrategysetSelectablesetSilent
setSizesetSizeIsInDeviceSpacesetTag
setTextsetTextStylesetVisible
setZIndexsheartoString
translateunregisterAnimationStyleupdateSceneTransformation
updateStateupdateTimeStampenableSceneGraphNotification
findParentgetClassNameintersectsBounds
isSceneGraphNotificationEnabled
Css Properties
Name Type Description
alignmentAnchorTypeText position according to the model bounds
anchortypeAnchorTypeAnchor type in case if label is in device space
clipstyleClipStyleClipping style
clipstyle-evenoddbooleanTrue if evenodd mode is on ('nonzero' 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
fillstylestringStyle applied on fill
fillstyleFillStyleStyle applied on fill
fillstyle-colorstringColor in CSS form
fillstyle-evenoddmodebooleanEven-odd fill mode
fillstyle-fillpatternPatternPattern
fillstyle-fillpattern-containernamestringAn optional container name, which creates an image pattern. This parameter is used for serialization if you want to save are reference to pattern instead of the pattern itself
fillstyle-fillpattern-patternnamestringName of this pattern for indexing
fillstyle-fillpattern-scalablebooleanFlag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported)
fillstyle-foregroundstringForeground color
fillstyle-patternPatternPattern
heightnumberDevice or model height of the label, depends on sizeisindevicespace
idstring | numberId of the node, its a unique identifier
linestylestringStyle applied on outline
linestyleLineStyleStyle applied on outline
linestyle-colorstringColor in CSS form
linestyle-fillstringOptional fill style to be used to fill lines generated with this style
linestyle-fillFillStyleOptional fill style to be used to fill lines generated with this style
linestyle-linecapCapStyleThe line cap style
linestyle-linedashoffsetnumberLine dash offset of dashed line
linestyle-linejoinJoinStyleThe line join style
linestyle-pixelsnapmodebooleanPixel Snap Mode, default(
linestyle-scalablebooleanTrue if width should depend on transformation
linestyle-unitstringOptional unit for the width
linestyle-widthnumber | stringThe line thickness
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
paddingnumber | stringIt has properties for specifying the padding for each side of the Label
radiusnumberThis defines if the rectangle has rounded border corners. 'radius' is the length denoting a radius for the rounded border of each corner
rotationanglenumberRotation angle at anchor
scalescrollstrategyScaleScrollStrategyScale scroll strategy
scalescrollstrategy-enabledbooleanEnable flag
selectablebooleanSelectable node, a boolean to determine if selection should consider this node
sizeisindevicespacebooleanSize is in device space
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
textstringText to display
textstylestringTextStyle to display
textstyleTextStyleTextStyle to display
textstyle-alignmentAlignmentStyleAlignment
textstyle-autosizebooleanAuto font size on high definition display
textstyle-backgroundstringBackground style
textstyle-backgroundFillStyleBackground style
textstyle-baselineBaseLineStyleBase line
textstyle-colorstringColor in CSS form
textstyle-fillFillStyleText fill style
textstyle-fontstringFont see
textstyle-fonturlstringThe place from which the font will be loaded, if null - uses system fonts. It can be base64 with url keyword
textstyle-lineheightstring | numberLine height
textstyle-multilinebooleanAllow multi-line text
textstyle-outlinestringOutline style
textstyle-outlineLineStyleOutline style
textstyle-overflowwrapOverflowWrapStyleOverflow wrap
textstyle-strikethroughstringStrikethrough style
textstyle-strikethroughLineStyleStrikethrough style
textstyle-textoverflowTextOverflowStyleText overflow
textstyle-underlinestringUnderline style
textstyle-underlineLineStyleUnderline style
textstyle-underlineoffsetstring | numberUnderline offset distance
textstyle-whitespaceWhiteSpaceStyleWhite space
textstyle-wordbreakWordBreakStyleWord break
transformstringAdditional CSS transformation applied to node or 'none'
transformTransformationAdditional CSS transformation applied to node or 'none'
visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
widthnumberDevice or model width of the label, depends on sizeisindevicespace
xnumberAnchor x position in case if label is in device space
ynumberAnchor y position in case if label is in device space
z-indexnumberDefine node z-index

Contents

Constructors

new Label(options)

• new Label(options?)

Parameters

Name Type
Optional optionsOptions

Overrides

Rectangle.constructor

Methods

addCssClass

▸ addCssClass(cssclass): Label

Adds new css class to node

Parameters

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

Returns

Label

this

Inherited from

Rectangle.addCssClass


addInvalidateHandler

▸ addInvalidateHandler(handler): Label

Add invalidate handler

Deprecated

since 4.0, use Node.on instead

Parameters

Name Type Description
handlerFunctionhandler to be notified about invalidation

Returns

Label

this

Inherited from

Rectangle.addInvalidateHandler


applyOpacity

▸ Protected applyOpacity(context): Label

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

Label

this

Inherited from

Rectangle.applyOpacity


applyResponsiveStyle

▸ Protected applyResponsiveStyle(): void

Apply a responsive style rules it is exists

Returns

void

Inherited from

Rectangle.applyResponsiveStyle


checkCollision

▸ checkCollision(context): boolean

Check collision

Parameters

Name Type Description
contextRenderingContextRendering Context

Returns

boolean

true if object is inside of rendering area

Overrides

Rectangle.checkCollision


clone

▸ clone(): Label

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

Returns

Label

clone

Overrides

Rectangle.clone


connectStyle

▸ connectStyle(style, type, callback): Label

Connects style.<br> <br> This convenience method subscribes a listener to given style for the specified type.<br> 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&gt;function to be called

Returns

Label

this

Inherited from

Rectangle.connectStyle


copyConstructor

▸ Protected copyConstructor(src, deepCopy?): Label

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

Parameters

Name Type Description
srcLabelSource to copy from
Optional deepCopybooleandeep copy

Returns

Label

this

Overrides

Rectangle.copyConstructor


disconnectStyle

▸ disconnectStyle(style, type, callback): Label

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

Parameters

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

Returns

Label

this

Inherited from

Rectangle.disconnectStyle


dispose

▸ dispose(): void

Disposes this node, once disposes a node should not be used anymore.<br> Clear all listeners, and disconnect styles to avoid memory leaks.<br> Also aggressively 'cleanup' this node by setting some of its members to null.

Returns

void

Inherited from

Rectangle.dispose


enableEventPropagation

▸ enableEventPropagation(enable): Label

Enable event propagation from the node hierarchy from bottom to top <p> 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. </p>

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) =&gt; {
// Got notifications from all children of parent group
});
childGroup.invalidate();

Parameters

Name Type Description
enablebooleanenable

Returns

Label

this

Inherited from

Rectangle.enableEventPropagation


execute

▸ execute(delegate): Label

Executes delegate and return the result. It allows us to keep all initialization calls in one place, <br> 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: Label) => voidFunction to execute

Returns

Label

The result if any or this

Inherited from

Rectangle.execute

▸ execute<T&gt;(delegate): T

Type parameters

Name
T

Parameters

Name Type
delegate(this: Label) => T

Returns

T

Inherited from

Rectangle.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

Rectangle.filter


getAlignment

▸ getAlignment(): AnchorType

Returns the current anchor type.

Returns

AnchorType

current anchor type


getAnchor

▸ getAnchor(): Point

Gets the anchor

Returns

Point


getAnchorType

▸ getAnchorType(): AnchorType

Returns the current anchor type.

Returns

AnchorType

current anchor type


getAnchorX

▸ getAnchorX(): number

Return anchored x position if any

Returns

number


getAnchorY

▸ getAnchorY(): number

Return anchored y position if any

Returns

number


getAnimationStyle

▸ getAnimationStyle(): AnimationStyle

Return animation style

Returns

AnimationStyle

animationStyle current animation style

Inherited from

Rectangle.getAnimationStyle


getBounds

▸ getBounds(): Rect

Return bounds. Will also lock the bounds so they cannot be directly modified.

Returns

Rect

bounds

Inherited from

Rectangle.getBounds


getCenterX

▸ getCenterX(): number

Returns the X coordinate of the center of the framing rectangle of this rectangular shape.

Returns

number

Inherited from

Rectangle.getCenterX


getCenterY

▸ getCenterY(): number

Returns the Y coordinate of the center of the framing rectangle of this rectangular shape.

Returns

number

Inherited from

Rectangle.getCenterY


getClassName

▸ getClassName(): string

Returns

string

Inherited from

Rectangle.getClassName


getClipStyle

▸ getClipStyle(): ClipStyle

Gets the current clipping style

Returns

ClipStyle

clipping style

Inherited from

Rectangle.getClipStyle


getCornerRadius

▸ getCornerRadius(): number

return corner radius

Returns

number

radius

Inherited from

Rectangle.getCornerRadius


getCss

▸ getCss(): CssStyle

Return CSS style

Returns

CssStyle

Inherited from

Rectangle.getCss


getCssClass

▸ getCssClass(): string

Returns css class name to be used to apply CSS style

Returns

string

the css class name

Inherited from

Rectangle.getCssClass


getCssClasses

▸ getCssClasses(): string[]

Gets list of css class names which applied to this node

Returns

string[]

Inherited from

Rectangle.getCssClasses


getCssTransform

▸ getCssTransform(): string

Returns CSS transformation

Returns

string

Inherited from

Rectangle.getCssTransform


getFillStyle

▸ getFillStyle(): FillStyle

Return fill style

Returns

FillStyle

fillStyle current fill style

Inherited from

Rectangle.getFillStyle


getHeight

▸ getHeight(): number

Returns the height of the framing rectangle.

Returns

number

Inherited from

Rectangle.getHeight


getId

▸ getId(): string | number

Returns the associated identifier of the node

Returns

string | number

The node's id

Inherited from

Rectangle.getId


getInvalidateMethod

▸ Protected getInvalidateMethod(): AttributeCallback<EventDispatcher&gt;

Gets invalidate method

Returns

AttributeCallback<EventDispatcher&gt;

method to invalidate this object

Inherited from

Rectangle.getInvalidateMethod


getLayoutStyle

▸ getLayoutStyle(): LayoutStyle<string | number&gt;

Return desired layout style

Returns

LayoutStyle<string | number&gt;

Inherited from

Rectangle.getLayoutStyle


getLineStyle

▸ getLineStyle(): LineStyle

Return line style

Returns

LineStyle

lineStyle current line style

Inherited from

Rectangle.getLineStyle


getLocalTransform

▸ getLocalTransform(): Transformation

Retrieves the transformation of bounds to parent

Returns

Transformation

transform the local transform.

Inherited from

Rectangle.getLocalTransform


getMarginsStyle

▸ getMarginsStyle(): SpaceStyle<string | number&gt;

Return margins style

Returns

SpaceStyle<string | number&gt;

Inherited from

Rectangle.getMarginsStyle


getName

▸ getName(): string

Returns the node name

Returns

string

The node name

Inherited from

Rectangle.getName


getOpacity

▸ getOpacity(): number

Returns current node opacity

Returns

number

opacity

Inherited from

Rectangle.getOpacity


getOpacityBlendMode

▸ getOpacityBlendMode(): BlendMode

Returns current node opacity

Returns

BlendMode

opacity blend mode

Inherited from

Rectangle.getOpacityBlendMode


getPaddingStyle

▸ getPaddingStyle(): SpaceStyle<string | number&gt;

Return padding style

Returns

SpaceStyle<string | number&gt;

padding


getParent

▸ getParent(): Node

Return parent node

Returns

Node

parent node

Inherited from

Rectangle.getParent


getProperties

▸ getProperties(): OptionsOut

Gets all the properties pertaining to this object

Returns

OptionsOut

properties

Overrides

Rectangle.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

Rectangle.getProperty


getPropertyKeys

▸ getPropertyKeys(): string[]

Returns known properties keys

Returns

string[]

Inherited from

Rectangle.getPropertyKeys


getRenderingFilter

▸ getRenderingFilter(): IFilter

Return filter to be used for rendering and picking

Returns

IFilter

current filter

Inherited from

Rectangle.getRenderingFilter


getResponsiveStyle

▸ getResponsiveStyle(): ResponsiveStyle

Return responsive style

Returns

ResponsiveStyle

Inherited from

Rectangle.getResponsiveStyle


getRoot

▸ getRoot(): Node

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

Returns

Node

the root node

Inherited from

Rectangle.getRoot


getRotationAngle

▸ getRotationAngle(): number

Returns rotation angle (in radians)

Returns

number

rotationAngle rotation angle at anchor


getScaleScrollStrategy

▸ getScaleScrollStrategy(): Delegate

Gets scale scroll strategy

Returns

Delegate

scale scroll strategy

Inherited from

Rectangle.getScaleScrollStrategy


getSceneTransform

▸ getSceneTransform(): Transformation

Returns transformation from node to root scene

Returns

Transformation

a transformation from node to root scene

Inherited from

Rectangle.getSceneTransform


getSize

▸ getSize(): Dimension

Returns user defined devise size (if exists)

Returns

Dimension


getSizeIsInDeviceSpace

▸ getSizeIsInDeviceSpace(): boolean

Returns true if the shape size is set in device space

Returns

boolean

true if size is defined in device space


getTag

▸ getTag(): any

Returns the object associated with the node by user.

Returns

any

The node's user-object

Inherited from

Rectangle.getTag


getText

▸ getText(): string

Get this text's contents as a string.

Returns

string

text


getTextStyle

▸ getTextStyle(): TextStyle

The style associated with this label.

Returns

TextStyle

text style


getVisible

▸ getVisible(): boolean

Return visibility of the node

Returns

boolean

true if node is visible

Inherited from

Rectangle.getVisible


getWidth

▸ getWidth(): number

Returns the width of the framing rectangle.

Returns

number

Inherited from

Rectangle.getWidth


getWorldTransform

▸ getWorldTransform(): Transformation

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

Returns

Transformation

transform the world transform.

Inherited from

Rectangle.getWorldTransform


getX

▸ getX(): number

Returns the X coordinate of the left bottom corner of the framing rectangle.

Returns

number

Inherited from

Rectangle.getX


getY

▸ getY(): number

Returns the Y coordinate of the left bottom corner of the framing rectangle.

Returns

number

Inherited from

Rectangle.getY


getZIndex

▸ getZIndex(): number

Returns node z-index (null if not set)

Returns

number

Inherited from

Rectangle.getZIndex


hasCssClass

▸ hasCssClass(cssClass): boolean

Check if node has specified css class

Parameters

Name Type Description
cssClassstringcss class name

Returns

boolean

Inherited from

Rectangle.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

Rectangle.hasEventListener


invalidate

▸ invalidate(bounds?, force?): Label

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

Label

this

Inherited from

Rectangle.invalidate


invalidateLayout

▸ invalidateLayout(): Label

Notify that layout is invalidated. Send event Events.LayoutInvalidated

Returns

Label

this

Inherited from

Rectangle.invalidateLayout


invalidateParent

▸ invalidateParent(bounds?, force?): Label

Invalidate bounds

Parameters

Name Type Description
Optional boundsRectif null is provided then cache (if any will be completely refreshed) otherwise only specified rect or node.bounds will be refreshed
Optional forcebooleanflag indicating if the parent must be forcibly invalidated

Returns

Label

this

Inherited from

Rectangle.invalidateParent


isDisposed

▸ isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

Rectangle.isDisposed


isEventPropagationEnabled

▸ isEventPropagationEnabled(): boolean

Return true if event propagation is enabled from child to parent

Returns

boolean

Inherited from

Rectangle.isEventPropagationEnabled


isNotificationEnabled

▸ isNotificationEnabled(): boolean

return state of notification

Returns

boolean

current notification state

Inherited from

Rectangle.isNotificationEnabled


isSelectable

▸ isSelectable(): boolean

Returns true if node can be picked/selected.

Returns

boolean

The selectable flag

Inherited from

Rectangle.isSelectable


isSilent

▸ isSilent(): boolean

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

Returns

boolean

Inherited from

Rectangle.isSilent


notify

▸ notify<E&gt;(event, source, args?): Label

Notify listeners of the Node

Type parameters

NameType
Eextends string

Parameters

Name Type Description
eventEtype of event
sourceAbstractNodesource who called the event
Optional argsEventMap[E]event arguments

Returns

Label

this

Inherited from

Rectangle.notify


off

▸ off<E&gt;(type?, callback?): Label

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

Returns

Label

this

Inherited from

Rectangle.off


on

▸ on<E&gt;(type, callback): Label

Attach listener on event that will be called whenever the specified event is delivered to the target <p> If the callback function is already in the list of event listeners for this target, the function is not added a second time. </p> <p> 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. </p>

Type parameters

NameType
Eextends string

Parameters

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

Returns

Label

this

Inherited from

Rectangle.on


onParentChanged

▸ Protected onParentChanged(node): Label

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

Parameters

Name Type Description
nodeNodenode to change parent

Returns

Label

this

Inherited from

Rectangle.onParentChanged


onRectChanged

▸ Protected onRectChanged(newRect): Label

Parameters

Name Type
newRectRect

Returns

Label

Inherited from

Rectangle.onRectChanged


onVisibilityChanged

▸ Protected onVisibilityChanged(): void

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

Returns

void

Inherited from

Rectangle.onVisibilityChanged


postRendering

▸ Protected postRendering(context): void

To be called after rendering. Call this method if you override method render

Parameters

Name Type Description
contextRenderingContextRendering Context

Returns

void

Inherited from

Rectangle.postRendering


preRendering

▸ Protected preRendering(context): void

Occurs before rendering this method sets clipping by default. Call this method if you override method render

Parameters

Name Type Description
contextRenderingContextRendering Context

Returns

void

Inherited from

Rectangle.preRendering


registerAnimationStyle

▸ registerAnimationStyle(root): void

Register animation style.

Parameters

Name Type Description
rootNoderoot node for node

Returns

void

Inherited from

Rectangle.registerAnimationStyle


removeCssClass

▸ removeCssClass(cssclass): Label

Removes css class from node

Parameters

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

Returns

Label

this

Inherited from

Rectangle.removeCssClass


removeInvalidateHandler

▸ removeInvalidateHandler(handler): Label

Remove invalidate handler

Deprecated

since 4.0, use Node.off instead

Parameters

Name Type Description
handlerFunctionhandler to be notified about invalidation

Returns

Label

this

Inherited from

Rectangle.removeInvalidateHandler


render

▸ render(context): void

Renders node

Parameters

Name Type Description
contextRenderingContextThe rendering context to be used to draw the node

Returns

void

Inherited from

Rectangle.render


renderAsync

▸ renderAsync(context, callback): void

Render node in asynchronous mode. Default implementation creates call method "render" inside

Parameters

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

Returns

void

Inherited from

Rectangle.renderAsync


renderContent

▸ Protected renderContent(localContext): void

Parameters

Name Type
localContextRenderingContext

Returns

void

Inherited from

Rectangle.renderContent


rotate

▸ rotate(theta, x, y): Label

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

Label

this

Inherited from

Rectangle.rotate


scale

▸ scale(xx, yy): Label

Scale node

Parameters

Name Type Description
xxnumberx scale factor
yynumbery scale factor

Returns

Label

this

Inherited from

Rectangle.scale


setAlignment

▸ setAlignment(alignment): Label

Sets the anchor type.

Parameters

Name Type
alignmentAnchorType

Returns

Label

this


setAnchor

▸ setAnchor(p1, p2?): Label

Sets anchor point to given position

Parameters

Name Type Description
p1number | Pointpoint or x coordinate
Optional p2numbery coordinate

Returns

Label

this


setAnchorType

▸ setAnchorType(anchorType): Label

Sets the anchor type.

Parameters

Name Type
anchorTypeAnchorType

Returns

Label

this


setAnchorX

▸ setAnchorX(ax): Label

Sets x anchor position

Parameters

Name Type Description
axnumberanchor x position

Returns

Label

this


setAnchorY

▸ setAnchorY(ay): Label

Sets y anchor position

Parameters

Name Type Description
aynumberanchor y position

Returns

Label

this


setAnimationStyle

▸ setAnimationStyle(animationStyle): Label

Sets animation style

Parameters

Name Type Description
animationStyleTypeanimation style

Returns

Label

Inherited from

Rectangle.setAnimationStyle


setBounds

▸ setBounds(rect): Label

Sets the location and size of the framing rectangle of this rectangular shape to the specified values. This method is the same as setRect.

Parameters

Name Type Description
rectRectbounds rect

Returns

Label

this

Inherited from

Rectangle.setBounds

▸ setBounds(x1, y1?, x2?, y2?): Label

Sets the location and size of the framing rectangle of this rectangular shape to the specified values. This method is the same as setRect.

Parameters

Name Type Description
x1numberx coordinate of the top left corner
Optional y1numbery coordinate of the top left corner
Optional x2numberx coordinate of the bottom right corner
Optional y2numbery coordinate of the bottom right corner

Returns

Label

this

Inherited from

Rectangle.setBounds


setClipStyle

▸ setClipStyle(style): Label

Sets a new clipping style

Parameters

Name Type Description
styleGraphicsPath | ClipStyle | Optionsa new clipping style

Returns

Label

this

Inherited from

Rectangle.setClipStyle


setCornerRadius

▸ setCornerRadius(radius): Label

Set border radius in model coordinates.

Parameters

Name Type Description
radiusnumberborder radius in model coordinates

Returns

Label

this

Inherited from

Rectangle.setCornerRadius


setCss

▸ setCss(style, merge?): Label

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

Label

this

Inherited from

Rectangle.setCss


setCssClass

▸ setCssClass(name): Label

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

Label

this

Inherited from

Rectangle.setCssClass


setCssTransform

▸ setCssTransform(transform): Label

Set CSS transformation

Parameters

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

Returns

Label

this

Inherited from

Rectangle.setCssTransform


setFillStyle

▸ setFillStyle(fillStyle, merge?): Label

Sets fill style

Parameters

Name Type Description
fillStyleTypea new fill style
Optional mergebooleantrue if you want to merge fillStyle with existing attribute, false by default

Returns

Label

this

Inherited from

Rectangle.setFillStyle


setId

▸ setId(id): Label

Allows the user to associate any identifier

Parameters

Name Type Description
idstring | numberobject id

Returns

Label

this

Inherited from

Rectangle.setId


setLayoutStyle

▸ setLayoutStyle(layoutStyle, merge?): Label

Specify desired layout style

Parameters

Name Type Description
layoutStyleLayoutStyle<string | number&gt; | Options<string | number&gt;desired layout style or layout style params
Optional mergebooleantrue if you want to merge layoutStyle with existing attribute, false by default

Returns

Label

Inherited from

Rectangle.setLayoutStyle


setLineStyle

▸ setLineStyle(lineStyle, merge?): Label

Sets line style

Parameters

Name Type Description
lineStyleTypeline style or options
Optional mergebooleantrue if you want to merge lineStyle with existing attribute, false by default

Returns

Label

this

Inherited from

Rectangle.setLineStyle


setLocalTransform

▸ setLocalTransform(localTransform, force?): Label

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

Label

this

Inherited from

Rectangle.setLocalTransform


setMarginsStyle

▸ setMarginsStyle(margins, merge?): Label

Sets margins style

Parameters

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

Returns

Label

this

Inherited from

Rectangle.setMarginsStyle


setName

▸ setName(name): Label

Sets name of the node

Parameters

Name Type Description
namestringThe node name

Returns

Label

this

Inherited from

Rectangle.setName


setNotification

▸ setNotification(notify, force?): Label

set notification state

Parameters

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

Returns

Label

this

Inherited from

Rectangle.setNotification


setOpacity

▸ setOpacity(opacity, blendMode?): Label

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

Label

this

Inherited from

Rectangle.setOpacity


setPaddingStyle

▸ setPaddingStyle(paddingStyle, merge?): Label

Sets padding style

Parameters

Name Type Description
paddingStyleType<string | number&gt;padding style
Optional mergebooleantrue if you want to merge paddingStyle with existing attribute, false by default

Returns

Label

this


setParent

▸ setParent(parent): Label

Sets parent node. Don't call this method directly. It is internal method.

Parameters

Name Type Description
parentNodea parent node

Returns

Label

this

Inherited from

Rectangle.setParent


setProperties

▸ setProperties(properties?): Label

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptionsobject containing the properties to set

Returns

Label

Overrides

Rectangle.setProperties


setProperty

▸ setProperty(name, value): Label

Sets dynamic property by name

Parameters

Name Type Description
namestringproperty name
valueanyproperty value

Returns

Label

this

Inherited from

Rectangle.setProperty


setRect

▸ setRect(rect): Label

Sets the location and size of the framing rectangle of this rectangular shape to the specified values.

Parameters

Name Type Description
rectRectrect

Returns

Label

Inherited from

Rectangle.setRect

▸ setRect(params): Label

Sets the location and size of the framing rectangle of this rectangular shape to the specified values.

Parameters

Name Type Description
paramsOptionsrect params

Returns

Label

Inherited from

Rectangle.setRect

▸ setRect(x1, y1, x2, y2): Label

Sets the location and size of the framing rectangle of this rectangular shape to the specified values.

Parameters

Name Type Description
x1numberx coordinate of the top left corner
y1numbery coordinate of the top left corner
x2numberx coordinate of the bottom right corner
y2numbery coordinate of the bottom right corner

Returns

Label

Inherited from

Rectangle.setRect


setRenderingFilter

▸ setRenderingFilter(filter): Label

Sets filter to be applied before rendering and picking

Parameters

Name Type Description
filterIFilterfilter to set

Returns

Label

this

Inherited from

Rectangle.setRenderingFilter


setResponsiveStyle

▸ setResponsiveStyle(style): Label

Sets responsive style.

Parameters

Name Type Description
styleOptions | ResponsiveStyleresponsive style

Returns

Label

this

Inherited from

Rectangle.setResponsiveStyle


setRotationAngle

▸ setRotationAngle(rotationAngle): Label

Set rotation angle

Parameters

Name Type Description
rotationAnglenumberrotation angle (in radians) at anchor

Returns

Label

this


setScaleScrollStrategy

▸ setScaleScrollStrategy(strategy?): Label

Sets scale scroll strategy

Parameters

Name Type Description
Optional strategyDelegatescale scroll strategy

Returns

Label

this

Inherited from

Rectangle.setScaleScrollStrategy


setSelectable

▸ setSelectable(selectable): Label

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

Label

this

Inherited from

Rectangle.setSelectable


setSilent

▸ setSilent(bool): Label

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

Label

this

Inherited from

Rectangle.setSilent


setSize

▸ setSize(width, height?): Label

Sets device size in case if shape is in device space

Parameters

Name Type
widthnumber | Dimension | Options
Optional heightnumber

Returns

Label


setSizeIsInDeviceSpace

▸ setSizeIsInDeviceSpace(sizeIsInDeviceSpace): Label

Sets whether the shape size is set in device space.

Parameters

Name Type Description
sizeIsInDeviceSpacebooleantrue if the shape size is fixed in device space; otherwise, false.

Returns

Label

this


setTag

▸ setTag(tag): Label

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

Parameters

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

Returns

Label

this

Inherited from

Rectangle.setTag


setText

▸ setText(text): Label

Update the string this text displays.

Example

text.setText('Temperature &lt;b style="font-color:red"&gt;110&amp;deg;&lt;/b&gt; (&lt;i style="font-color:gray"&gt;Fahrenheit&lt;/i&gt;')

Parameters

Name Type Description
textstringnew text for this shape * can contains text formatting tags, <p> <font> <b> <strong> <i> <em> <mark> <small> <del> <ins> <sub> <sup> see https://www.w3schools.com/html/html_formatting.asp each tags except <br> can contains style attribute with set of 'font-size', 'font-family', 'font-weight', 'font-style', 'font-color' properties

Returns

Label

this


setTextStyle

▸ setTextStyle(textStyle, merge?): Label

Set text style

Parameters

Name Type Description
textStyleTypea new shape text style
Optional mergebooleantrue if you want to merge textStyle with existing attribute, false by default

Returns

Label

this


setVisible

▸ setVisible(value): Label

Sets visibility of the node. Send event Events.VisibilityChanged

Parameters

Name Type Description
valuebooleanflag specifying visibility of the node

Returns

Label

this

Inherited from

Rectangle.setVisible


setZIndex

▸ setZIndex(value): Label

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

Parameters

Name Type Description
valuenumberindex determining node z-position

Returns

Label

this

Inherited from

Rectangle.setZIndex


shear

▸ shear(shx, shy): Label

Shear this node's bounds

Parameters

Name Type Description
shxnumberx-axis shear
shynumbery-axis shear

Returns

Label

this

Inherited from

Rectangle.shear


toString

▸ toString(): string

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

Returns

string

A string representation

Inherited from

Rectangle.toString


translate

▸ translate(tx, ty): Label

Translate bounds

Parameters

Name Type Description
txnumberx translation
tynumbery translation

Returns

Label

this

Inherited from

Rectangle.translate


unregisterAnimationStyle

▸ unregisterAnimationStyle(root): void

Unregister animation style.

Parameters

Name Type Description
rootNoderoot node for node

Returns

void

Inherited from

Rectangle.unregisterAnimationStyle


updateSceneTransformation

▸ updateSceneTransformation(): Label

Update scene transformation

Returns

Label

this

Inherited from

Rectangle.updateSceneTransformation


updateState

▸ updateState(regions?, changes?): Label

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

Label

this

Inherited from

Rectangle.updateState


updateTimeStamp

▸ Protected updateTimeStamp(): Label

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

Returns

Label

this

Inherited from

Rectangle.updateTimeStamp


enableSceneGraphNotification

▸ Static enableSceneGraphNotification(enabled): void

Enable / disable all notifications

Parameters

Name Type Description
enabledbooleansets if this object sends notifications

Returns

void

Inherited from

Rectangle.enableSceneGraphNotification


findParent

▸ Static findParent<T&gt;(node, classType, filter?): InstanceType<T&gt;

Find root of the node with specified type

Type parameters

NameType
Textends Constructor<any&gt;

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&gt;

Inherited from

Rectangle.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

Rectangle.findParent


getClassName

▸ Static getClassName(): string

Returns

string

Inherited from

Rectangle.getClassName


intersectsBounds

▸ Static intersectsBounds(bounds, localTransformation, parentInvalidArea, expand?): boolean

Check collision of the shape bounds with parent invalid area

Parameters

Name Type Description
boundsRectshape bounds
localTransformationTransformationlocal transformation of the bounds
parentInvalidAreaRectinvalid parent area
Optional expandDimensionoptional expand the bounds in model coordinate

Returns

boolean

true if bounds intersect the invalid area

Inherited from

Rectangle.intersectsBounds


isSceneGraphNotificationEnabled

▸ Static isSceneGraphNotificationEnabled(): boolean

Return status of the global notification for all nodes.

Returns

boolean

Inherited from

Rectangle.isSceneGraphNotificationEnabled