Bounds: Added extendXY() method
This is a simpler variant of the extend() method, but with less overhead.
This commit is contained in:
@@ -392,6 +392,32 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: extendXY
|
||||
* Extend the bounds to include the XY coordinate specified.
|
||||
*
|
||||
* Parameters:
|
||||
* x - {number} The X part of the the coordinate.
|
||||
* y - {number} The Y part of the the coordinate.
|
||||
*/
|
||||
extendXY:function(x, y) {
|
||||
// clear cached center location
|
||||
this.centerLonLat = null;
|
||||
|
||||
if ((this.left == null) || (x < this.left)) {
|
||||
this.left = x;
|
||||
}
|
||||
if ((this.bottom == null) || (y < this.bottom)) {
|
||||
this.bottom = y;
|
||||
}
|
||||
if ((this.right == null) || (x > this.right)) {
|
||||
this.right = x;
|
||||
}
|
||||
if ((this.top == null) || (y > this.top)) {
|
||||
this.top = y;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: containsLonLat
|
||||
* Returns whether the bounds object contains the given <OpenLayers.LonLat>.
|
||||
|
||||
Reference in New Issue
Block a user