davidfig / pixi-viewport

A highly configurable viewport/2D camera designed to work with pixi.js
https://davidfig.github.io/pixi-viewport/
MIT License
1.04k stars 174 forks source link

Disable Viewport Drag when dragging elements on stage #327

Open Chankse opened 3 years ago

Chankse commented 3 years ago

Hello, I have Pixi Viewport on my project and I add a container with some sprites to it. I have dragging functionality on my sprites with 'mousemove' and 'touchmove', which works fine but when I add the drag plugin to the viewport, it is called alongside mousemove. Is there any option/variable I have to add to disable the drug when elements inside viewport are dragged or how should I do that?

mhazy commented 3 years ago

I've handled this by pausing the viewport when the user is interacting with elements.

viewport.pause = true

https://davidfig.github.io/pixi-viewport/jsdoc/Viewport.html#pause

Chankse commented 3 years ago

Thank you very much, I'll try that, in my case stopPropagation worked as well, but I don't think it will work in every case

blueslurpee commented 2 years ago

This worked for my use case, many thanks