Fix for "When Navigation control is inactive, doubleclick zooms in", using
the new click handler that Tim and I created over the weekend. (Hooray for handlers!) r=tschaub (Closes #1068) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5527 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -57,6 +57,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
activate: function() {
|
activate: function() {
|
||||||
this.dragPan.activate();
|
this.dragPan.activate();
|
||||||
this.wheelHandler.activate();
|
this.wheelHandler.activate();
|
||||||
|
this.clickHandler.activate();
|
||||||
this.zoomBox.activate();
|
this.zoomBox.activate();
|
||||||
return OpenLayers.Control.prototype.activate.apply(this,arguments);
|
return OpenLayers.Control.prototype.activate.apply(this,arguments);
|
||||||
},
|
},
|
||||||
@@ -67,6 +68,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
deactivate: function() {
|
deactivate: function() {
|
||||||
this.zoomBox.deactivate();
|
this.zoomBox.deactivate();
|
||||||
this.dragPan.deactivate();
|
this.dragPan.deactivate();
|
||||||
|
this.clickHandler.deactivate();
|
||||||
this.wheelHandler.deactivate();
|
this.wheelHandler.deactivate();
|
||||||
return OpenLayers.Control.prototype.deactivate.apply(this,arguments);
|
return OpenLayers.Control.prototype.deactivate.apply(this,arguments);
|
||||||
},
|
},
|
||||||
@@ -75,7 +77,12 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
* Method: draw
|
* Method: draw
|
||||||
*/
|
*/
|
||||||
draw: function() {
|
draw: function() {
|
||||||
this.map.events.register( "dblclick", this, this.defaultDblClick );
|
this.clickHandler = new OpenLayers.Handler.Click(this,
|
||||||
|
{ 'dblclick': this.defaultDblClick },
|
||||||
|
{
|
||||||
|
'double': true,
|
||||||
|
'stopDouble': true
|
||||||
|
});
|
||||||
this.dragPan = new OpenLayers.Control.DragPan({map: this.map});
|
this.dragPan = new OpenLayers.Control.DragPan({map: this.map});
|
||||||
this.zoomBox = new OpenLayers.Control.ZoomBox(
|
this.zoomBox = new OpenLayers.Control.ZoomBox(
|
||||||
{map: this.map, keyMask: OpenLayers.Handler.MOD_SHIFT});
|
{map: this.map, keyMask: OpenLayers.Handler.MOD_SHIFT});
|
||||||
@@ -96,8 +103,6 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
defaultDblClick: function (evt) {
|
defaultDblClick: function (evt) {
|
||||||
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
|
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
|
||||||
this.map.setCenter(newCenter, this.map.zoom + 1);
|
this.map.setCenter(newCenter, this.map.zoom + 1);
|
||||||
OpenLayers.Event.stop(evt);
|
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user