number

X-value

number

Y-value

Methods

difference

static

difference(a, b) returns Blockly.utils.Coordinate

Returns the difference between two coordinates as a new Blockly.utils.Coordinate.

Parameter

a

(non-null Blockly.utils.Coordinate or non-null SVGPoint)

An x/y coordinate.

b

(non-null Blockly.utils.Coordinate or non-null SVGPoint)

An x/y coordinate.

Returns

`non-null Blockly.utils.Coordinate` A Coordinate representing the difference between `a` and `b`.

distance

static

distance(a, b) returns number

Returns the distance between two coordinates.

Parameter

a

Blockly.utils.Coordinate

A Coordinate.

Value must not be null.

b

Blockly.utils.Coordinate

A Coordinate.

Value must not be null.

Returns

`number` The distance between `a` and `b`.

equals

static

equals(a, b) returns boolean

Compares coordinates for equality.

Parameter

a

Blockly.utils.Coordinate

A Coordinate.

b

Blockly.utils.Coordinate

A Coordinate.

Returns

`boolean` True iff the coordinates are equal, or if both are null.

magnitude

static

magnitude(a) returns number

Returns the magnitude of a coordinate.

Parameter

a

Blockly.utils.Coordinate

A Coordinate.

Value must not be null.

Returns

`number` The distance between the origin and `a`.

sum

static

sum(a, b) returns Blockly.utils.Coordinate

Returns the sum of two coordinates as a new Blockly.utils.Coordinate.

Parameter

a

(non-null Blockly.utils.Coordinate or non-null SVGPoint)

An x/y coordinate.

b

(non-null Blockly.utils.Coordinate or non-null SVGPoint)

An x/y coordinate.

Returns

`non-null Blockly.utils.Coordinate` A Coordinate representing the sum of the two coordinates.

scale

scale(s) returns Blockly.utils.Coordinate

Scales this coordinate by the given scale factor.

Parameter

s

number

The scale factor to use for both x and y dimensions.

Returns

`non-null Blockly.utils.Coordinate` This coordinate after scaling.

translate

translate(tx, ty) returns Blockly.utils.Coordinate

Translates this coordinate by the given offsets. respectively.

Parameter

tx

number

The value to translate x by.

ty

number

The value to translate y by.

Returns

`non-null Blockly.utils.Coordinate` This coordinate after translating.