-
Notifications
You must be signed in to change notification settings - Fork 5
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
"squishy" drag 'n' drop of pieces already on the board #3
Comments
@csells this is a general problem about Draggables. You can use a slightly modified version of Draggable to solve this issue. Below is a ZeroDelayDraggableClass I am using which prevents "touch -> drag" delay you mentioned. class ZeroDelayDraggable extends Draggable<dynamic> {
_ZeroDelayDraggable({Tile dynamic, int maxSimultaneousDrags, Widget child, Widget feedback, DragAnchor dragAnchor, Widget childWhenDragging, VoidCallback onDragStarted, DraggableCanceledCallback onDraggableCanceled, DragEndCallback onDragEnd})
: super(data: data, maxSimultaneousDrags: maxSimultaneousDrags, child: child, feedback: feedback, dragAnchor: dragAnchor, childWhenDragging: childWhenDragging, onDragStarted: onDragStarted, onDraggableCanceled: onDraggableCanceled, onDragEnd: onDragEnd);
@override
MultiDragGestureRecognizer<MultiDragPointerState> createRecognizer(GestureMultiDragStartCallback onStart) {
return DelayedMultiDragGestureRecognizer(delay: Duration.zero)..onStart = onStart;
}
} |
Interesting. Can the same technique be used with a GestureDetector? |
There will be a delay if you use multiple gesture recognizers on top of each other. Here we got 2 objects fighting for gesture events. One is game board, one is the draggable on the game board. If you have only one gesture detecting widget, for example a SingleChildScrollView, there will be no delay recognizing the drag gesture. |
it feels like we're using touch-based d'n'd instead of mouse-based d'n'd which is intrinsically "squishy" as you have to move 5-10 pixels before a drag operation is registered and the piece is first moved.
The text was updated successfully, but these errors were encountered: