Bounds

Represents a rectangular area in pixel coordinates.

Usage example

var p1 = L.point(10, 10),
p2 = L.point(40, 60),
bounds = L.bounds(p1, p2);

All Leaflet methods that accept Bounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:

otherBounds.intersects([[10, 10], [40, 60]]);

Creation

Factory Description
L.bounds(<Point> topLeft, <Point> bottomRight) Creates a Bounds object from two coordinates (usually top-left and bottom-right corners).
L.bounds(<Point[]> points) Creates a Bounds object from the points it contains

Methods

Method Returns Description
extend(<Point> point) this

Extends the bounds to contain the given point.

getCenter(<Boolean> round?) Point

Returns the center point of the bounds.

getBottomLeft() Point

Returns the bottom-left point of the bounds.

getTopRight() Point

Returns the top-right point of the bounds.

getSize() Point

Returns the size of the given bounds

contains(<Bounds> otherBounds) Boolean

Returns true if the rectangle contains the given one.

contains(<Point> point) Boolean

Returns true if the rectangle contains the given point.

intersects(<Bounds> otherBounds) Boolean

Returns true if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.

overlaps(<Bounds> otherBounds) Boolean

Returns true if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.

Properties

Property Type Description
min Point The top left corner of the rectangle.
max Point The bottom right corner of the rectangle.
v1.1.0
Props Wrld.Prop
Themes Wrld.themes
Heatmaps Wrld.Heatmap
Events Event objects
Services (Optional) WrldPoiApi