melowntech / vts-browser-js

JavaScript WebGL 3D map rendering engine
BSD 2-Clause "Simplified" License
218 stars 42 forks source link

Double click inside panel will pan map #154

Closed jrjdavidson closed 5 years ago

jrjdavidson commented 5 years ago

If a user double-clicks inside a panel created via the browser.ui.addControl() method, the map will pan to the said location. This doesn't seem to be an issue with other button or panels such as the search input box however. Example of this: https://jsfiddle.net/be637spg/ Double-click where it says 'Nothing hovered'

jrjdavidson commented 5 years ago

edited original post to a new fiddle that had 'jumpAllowed: true' on the browser

davidmtech commented 5 years ago

You can prevent this behavior by adding doubleClick event to the panel.

statusDiv.on('dblclick', onDoNothing.bind(this));

the function called by event should look something like this:

function onDoNothing(event) {
    vts.dom.preventDefault(event);    
    vts.dom.stopPropagation(event);    
}

There is an example: https://jsfiddle.net/7gmqykjc/

jrjdavidson commented 5 years ago

Thanks David. Not sure if it's possible, but might be useful to add this as a default behaviour to elements created by the addControl() method?