ym.modules.provider.Bounds
Overview
Creates a bounds object from two pixel coordinates or from the contained points.
var p1 = ym.point(10, 10),
p2 = ym.point(40, 60),
bounds = ym.bounds(p1, p2);
All leaflet methods that accept bounds objects also accept them in a simple array form (unless otherwise specified), so that the above bounds example can be rewritten that way:
otherBounds.intersects([[10, 10], [40, 60]]);
Initialization
Factory: ym.bounds(Point topLeft, Point bottomRight)
Creates a bounds object from two pixel coordinates (top-left and bottom-right).
Factory: ym.bounds(Point[] points)
Creates a Bounds object that is defined by the points it contains.
Features
Name | Description | Data type | Default value |
---|---|---|---|
min |
The upper left corner of the rectangle. | Point |
|
max |
The lower right corner of the rectangle. | Point |
Methods
extend(point) ab v3
Extends the limits by the specified point.
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
point |
Point |
getCenter() ab v3
Returns the center of the boundaries.
Return
Point
contains(bounds) ab v3
Returns true if the rectangle contains the specified rectangle.
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
bounds |
Bounds |
Return
Bool
contains(point) ab v3
Returns true if the rectangle contains the specified point.
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
point |
Point |
Return
Bool
intersects(bounds) ab v3
Returns true if the rectangle intersects the specified boundaries.
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
bounds |
Bounds |
Return
Bool
isValid() ab v3
Returns true if the limits are correctly initialized.
Return
Bool
getSize() ab v3
Returns the size of the specified limits.
Return
Point