Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
e1712cce
Unverified
Commit
e1712cce
authored
Nov 06, 2020
by
Tong Mu
Committed by
GitHub
Nov 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reland: Fix a multiple pointers bug
This relands #68587
parent
76784651
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
7 deletions
+74
-7
monodrag.dart
packages/flutter/lib/src/gestures/monodrag.dart
+2
-6
recognizer.dart
packages/flutter/lib/src/gestures/recognizer.dart
+1
-1
drag_test.dart
packages/flutter/test/gestures/drag_test.dart
+71
-0
No files found.
packages/flutter/lib/src/gestures/monodrag.dart
View file @
e1712cce
...
...
@@ -386,12 +386,8 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
void
_giveUpPointer
(
int
pointer
,
{
bool
reject
=
true
})
{
stopTrackingPointer
(
pointer
);
if
(
reject
)
{
if
(
_velocityTrackers
.
containsKey
(
pointer
))
{
_velocityTrackers
.
remove
(
pointer
);
resolvePointer
(
pointer
,
GestureDisposition
.
rejected
);
}
}
if
(
reject
)
resolvePointer
(
pointer
,
GestureDisposition
.
rejected
);
}
void
_checkDown
()
{
...
...
packages/flutter/lib/src/gestures/recognizer.dart
View file @
e1712cce
...
...
@@ -268,8 +268,8 @@ abstract class OneSequenceGestureRecognizer extends GestureRecognizer {
void
resolvePointer
(
int
pointer
,
GestureDisposition
disposition
)
{
final
GestureArenaEntry
?
entry
=
_entries
[
pointer
];
if
(
entry
!=
null
)
{
entry
.
resolve
(
disposition
);
_entries
.
remove
(
pointer
);
entry
.
resolve
(
disposition
);
}
}
...
...
packages/flutter/test/gestures/drag_test.dart
View file @
e1712cce
...
...
@@ -1151,4 +1151,75 @@ void main() {
logs
.
clear
();
},
);
testGesture
(
'On multiple pointers, the last tracking pointer can be rejected by [resolvePointer] when the '
'other pointer already accepted the VerticalDragGestureRecognizer'
,
(
GestureTester
tester
)
{
// Regressing test for https://github.com/flutter/flutter/issues/68373
final
List
<
String
>
logs
=
<
String
>[];
final
VerticalDragGestureRecognizer
drag
=
VerticalDragGestureRecognizer
()
..
onDown
=
(
DragDownDetails
details
)
{
logs
.
add
(
'downD'
);
}
..
onStart
=
(
DragStartDetails
details
)
{
logs
.
add
(
'startD'
);
}
..
onUpdate
=
(
DragUpdateDetails
details
)
{
logs
.
add
(
'updateD'
);
}
..
onEnd
=
(
DragEndDetails
details
)
{
logs
.
add
(
'endD'
);
}
..
onCancel
=
()
{
logs
.
add
(
'cancelD'
);
};
// Competitor
final
TapGestureRecognizer
tap
=
TapGestureRecognizer
()
..
onTapDown
=
(
TapDownDetails
details
)
{
logs
.
add
(
'downT'
);
}
..
onTapUp
=
(
TapUpDetails
details
)
{
logs
.
add
(
'upT'
);
}
..
onTapCancel
=
()
{};
addTearDown
(
tap
.
dispose
);
addTearDown
(
drag
.
dispose
);
final
TestPointer
pointer1
=
TestPointer
(
1
,
PointerDeviceKind
.
touch
);
final
TestPointer
pointer2
=
TestPointer
(
2
,
PointerDeviceKind
.
touch
);
final
TestPointer
pointer3
=
TestPointer
(
3
,
PointerDeviceKind
.
touch
);
final
TestPointer
pointer4
=
TestPointer
(
4
,
PointerDeviceKind
.
touch
);
final
PointerDownEvent
down1
=
pointer1
.
down
(
const
Offset
(
10.0
,
10.0
));
final
PointerDownEvent
down2
=
pointer2
.
down
(
const
Offset
(
11.0
,
11.0
));
final
PointerDownEvent
down3
=
pointer3
.
down
(
const
Offset
(
12.0
,
12.0
));
final
PointerDownEvent
down4
=
pointer4
.
down
(
const
Offset
(
13.0
,
13.0
));
tap
.
addPointer
(
down1
);
drag
.
addPointer
(
down1
);
tester
.
closeArena
(
pointer1
.
pointer
);
tester
.
route
(
down1
);
expect
(
logs
,
<
String
>[
'downD'
]);
logs
.
clear
();
tap
.
addPointer
(
down2
);
drag
.
addPointer
(
down2
);
tester
.
closeArena
(
pointer2
.
pointer
);
tester
.
route
(
down2
);
expect
(
logs
,
<
String
>[]);
tap
.
addPointer
(
down3
);
drag
.
addPointer
(
down3
);
tester
.
closeArena
(
pointer3
.
pointer
);
tester
.
route
(
down3
);
expect
(
logs
,
<
String
>[]);
drag
.
addPointer
(
down4
);
tester
.
closeArena
(
pointer4
.
pointer
);
tester
.
route
(
down4
);
expect
(
logs
,
<
String
>[
'startD'
]);
logs
.
clear
();
tester
.
route
(
pointer2
.
up
());
GestureBinding
.
instance
!.
gestureArena
.
sweep
(
pointer2
.
pointer
);
expect
(
logs
,
<
String
>[]);
tester
.
route
(
pointer4
.
cancel
());
expect
(
logs
,
<
String
>[]);
tester
.
route
(
pointer3
.
cancel
());
expect
(
logs
,
<
String
>[]);
tester
.
route
(
pointer1
.
cancel
());
expect
(
logs
,
<
String
>[
'endD'
]);
logs
.
clear
();
},
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment