adjusting dx and dy instad of not moving the map at all when we reach the restrictedExtent. p=me,elemoine, r=elemoine (closes #3388)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@12158 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -1674,8 +1674,6 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
* dy - {Number}
|
||||
*/
|
||||
moveByPx: function(dx, dy) {
|
||||
dx = Math.round(dx);
|
||||
dy = Math.round(dy);
|
||||
var hw = this.size.w / 2;
|
||||
var hh = this.size.h / 2;
|
||||
var x = hw + dx;
|
||||
@@ -1689,15 +1687,13 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
// wrapping the date line makes no sense for restricted extents
|
||||
wrapDateLine = false;
|
||||
}
|
||||
var valid = y <= this.maxPx.y - yRestriction &&
|
||||
y >= this.minPx.y + yRestriction;
|
||||
var minX = this.minPx.x, maxX = this.maxPx.x;
|
||||
if (!wrapDateLine) {
|
||||
valid = valid &&
|
||||
dx = wrapDateLine ||
|
||||
x <= this.maxPx.x - xRestriction &&
|
||||
x >= this.minPx.x + xRestriction;
|
||||
}
|
||||
if (valid) {
|
||||
x >= this.minPx.x + xRestriction ? Math.round(dx) : 0;
|
||||
dy = y <= this.maxPx.y - yRestriction &&
|
||||
y >= this.minPx.y + yRestriction ? Math.round(dy) : 0;
|
||||
var minX = this.minPx.x, maxX = this.maxPx.x;
|
||||
if (dx || dy) {
|
||||
if (!this.dragging) {
|
||||
this.dragging = true;
|
||||
this.events.triggerEvent("movestart");
|
||||
|
||||
Reference in New Issue
Block a user