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
04ee7133
Commit
04ee7133
authored
Nov 03, 2015
by
Hixie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor cleanup in tap.dart
parent
c5a966c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
17 deletions
+19
-17
tap.dart
packages/flutter/lib/src/gestures/tap.dart
+19
-17
No files found.
packages/flutter/lib/src/gestures/tap.dart
View file @
04ee7133
...
...
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:ui'
as
ui
;
import
'dart:ui'
show
Point
,
Offset
;
import
'arena.dart'
;
import
'constants.dart'
;
...
...
@@ -11,8 +11,8 @@ import 'events.dart';
import
'pointer_router.dart'
;
import
'recognizer.dart'
;
typedef
void
GestureTapDownCallback
(
ui
.
Point
globalPosition
);
typedef
void
GestureTapUpCallback
(
ui
.
Point
globalPosition
);
typedef
void
GestureTapDownCallback
(
Point
globalPosition
);
typedef
void
GestureTapUpCallback
(
Point
globalPosition
);
typedef
void
GestureTapCallback
(
);
typedef
void
GestureTapCancelCallback
(
);
...
...
@@ -99,15 +99,15 @@ class _TapTracker {
_TapTracker
({
PointerInputEvent
event
,
this
.
entry
})
:
pointer
=
event
.
pointer
,
_initialPosition
=
event
.
position
,
_isTrackingPointer
=
false
{
_initialPosition
=
event
.
position
{
assert
(
event
.
type
==
'pointerdown'
);
}
final
int
pointer
;
GestureArenaEntry
entry
;
ui
.
Point
_initialPosition
;
bool
_isTrackingPointer
;
final
GestureArenaEntry
entry
;
final
Point
_initialPosition
;
bool
_isTrackingPointer
=
false
;
void
startTrackingPointer
(
PointerRouter
router
,
PointerRoute
route
)
{
if
(!
_isTrackingPointer
)
{
...
...
@@ -124,7 +124,7 @@ class _TapTracker {
}
bool
isWithinTolerance
(
PointerInputEvent
event
,
double
tolerance
)
{
ui
.
Offset
offset
=
event
.
position
-
_initialPosition
;
Offset
offset
=
event
.
position
-
_initialPosition
;
return
offset
.
distance
<=
tolerance
;
}
...
...
@@ -135,21 +135,23 @@ enum _TapResolution {
cancel
}
/// TapGesture represents a full gesture resulting from a single tap
///
sequence. Tap gestures are passive, meaning that they will not
///
pre-
empt any other arena member in play.
/// TapGesture represents a full gesture resulting from a single tap
sequence,
///
as part of a [MultiTapGestureRecognizer]. Tap gestures are passive, meaning
///
that they will not pre
empt any other arena member in play.
class
_TapGesture
extends
_TapTracker
{
_TapGesture
({
this
.
gestureRecognizer
,
PointerInputEvent
event
})
:
super
(
event:
event
)
{
entry
=
GestureArena
.
instance
.
add
(
event
.
pointer
,
gestureRecognizer
);
_TapGesture
({
MultiTapGestureRecognizer
gestureRecognizer
,
PointerInputEvent
event
})
:
gestureRecognizer
=
gestureRecognizer
,
super
(
event:
event
,
entry:
GestureArena
.
instance
.
add
(
event
.
pointer
,
gestureRecognizer
))
{
startTrackingPointer
(
gestureRecognizer
.
router
,
handleEvent
);
}
final
MultiTapGestureRecognizer
gestureRecognizer
;
bool
_wonArena
=
false
;
ui
.
Point
_finalPosition
;
Point
_finalPosition
;
void
handleEvent
(
PointerInputEvent
event
)
{
assert
(
event
.
pointer
==
pointer
);
...
...
@@ -231,7 +233,7 @@ class MultiTapGestureRecognizer extends GestureArenaMember {
_gestureMap
[
pointer
]?.
reject
();
}
void
_resolveTap
(
int
pointer
,
_TapResolution
resolution
,
ui
.
Point
globalPosition
)
{
void
_resolveTap
(
int
pointer
,
_TapResolution
resolution
,
Point
globalPosition
)
{
_gestureMap
.
remove
(
pointer
);
if
(
resolution
==
_TapResolution
.
tap
)
{
if
(
onTapUp
!=
null
)
...
...
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