IRectangleGeometryAccess

Extends IFreezable.

Interface for accessing the "Rectangle" geometry.

Constructor | Fields | Events | Methods

Constructor

IRectangleGeometryAccess()

Fields

Name

Type

Description

events

IEventManager

Event manager for the object.

Inherited from IFreezable.

Events

Name

Description

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

Name

Returns

Description

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:

Parameter

Default value

Description

position*

—

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:

Parameter

Default value

Description

anchorPosition*

—

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

{IRectangleGeometryAccess} setCoordinates(coordinates)

Sets the coordinates of two opposite corners of the rectangle.

Returns self-reference.

Parameters:

Parameter

Default value

Description

coordinates*

—

Type: Number[][]

Coordinates of corners.

* Mandatory parameter/option.