graphx icon indicating copy to clipboard operation
graphx copied to clipboard

1. support long press like flutter

Open imiskolee opened this issue 4 years ago • 7 comments

What's this PR doing ?

#1. added new mouse event callback on DisplayObject called onLongPress.

how the new event longPress happed ?

yourdisplayobject.longPressDuration = Duration(seconds: 1.0);
yourdisplayobject.longPressDistance = 1.0;
yourdisplayobject.onLongPress((event){});

imiskolee avatar May 27 '21 12:05 imiskolee

First of all, thanks for the PR! As GraphX originally tries to adapt to the ActionScript experience, I have some doubts regarding this type of computed gestures should be in an external decorator class. As multitouch input is also missing, might be an interesting feature to revisit how this works.

Regarding the longPress signal, it would be great to be able to configure the threshold distance and duration, on demand, how do think that should look like?

roipeker avatar May 27 '21 14:05 roipeker

@roipeker Yes, we need configurable the duration and test distance. Maybe configure them on displayobject or others ?

imiskolee avatar May 28 '21 02:05 imiskolee

Might be. Although Im still unsure about the addition on DisplayObject for this "compound" gesture... as you might as well create a mixin, or extension to add this behavior on top of the current input signals for your specific objects. Too bad that we should stay "idiomatic" with the Signal callbacks, otherwise something like onLongPress(timeout, distance).add(callback) would be an interesting option to not bloat so much the current loong api available in displayObject.

roipeker avatar May 28 '21 03:05 roipeker

@roipeker yes, I am also think onLongPress(timeout, distance).add(callback) it's better solution. I will try it next a few days.

imiskolee avatar May 28 '21 12:05 imiskolee

Hello, I am already finished it.

imiskolee avatar May 31 '21 16:05 imiskolee

And more, I will start to multi-touch event next, did you have any ideas?

imiskolee avatar May 31 '21 16:05 imiskolee

No idea in particular to be honest. Might start from stage for the basics events: down, move, release for each touch id

roipeker avatar May 31 '21 17:05 roipeker