On Jun 7, 11:03 pm, philmaker <
philma...@gmail.com> wrote:
> I think you need to provide more information to get a good answer.
> Easel current only provides support for single touch - not multi-
> touch.
Sure, I understand about single touch.
I'm trying to implement something like a sketching program, where I
start with an empty canvas, touch and drag my finger and a rubber-band
line will follow my finger. When I raise my finger, the program draws
a line on the canvas. If I touch the line with my finger, it gets
selected and I can (for example) move it. And I want it to work with a
mouse inside of, say, FF on a PC, and with my finger on the iPad.
That's a really basic outline, and I've got this more or less working.
I'd written mouse Up / Down / Move handlers for a PC browser, then for
the iPad I did the following:
...
canvas.addEventListener( 'touchstart', onTouchDown, false );
canvas.addEventListener( 'touchend', onTouchUp, false );
canvas.addEventListener( 'touchmove', onTouchMove, false );
...
function onTouchDown( e ) {
var tEvent = e.touches.item(0);
onMouseDown( tEvent );
}
function onMouseDown( e ) { ... } // mouse handler for PC browser
...
function onTouchUp( e ) {
var tEvent = e.changedTouches.item(0);
onMouseUp( tEvent );
}
function onMouseUp( e ) { ... } // mouse handler for PC browser
...
function onTouchMove( e ) {
var tEvent = e.touches.item(0);
onMouseMove( tEvent );
}
function onMouseMove( e ) { ... } // mouse handler for PC browser
My question is, basically, is there a better way to do this with
EaselJS? This works, but it is not very responsive. Ie, the rubberband
line noticeably lags my finger motion.
I know that the most recent version of EaselJS has single touch
support, and I've seen how it's used in the drag-and-drop test program
(where handlers are added to each Shape). But I'd like to know if
there's a better way to do what I'm doing by attaching handlers to the
canvas.
Thanks,
Craig