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

Prevent pan & zoom effect on children nodes #16

Closed
anhnhoktvn opened this issue Aug 7, 2019 · 4 comments
Closed

Prevent pan & zoom effect on children nodes #16

anhnhoktvn opened this issue Aug 7, 2019 · 4 comments

Comments

@anhnhoktvn
Copy link

I have an issue when the container element (which apply pan-zoom) has some input element.
When I select some text (movedown and mousemove events happen) in the input element, the container will trigger a pan move too. How to prevent this?

Could we provide an srcElement property in the callback of panzoom so that we can detect whether the event is triggered from an child node and so that we can handle this case.

@dy
Copy link
Owner

dy commented Aug 7, 2019

Done, @3.5.0 should support srcElement. Note though for pinch-zoom that's always target itself, there's no way to detect orig target from what I see.

@dy dy closed this as completed Aug 7, 2019
@anhnhoktvn
Copy link
Author

Thank you very much. Unfortunately, I still can not select the text in child node. I found out that an eventlistener (onMove function) in impetus.js library has canceled the mousemove event. To make it work I have to comment out that line (ev.preventDefault()).
Another way to workaround for this issue is wrapping the children nodes into another node and add a stoppropagation to stop the event go up to the containter.
Just leave a comment here if anyone has the same issue.

@dy
Copy link
Owner

dy commented Aug 8, 2019

@anhnhoktvn can you stoppropagation directly on srcElement, in a separate event listener?

@anhnhoktvn
Copy link
Author

anhnhoktvn commented Aug 9, 2019

@dy The e parameter in the callback function of panzoom is not the mouse/wheel/touch event. Therefore I can not call stoppropagation there. And the children nodes is dynamically added/removed, adding separate event listener to all the children nodes seems not a good idea.

Could you also expose the original event? Because in the near future, I'd like to detect also modifier keys (ctrl/shift/alt) in the callback too.

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

2 participants