Skip to main content
Known Participant
October 31, 2011
Question

override mouseEvent with TransformGestureEvent?

  • October 31, 2011
  • 1 reply
  • 847 views

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 has been closed for replies.

1 reply

Inspiring
October 31, 2011

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

timdiaconAuthor
Known Participant
October 31, 2011

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.

timdiaconAuthor
Known Participant
November 1, 2011

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.