pixi-viewport
pixi-viewport copied to clipboard
Any way to get current zoom value?
Hey,
I set up pixi viewport like this:
this.viewport
.pinch()
.wheel({ smooth: 3 })
.clampZoom({
minWidth: 300,
minHeight: 300,
maxWidth: 8000,
maxHeight: 8000,
})
.decelerate();
So users can pinch to zoom while in the game. Is there any possibility to get the percentage value of the current zoom in the library? I'm trying to calculate it but I'm wondering if there is possibly any ready value / function that I could refer to.
The current zoom is viewport.scale.x. If your default zoom is 1, then that's the percent (multiplied by 100). If default zoom is not one, then divide by the default zoom before multiplying by 100.