This does solve my problem. Thanks.

JK

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of shitake83
Sent: Tuesday, June 14, 2011 10:23 AM
To: [email protected]
Subject: [OpenLayers-Users] Re: problem - map errorneously auto zoom in when 
continuously clicking on a marker

Hi.
You could "restrict" double-clicking to zoom, by removing the control from the 
map.
Then you wouldn't be able to double-click to zoom, but you could still scroll 
the mousewheel to zoom in or out, or just let your users use the slider.

The double click function resides in OpenLayers.Control.Navigation 
http://dev.openlayers.org/docs/files/OpenLayers/Control/Navigation-js.html

This is the original implementation:

defaultDblClick: function (evt) {
        var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); 
        this.map.setCenter(newCenter, this.map.zoom + 1); }
    

To disable doubleClick add this:
__________________________
var Navigation = new OpenLayers.Control.Navigation({
defaultDblClick: function(event) { return; } });

map.addControl(Navigation);


You have to call the addControl method, otherwise the standard defaultDblClick 
function wont be overwritten. 

I havent tried it, but you could change the implementation in a way, that it 
checks to see if you have hit a marker, which would mean that a popup would 
fire up or if you were trying to induce a zoom with the dblClick. If a marker 
was hit, dont take the dblClick as a "dblClick to zoom in" but as a 
"doubleClickToShowPopup".


var Navigation = new OpenLayers.Control.Navigation({
defaultDblClick: function(evt) {
if(determineDblClick() == 0)
      {
        dblClickToZoom();
      }
else{ doubleClickToShowPopup(); }
}
return;}


Cheers.Shitake.

--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/problem-map-errorneously-auto-zoom-in-when-continuously-clicking-on-a-marker-tp6474469p6474795.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to