Documentation
Reference
2.1.50 (current version)
collection
interactivityModel
Interfaces

IRectangleGeometryAccess

Extends IFreezable.

Interface for accessing the "Rectangle" geometry.

Constructor | Fields | Events | Methods

Constructor

IRectangleGeometryAccess()

Fields

NameTypeDescription
eventsIEventManager

Event manager for the object.

Inherited from IFreezable.

Events

NameDescription
change

Change to corner coordinates. Instance of the Event class. Names of fields that are available via the Event.get method:

  • oldCoordinates - Old coordinates of the corners.
  • newCoordinates - New coordinates of the corners.

Methods

NameReturnsDescription
contains(position)

Boolean

Checks whether the passed point is located inside the rectangle.

freeze()

IFreezable

Switches the object to "frozen" mode.

Inherited from IFreezable.

getClosest(anchorPosition)

Object

Searches for the point nearest to "anchorPosition" on the rectangle contour.

getCoordinates()

Number[][]

Returns coordinates of two opposite corners of the rectangle.

isFrozen()

Boolean

Returns true if the object is in "frozen" mode, otherwise false.

Inherited from IFreezable.

setCoordinates(coordinates)

IRectangleGeometryAccess

Sets the coordinates of two opposite corners of the rectangle.

unfreeze()

IFreezable

Switches the object to active mode.

Inherited from IFreezable.

Events details

change

Change to corner coordinates. Instance of the Event class. Names of fields that are available via the Event.get method:

  • oldCoordinates - Old coordinates of the corners.
  • newCoordinates - New coordinates of the corners.

Methods details

contains

{Boolean} contains(position)

Checks whether the passed point is located inside the rectangle.

Returns indicator for whether the point belongs to the rectangle.

Parameters:

ParameterDefault valueDescription
position*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Number[]

Coordinates of a point.

* Mandatory parameter/option.

getClosest

{Object} getClosest(anchorPosition)

Searches for the point nearest to "anchorPosition" on the rectangle contour.

Returns an object with the following fields:

  • position - The point on the rectangle contour that is nearest to "anchorPosition".
  • distance - Distance from "anchorPosition" to "position".
.

Parameters:

ParameterDefault valueDescription
anchorPosition*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Number[]

Coordinates of a point for which the nearest rectangle vertex is calculated.

* Mandatory parameter/option.

getCoordinates

{Number[][]} getCoordinates()

Returns coordinates of two opposite corners of the rectangle.

setCoordinates

Sets the coordinates of two opposite corners of the rectangle.

Returns self-reference.

Parameters:

ParameterDefault valueDescription
coordinates*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Number[][]

Coordinates of corners.

* Mandatory parameter/option.