RectangleFactory

Rectangle factory.

Constructor

new RectangleFactory()

Methods

constrainAnchorMove(_anchor)

Constrain anchor movement.

Parameters:
NameTypeDescription
_anchorKonva.Ellipse

The active anchor.

createShapeGroup(annotation, style) → {Konva.Group}

Create a rectangle shape to be displayed.

Parameters:
NameTypeDescription
annotationAnnotation

The associated annotation.

styleStyle

The drawing style.

Returns:

The Konva group.

Type: 
Konva.Group

getAnchors(shape, style) → {Array.<Konva.Ellipse>}

Get anchors to update a rectangle shape.

Parameters:
NameTypeDescription
shapeKonva.Rect

The associated shape.

styleStyle

The application style.

Returns:

A list of anchors.

Type: 
Array.<Konva.Ellipse>

getGroupName() → {string}

Get the name of the shape group.

Returns:

The name.

Type: 
string

getNPoints() → {number}

Get the number of points needed to build the shape.

Returns:

The number of points.

Type: 
number

getName() → {string}

Get the name of the factory.

Returns:

The name.

Type: 
string

getTimeout() → {number}

Get the timeout between point storage.

Returns:

The timeout in milliseconds.

Type: 
number

setAnnotationMathShape(annotation, points)

Set an annotation math shape from input points.

Parameters:
NameTypeDescription
annotationAnnotation

The annotation.

pointsArray.<Point2D>

The points.

updateAnnotationOnAnchorMove(annotation, anchor)

Update an annotation on anchor move.

Parameters:
NameTypeDescription
annotationAnnotation

The annotation.

anchorKonva.Shape

The anchor.

updateAnnotationOnTranslation(annotation, translation)

Update an annotation on translation (shape move).

Parameters:
NameTypeDescription
annotationAnnotation

The annotation.

translationobject

The translation.

updateConnector(group)

Update the shape connector.

Parameters:
NameTypeDescription
groupKonva.Group

The shape group.

updateLabelContent(annotation, group, _style)

Update the shape label content.

Parameters:
NameTypeDescription
annotationAnnotation

The associated annotation.

groupKonva.Group

The shape group.

_styleStyle

The application style.

updateShapeGroupOnAnchorMove(annotation, anchor, style)

Update shape and label on anchor move taking the updated annotation as input.

Parameters:
NameTypeDescription
annotationAnnotation

The associated annotation.

anchorKonva.Ellipse

The active anchor.

styleStyle

The application style.

(static) supports(mathShape) → {boolean}

Does this factory support the input math shape.

Parameters:
NameTypeDescription
mathShapeobject

The mathematical shape.

Returns:

True if supported.

Type: 
boolean