panzoom icon indicating copy to clipboard operation
panzoom copied to clipboard

Provide callback to cancel the zoom on double click

Open BrianWalters opened this issue 3 years ago • 3 comments

Just like beforeMouseDown, we need a way to cancel the double click zoom event depending on the event context. For example, if we have buttons overlayed on the panzoom area, a user double-clicking a button shouldn't initiate a zoom.

There is also no way I could see to disable the double click zoom entirely, if say someone created their own zoom in/out buttons, or maybe they want to implement some other function for a double click.

BrianWalters avatar Apr 20 '21 22:04 BrianWalters

up please

450Oucema avatar Nov 10 '22 10:11 450Oucema

Hi @BrianWalters . I hope you are doing good. Were you able to figure out something. I am stuck in the same issue :)

RahulRaj97 avatar Jan 31 '23 13:01 RahulRaj97

For now, in your custom button/overlay add event.stopPropagation() like this:


function doTheThing(event) {
	hackTheGibson();
	event.stopPropagation();
	alert("event propagation halted.");
}

buttonOverlay.addEventListener("dblclick", doTheThing);

https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation

But, yes we need an option to disable double click Zoom, something like this doubleClickZoom: false

catpea avatar Jan 02 '24 00:01 catpea