Skip to content

Connector

Connector

Extends

Constructors

new Connector()

new Connector(): Connector

Returns

Connector

Overrides

Line.constructor

Source

shapes.ts:2745

Properties

children

children: Obj[]

Inherited from

Line.children

Source

core/obj.ts:14


connectable

connectable: boolean

Connectable flag

Inherited from

Line.connectable

Source

shapes.ts:218


constraints

constraints: Constraint[]

Shape’s constraints

Inherited from

Line.constraints

Source

shapes.ts:333


containable

containable: boolean

Containable flag

Inherited from

Line.containable

Source

shapes.ts:203


containableFilter

containableFilter: string

Containable filter

Inherited from

Line.containableFilter

Source

shapes.ts:208


description

description: string

Description of the shape

Inherited from

Line.description

Source

shapes.ts:163


enable

enable: boolean

Enable flag

Inherited from

Line.enable

Source

shapes.ts:178


fillColor

fillColor: string

Fill color

Inherited from

Line.fillColor

Source

shapes.ts:263


fillStyle

fillStyle: string

Fill style

Inherited from

Line.fillStyle

Source

shapes.ts:268


fontColor

fontColor: string

Font color

Inherited from

Line.fontColor

Source

shapes.ts:273


fontFamily

fontFamily: string

Font family

Inherited from

Line.fontFamily

Source

shapes.ts:278


fontSize

fontSize: number

Font size

Inherited from

Line.fontSize

Source

shapes.ts:283


fontStyle

fontStyle: string

Font style

Inherited from

Line.fontStyle

Source

shapes.ts:288


fontWeight

fontWeight: number

Font weight

Inherited from

Line.fontWeight

Source

shapes.ts:293


head: null | Shape

Source

shapes.ts:2722


headAnchor

headAnchor: number[]

Head’s anchor position

Source

shapes.ts:2728


headEndType

headEndType: LineEndTypeEnum

Inherited from

Line.headEndType

Source

shapes.ts:2369


headMargin

headMargin: number

Marginal space to head

Source

shapes.ts:2738


height

height: number

Shape’s height

Inherited from

Line.height

Source

shapes.ts:238


id

id: string

Inherited from

Line.id

Source

core/obj.ts:11


left

left: number

Shape’s left position

Inherited from

Line.left

Source

shapes.ts:223


lineType

lineType: LineTypeEnum

Inherited from

Line.lineType

Source

shapes.ts:2368


link: string

Link

Inherited from

Line.link

Source

shapes.ts:323


movable

movable: MovableEnum

Indicate how this shape can be moved

Inherited from

Line.movable

Source

shapes.ts:188


movableParentFilter

movableParentFilter: string

Movable parent filter

Inherited from

Line.movableParentFilter

Source

shapes.ts:213


name

name: string

Name of the shape

Inherited from

Line.name

Source

shapes.ts:158


opacity

opacity: number

Opacity

Inherited from

Line.opacity

Source

shapes.ts:298


parent

parent: null | Obj

Inherited from

Line.parent

Source

core/obj.ts:13


path

path: number[][]

Inherited from

Line.path

Source

shapes.ts:1908


pathEditable

pathEditable: boolean

Inherited from

Line.pathEditable

Source

shapes.ts:1907


properties

properties: Property[]

Shape’s properties

Inherited from

Line.properties

Source

shapes.ts:338


proto

proto: boolean

The flag to indicate this shape is a prototype or not

Inherited from

Line.proto

Source

shapes.ts:168


reference

reference: null | Shape

A reference to shape

Inherited from

Line.reference

Source

shapes.ts:328


rotatable

rotatable: boolean

Rotatable flag

Inherited from

Line.rotatable

Source

shapes.ts:198


rotate

rotate: number

Shape’s rotation angle (in degree)

Inherited from

Line.rotate

Source

shapes.ts:243


roughness

roughness: number

Roughness

Inherited from

Line.roughness

Source

shapes.ts:303


scripts

scripts: Script[]

Shape’s scripts

Inherited from

Line.scripts

Source

shapes.ts:343


shadow

shadow: boolean

Shadow

Inherited from

Line.shadow

Source

shapes.ts:308


shadowColor

shadowColor: string

Shadow color

Inherited from

Line.shadowColor

Source

shapes.ts:313


shadowOffset

shadowOffset: number[]

Shadow offset

Inherited from

Line.shadowOffset

Source

shapes.ts:318


sizable

sizable: SizableEnum

Indicate how this shape can be resized

Inherited from

Line.sizable

Source

shapes.ts:193


strokeColor

strokeColor: string

Stroke color

Inherited from

Line.strokeColor

Source

shapes.ts:248


strokePattern

strokePattern: number[]

Stroke pattern

Inherited from

Line.strokePattern

Source

shapes.ts:258


strokeWidth

strokeWidth: number

Stroke width

Inherited from

Line.strokeWidth

Source

shapes.ts:253


tags

tags: string[]

Tags

Inherited from

Line.tags

Source

shapes.ts:173


tail

tail: null | Shape

Source

shapes.ts:2723


tailAnchor

tailAnchor: number[]

Tail’s anchor position

Source

shapes.ts:2733


tailEndType

tailEndType: LineEndTypeEnum

Inherited from

Line.tailEndType

Source

shapes.ts:2370


tailMargin

tailMargin: number

Marginal space to tail

Source

shapes.ts:2743


top

top: number

Shape’s top position

Inherited from

Line.top

Source

shapes.ts:228


type

type: string

Inherited from

Line.type

Source

core/obj.ts:12


visible

visible: boolean

Visible flag

Inherited from

Line.visible

Source

shapes.ts:183


width

width: number

Shape’s width

Inherited from

Line.width

Source

shapes.ts:233

Accessors

bottom

get bottom(): number

Returns

number

Source

shapes.ts:563


get right(): number

Returns

number

Source

shapes.ts:559

Methods

assignStyles()

assignStyles(canvas): void

Assign styles to memoization canvas.

Parameters

canvas: MemoizationCanvas

Returns

void

Inherited from

Line.assignStyles

Source

shapes.ts:653


canContain()

canContain(shape): boolean

Determine a given shape can be contained in this shape

Parameters

shape: Shape

Returns

boolean

Inherited from

Line.canContain

Source

shapes.ts:1107


computeOpacity()

computeOpacity(): number

Returns

number

Inherited from

Line.computeOpacity

Source

shapes.ts:643


containsPoint()

containsPoint(canvas, point): boolean

Determines whether this shape contains a point in GCS

Parameters

canvas: Canvas

point: number[]

Returns

boolean

Inherited from

Line.containsPoint

Source

shapes.ts:1962


draw()

draw(canvas, showDOM): void

Draw this shape

Render vs Draw

  • Render: computing geometries how to draw the shape
  • Draw: actual drawing the computed geometries of the shape on the canvas

Parameters

canvas: Canvas

showDOM: boolean= false

Returns

void

Inherited from

Line.draw

Source

shapes.ts:799


drawLink(canvas, showDOM): void

Draw link

Parameters

canvas: Canvas

showDOM: boolean= false

Returns

void

Inherited from

Line.drawLink

Source

shapes.ts:813


finalize()

finalize(canvas): void

Finalize shape

Parameters

canvas: Canvas

Returns

void

Inherited from

Line.finalize

Source

shapes.ts:583


find()

find(pred): null | Obj

Find an shape in breath-first order

Parameters

pred

Returns

null | Obj

Inherited from

Line.find

Source

core/obj.ts:147


findAllByQuery()

findAllByQuery(queryString): Shape[]

Find all shapes matched with the query string

Parameters

queryString: string

Returns

Shape[]

Inherited from

Line.findAllByQuery

Source

shapes.ts:1097


findByQuery()

findByQuery(queryString): null | Shape

Find a shape first matched with the query string

Parameters

queryString: any

Returns

null | Shape

Inherited from

Line.findByQuery

Source

shapes.ts:1084


findDepthFirst()

findDepthFirst(pred): null | Obj

Find an shape in depth-first order

Parameters

pred

Returns

null | Obj

Inherited from

Line.findDepthFirst

Source

core/obj.ts:160


findParent()

findParent(pred): null | Obj

Find a shape along with the parent-chain

Parameters

pred

Returns

null | Obj

Inherited from

Line.findParent

Source

core/obj.ts:173


fromJSON()

fromJSON(json): void

Import shape from JSON

Parameters

json: any

Returns

void

Overrides

Line.fromJSON

Source

shapes.ts:2787


getBoundingRect()

getBoundingRect(includeAnchorPoints): number[][]

Return a bounding rect.

Parameters

includeAnchorPoints: boolean= false

Returns

number[][]

Overrides

Line.getBoundingRect

Source

shapes.ts:2818


getCenter()

getCenter(): number[]

Returns the center point

Returns

number[]

Inherited from

Line.getCenter

Source

shapes.ts:853


getChildrenBoundingRect()

getChildrenBoundingRect(): number[][]

Return a bounding box embracing children shapes

Returns

number[][]

Inherited from

Line.getChildrenBoundingRect

Source

shapes.ts:921


getEnclosure()

getEnclosure(): number[][]

Return a enclosure

Returns

number[][]

Inherited from

Line.getEnclosure

Source

shapes.ts:955


getEndSegment()

getEndSegment(isHead): number[][]

Return a segment of an end

Parameters

isHead: boolean

Returns

number[][]

segment line to end

Inherited from

Line.getEndSegment

Source

shapes.ts:1953


getHeadAnchorPoint()

getHeadAnchorPoint(): number[]

Return head anchor point

Returns

number[]

Source

shapes.ts:2834


getHeadOutline()

getHeadOutline(): null | number[][]

Return head’s outline

Returns

null | number[][]

Source

shapes.ts:2876


getJson()

getJson(json, field, defaultValue): any

Get a field from the JSON object, return defaultValue if the field is not defined.

Parameters

json: any

field: string

defaultValue: any

Returns

any

Inherited from

Line.getJson

Source

core/obj.ts:53


getOutline()

getOutline(): number[][]

Return outline polygon.

Returns

number[][]

Inherited from

Line.getOutline

Source

shapes.ts:788


getPage()

getPage(): null | Page

Return the page that contains this shape

Returns

null | Page

Inherited from

Line.getPage

Source

shapes.ts:555


getProperty()

getProperty(name): any

Get a property object

Parameters

name: string

Returns

any

Inherited from

Line.getProperty

Source

shapes.ts:1119


getPropertyValue()

getPropertyValue(name): any

Get a property value

Parameters

name: string

Returns

any

Inherited from

Line.getPropertyValue

Source

shapes.ts:1129


getRectInDCS()

getRectInDCS(canvas, includeAnchorPoints): number[][]

Return a bounding box in DOM coord.

[Note] If you want to place DOM elements over the canvas, use this method. and don’t forget to apply transform scale to the DOM element.

Parameters

canvas: Canvas

includeAnchorPoints: boolean= false

Returns

number[][]

Inherited from

Line.getRectInDCS

Source

shapes.ts:934


getScript()

getScript(id): undefined | string

Get a property object

Parameters

id: string

Returns

undefined | string

Inherited from

Line.getScript

Source

shapes.ts:1137


getSeed()

getSeed(): number

Return the seed number

Returns

number

Inherited from

Line.getSeed

Source

shapes.ts:570


getShapeAt()

getShapeAt(canvas, point, exceptions, allowDisabledAndInvisible): null | Shape

Pick a shape at specific position (x, y)

Parameters

canvas: Canvas

point: number[]

exceptions: Shape[]= []

allowDisabledAndInvisible: boolean= false

Returns

null | Shape

Inherited from

Line.getShapeAt

Source

shapes.ts:603


getTailAnchorPoint()

getTailAnchorPoint(): number[]

Return tail anchor point

Returns

number[]

Source

shapes.ts:2855


getTailOutline()

getTailOutline(): null | number[][]

Return head’s outline

Returns

null | number[][]

Source

shapes.ts:2883


getViewport()

getViewport(canvas): number[][]

Return a viewport in GCS. Viewport is a rect that includes actually drawn area which includes stroke width, arrowheads, etc. So viewport is mostly larger than bounding rect.

Parameters

canvas: Canvas

Returns

number[][]

Inherited from

Line.getViewport

Source

shapes.ts:911


initialze()

initialze(canvas): void

Initialize shape

Parameters

canvas: Canvas

Returns

void

Inherited from

Line.initialze

Source

shapes.ts:578


isClosed()

isClosed(): boolean

Return is the path is closed

Returns

boolean

Inherited from

Line.isClosed

Source

shapes.ts:1944


isDescendant()

isDescendant(obj): boolean

Test whether the given shape is a descendant

Parameters

obj: Obj

Returns

boolean

Inherited from

Line.isDescendant

Source

core/obj.ts:183


localCoordTransform()

localCoordTransform(canvas, point, recursive): number[]

Transform local coord to parent’s coord (LCS —> parent’s LCS) if recursive=true, transform to GCS (Global coord-system).

Parameters

canvas: Canvas

point: number[]

recursive: boolean= false

Returns

number[]

Inherited from

Line.localCoordTransform

Source

shapes.ts:689


localCoordTransformRev()

localCoordTransformRev(canvas, point, recursive): number[]

Transform parent’s coord to local coord (parent’s LCS —> LCS) if recursive=true, transform GCS (Global coord-system) —> LCS.

Parameters

canvas: Canvas

point: number[]

recursive: boolean= false

Returns

number[]

Inherited from

Line.localCoordTransformRev

Source

shapes.ts:709


localTransform()

localTransform(canvas, recursive): void

Transform local context to parent’s context

Parameters

canvas: Canvas

recursive: boolean= false

Returns

void

Inherited from

Line.localTransform

Source

shapes.ts:673


match()

match(query): boolean

Returns true if query matches this shape

Parameters

query: object[]

Returns

boolean

Inherited from

Line.match

Source

shapes.ts:1060


overlapClippingArea()

overlapClippingArea(canvas, rect): boolean

Determines whether the given rect overlaps this shape’s clipping area. If the shape don’t have clipping area, return true. If the shape has clipping area, return true if the rect overlaps the clipping area. (e.g. Frame)

Parameters

canvas: Canvas

rect: number[][]

Returns

boolean

Inherited from

Line.overlapClippingArea

Source

shapes.ts:991


overlapRect()

overlapRect(canvas, rect): boolean

Determines whether this shape overlaps a given rect

Parameters

canvas: Canvas

rect: number[][]

Returns

boolean

Inherited from

Line.overlapRect

Source

shapes.ts:1985


parseQueryString()

parseQueryString(queryString): any[]

Parse the query-string and returns a query object (JSON)

Query syntax: = [”|” ]* = [”&” ]* = | = e.g.) OuterBox, NameText, … = ”@” e.g.) @Box, @Text, @Line, … = ”#” e.g.) #label, #compartment, …

e.g.) parseQuery(“@Box|NameText|@Text&#compartment”) —> [{_type: “Box”},{name: “NameText”},{_type: “Text”, tag:“compartment”}]

Parameters

queryString: string

Returns

any[]

query object

Inherited from

Line.parseQueryString

Source

shapes.ts:1035


render()

render(canvas): void

Render this shape

Render vs Draw

  • Render: computing geometries how to draw the shape
  • Draw: actual drawing the computed geometries of the shape on the canvas

Parameters

canvas: MemoizationCanvas

Returns

void

Inherited from

Line.render

Source

shapes.ts:732


renderDefault()

renderDefault(canvas): void

Draw this shape

Parameters

canvas: MemoizationCanvas

Returns

void

Inherited from

Line.renderDefault

Source

shapes.ts:2415


renderLineEnd()

renderLineEnd(canvas, edgeEndType, isHead): number[]

Draw line end types. All line-ends are drawn based on the point grid as below:

0 1 2 3 4 5 6 7 8 9 10

0 • • • • • • • • • • • 1 • • • • • • • • • • • 2 • • • • • • • • • • • 3 HEAD •-•-•-•-•-•-•-•-•-•-•---------- TAIL 4 • • • • • • • • • • • 5 • • • • • • • • • • • 6 • • • • • • • • • • •

Parameters

canvas: MemoizationCanvas

edgeEndType: string

isHead: boolean

Returns

number[]

an end point the path should be drawn to

Inherited from

Line.renderLineEnd

Source

shapes.ts:2461


renderOutline()

renderOutline(canvas): void

Render this shape’s outline

Parameters

canvas: MemoizationCanvas

Returns

void

Inherited from

Line.renderOutline

Source

shapes.ts:757


renderOutlineDefault()

renderOutlineDefault(canvas): number[][]

Return default outline

Parameters

canvas: MemoizationCanvas

Returns

number[][]

Inherited from

Line.renderOutlineDefault

Source

shapes.ts:2642


renderShadow()

renderShadow(canvas): void

Render shadow

Parameters

canvas: MemoizationCanvas

Returns

void

Inherited from

Line.renderShadow

Source

shapes.ts:2669


renderViewport()

renderViewport(canvas): void

Return this shape’s viewport

Parameters

canvas: MemoizationCanvas

Returns

void

Inherited from

Line.renderViewport

Source

shapes.ts:870


renderViewportDefault()

renderViewportDefault(canvas): number[][]

Render default viewport

Parameters

canvas: MemoizationCanvas

Returns

number[][]

Inherited from

Line.renderViewportDefault

Source

shapes.ts:2655


resolveRefs()

resolveRefs(idMap, nullIfNotFound): void

Resolve references

Parameters

idMap: Record<string, Shape>

id to object map

nullIfNotFound: boolean= false

assign null if not found

Returns

void

Overrides

Line.resolveRefs

Source

shapes.ts:2797


setJson()

setJson(json, field, value, defaultValue, enforce): void

Set a field in the JSON object only if the value is defined and not equal to the default value.

Parameters

json: any

The JSON object to set the field in.

field: string

The field name to set.

value: any

The value to set.

defaultValue: any

The default value to compare against.

enforce: boolean= false

If true, the field will be set even if it is equal to the default value.

Returns

void

Inherited from

Line.setJson

Source

core/obj.ts:31


toJSON()

toJSON(recursive, keepRefs, enforce): any

Export shape to JSON

Parameters

recursive: boolean= false

keepRefs: boolean= false

enforce: boolean= false

Returns

any

Overrides

Line.toJSON

Source

shapes.ts:2756


traverse()

traverse(fun, parent): void

Traverse all objects in breath-first order

Parameters

fun

parent: null | Obj= null

Returns

void

Inherited from

Line.traverse

Source

core/obj.ts:101


traverseDepthFirst()

traverseDepthFirst(fun, parent): void

Traverse all shapes in depth-first order

Parameters

fun

parent: null | Obj= null

Returns

void

Inherited from

Line.traverseDepthFirst

Source

core/obj.ts:115


traverseDepthFirstSequence()

traverseDepthFirstSequence(): Obj[]

Returns an array of shapes in order of traverse sequence.

Returns

Obj[]

Inherited from

Line.traverseDepthFirstSequence

Source

core/obj.ts:138


traverseSequence()

traverseSequence(): Obj[]

Returns an array of shapes in order of traverse sequence.

Returns

Obj[]

Inherited from

Line.traverseSequence

Source

core/obj.ts:129


update()

update(canvas): void

Update shape

Parameters

canvas: Canvas

Returns

void

Inherited from

Line.update

Source

shapes.ts:593


visit()

visit(fun, parent): void

Visit all shapes in breath-first order. The difference from traverse() is that each shape determine visit into children or not. (e.g. Group and Frame doens’t visit into children)

Parameters

fun

parent: null | Shape= null

Returns

void

Inherited from

Line.visit

Source

shapes.ts:632