Pinch Zoom - constrain weirdness

SquareHeartSquareHeart Member, PRO Posts: 69
edited November -1 in Working with GS (Mac)
I've been trying to make a map for my game that can be drag scrolled and pinch zoomed.
I've got pretty close to getting the interaction right except for the pinch zoom.
so far I have:
2 hidden actors that constrain to both touch 1 and touch 2, I have an expression to get the distance between them.
that value is zeroed out on first touch of the two fingers - when you pinch in or out it'll return a positive or negative value. - this is where I'm currently stuck -
I have got this PinchZoom value and, In my mind - All I need to do is this expression to:

constrain -- MapSizeX to MapSizeX+(PinchZoom*.25)
constrain -- MapSizeY to MapSizeY+PinchZoom

so I have this - but what I'm finding is that the pinchzoom will continually add to X/Y values - so if you pinch in and hold, the map will continue to shrink - and if you pinch out and hold the map will grow continously also.
This I find odd behaviour for a constrain, or have I got the wrong end of the stick here:

As a stopgap I've stuck the constrains above in a timer that fires off every .05 secs - this fixes the problem but introduces jerky stepping as the map is scaled.

any tips? this has been a real bugger.
Sign In or Register to comment.