1

I want to overwrite this interaction because on my tablet when I dbl click while map is moving (using this example http://openlayers.org/en/v3.2.1/examples/geolocation-orientation.html) what happens is that map zoom and jump to marker , but I noticed if I use view.setResolution(newResolution); then it zooms nicely without any "jumps".

so I want to overwrite the interaction to run the code above.

5
  • 1
    Do you mean, disable it? Or you want another action? – Jonatas Walker Jun 17 '15 at 9:27
  • 1
    Would you be able to review this Meta advice on structuring your question to attract potential answerers, please? – PolyGeo Jun 17 '15 at 9:46
  • 1
    I believe you can just supply your own version of the function using prototype. Could you clarify what you are trying to do in a bit more detail. – John Powell Jun 17 '15 at 10:47
  • I want that when dblclicking on map to run this code : view.setResolution(newResolution); – Alophind Jun 17 '15 at 11:57
  • Any feedback ... ? – Jonatas Walker Nov 11 '15 at 8:16
2

Maybe that way

test= new ol.interaction.DoubleClickZoom({delta:0});
map.addInteraction(test);

map.on('dblclick', function(evt) {
 ...do something else with dblclick...
});
2

It is simple as this:

map.on('dblclick', function(evt){
    evt.preventDefault();

    olview.setResolution(resolut);
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.