SVGCoordinates

SVGCoordinates

Class representing an SVG coordinate

Constructor

new SVGCoordinates(x, y)

Create a Cartesian coordinate tuple

Parameters:
Name Type Description
x number

A valid x coordinate (0 if not parseable as a number)

y number

A valid y coordinate (0 if not parseable as a number)

Source:

Members

x :number

The X part of the coordinate tuple

Source:

y :number

The Y part of the coordinate tuple

Source:

Methods

(static) absoluteFrom(relativeCoordinates, origin) → {SVGCoordinates}

Transpose some relative coordinates from a given origin

NOTE: This method doesn't mutate the original relative coordinates, it provides a new set of coordinates.

Parameters:
Name Type Description
relativeCoordinates SVGCoordinates

The relative coordinates to make absolute

origin SVGCoordinates

The origin to compute absolute coordinates from.

Source:

(static) relativeTo(absoluteCoordinates, origin) → {SVGCoordinates}

Transpose some absolute coordinates relatively to a given origin

NOTE: This method doesn't mutate the original absolute coordinates, it provides a new set of coordinates.

Parameters:
Name Type Description
absoluteCoordinates SVGCoordinates

The absolute coordinates to make relative

origin SVGCoordinates

The origin to compute relative coordinates to.

Source:

absoluteFrom(origin) → {SVGCoordinates}

Transpose the current relative coordinates from a given origin

NOTE: This method mutates the current coordinates.

Parameters:
Name Type Description
origin SVGCoordinates

The origin to compute absolute coordinates from.

Source:

relativeTo(origin) → {SVGCoordinates}

Transpose the current absolute coordinates relatively to a given origin

NOTE: This method mutates the current coordinates.

Parameters:
Name Type Description
origin SVGCoordinates

The origin to compute relative coordinates to.

Source:

toJSON()

Transform the coordinate into an Array [x,y] to be used as a JSON representation

Source:

toString()

Transform a coordinate into a string of type "x,y"

Source: