blockly > utils > Coordinate

utils.Coordinate class

Class for representing coordinates and positions.

Signature:

export declare class Coordinate 

Constructors

Constructor Modifiers Description
(constructor)(x, y) Constructs a new instance of the Coordinate class

Properties

Property Modifiers Type Description
x number
y number

Methods

Method Modifiers Description
clone() Creates a new copy of this coordinate.
difference(a, b) static Returns the difference between two coordinates as a new Coordinate.
distance(a, b) static Returns the distance between two coordinates.
equals(a, b) static Compares coordinates for equality.
magnitude(a) static Returns the magnitude of a coordinate.
scale(s) Scales this coordinate by the given scale factor.
sum(a, b) static Returns the sum of two coordinates as a new Coordinate.
translate(tx, ty) Translates this coordinate by the given offsets. respectively.