wrld.js

Point

Represents a point with x and y coordinates in pixels.

var point = L.point(200, 300);

All Leaflet methods and options that accept Point objects also accept them in a simple Array form (unless noted otherwise), so these lines are equivalent:

map.panBy([200, 300]);
map.panBy(L.point(200, 300));

Creation

Factory Description
L.point( <Number> x, <Number> y, <Boolean> round? ) Creates a Point object with the given x and y coordinates. If optional round is set to true, rounds the x and y values.

Properties

Property Type Description
x Number The x coordinate.
y Number The y coordinate.

Methods

Method Returns Description
add( <Point> otherPoint ) Point Returns the result of addition of the current and the given points.
subtract( <Point> otherPoint ) Point Returns the result of subtraction of the given point from the current.
multiplyBy( <Number> number ) Point Returns the result of multiplication of the current point by the given number.
divideBy( <Number> number, <Boolean> round? ) Point Returns the result of division of the current point by the given number. If optional round is set to true, returns a rounded result.
distanceTo( <Point> otherPoint ) Number Returns the distance between the current and the given points.
clone() Point Returns a copy of the current point.
round() Point Returns a copy of the current point with rounded coordinates.
floor() Point Returns a copy of the current point with floored coordinates (rounded down).
equals( <Point> otherPoint ) Boolean Returns true if the given point has the same coordinates.
contains( <Point> otherPoint ) Boolean Returns true if the both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).
toString() String Returns a string representation of the point for debugging purposes.
v0.1.1335