Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide callback to cancel the zoom on double click #247

Open
BrianWalters opened this issue Apr 20, 2021 · 4 comments
Open

Provide callback to cancel the zoom on double click #247

BrianWalters opened this issue Apr 20, 2021 · 4 comments

Comments

@BrianWalters
Copy link

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.

@450Oucema
Copy link

up please

@RahulRaj97
Copy link

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

@catpea
Copy link

catpea commented Jan 2, 2024

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

@wihlke
Copy link

wihlke commented Nov 12, 2024

panzoom(element, {
  zoomDoubleClickSpeed: 1,  // disables zoom on double click
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants