use tolerance for crosses right / force left
This commit is contained in:
@@ -623,20 +623,21 @@ OpenLayers.Bounds = OpenLayers.Class({
|
|||||||
if (maxExtent) {
|
if (maxExtent) {
|
||||||
var width = maxExtent.getWidth();
|
var width = maxExtent.getWidth();
|
||||||
|
|
||||||
//shift right?
|
//shift right?
|
||||||
while ( newBounds.left < maxExtent.left &&
|
while (newBounds.left < maxExtent.left &&
|
||||||
(newBounds.right - rightTolerance) <= maxExtent.left ) {
|
newBounds.right - rightTolerance <= maxExtent.left ) {
|
||||||
newBounds = newBounds.add(width, 0);
|
newBounds = newBounds.add(width, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//shift left?
|
//shift left?
|
||||||
while ( (newBounds.left + leftTolerance) >= maxExtent.right &&
|
while (newBounds.left + leftTolerance >= maxExtent.right &&
|
||||||
newBounds.right > maxExtent.right ) {
|
newBounds.right > maxExtent.right ) {
|
||||||
newBounds = newBounds.add(-width, 0);
|
newBounds = newBounds.add(-width, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// crosses right? force left
|
// crosses right? force left
|
||||||
if (newBounds.left < maxExtent.right && newBounds.right > maxExtent.right) {
|
if (newBounds.left + leftTolerance < maxExtent.right &&
|
||||||
|
newBounds.right - rightTolerance > maxExtent.right) {
|
||||||
newBounds = newBounds.add(-width, 0);
|
newBounds = newBounds.add(-width, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user