LabelFactory

Label factory to create and update shape label.

Constructor

new LabelFactory(positionGetter)

Parameters:
NameTypeDescription
positionGetterfunction

Default position getter.

Classes

LabelFactory

Methods

create(annotation, style) → {Konva.Label}

Creates the konva label.

Parameters:
NameTypeDescription
annotationAnnotation

The associated annotation.

styleStyle

The drawing style.

Returns:

The Konva label.

Type: 
Konva.Label

getClosestPoints(points1, points2) → {Array.<Point2D>}

Get the two closest points of two points lists.

Parameters:
NameTypeDescription
points1Array.<Point2D>

The first point list.

points2Array.<Point2D>

The second point list.

Returns:

The closests points.

Type: 
Array.<Point2D>

getConnector(connectorsPos, label, style) → {Konva.Line}

Get the connector between this label and its shape.

Parameters:
NameTypeDescription
connectorsPosArray.<Point2D>

The shape connectors positions.

labelKonva.Label

The label.

styleStyle

The drawing style.

Returns:

The connector.

Type: 
Konva.Line

getLabelAnchorsPosition(label) → {Array.<Point2D>}

Get the anchors positions for the label.

Parameters:
NameTypeDescription
labelKonva.Label

The label.

Returns:

The connectors positions.

Type: 
Array.<Point2D>

getPosition(annotation) → {Point2D}

Get the annotation label position.

Parameters:
NameTypeDescription
annotationAnnotation

The annotation.

Returns:

The position.

Type: 
Point2D

updateConnector(group, connectorsPos)

Update the connector between a label and its shape.

Parameters:
NameTypeDescription
groupKonva.Group

The associated shape group.

connectorsPosArray.<Point2D>

The shape connectors positions.

updateContent(annotation, group)

Update the shape label.

Parameters:
NameTypeDescription
annotationAnnotation

The associated annotation.

groupKonva.Group

The shape group.

updatePosition(annotation, group)

Update the shape label position.

Parameters:
NameTypeDescription
annotationAnnotation

The associated annotation.

groupKonva.Group

The shape group.