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
27b306a3
Unverified
Commit
27b306a3
authored
Jul 20, 2020
by
Jason Simmons
Committed by
GitHub
Jul 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track used Android pointer IDs and reuse IDs after a pointer is released (#61668)
parent
f8a82feb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
platform_views.dart
packages/flutter/lib/src/services/platform_views.dart
+10
-5
No files found.
packages/flutter/lib/src/services/platform_views.dart
View file @
27b306a3
...
...
@@ -495,6 +495,7 @@ class _AndroidMotionEventConverter {
<
int
,
AndroidPointerCoords
>{};
final
Map
<
int
,
AndroidPointerProperties
>
pointerProperties
=
<
int
,
AndroidPointerProperties
>{};
final
Set
<
int
>
usedAndroidPointerIds
=
<
int
>{};
Offset
Function
(
Offset
position
)
_pointTransformer
;
...
...
@@ -503,14 +504,18 @@ class _AndroidMotionEventConverter {
_pointTransformer
=
transformer
;
}
int
nextPointerId
=
0
;
int
downTimeMillis
;
void
handlePointerDownEvent
(
PointerDownEvent
event
)
{
if
(
nextPointerId
==
0
)
{
if
(
pointerProperties
.
isEmpty
)
{
downTimeMillis
=
event
.
timeStamp
.
inMilliseconds
;
}
pointerProperties
[
event
.
pointer
]
=
propertiesFor
(
event
,
nextPointerId
++);
int
androidPointerId
=
0
;
while
(
usedAndroidPointerIds
.
contains
(
androidPointerId
))
{
androidPointerId
++;
}
usedAndroidPointerIds
.
add
(
androidPointerId
);
pointerProperties
[
event
.
pointer
]
=
propertiesFor
(
event
,
androidPointerId
);
}
void
updatePointerPositions
(
PointerEvent
event
)
{
...
...
@@ -531,9 +536,9 @@ class _AndroidMotionEventConverter {
void
handlePointerUpEvent
(
PointerUpEvent
event
)
{
pointerPositions
.
remove
(
event
.
pointer
);
usedAndroidPointerIds
.
remove
(
pointerProperties
[
event
.
pointer
].
id
);
pointerProperties
.
remove
(
event
.
pointer
);
if
(
pointerProperties
.
isEmpty
)
{
nextPointerId
=
0
;
downTimeMillis
=
null
;
}
}
...
...
@@ -541,7 +546,7 @@ class _AndroidMotionEventConverter {
void
handlePointerCancelEvent
(
PointerCancelEvent
event
)
{
pointerPositions
.
clear
();
pointerProperties
.
clear
();
nextPointerId
=
0
;
usedAndroidPointerIds
.
clear
()
;
downTimeMillis
=
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