Skip to main content
Known Participant
Oct 31, 2011 10:22 AM UTC
Question

override mouseEvent with TransformGestureEvent?

I'm creating a simple drawing app. I have a mouseEventListener attached to a sprite and when the user drags a finger over the screen it draws a line - simple enough. I have then added in a listener for the Zoom and Pan transformGestureEvents which in turn scales and pans the canvas as you would expect.

The issue I am having is when you perform zoom or pan gestures there seems to be a slight delay in registering the event which means whenever you pan or zoom you also get a little unwanted line drawn.

I've tried adding a check for event.phase.begin and then disabling the mouseEvent when that fires but the delay is still there and I get the unwanted line. My next plan is start with Multitouch.input type as TouchEvents rather than GestureEvents and then as soon as I detect more than one touch point I will switch to Gesture events disable the drawing and enable the zoom and pan.

This seems a little over complicated has anyone got any better ideas?

Thanks!

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

Inspiring
Oct 31, 2011 12:45 PM UTC

Have you tried adding event.stopImmediatePropagation() and event.stopPropagation() at the end of the event handlers?

Translate
timdiaconAuthor
Known Participant
Oct 31, 2011 12:55 PM UTC

Thanks for reply but I'm not quite sure how I would use that though.

My problem, I think, is the delay in the user touching the screen with a second finger, moving those fingers and then that being recognised as a gesture. During that brief time the movement of one finger triggers the mouseMove event.

Translate
timdiaconAuthor
Known Participant
Nov 1, 2011 10:22 AM UTC

little update.

In the end I have started the app with Multitouch.inputmode as TouchEvent and I am using the TouchStart and TouchMove instead of mouse events. Then as soon as I detect more than one touchPoint I switch to Multitouch.inputMode = Gesture, remove the previous touch listeners and add the relavent TransformGestureEvent listeners.

This approach works pretty well but would still be interested to hear if there is a better approach.

Translate