Bounds
描述屏幕上的一个长方形区域,单位是像素。
示例
var p1 = W.point(10, 10),
p2 = W.point(40, 60),
bounds = W.bounds(p1, p2);
//所有接受 Bounds 实例的地方,都可接受一个数组(除非特别声明)
otherBounds.intersects([[10, 10], [40, 60]]);
构造函数
方法名 |
描述 |
W.latLngBounds(<Point> topLeft, <Point> bottomRight)) |
指定左上角和右下角 |
W.latLngBounds(<Point[]> points)) |
|
属性
方法
方法 |
返回值 |
描述 |
extend(<Point> point) |
this |
扩展范围,包含指定的点 |
getSize() |
Point |
返回的point的中x表示长度,y表示高度 |
getCenter() |
Point |
返回中心点 |
getBottomLeft() |
Point |
左下角 |
getTopRight() |
Point |
右上角 |
contains(<Bounds> otherBounds) |
Boolean |
如果包含指定的区域,返回true |
contains(<Point> point) |
Boolean |
如果包含指定的点,返回true |
intersects(<Bounds> otherBounds) |
Boolean |
如果两个区域相交(至少有一个共同点),返回true |
overlaps(<Bounds> otherBounds) |
Boolean |
如果两个区域重叠(共同区域是一个面,而不是一个点),返回true |