Prevent browser page zoom pinch gesture on desktop
See original GitHub issuePosted in html5 game forum here - haven’t received a response, but I believe this might be a bug.
Having an issue on desktop where Pixi interaction manager doesn’t appear to prevent default capturing pinch gestures.
This is especially problematic with Pixi Viewport, where pinch zoom gesture is getting caught by the browser; therefore, zooming the browser’s viewport (entire DOM).
Above, the pinch-zoom gesture is still picked up by the browser window.
Pixi Viewport creator David Figatner thought this should be default in Pixi’s Interaction Manager. https://github.com/davidfig/pixi-viewport/issues/196
Expected Behavior
Presume that Pixi would capture this event, and prevent default of the browser.
Believe this works in frameworks like Fabric.js and Deck.gl
Current Behavior
Pinch gesture is picked up by the browser, zooming the entire browser.
Another side effect is that the Pixi view becomes grainy since it isn’t being re-rendered.
Possible Solution
Prevent default of the events.
Maybe the intent is for it to zoom the entire DOM, without rendering high resolution.
Steps to Reproduce
Pinch-zoom a Pixi application - ideally with Pixi Viewport.
Environment
pixi.js
version: 5.2.0- Browser & Version: Chrome 80.0.3987.100 (Official Build) (64-bit)
- OS & Version: macOS Mojave 10.14.6
- Running Example: https://codepen.io/jasonsturges/pen/BayMWxm
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:15 (7 by maintainers)
Top GitHub Comments
@jasonsturges Ok, i found a solution. It is simple and doesn’t apply fo PIXI.
You should prevent
wheel
event =)https://www.pixiplayground.com/#/edit/qjyV1YQMdfWc-db8AVGd2
Added to WIKI: https://github.com/pixijs/pixi.js/wiki/v5-Hacks#prevent-pinch-gesture-in-chrome
Thanks @nazywamsiepawel for your solution. I had the same issue.