Closed sidesixmedia closed 12 years ago
Yes, it's in global (screen) coordinate space. Since I migrated from flash.display.DisplayObject to more abstract targets I'm also trying to get rid of unnecessary dependencies such as globalToLocal
and localToGlobal
(where possible). Location initially is calculated in global coordinate space, so just let it stay like this. Once you need to transform you can always do that. Also I bet you mostly need it it target.parent space, right?
So regarding Starling... Doesn't globalToLocal()
takes contentScaleFactor into account? Well anyhow, you could write some utility method that does all this calculations (you don't need these calculations often, so it's not a performance issue, right?). Also note that Starling's "global" is not really a "screen global coordinate space" (that's why I have this utility https://github.com/fljot/Gestouch/blob/master/src/org/gestouch/extensions/starling/StarlingUtils.as ), so you might also need to include this into your calculations.
And thank you.
Thanks, fljot. I didn't notice the StarlingUtils extension, but that will definitely come in handy. I realized my "Step 3" was due to an error in my own script, not Gestouch or Starling, so scratch that off the list too.
We've rolled our own gesture support before since the default Flash "swipe" recognition is so bad, but GesTouch takes things well beyond that.
Keep up the good work.
It seems like the Gesture.location parameter is always returned as a point in the global coordinate space rather than in the Gesture.target space. Is this intentional or am I misusing the interface somehow?
This makes Starling integration more complicated, especially because the contentScaleFactor is not taken into account when reporting the touch location. That means in order to use the Gesture.location value the developer must:
I realize these aren't necessarily the responsibility of the GesTouch engine, but it would be great to see a more straightforward way to benefit from the Gesture.location value.
Excellent work by the way!