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
5e9b2fba
Commit
5e9b2fba
authored
Nov 02, 2015
by
Kris Giesing
Committed by
kgiesing
Nov 03, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Style pass on velocity tracker and event recorder
parent
24ea0f0d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
122 deletions
+137
-122
lsq_solver.dart
packages/flutter/lib/src/gestures/lsq_solver.dart
+58
-50
velocity_tracker.dart
packages/flutter/lib/src/gestures/velocity_tracker.dart
+69
-65
event_recorder.dart
packages/flutter/lib/src/widgets/event_recorder.dart
+10
-7
No files found.
packages/flutter/lib/src/gestures/lsq_solver.dart
View file @
5e9b2fba
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
"dart:math"
as
math
;
import
"dart:typed_data"
;
class
Vector
{
Vector
(
int
size
)
:
_offset
=
0
,
_length
=
size
,
_elem
=
new
Float64List
(
size
);
class
_
Vector
{
_
Vector
(
int
size
)
:
_offset
=
0
,
_length
=
size
,
_elem
ents
=
new
Float64List
(
size
);
Vector
.
fromValues
(
List
<
double
>
values
)
:
_offset
=
0
,
_length
=
values
.
length
,
_elem
=
values
;
_
Vector
.
fromValues
(
List
<
double
>
values
)
:
_offset
=
0
,
_length
=
values
.
length
,
_elem
ents
=
values
;
Vector
.
fromVOL
(
List
<
double
>
values
,
int
offset
,
int
length
)
:
_offset
=
offset
,
_length
=
length
,
_elem
=
values
;
_
Vector
.
fromVOL
(
List
<
double
>
values
,
int
offset
,
int
length
)
:
_offset
=
offset
,
_length
=
length
,
_elem
ents
=
values
;
int
get
length
=>
_length
;
operator
[](
int
i
)
=>
_elem
[
i
+
_offset
];
operator
[]=(
int
i
,
double
value
)
=>
_elem
[
i
+
_offset
]
=
value
;
operator
[](
int
i
)
=>
_elem
ents
[
i
+
_offset
];
operator
[]=(
int
i
,
double
value
)
=>
_elem
ents
[
i
+
_offset
]
=
value
;
operator
*(
Vector
a
)
{
operator
*(
_
Vector
a
)
{
double
result
=
0.0
;
for
(
int
i
=
0
;
i
<
_length
;
i
++)
{
result
+=
this
[
i
]
*
a
[
i
];
...
...
@@ -38,28 +42,32 @@ class Vector {
final
int
_offset
;
final
int
_length
;
final
List
<
double
>
_elem
;
final
List
<
double
>
_elem
ents
;
}
class
Matrix
{
Matrix
(
int
rows
,
int
cols
)
class
_
Matrix
{
_
Matrix
(
int
rows
,
int
cols
)
:
_rows
=
rows
,
_cols
=
cols
,
_elem
=
new
Float64List
(
rows
*
cols
);
_col
umn
s
=
cols
,
_elem
ents
=
new
Float64List
(
rows
*
cols
);
double
get
(
int
row
,
int
col
)
=>
_elem
[
row
*
_col
s
+
col
];
double
get
(
int
row
,
int
col
)
=>
_elem
ents
[
row
*
_column
s
+
col
];
void
set
(
int
row
,
int
col
,
double
value
)
{
_elem
[
row
*
_col
s
+
col
]
=
value
;
_elem
ents
[
row
*
_column
s
+
col
]
=
value
;
}
Vector
getRow
(
int
row
)
=>
new
Vector
.
fromVOL
(
_elem
,
row
*
_cols
,
_cols
);
_Vector
getRow
(
int
row
)
=>
new
_Vector
.
fromVOL
(
_elements
,
row
*
_columns
,
_columns
);
String
toString
()
{
String
result
=
""
;
for
(
int
i
=
0
;
i
<
_rows
;
i
++)
{
if
(
i
>
0
)
result
+=
"; "
;
for
(
int
j
=
0
;
j
<
_cols
;
j
++)
{
for
(
int
j
=
0
;
j
<
_col
umn
s
;
j
++)
{
if
(
j
>
0
)
result
+=
", "
;
result
+=
get
(
i
,
j
).
toString
();
...
...
@@ -69,8 +77,8 @@ class Matrix {
}
final
int
_rows
;
final
int
_cols
;
final
List
<
double
>
_elem
;
final
int
_col
umn
s
;
final
List
<
double
>
_elem
ents
;
}
class
PolynomialFit
{
...
...
@@ -99,10 +107,9 @@ class LeastSquaresSolver {
// Shorthands for the purpose of notation equivalence to original C++ code
final
int
m
=
x
.
length
;
final
int
n
=
degree
+
1
;
final
List
<
double
>
out_b
=
result
.
coefficients
;
// Expand the X vector to a matrix A, pre-multiplied by the weights.
Matrix
a
=
new
Matrix
(
n
,
m
);
_Matrix
a
=
new
_
Matrix
(
n
,
m
);
for
(
int
h
=
0
;
h
<
m
;
h
++)
{
a
.
set
(
0
,
h
,
w
[
h
]);
for
(
int
i
=
1
;
i
<
n
;
i
++)
{
...
...
@@ -113,15 +120,15 @@ class LeastSquaresSolver {
// Apply the Gram-Schmidt process to A to obtain its QR decomposition.
// Orthonormal basis, column-major ordVectorer.
Matrix
q
=
new
Matrix
(
n
,
m
);
_Matrix
q
=
new
_
Matrix
(
n
,
m
);
// Upper triangular matrix, row-major order.
Matrix
r
=
new
Matrix
(
n
,
n
);
_Matrix
r
=
new
_
Matrix
(
n
,
n
);
for
(
int
j
=
0
;
j
<
n
;
j
++)
{
for
(
int
h
=
0
;
h
<
m
;
h
++)
{
q
.
set
(
j
,
h
,
a
.
get
(
j
,
h
));
}
for
(
int
i
=
0
;
i
<
j
;
i
++)
{
double
dot
=
q
.
getRow
(
j
)
*
q
.
getRow
(
i
);
double
dot
=
q
.
getRow
(
j
)
*
q
.
getRow
(
i
);
for
(
int
h
=
0
;
h
<
m
;
h
++)
{
q
.
set
(
j
,
h
,
q
.
get
(
j
,
h
)
-
dot
*
q
.
get
(
i
,
h
));
}
...
...
@@ -133,56 +140,57 @@ class LeastSquaresSolver {
return
null
;
}
double
invNorm
=
1.0
/
norm
;
double
inv
erse
Norm
=
1.0
/
norm
;
for
(
int
h
=
0
;
h
<
m
;
h
++)
{
q
.
set
(
j
,
h
,
q
.
get
(
j
,
h
)
*
invNorm
);
q
.
set
(
j
,
h
,
q
.
get
(
j
,
h
)
*
inv
erse
Norm
);
}
for
(
int
i
=
0
;
i
<
n
;
i
++)
{
r
.
set
(
j
,
i
,
i
<
j
?
0.0
:
q
.
getRow
(
j
)
*
a
.
getRow
(
i
));
r
.
set
(
j
,
i
,
i
<
j
?
0.0
:
q
.
getRow
(
j
)
*
a
.
getRow
(
i
));
}
}
// Solve R B = Qt W Y to find B. This is easy because R is upper triangular.
// We just work from bottom-right to top-left calculating B's coefficients.
Vector
wy
=
new
Vector
(
m
);
_Vector
wy
=
new
_
Vector
(
m
);
for
(
int
h
=
0
;
h
<
m
;
h
++)
{
wy
[
h
]
=
y
[
h
]
*
w
[
h
];
}
for
(
int
i
=
n
;
i
--
!=
0
;)
{
out_b
[
i
]
=
q
.
getRow
(
i
)
*
wy
;
result
.
coefficients
[
i
]
=
q
.
getRow
(
i
)
*
wy
;
for
(
int
j
=
n
-
1
;
j
>
i
;
j
--)
{
out_b
[
i
]
-=
r
.
get
(
i
,
j
)
*
out_b
[
j
];
result
.
coefficients
[
i
]
-=
r
.
get
(
i
,
j
)
*
result
.
coefficients
[
j
];
}
out_b
[
i
]
/=
r
.
get
(
i
,
i
);
result
.
coefficients
[
i
]
/=
r
.
get
(
i
,
i
);
}
// Calculate the coefficient of determination as 1 - (SSerr / SStot) where
// SSerr is the residual sum of squares (variance of the error),
// and SStot is the total sum of squares (variance of the data) where each
// has been weighted.
double
ymean
=
0.0
;
// Calculate the coefficient of determination (confidence) as:
// 1 - (sumSquaredError / sumSquaredTotal)
// where sumSquaredError is the residual sum of squares (variance of the
// error), and sumSquaredTotal is the total sum of squares (variance of the
// data) where each has been weighted.
double
yMean
=
0.0
;
for
(
int
h
=
0
;
h
<
m
;
h
++)
{
y
m
ean
+=
y
[
h
];
y
M
ean
+=
y
[
h
];
}
y
m
ean
/=
m
;
y
M
ean
/=
m
;
double
s
ser
r
=
0.0
;
double
s
stot
=
0.0
;
double
s
umSquaredErro
r
=
0.0
;
double
s
umSquaredTotal
=
0.0
;
for
(
int
h
=
0
;
h
<
m
;
h
++)
{
double
err
=
y
[
h
]
-
out_b
[
0
];
double
err
=
y
[
h
]
-
result
.
coefficients
[
0
];
double
term
=
1.0
;
for
(
int
i
=
1
;
i
<
n
;
i
++)
{
term
*=
x
[
h
];
err
-=
term
*
out_b
[
i
];
err
-=
term
*
result
.
coefficients
[
i
];
}
s
ser
r
+=
w
[
h
]
*
w
[
h
]
*
err
*
err
;
double
v
=
y
[
h
]
-
y
m
ean
;
s
stot
+=
w
[
h
]
*
w
[
h
]
*
v
*
v
;
s
umSquaredErro
r
+=
w
[
h
]
*
w
[
h
]
*
err
*
err
;
double
v
=
y
[
h
]
-
y
M
ean
;
s
umSquaredTotal
+=
w
[
h
]
*
w
[
h
]
*
v
*
v
;
}
double
det
=
sstot
>
0.000001
?
1.0
-
(
sserr
/
sstot
)
:
1.0
;
result
.
confidence
=
det
;
result
.
confidence
=
sumSquaredTotal
>
0.000001
?
1.0
-
(
sumSquaredError
/
sumSquaredTotal
)
:
1.0
;
return
result
;
}
...
...
packages/flutter/lib/src/gestures/velocity_tracker.dart
View file @
5e9b2fba
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:ui'
as
ui
;
import
'lsq_solver.dart'
;
...
...
@@ -10,62 +14,62 @@ class GestureVelocity {
final
double
y
;
}
class
Estimator
{
class
_
Estimator
{
int
degree
;
double
time
;
List
<
double
>
x
coeff
;
List
<
double
>
y
coeff
;
List
<
double
>
x
Coefficients
;
List
<
double
>
y
Coefficients
;
double
confidence
;
String
toString
()
{
String
result
=
"Estimator(degree: "
+
degree
.
toString
();
result
+=
", time: "
+
time
.
toString
();
result
+=
", confidence: "
+
confidence
.
toString
();
result
+=
", x
coeff: "
+
(
new
Vector
.
fromValues
(
xcoeff
))
.
toString
();
result
+=
", y
coeff: "
+
(
new
Vector
.
fromValues
(
ycoeff
))
.
toString
();
result
+=
", x
Coefficients: "
+
xCoefficients
.
toString
();
result
+=
", y
Coefficients: "
+
yCoefficients
.
toString
();
return
result
;
}
}
abstract
class
VelocityTrackerStrategy
{
abstract
class
_
VelocityTrackerStrategy
{
void
addMovement
(
double
timeStamp
,
double
x
,
double
y
);
bool
getEstimator
(
Estimator
estimator
);
bool
getEstimator
(
_
Estimator
estimator
);
void
clear
();
}
enum
Weighting
{
WEIGHTING_NONE
,
WEIGHTING_DELTA
,
WEIGHTING_CENTRAL
,
WEIGHTING_RECENT
enum
_
Weighting
{
weightingNone
,
weightingDelta
,
weightingCentral
,
weightingRecent
}
class
Movement
{
double
event
_t
ime
=
0.0
;
class
_
Movement
{
double
event
T
ime
=
0.0
;
ui
.
Point
position
=
ui
.
Point
.
origin
;
}
class
LeastSquaresVelocityTrackerStrategy
extends
VelocityTrackerStrategy
{
class
_LeastSquaresVelocityTrackerStrategy
extends
_
VelocityTrackerStrategy
{
static
const
int
kHistorySize
=
20
;
static
const
int
kHorizonM
S
=
100
;
static
const
int
kHorizonM
illiseconds
=
100
;
LeastSquaresVelocityTrackerStrategy
(
this
.
degree
,
this
.
weighting
)
:
_index
=
0
,
_movements
=
new
List
<
Movement
>(
kHistorySize
);
_
LeastSquaresVelocityTrackerStrategy
(
this
.
degree
,
this
.
weighting
)
:
_index
=
0
,
_movements
=
new
List
<
_
Movement
>(
kHistorySize
);
final
int
degree
;
final
Weighting
weighting
;
final
List
<
Movement
>
_movements
;
final
_
Weighting
weighting
;
final
List
<
_
Movement
>
_movements
;
int
_index
;
void
addMovement
(
double
timeStamp
,
double
x
,
double
y
)
{
if
(++
_index
==
kHistorySize
)
_index
=
0
;
Movement
movement
=
_getMovement
(
_index
);
movement
.
event
_t
ime
=
timeStamp
;
_
Movement
movement
=
_getMovement
(
_index
);
movement
.
event
T
ime
=
timeStamp
;
movement
.
position
=
new
ui
.
Point
(
x
,
y
);
}
bool
getEstimator
(
Estimator
estimator
)
{
bool
getEstimator
(
_
Estimator
estimator
)
{
// Iterate over movement samples in reverse time order and collect samples.
List
<
double
>
x
=
new
List
<
double
>();
List
<
double
>
y
=
new
List
<
double
>();
...
...
@@ -73,12 +77,12 @@ class LeastSquaresVelocityTrackerStrategy extends VelocityTrackerStrategy {
List
<
double
>
time
=
new
List
<
double
>();
int
m
=
0
;
int
index
=
_index
;
Movement
newest_m
ovement
=
_getMovement
(
index
);
_Movement
newestM
ovement
=
_getMovement
(
index
);
do
{
Movement
movement
=
_getMovement
(
index
);
_
Movement
movement
=
_getMovement
(
index
);
double
age
=
newest
_movement
.
event_time
-
movement
.
event_t
ime
;
if
(
age
>
kHorizonM
S
)
double
age
=
newest
Movement
.
eventTime
-
movement
.
eventT
ime
;
if
(
age
>
kHorizonM
illiseconds
)
break
;
ui
.
Point
position
=
movement
.
position
;
...
...
@@ -104,9 +108,9 @@ class LeastSquaresVelocityTrackerStrategy extends VelocityTrackerStrategy {
LeastSquaresSolver
ySolver
=
new
LeastSquaresSolver
(
time
,
y
,
w
);
PolynomialFit
yFit
=
ySolver
.
solve
(
n
);
if
(
yFit
!=
null
)
{
estimator
.
x
coeff
=
xFit
.
coefficients
;
estimator
.
y
coeff
=
yFit
.
coefficients
;
estimator
.
time
=
newest
_movement
.
event_t
ime
;
estimator
.
x
Coefficients
=
xFit
.
coefficients
;
estimator
.
y
Coefficients
=
yFit
.
coefficients
;
estimator
.
time
=
newest
Movement
.
eventT
ime
;
estimator
.
degree
=
n
;
estimator
.
confidence
=
xFit
.
confidence
*
yFit
.
confidence
;
return
true
;
...
...
@@ -116,9 +120,9 @@ class LeastSquaresVelocityTrackerStrategy extends VelocityTrackerStrategy {
// No velocity data available for this pointer, but we do have its current
// position.
estimator
.
x
coeff
=
[
x
[
0
]
];
estimator
.
y
coeff
=
[
y
[
0
]
];
estimator
.
time
=
newest
_movement
.
event_t
ime
;
estimator
.
x
Coefficients
=
[
x
[
0
]
];
estimator
.
y
Coefficients
=
[
y
[
0
]
];
estimator
.
time
=
newest
Movement
.
eventT
ime
;
estimator
.
degree
=
0
;
estimator
.
confidence
=
1.0
;
return
true
;
...
...
@@ -130,7 +134,7 @@ class LeastSquaresVelocityTrackerStrategy extends VelocityTrackerStrategy {
double
_chooseWeight
(
int
index
)
{
switch
(
weighting
)
{
case
Weighting
.
WEIGHTING_DELTA
:
case
_Weighting
.
weightingDelta
:
// Weight points based on how much time elapsed between them and the next
// point so that points that "cover" a shorter time span are weighed less.
// delta 0ms: 0.5
...
...
@@ -138,61 +142,61 @@ class LeastSquaresVelocityTrackerStrategy extends VelocityTrackerStrategy {
if
(
index
==
_index
)
{
return
1.0
;
}
int
next
_i
ndex
=
(
index
+
1
)
%
kHistorySize
;
double
delta
_millis
=
_movements
[
next_index
].
event_t
ime
-
_movements
[
index
].
event
_t
ime
;
if
(
delta
_milli
s
<
0
)
int
next
I
ndex
=
(
index
+
1
)
%
kHistorySize
;
double
delta
Milliseconds
=
_movements
[
nextIndex
].
eventT
ime
-
_movements
[
index
].
event
T
ime
;
if
(
delta
Millisecond
s
<
0
)
return
0.5
;
if
(
delta
_milli
s
<
10
)
return
0.5
+
delta
_milli
s
*
0.05
;
if
(
delta
Millisecond
s
<
10
)
return
0.5
+
delta
Millisecond
s
*
0.05
;
return
1.0
;
case
Weighting
.
WEIGHTING_CENTRAL
:
case
_Weighting
.
weightingCentral
:
// Weight points based on their age, weighing very recent and very old
// points less.
// age 0ms: 0.5
// age 10ms: 1.0
// age 50ms: 1.0
// age 60ms: 0.5
double
age
_millis
=
_movements
[
_index
].
event_t
ime
-
_movements
[
index
].
event
_t
ime
;
if
(
age
_milli
s
<
0
)
double
age
Milliseconds
=
_movements
[
_index
].
eventT
ime
-
_movements
[
index
].
event
T
ime
;
if
(
age
Millisecond
s
<
0
)
return
0.5
;
if
(
age
_milli
s
<
10
)
return
0.5
+
age
_milli
s
*
0.05
;
if
(
age
_milli
s
<
50
)
if
(
age
Millisecond
s
<
10
)
return
0.5
+
age
Millisecond
s
*
0.05
;
if
(
age
Millisecond
s
<
50
)
return
1.0
;
if
(
age
_milli
s
<
60
)
return
0.5
+
(
60
-
age
_milli
s
)
*
0.05
;
if
(
age
Millisecond
s
<
60
)
return
0.5
+
(
60
-
age
Millisecond
s
)
*
0.05
;
return
0.5
;
case
Weighting
.
WEIGHTING_RECENT
:
case
_Weighting
.
weightingRecent
:
// Weight points based on their age, weighing older points less.
// age 0ms: 1.0
// age 50ms: 1.0
// age 100ms: 0.5
double
age
_millis
=
_movements
[
_index
].
event_t
ime
-
_movements
[
index
].
event
_t
ime
;
if
(
age
_milli
s
<
50
)
{
double
age
Milliseconds
=
_movements
[
_index
].
eventT
ime
-
_movements
[
index
].
event
T
ime
;
if
(
age
Millisecond
s
<
50
)
{
return
1.0
;
}
if
(
age
_milli
s
<
100
)
{
return
0.5
+
(
100
-
age
_milli
s
)
*
0.01
;
if
(
age
Millisecond
s
<
100
)
{
return
0.5
+
(
100
-
age
Millisecond
s
)
*
0.01
;
}
return
0.5
;
case
Weighting
.
WEIGHTING_NONE
:
case
_Weighting
.
weightingNone
:
default
:
return
1.0
;
}
}
Movement
_getMovement
(
int
i
)
{
Movement
result
=
_movements
[
i
];
_
Movement
_getMovement
(
int
i
)
{
_
Movement
result
=
_movements
[
i
];
if
(
result
==
null
)
{
result
=
new
Movement
();
result
=
new
_
Movement
();
_movements
[
i
]
=
result
;
}
return
result
;
...
...
@@ -206,7 +210,7 @@ class VelocityTracker {
VelocityTracker
()
:
_lastTimeStamp
=
0.0
,
_strategy
=
_createStrategy
();
double
_lastTimeStamp
;
VelocityTrackerStrategy
_strategy
;
_
VelocityTrackerStrategy
_strategy
;
void
addPosition
(
double
timeStamp
,
double
x
,
double
y
)
{
if
((
timeStamp
-
_lastTimeStamp
)
>=
kAssumePointerMoveStoppedTimeMs
)
...
...
@@ -216,19 +220,19 @@ class VelocityTracker {
}
GestureVelocity
getVelocity
()
{
Estimator
estimator
=
new
Estimator
();
_Estimator
estimator
=
new
_
Estimator
();
if
(
_strategy
.
getEstimator
(
estimator
)
&&
estimator
.
degree
>=
1
)
{
// convert from pixels/ms to pixels/s
return
new
GestureVelocity
(
isValid:
true
,
x:
estimator
.
x
coeff
[
1
]*
1000
,
y:
estimator
.
y
coeff
[
1
]*
1000
x:
estimator
.
x
Coefficients
[
1
]
*
1000
,
y:
estimator
.
y
Coefficients
[
1
]
*
1000
);
}
return
new
GestureVelocity
(
isValid:
false
,
x:
0.0
,
y:
0.0
);
}
static
VelocityTrackerStrategy
_createStrategy
()
{
return
new
LeastSquaresVelocityTrackerStrategy
(
2
,
Weighting
.
WEIGHTING_NONE
);
static
_
VelocityTrackerStrategy
_createStrategy
()
{
return
new
_LeastSquaresVelocityTrackerStrategy
(
2
,
_Weighting
.
weightingNone
);
}
}
packages/flutter/lib/src/widgets/event_recorder.dart
View file @
5e9b2fba
...
...
@@ -13,8 +13,14 @@ enum EventRecorderMode {
record
}
typedef
void
EventsReady
(
List
<
PointerInputEvent
>
events
);
typedef
void
EventsReady
Callback
(
List
<
PointerInputEvent
>
events
);
/// EventRecorder is a utility widget that allows input events occurring
/// on the child to be recorded. The widget is initially in the "stop" state
/// by default. When in the "record" state, all pointer input events
/// occurring on the child are recorded into a buffer. When the "stop" state
/// is entered again, the onEventsReady callback is invoked with a list of
/// the recorded events.
class
EventRecorder
extends
StatefulComponent
{
EventRecorder
({
Key
key
,
...
...
@@ -25,32 +31,29 @@ class EventRecorder extends StatefulComponent {
final
Widget
child
;
final
EventRecorderMode
mode
;
final
EventsReady
onEventsReady
;
final
EventsReady
Callback
onEventsReady
;
_EventRecorderState
createState
()
=>
new
_EventRecorderState
();
}
class
_EventRecorderState
extends
State
<
EventRecorder
>
{
EventRecorderMode
_mode
;
List
<
PointerInputEvent
>
_events
=
new
List
<
PointerInputEvent
>();
void
initState
()
{
super
.
initState
();
_mode
=
config
.
mode
;
}
void
didUpdateConfig
(
EventRecorder
oldConfig
)
{
if
(
_
mode
==
EventRecorderMode
.
record
&&
if
(
oldConfig
.
mode
==
EventRecorderMode
.
record
&&
config
.
mode
==
EventRecorderMode
.
stop
)
{
config
.
onEventsReady
(
_events
);
_events
.
clear
();
}
_mode
=
config
.
mode
;
}
void
_recordEvent
(
PointerInputEvent
event
)
{
if
(
_
mode
==
EventRecorderMode
.
record
)
{
if
(
config
.
mode
==
EventRecorderMode
.
record
)
{
_events
.
add
(
event
);
}
}
...
...
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