Improving the PanZoomBar behavior so that when you click on the bar after dragging to the top, the map doesn't re-zoom on mouse up. r=me (closes #1861)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10025 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -65,6 +65,18 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
|||||||
*/
|
*/
|
||||||
forceFixedZoomLevel: false,
|
forceFixedZoomLevel: false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property: mouseDragStart
|
||||||
|
* {<OpenLayers.Pixel>}
|
||||||
|
*/
|
||||||
|
mouseDragStart: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property: zoomStart
|
||||||
|
* {<OpenLayers.Pixel>}
|
||||||
|
*/
|
||||||
|
zoomStart: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Control.PanZoomBar
|
* Constructor: OpenLayers.Control.PanZoomBar
|
||||||
*/
|
*/
|
||||||
@@ -85,6 +97,9 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
OpenLayers.Control.PanZoom.prototype.destroy.apply(this, arguments);
|
OpenLayers.Control.PanZoom.prototype.destroy.apply(this, arguments);
|
||||||
|
|
||||||
|
delete this.mouseDragStart;
|
||||||
|
delete this.zoomStart;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -342,7 +357,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
|||||||
if (!OpenLayers.Event.isLeftClick(evt)) {
|
if (!OpenLayers.Event.isLeftClick(evt)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.zoomStart) {
|
if (this.mouseDragStart) {
|
||||||
this.div.style.cursor="";
|
this.div.style.cursor="";
|
||||||
this.map.events.un({
|
this.map.events.un({
|
||||||
"mouseup": this.passEventToSlider,
|
"mouseup": this.passEventToSlider,
|
||||||
@@ -359,7 +374,6 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
|||||||
zoomLevel += Math.round(deltaY/this.zoomStopHeight);
|
zoomLevel += Math.round(deltaY/this.zoomStopHeight);
|
||||||
}
|
}
|
||||||
this.map.zoomTo(zoomLevel);
|
this.map.zoomTo(zoomLevel);
|
||||||
this.moveZoomBar();
|
|
||||||
this.mouseDragStart = null;
|
this.mouseDragStart = null;
|
||||||
OpenLayers.Event.stop(evt);
|
OpenLayers.Event.stop(evt);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user