RectangleFactory

Rectangle factory.

Constructor

new RectangleFactory()

Methods

create(points, style, viewController) → {Konva.Group}

Create a rectangle shape to be displayed.

Parameters:
NameTypeDescription
pointsArray.<Point2D>

The points from which to extract the rectangle.

styleStyle

The drawing style.

viewControllerViewController

The associated view controller.

Returns:

The Konva group.

Type: 
Konva.Group

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

Get anchors to update a rectangle shape.

Parameters:
NameTypeDescription
shapeKonva.Shape

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

getTimeout() → {number}

Get the timeout between point storage.

Returns:

The timeout in milliseconds.

Type: 
number

isFactoryGroup(group) → {boolean}

Is the input group a group of this factory?

Parameters:
NameTypeDescription
groupKonva.Group

The group to test.

Returns:

True if the group is from this fcatory.

Type: 
boolean

update(anchor, style, viewController)

Update a rectangle shape.

Parameters:
NameTypeDescription
anchorKonva.Ellipse

The active anchor.

styleStyle

The app style.

viewControllerViewController

The associated view controller.

updateQuantification(group, viewController)

Update the quantification of a Rectangle.

Parameters:
NameTypeDescription
groupKonva.Group

The group with the shape.

viewControllerViewController

The associated view controller.