pixi-viewport icon indicating copy to clipboard operation
pixi-viewport copied to clipboard

viewport doesn't work properly when parent is scaled

Open davidfig opened this issue 6 years ago • 2 comments

When the viewport's parent scale is not 1, the input distance calculations are off.

For example, my current game uses a viewport within a scaled region. The drags are not scaled down to account for the parent's scale.

davidfig avatar May 12 '18 03:05 davidfig

Is there any way to fix this?

eranimo avatar Sep 02 '18 04:09 eranimo

There's always a way to fix things :smile: I decided to work around it last time instead of fixing it because of my schedule.

The right way to fix it would be to apply the worldtransform of the viewport in all viewport and input calculations (currently I cheat by using the scale and position). If done correctly, it would also support independent rotation of the viewport--something I'd also love to add a plugin (to support spinning while pinching).

Regrettably I don't have time right now, but I will add it to the list. and see if anyone else wants to take a shot.

davidfig avatar Sep 02 '18 04:09 davidfig