ym.modules.provider.Point
Overview
Represents a point with x and y coordinates in pixels.
All leaflet methods and options that accept point objects also accept them in a simple array form (unless otherwise specified). These lines are therefore equivalent:
Initialization
Factory: ym.point(x, y, round)
Creates a Point object with the specified x and y coordinates. If the optional parameter round is set to true, the x and y values are rounded.
Parameter | Description | Data type | Default value |
---|---|---|---|
x | [required] | int | |
y | [required] | int | |
round | [optional] | bool |
Methods
Name | Description | Data type | Default value |
---|---|---|---|
add(Point otherPoint) | Returns the result of the addition of the current and specified points. | Point | |
subtract(Point otherPoint) | Returns the result of subtracting the specified point from the current point. | Point | |
multiplyBy(int number) | Returns the result of multiplying the current point by the specified number. | Point | |
divideBy(int number, bool round?) | Returns the result of dividing the current point by the specified number. If the optional round parameter is set to true, a rounded result is returned. | Point | |
distanceTo(Point otherPoint) | Returns the distance between the current and the specified points. | int | |
clone() | Returns a copy of the current point. | Point | |
round() | Returns a copy of the current point with rounded coordinates. | Point | |
floor() | Returns a copy of the current point with floored coordinates. | Point | |
equals(Point otherPoint) | Returns true if the specified point has the same coordinates. | bool | |
contains(Point otherPoint) | Returns true if the two coordinates of the specified point are smaller than the corresponding current point coordinates (in absolute values). | bool | |
toString() | Returns a string representation of the point for debugging purposes. | string |
Features
Name | Description | Data type | Default value |
---|---|---|---|
x | The x-coordinate. | int | |
y | The y-coordinate. | int |