Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1. support long press like flutter #23

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

imiskolee
Copy link

@imiskolee imiskolee commented May 27, 2021

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){});

@roipeker
Copy link
Owner

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?

@imiskolee
Copy link
Author

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

@roipeker
Copy link
Owner

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.

@imiskolee
Copy link
Author

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

@imiskolee
Copy link
Author

Hello, I am already finished it.

@imiskolee
Copy link
Author

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

@roipeker
Copy link
Owner

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

Copy link
Owner

@roipeker roipeker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, check the comments and give me your thoughts

lib/src/events/signal.dart Outdated Show resolved Hide resolved
EventSignal();
factory EventSignal.longPress(Duration duration,double distance) {
var signal = EventSignal<T>();
signal.configure[EventSignalConfKey.LongPressDuration] = duration;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another observation, even if the Duration type makes total sense in Dart/Flutter, GraphX is currently using double to express durations in the tween system and the "ticker" elapsed time since last frame ... ( 0.1 = 100 milliseconds). Just a thought, as that concept is taken from JS/AS3.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Duration is better on user side, maybe we can translate Duration to double ticks?

lib/src/events/mixins.dart Outdated Show resolved Hide resolved
Misko Lee and others added 2 commits June 1, 2021 18:08
…-support

# Conflicts:
#	CHANGELOG.md
#	README.md
#	example/lib/demos/simple_interactions/ui/my_button.dart
#	example/pubspec.yaml
#	example/readme.md
#	lib/src/display/display_object.dart
#	lib/src/events/mixins.dart
#	lib/src/render/graphics.dart
#	lib/src/tween/src/mixins/tweenable.dart
#	pubspec.lock
#	pubspec.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants