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
fc5832dc
Commit
fc5832dc
authored
Nov 13, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #355 from Hixie/tap-bugs
Fix tapcancel on slop.
parents
16471d92
c40cb176
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
4 deletions
+21
-4
arena.dart
packages/flutter/lib/src/gestures/arena.dart
+2
-3
recognizer.dart
packages/flutter/lib/src/gestures/recognizer.dart
+1
-1
tap.dart
packages/flutter/lib/src/gestures/tap.dart
+9
-0
tap_test.dart
packages/unit/test/gestures/tap_test.dart
+9
-0
No files found.
packages/flutter/lib/src/gestures/arena.dart
View file @
fc5832dc
...
...
@@ -146,8 +146,7 @@ class GestureArena {
}
else
{
assert
(
disposition
==
GestureDisposition
.
accepted
);
if
(
state
.
isOpen
)
{
if
(
state
.
eagerWinner
==
null
)
state
.
eagerWinner
=
member
;
state
.
eagerWinner
??=
member
;
}
else
{
_resolveInFavorOf
(
key
,
state
,
member
);
}
...
...
@@ -166,4 +165,4 @@ class GestureArena {
}
member
.
acceptGesture
(
key
);
}
}
\ No newline at end of file
}
packages/flutter/lib/src/gestures/recognizer.dart
View file @
fc5832dc
...
...
@@ -112,7 +112,7 @@ abstract class PrimaryPointerGestureRecognizer extends OneSequenceGestureRecogni
// TODO(abarth): Maybe factor the slop handling out into a separate class?
if
(
event
.
type
==
'pointermove'
&&
_getDistance
(
event
)
>
kTouchSlop
)
{
resolve
(
GestureDisposition
.
rejected
);
stopTrackingPointer
(
event
.
p
ointer
);
stopTrackingPointer
(
primaryP
ointer
);
}
else
{
handlePrimaryPointer
(
event
);
}
...
...
packages/flutter/lib/src/gestures/tap.dart
View file @
fc5832dc
...
...
@@ -43,6 +43,15 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
}
}
void
resolve
(
GestureDisposition
disposition
)
{
if
(
_wonArena
&&
disposition
==
GestureDisposition
.
rejected
)
{
if
(
onTapCancel
!=
null
)
onTapCancel
();
_reset
();
}
super
.
resolve
(
disposition
);
}
void
didExceedDeadline
()
{
_checkDown
();
}
...
...
packages/unit/test/gestures/tap_test.dart
View file @
fc5832dc
...
...
@@ -161,19 +161,28 @@ void main() {
tap
.
onTap
=
()
{
tapRecognized
=
true
;
};
bool
tapCanceled
=
false
;
tap
.
onTapCancel
=
()
{
tapCanceled
=
true
;
};
tap
.
addPointer
(
down3
);
GestureArena
.
instance
.
close
(
3
);
expect
(
tapRecognized
,
isFalse
);
expect
(
tapCanceled
,
isFalse
);
router
.
route
(
down3
);
expect
(
tapRecognized
,
isFalse
);
expect
(
tapCanceled
,
isFalse
);
router
.
route
(
move3
);
expect
(
tapRecognized
,
isFalse
);
expect
(
tapCanceled
,
isTrue
);
router
.
route
(
up3
);
expect
(
tapRecognized
,
isFalse
);
expect
(
tapCanceled
,
isTrue
);
GestureArena
.
instance
.
sweep
(
3
);
expect
(
tapRecognized
,
isFalse
);
expect
(
tapCanceled
,
isTrue
);
tap
.
dispose
();
});
...
...
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