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
a4a783b6
Commit
a4a783b6
authored
Nov 16, 2016
by
Adam Barth
Committed by
GitHub
Nov 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for pointer hover (#6884)
parent
15fb5c4c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
210 additions
and
39 deletions
+210
-39
engine.version
bin/internal/engine.version
+1
-1
touch_input.dart
examples/layers/raw/touch_input.dart
+3
-3
binding.dart
packages/flutter/lib/src/gestures/binding.dart
+1
-1
converter.dart
packages/flutter/lib/src/gestures/converter.dart
+121
-19
events.dart
packages/flutter/lib/src/gestures/events.dart
+79
-9
gesture_binding_test.dart
packages/flutter/test/gestures/gesture_binding_test.dart
+5
-5
test_pointer.dart
packages/flutter_test/lib/src/test_pointer.dart
+0
-1
No files found.
bin/internal/engine.version
View file @
a4a783b6
ce8b187914f599e8e579fab829671fb2f07064b
7
d1bc4c4850ee155430b3ff66609a22536404825
7
examples/layers/raw/touch_input.dart
View file @
a4a783b6
...
@@ -79,15 +79,15 @@ void beginFrame(Duration timeStamp) {
...
@@ -79,15 +79,15 @@ void beginFrame(Duration timeStamp) {
void
handlePointerDataPacket
(
ui
.
PointerDataPacket
packet
)
{
void
handlePointerDataPacket
(
ui
.
PointerDataPacket
packet
)
{
// The pointer packet contains a number of pointer movements, which we iterate
// The pointer packet contains a number of pointer movements, which we iterate
// through and process.
// through and process.
for
(
ui
.
PointerData
pointer
in
packet
.
pointers
)
{
for
(
ui
.
PointerData
datum
in
packet
.
data
)
{
if
(
pointer
.
change
==
ui
.
PointerChange
.
down
)
{
if
(
datum
.
change
==
ui
.
PointerChange
.
down
)
{
// If the pointer went down, we change the color of the circle to blue.
// If the pointer went down, we change the color of the circle to blue.
color
=
const
ui
.
Color
(
0xFF0000FF
);
color
=
const
ui
.
Color
(
0xFF0000FF
);
// Rather than calling paint() synchronously, we ask the engine to
// Rather than calling paint() synchronously, we ask the engine to
// schedule a frame. The engine will call onBeginFrame when it is actually
// schedule a frame. The engine will call onBeginFrame when it is actually
// time to produce the frame.
// time to produce the frame.
ui
.
window
.
scheduleFrame
();
ui
.
window
.
scheduleFrame
();
}
else
if
(
pointer
.
change
==
ui
.
PointerChange
.
up
)
{
}
else
if
(
datum
.
change
==
ui
.
PointerChange
.
up
)
{
// Similarly, if the pointer went up, we change the color of the circle to
// Similarly, if the pointer went up, we change the color of the circle to
// green and schedule a frame. It's harmless to call scheduleFrame many
// green and schedule a frame. It's harmless to call scheduleFrame many
// times because the engine will ignore redundant requests up until the
// times because the engine will ignore redundant requests up until the
...
...
packages/flutter/lib/src/gestures/binding.dart
View file @
a4a783b6
...
@@ -29,7 +29,7 @@ abstract class GestureBinding extends BindingBase implements HitTestable, HitTes
...
@@ -29,7 +29,7 @@ abstract class GestureBinding extends BindingBase implements HitTestable, HitTes
static
GestureBinding
_instance
;
static
GestureBinding
_instance
;
void
_handlePointerDataPacket
(
ui
.
PointerDataPacket
packet
)
{
void
_handlePointerDataPacket
(
ui
.
PointerDataPacket
packet
)
{
_pendingPointerEvents
.
addAll
(
PointerEventConverter
.
expand
(
packet
.
pointers
,
ui
.
window
.
devicePixelRatio
));
_pendingPointerEvents
.
addAll
(
PointerEventConverter
.
expand
(
packet
.
data
,
ui
.
window
.
devicePixelRatio
));
_flushPointerEventQueue
();
_flushPointerEventQueue
();
}
}
...
...
packages/flutter/lib/src/gestures/converter.dart
View file @
a4a783b6
...
@@ -36,6 +36,13 @@ class PointerEventConverter {
...
@@ -36,6 +36,13 @@ class PointerEventConverter {
// Map from platform pointer identifiers to PointerEvent pointer identifiers.
// Map from platform pointer identifiers to PointerEvent pointer identifiers.
static
Map
<
int
,
_PointerState
>
_pointers
=
<
int
,
_PointerState
>{};
static
Map
<
int
,
_PointerState
>
_pointers
=
<
int
,
_PointerState
>{};
static
_PointerState
_ensureStateForPointer
(
ui
.
PointerData
datum
,
Point
position
)
{
return
_pointers
.
putIfAbsent
(
datum
.
device
,
()
=>
new
_PointerState
(
position
)
);
}
/// Expand the given packet of pointer data into a sequence of framework pointer events.
/// Expand the given packet of pointer data into a sequence of framework pointer events.
static
Iterable
<
PointerEvent
>
expand
(
Iterable
<
ui
.
PointerData
>
data
,
double
devicePixelRatio
)
sync
*
{
static
Iterable
<
PointerEvent
>
expand
(
Iterable
<
ui
.
PointerData
>
data
,
double
devicePixelRatio
)
sync
*
{
for
(
ui
.
PointerData
datum
in
data
)
{
for
(
ui
.
PointerData
datum
in
data
)
{
...
@@ -43,19 +50,14 @@ class PointerEventConverter {
...
@@ -43,19 +50,14 @@ class PointerEventConverter {
final
Duration
timeStamp
=
datum
.
timeStamp
;
final
Duration
timeStamp
=
datum
.
timeStamp
;
final
PointerDeviceKind
kind
=
datum
.
kind
;
final
PointerDeviceKind
kind
=
datum
.
kind
;
switch
(
datum
.
change
)
{
switch
(
datum
.
change
)
{
case
ui
.
PointerChange
.
down
:
case
ui
.
PointerChange
.
add
:
assert
(!
_pointers
.
containsKey
(
datum
.
pointer
));
assert
(!
_pointers
.
containsKey
(
datum
.
device
));
_PointerState
state
=
_pointers
.
putIfAbsent
(
_PointerState
state
=
_ensureStateForPointer
(
datum
,
position
);
datum
.
pointer
,
()
=>
new
_PointerState
(
position
)
);
assert
(
state
.
lastPosition
==
position
);
assert
(
state
.
lastPosition
==
position
);
state
.
startNewPointer
();
state
.
setDown
();
yield
new
PointerAddedEvent
(
yield
new
PointerAddedEvent
(
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
state
.
pointer
,
kind:
kind
,
kind:
kind
,
device:
datum
.
device
,
position:
position
,
position:
position
,
obscured:
datum
.
obscured
,
obscured:
datum
.
obscured
,
pressureMin:
datum
.
pressureMin
,
pressureMin:
datum
.
pressureMin
,
...
@@ -67,10 +69,108 @@ class PointerEventConverter {
...
@@ -67,10 +69,108 @@ class PointerEventConverter {
orientation:
datum
.
orientation
,
orientation:
datum
.
orientation
,
tilt:
datum
.
tilt
tilt:
datum
.
tilt
);
);
break
;
case
ui
.
PointerChange
.
hover
:
final
bool
alreadyAdded
=
_pointers
.
containsKey
(
datum
.
device
);
_PointerState
state
=
_ensureStateForPointer
(
datum
,
position
);
assert
(!
state
.
down
);
if
(!
alreadyAdded
)
{
assert
(
state
.
lastPosition
==
position
);
yield
new
PointerAddedEvent
(
timeStamp:
timeStamp
,
kind:
kind
,
device:
datum
.
device
,
position:
position
,
obscured:
datum
.
obscured
,
pressureMin:
datum
.
pressureMin
,
pressureMax:
datum
.
pressureMax
,
distance:
datum
.
distance
,
distanceMax:
datum
.
distanceMax
,
radiusMin:
datum
.
radiusMin
,
radiusMax:
datum
.
radiusMax
,
orientation:
datum
.
orientation
,
tilt:
datum
.
tilt
);
}
Offset
offset
=
position
-
state
.
lastPosition
;
state
.
lastPosition
=
position
;
yield
new
PointerHoverEvent
(
timeStamp:
timeStamp
,
kind:
kind
,
device:
datum
.
device
,
position:
position
,
delta:
offset
,
buttons:
datum
.
buttons
,
obscured:
datum
.
obscured
,
pressureMin:
datum
.
pressureMin
,
pressureMax:
datum
.
pressureMax
,
distance:
datum
.
distance
,
distanceMax:
datum
.
distanceMax
,
radiusMajor:
datum
.
radiusMajor
,
radiusMinor:
datum
.
radiusMajor
,
radiusMin:
datum
.
radiusMin
,
radiusMax:
datum
.
radiusMax
,
orientation:
datum
.
orientation
,
tilt:
datum
.
tilt
);
state
.
lastPosition
=
position
;
break
;
case
ui
.
PointerChange
.
down
:
final
bool
alreadyAdded
=
_pointers
.
containsKey
(
datum
.
device
);
_PointerState
state
=
_ensureStateForPointer
(
datum
,
position
);
assert
(!
state
.
down
);
if
(!
alreadyAdded
)
{
assert
(
state
.
lastPosition
==
position
);
yield
new
PointerAddedEvent
(
timeStamp:
timeStamp
,
kind:
kind
,
device:
datum
.
device
,
position:
position
,
obscured:
datum
.
obscured
,
pressureMin:
datum
.
pressureMin
,
pressureMax:
datum
.
pressureMax
,
distance:
datum
.
distance
,
distanceMax:
datum
.
distanceMax
,
radiusMin:
datum
.
radiusMin
,
radiusMax:
datum
.
radiusMax
,
orientation:
datum
.
orientation
,
tilt:
datum
.
tilt
);
}
if
(
state
.
lastPosition
!=
position
)
{
// Not all sources of pointer packets respect the invariant that
// they hover the pointer to the down location before sending the
// down event. We restore the invariant here for our clients.
Offset
offset
=
position
-
state
.
lastPosition
;
state
.
lastPosition
=
position
;
yield
new
PointerHoverEvent
(
timeStamp:
timeStamp
,
kind:
kind
,
device:
datum
.
device
,
position:
position
,
delta:
offset
,
buttons:
datum
.
buttons
,
obscured:
datum
.
obscured
,
pressureMin:
datum
.
pressureMin
,
pressureMax:
datum
.
pressureMax
,
distance:
datum
.
distance
,
distanceMax:
datum
.
distanceMax
,
radiusMajor:
datum
.
radiusMajor
,
radiusMinor:
datum
.
radiusMajor
,
radiusMin:
datum
.
radiusMin
,
radiusMax:
datum
.
radiusMax
,
orientation:
datum
.
orientation
,
tilt:
datum
.
tilt
);
state
.
lastPosition
=
position
;
}
state
.
startNewPointer
();
state
.
setDown
();
yield
new
PointerDownEvent
(
yield
new
PointerDownEvent
(
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
state
.
pointer
,
pointer:
state
.
pointer
,
kind:
kind
,
kind:
kind
,
device:
datum
.
device
,
position:
position
,
position:
position
,
buttons:
datum
.
buttons
,
buttons:
datum
.
buttons
,
obscured:
datum
.
obscured
,
obscured:
datum
.
obscured
,
...
@@ -90,8 +190,8 @@ class PointerEventConverter {
...
@@ -90,8 +190,8 @@ class PointerEventConverter {
// If the service starts supporting hover pointers, then it must also
// If the service starts supporting hover pointers, then it must also
// start sending us ADDED and REMOVED data points.
// start sending us ADDED and REMOVED data points.
// See also: https://github.com/flutter/flutter/issues/720
// See also: https://github.com/flutter/flutter/issues/720
assert
(
_pointers
.
containsKey
(
datum
.
pointer
));
assert
(
_pointers
.
containsKey
(
datum
.
device
));
_PointerState
state
=
_pointers
[
datum
.
pointer
];
_PointerState
state
=
_pointers
[
datum
.
device
];
assert
(
state
.
down
);
assert
(
state
.
down
);
Offset
offset
=
position
-
state
.
lastPosition
;
Offset
offset
=
position
-
state
.
lastPosition
;
state
.
lastPosition
=
position
;
state
.
lastPosition
=
position
;
...
@@ -99,15 +199,14 @@ class PointerEventConverter {
...
@@ -99,15 +199,14 @@ class PointerEventConverter {
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
state
.
pointer
,
pointer:
state
.
pointer
,
kind:
kind
,
kind:
kind
,
device:
datum
.
device
,
position:
position
,
position:
position
,
delta:
offset
,
delta:
offset
,
down:
state
.
down
,
buttons:
datum
.
buttons
,
buttons:
datum
.
buttons
,
obscured:
datum
.
obscured
,
obscured:
datum
.
obscured
,
pressure:
datum
.
pressure
,
pressure:
datum
.
pressure
,
pressureMin:
datum
.
pressureMin
,
pressureMin:
datum
.
pressureMin
,
pressureMax:
datum
.
pressureMax
,
pressureMax:
datum
.
pressureMax
,
distance:
datum
.
distance
,
distanceMax:
datum
.
distanceMax
,
distanceMax:
datum
.
distanceMax
,
radiusMajor:
datum
.
radiusMajor
,
radiusMajor:
datum
.
radiusMajor
,
radiusMinor:
datum
.
radiusMajor
,
radiusMinor:
datum
.
radiusMajor
,
...
@@ -119,8 +218,8 @@ class PointerEventConverter {
...
@@ -119,8 +218,8 @@ class PointerEventConverter {
break
;
break
;
case
ui
.
PointerChange
.
up
:
case
ui
.
PointerChange
.
up
:
case
ui
.
PointerChange
.
cancel
:
case
ui
.
PointerChange
.
cancel
:
assert
(
_pointers
.
containsKey
(
datum
.
pointer
));
assert
(
_pointers
.
containsKey
(
datum
.
device
));
_PointerState
state
=
_pointers
[
datum
.
pointer
];
_PointerState
state
=
_pointers
[
datum
.
device
];
assert
(
state
.
down
);
assert
(
state
.
down
);
if
(
position
!=
state
.
lastPosition
)
{
if
(
position
!=
state
.
lastPosition
)
{
// Not all sources of pointer packets respect the invariant that
// Not all sources of pointer packets respect the invariant that
...
@@ -134,15 +233,14 @@ class PointerEventConverter {
...
@@ -134,15 +233,14 @@ class PointerEventConverter {
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
state
.
pointer
,
pointer:
state
.
pointer
,
kind:
kind
,
kind:
kind
,
device:
datum
.
device
,
position:
position
,
position:
position
,
delta:
offset
,
delta:
offset
,
down:
state
.
down
,
buttons:
datum
.
buttons
,
buttons:
datum
.
buttons
,
obscured:
datum
.
obscured
,
obscured:
datum
.
obscured
,
pressure:
datum
.
pressure
,
pressure:
datum
.
pressure
,
pressureMin:
datum
.
pressureMin
,
pressureMin:
datum
.
pressureMin
,
pressureMax:
datum
.
pressureMax
,
pressureMax:
datum
.
pressureMax
,
distance:
datum
.
distance
,
distanceMax:
datum
.
distanceMax
,
distanceMax:
datum
.
distanceMax
,
radiusMajor:
datum
.
radiusMajor
,
radiusMajor:
datum
.
radiusMajor
,
radiusMinor:
datum
.
radiusMajor
,
radiusMinor:
datum
.
radiusMajor
,
...
@@ -160,6 +258,7 @@ class PointerEventConverter {
...
@@ -160,6 +258,7 @@ class PointerEventConverter {
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
state
.
pointer
,
pointer:
state
.
pointer
,
kind:
kind
,
kind:
kind
,
device:
datum
.
device
,
position:
position
,
position:
position
,
buttons:
datum
.
buttons
,
buttons:
datum
.
buttons
,
obscured:
datum
.
obscured
,
obscured:
datum
.
obscured
,
...
@@ -176,6 +275,7 @@ class PointerEventConverter {
...
@@ -176,6 +275,7 @@ class PointerEventConverter {
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
state
.
pointer
,
pointer:
state
.
pointer
,
kind:
kind
,
kind:
kind
,
device:
datum
.
device
,
position:
position
,
position:
position
,
buttons:
datum
.
buttons
,
buttons:
datum
.
buttons
,
obscured:
datum
.
obscured
,
obscured:
datum
.
obscured
,
...
@@ -189,10 +289,13 @@ class PointerEventConverter {
...
@@ -189,10 +289,13 @@ class PointerEventConverter {
tilt:
datum
.
tilt
tilt:
datum
.
tilt
);
);
}
}
_pointers
.
remove
(
datum
.
device
);
break
;
case
ui
.
PointerChange
.
remove
:
yield
new
PointerRemovedEvent
(
yield
new
PointerRemovedEvent
(
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
state
.
pointer
,
kind:
kind
,
kind:
kind
,
device:
datum
.
device
,
obscured:
datum
.
obscured
,
obscured:
datum
.
obscured
,
pressureMin:
datum
.
pressureMin
,
pressureMin:
datum
.
pressureMin
,
pressureMax:
datum
.
pressureMax
,
pressureMax:
datum
.
pressureMax
,
...
@@ -200,7 +303,6 @@ class PointerEventConverter {
...
@@ -200,7 +303,6 @@ class PointerEventConverter {
radiusMin:
datum
.
radiusMin
,
radiusMin:
datum
.
radiusMin
,
radiusMax:
datum
.
radiusMax
radiusMax:
datum
.
radiusMax
);
);
_pointers
.
remove
(
datum
.
pointer
);
break
;
break
;
default
:
default
:
// TODO(ianh): once https://github.com/flutter/flutter/issues/720 is
// TODO(ianh): once https://github.com/flutter/flutter/issues/720 is
...
...
packages/flutter/lib/src/gestures/events.dart
View file @
a4a783b6
...
@@ -76,6 +76,7 @@ abstract class PointerEvent {
...
@@ -76,6 +76,7 @@ abstract class PointerEvent {
this
.
timeStamp
:
Duration
.
ZERO
,
this
.
timeStamp
:
Duration
.
ZERO
,
this
.
pointer
:
0
,
this
.
pointer
:
0
,
this
.
kind
:
PointerDeviceKind
.
touch
,
this
.
kind
:
PointerDeviceKind
.
touch
,
this
.
device
:
0
,
this
.
position
:
Point
.
origin
,
this
.
position
:
Point
.
origin
,
this
.
delta
:
Offset
.
zero
,
this
.
delta
:
Offset
.
zero
,
this
.
buttons
:
0
,
this
.
buttons
:
0
,
...
@@ -103,6 +104,9 @@ abstract class PointerEvent {
...
@@ -103,6 +104,9 @@ abstract class PointerEvent {
/// The kind of input device for which the event was generated.
/// The kind of input device for which the event was generated.
final
PointerDeviceKind
kind
;
final
PointerDeviceKind
kind
;
/// Unique identifier for the pointing device, reused across interactions.
final
int
device
;
/// Coordinate of the position of the pointer, in logical pixels in the global
/// Coordinate of the position of the pointer, in logical pixels in the global
/// coordinate space.
/// coordinate space.
final
Point
position
;
final
Point
position
;
...
@@ -219,6 +223,7 @@ abstract class PointerEvent {
...
@@ -219,6 +223,7 @@ abstract class PointerEvent {
'timeStamp:
$timeStamp
, '
'timeStamp:
$timeStamp
, '
'pointer:
$pointer
, '
'pointer:
$pointer
, '
'kind:
$kind
, '
'kind:
$kind
, '
'device:
$device
, '
'position:
$position
, '
'position:
$position
, '
'delta:
$delta
, '
'delta:
$delta
, '
'buttons:
$buttons
, '
'buttons:
$buttons
, '
...
@@ -250,8 +255,8 @@ class PointerAddedEvent extends PointerEvent {
...
@@ -250,8 +255,8 @@ class PointerAddedEvent extends PointerEvent {
/// All of the argument must be non-null.
/// All of the argument must be non-null.
const
PointerAddedEvent
({
const
PointerAddedEvent
({
Duration
timeStamp:
Duration
.
ZERO
,
Duration
timeStamp:
Duration
.
ZERO
,
int
pointer:
0
,
PointerDeviceKind
kind:
PointerDeviceKind
.
touch
,
PointerDeviceKind
kind:
PointerDeviceKind
.
touch
,
int
device:
0
,
Point
position:
Point
.
origin
,
Point
position:
Point
.
origin
,
bool
obscured:
false
,
bool
obscured:
false
,
double
pressureMin:
1.0
,
double
pressureMin:
1.0
,
...
@@ -264,8 +269,8 @@ class PointerAddedEvent extends PointerEvent {
...
@@ -264,8 +269,8 @@ class PointerAddedEvent extends PointerEvent {
double
tilt:
0.0
double
tilt:
0.0
})
:
super
(
})
:
super
(
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
pointer
,
kind:
kind
,
kind:
kind
,
device:
device
,
position:
position
,
position:
position
,
obscured:
obscured
,
obscured:
obscured
,
pressureMin:
pressureMin
,
pressureMin:
pressureMin
,
...
@@ -289,8 +294,8 @@ class PointerRemovedEvent extends PointerEvent {
...
@@ -289,8 +294,8 @@ class PointerRemovedEvent extends PointerEvent {
/// All of the argument must be non-null.
/// All of the argument must be non-null.
const
PointerRemovedEvent
({
const
PointerRemovedEvent
({
Duration
timeStamp:
Duration
.
ZERO
,
Duration
timeStamp:
Duration
.
ZERO
,
int
pointer:
0
,
PointerDeviceKind
kind:
PointerDeviceKind
.
touch
,
PointerDeviceKind
kind:
PointerDeviceKind
.
touch
,
int
device:
0
,
bool
obscured:
false
,
bool
obscured:
false
,
double
pressureMin:
1.0
,
double
pressureMin:
1.0
,
double
pressureMax:
1.0
,
double
pressureMax:
1.0
,
...
@@ -299,8 +304,8 @@ class PointerRemovedEvent extends PointerEvent {
...
@@ -299,8 +304,8 @@ class PointerRemovedEvent extends PointerEvent {
double
radiusMax:
0.0
double
radiusMax:
0.0
})
:
super
(
})
:
super
(
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
pointer
,
kind:
kind
,
kind:
kind
,
device:
device
,
position:
null
,
position:
null
,
obscured:
obscured
,
obscured:
obscured
,
pressureMin:
pressureMin
,
pressureMin:
pressureMin
,
...
@@ -311,6 +316,57 @@ class PointerRemovedEvent extends PointerEvent {
...
@@ -311,6 +316,57 @@ class PointerRemovedEvent extends PointerEvent {
);
);
}
}
/// The pointer has moved with respect to the device while the pointer is not
/// in contact with the device.
///
/// See also:
///
/// * [PointerMoveEvent], which reports movement while the pointer is in
/// contact with the device.
class
PointerHoverEvent
extends
PointerEvent
{
/// Creates a pointer hover event.
///
/// All of the argument must be non-null.
const
PointerHoverEvent
({
Duration
timeStamp:
Duration
.
ZERO
,
PointerDeviceKind
kind:
PointerDeviceKind
.
touch
,
int
device:
0
,
Point
position:
Point
.
origin
,
Offset
delta:
Offset
.
zero
,
int
buttons:
0
,
bool
obscured:
false
,
double
pressureMin:
1.0
,
double
pressureMax:
1.0
,
double
distance:
0.0
,
double
distanceMax:
0.0
,
double
radiusMajor:
0.0
,
double
radiusMinor:
0.0
,
double
radiusMin:
0.0
,
double
radiusMax:
0.0
,
double
orientation:
0.0
,
double
tilt:
0.0
})
:
super
(
timeStamp:
timeStamp
,
kind:
kind
,
device:
device
,
position:
position
,
delta:
delta
,
buttons:
buttons
,
down:
false
,
obscured:
obscured
,
pressureMin:
pressureMin
,
pressureMax:
pressureMax
,
distance:
distance
,
distanceMax:
distanceMax
,
radiusMajor:
radiusMajor
,
radiusMinor:
radiusMinor
,
radiusMin:
radiusMin
,
radiusMax:
radiusMax
,
orientation:
orientation
,
tilt:
tilt
);
}
/// The pointer has made contact with the device.
/// The pointer has made contact with the device.
class
PointerDownEvent
extends
PointerEvent
{
class
PointerDownEvent
extends
PointerEvent
{
/// Creates a pointer down event.
/// Creates a pointer down event.
...
@@ -320,6 +376,7 @@ class PointerDownEvent extends PointerEvent {
...
@@ -320,6 +376,7 @@ class PointerDownEvent extends PointerEvent {
Duration
timeStamp:
Duration
.
ZERO
,
Duration
timeStamp:
Duration
.
ZERO
,
int
pointer:
0
,
int
pointer:
0
,
PointerDeviceKind
kind:
PointerDeviceKind
.
touch
,
PointerDeviceKind
kind:
PointerDeviceKind
.
touch
,
int
device:
0
,
Point
position:
Point
.
origin
,
Point
position:
Point
.
origin
,
int
buttons:
0
,
int
buttons:
0
,
bool
obscured:
false
,
bool
obscured:
false
,
...
@@ -337,6 +394,7 @@ class PointerDownEvent extends PointerEvent {
...
@@ -337,6 +394,7 @@ class PointerDownEvent extends PointerEvent {
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
pointer
,
pointer:
pointer
,
kind:
kind
,
kind:
kind
,
device:
device
,
position:
position
,
position:
position
,
buttons:
buttons
,
buttons:
buttons
,
down:
true
,
down:
true
,
...
@@ -355,7 +413,13 @@ class PointerDownEvent extends PointerEvent {
...
@@ -355,7 +413,13 @@ class PointerDownEvent extends PointerEvent {
);
);
}
}
/// The pointer has moved with respect to the device.
/// The pointer has moved with respect to the device while the pointer is in
/// contact with the device.
///
/// See also:
///
/// * [PointerHoverEvent], which reports movement while the pointer is not in
/// contact with the device.
class
PointerMoveEvent
extends
PointerEvent
{
class
PointerMoveEvent
extends
PointerEvent
{
/// Creates a pointer move event.
/// Creates a pointer move event.
///
///
...
@@ -364,15 +428,14 @@ class PointerMoveEvent extends PointerEvent {
...
@@ -364,15 +428,14 @@ class PointerMoveEvent extends PointerEvent {
Duration
timeStamp:
Duration
.
ZERO
,
Duration
timeStamp:
Duration
.
ZERO
,
int
pointer:
0
,
int
pointer:
0
,
PointerDeviceKind
kind:
PointerDeviceKind
.
touch
,
PointerDeviceKind
kind:
PointerDeviceKind
.
touch
,
int
device:
0
,
Point
position:
Point
.
origin
,
Point
position:
Point
.
origin
,
Offset
delta:
Offset
.
zero
,
Offset
delta:
Offset
.
zero
,
int
buttons:
0
,
int
buttons:
0
,
bool
down:
false
,
bool
obscured:
false
,
bool
obscured:
false
,
double
pressure:
1.0
,
double
pressure:
1.0
,
double
pressureMin:
1.0
,
double
pressureMin:
1.0
,
double
pressureMax:
1.0
,
double
pressureMax:
1.0
,
double
distance:
0.0
,
double
distanceMax:
0.0
,
double
distanceMax:
0.0
,
double
radiusMajor:
0.0
,
double
radiusMajor:
0.0
,
double
radiusMinor:
0.0
,
double
radiusMinor:
0.0
,
...
@@ -384,15 +447,16 @@ class PointerMoveEvent extends PointerEvent {
...
@@ -384,15 +447,16 @@ class PointerMoveEvent extends PointerEvent {
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
pointer
,
pointer:
pointer
,
kind:
kind
,
kind:
kind
,
device:
device
,
position:
position
,
position:
position
,
delta:
delta
,
delta:
delta
,
buttons:
buttons
,
buttons:
buttons
,
down:
down
,
down:
true
,
obscured:
obscured
,
obscured:
obscured
,
pressure:
pressure
,
pressure:
pressure
,
pressureMin:
pressureMin
,
pressureMin:
pressureMin
,
pressureMax:
pressureMax
,
pressureMax:
pressureMax
,
distance:
distance
,
distance:
0.0
,
distanceMax:
distanceMax
,
distanceMax:
distanceMax
,
radiusMajor:
radiusMajor
,
radiusMajor:
radiusMajor
,
radiusMinor:
radiusMinor
,
radiusMinor:
radiusMinor
,
...
@@ -412,6 +476,7 @@ class PointerUpEvent extends PointerEvent {
...
@@ -412,6 +476,7 @@ class PointerUpEvent extends PointerEvent {
Duration
timeStamp:
Duration
.
ZERO
,
Duration
timeStamp:
Duration
.
ZERO
,
int
pointer:
0
,
int
pointer:
0
,
PointerDeviceKind
kind:
PointerDeviceKind
.
touch
,
PointerDeviceKind
kind:
PointerDeviceKind
.
touch
,
int
device:
0
,
Point
position:
Point
.
origin
,
Point
position:
Point
.
origin
,
int
buttons:
0
,
int
buttons:
0
,
bool
obscured:
false
,
bool
obscured:
false
,
...
@@ -427,8 +492,10 @@ class PointerUpEvent extends PointerEvent {
...
@@ -427,8 +492,10 @@ class PointerUpEvent extends PointerEvent {
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
pointer
,
pointer:
pointer
,
kind:
kind
,
kind:
kind
,
device:
device
,
position:
position
,
position:
position
,
buttons:
buttons
,
buttons:
buttons
,
down:
false
,
obscured:
obscured
,
obscured:
obscured
,
pressureMin:
pressureMin
,
pressureMin:
pressureMin
,
pressureMax:
pressureMax
,
pressureMax:
pressureMax
,
...
@@ -450,6 +517,7 @@ class PointerCancelEvent extends PointerEvent {
...
@@ -450,6 +517,7 @@ class PointerCancelEvent extends PointerEvent {
Duration
timeStamp:
Duration
.
ZERO
,
Duration
timeStamp:
Duration
.
ZERO
,
int
pointer:
0
,
int
pointer:
0
,
PointerDeviceKind
kind:
PointerDeviceKind
.
touch
,
PointerDeviceKind
kind:
PointerDeviceKind
.
touch
,
int
device:
0
,
Point
position:
Point
.
origin
,
Point
position:
Point
.
origin
,
int
buttons:
0
,
int
buttons:
0
,
bool
obscured:
false
,
bool
obscured:
false
,
...
@@ -465,8 +533,10 @@ class PointerCancelEvent extends PointerEvent {
...
@@ -465,8 +533,10 @@ class PointerCancelEvent extends PointerEvent {
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
pointer
,
pointer:
pointer
,
kind:
kind
,
kind:
kind
,
device:
device
,
position:
position
,
position:
position
,
buttons:
buttons
,
buttons:
buttons
,
down:
false
,
obscured:
obscured
,
obscured:
obscured
,
pressureMin:
pressureMin
,
pressureMin:
pressureMin
,
pressureMax:
pressureMax
,
pressureMax:
pressureMax
,
...
...
packages/flutter/test/gestures/gesture_binding_test.dart
View file @
a4a783b6
...
@@ -34,7 +34,7 @@ void main() {
...
@@ -34,7 +34,7 @@ void main() {
test
(
'Pointer tap events'
,
()
{
test
(
'Pointer tap events'
,
()
{
ui
.
PointerDataPacket
packet
=
new
ui
.
PointerDataPacket
(
ui
.
PointerDataPacket
packet
=
new
ui
.
PointerDataPacket
(
pointers
:
<
ui
.
PointerData
>[
data
:
<
ui
.
PointerData
>[
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
down
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
down
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
up
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
up
),
]
]
...
@@ -51,7 +51,7 @@ void main() {
...
@@ -51,7 +51,7 @@ void main() {
test
(
'Pointer move events'
,
()
{
test
(
'Pointer move events'
,
()
{
ui
.
PointerDataPacket
packet
=
new
ui
.
PointerDataPacket
(
ui
.
PointerDataPacket
packet
=
new
ui
.
PointerDataPacket
(
pointers
:
<
ui
.
PointerData
>[
data
:
<
ui
.
PointerData
>[
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
down
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
down
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
move
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
move
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
up
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
up
),
...
@@ -70,7 +70,7 @@ void main() {
...
@@ -70,7 +70,7 @@ void main() {
test
(
'Synthetic move events'
,
()
{
test
(
'Synthetic move events'
,
()
{
ui
.
PointerDataPacket
packet
=
new
ui
.
PointerDataPacket
(
ui
.
PointerDataPacket
packet
=
new
ui
.
PointerDataPacket
(
pointers
:
<
ui
.
PointerData
>[
data
:
<
ui
.
PointerData
>[
new
ui
.
PointerData
(
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
down
,
change:
ui
.
PointerChange
.
down
,
physicalX:
1.0
,
physicalX:
1.0
,
...
@@ -97,7 +97,7 @@ void main() {
...
@@ -97,7 +97,7 @@ void main() {
test
(
'Pointer cancel events'
,
()
{
test
(
'Pointer cancel events'
,
()
{
ui
.
PointerDataPacket
packet
=
new
ui
.
PointerDataPacket
(
ui
.
PointerDataPacket
packet
=
new
ui
.
PointerDataPacket
(
pointers
:
<
ui
.
PointerData
>[
data
:
<
ui
.
PointerData
>[
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
down
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
down
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
cancel
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
cancel
),
]
]
...
@@ -114,7 +114,7 @@ void main() {
...
@@ -114,7 +114,7 @@ void main() {
test
(
'Can cancel pointers'
,
()
{
test
(
'Can cancel pointers'
,
()
{
ui
.
PointerDataPacket
packet
=
new
ui
.
PointerDataPacket
(
ui
.
PointerDataPacket
packet
=
new
ui
.
PointerDataPacket
(
pointers
:
<
ui
.
PointerData
>[
data
:
<
ui
.
PointerData
>[
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
down
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
down
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
up
),
new
ui
.
PointerData
(
change:
ui
.
PointerChange
.
up
),
]
]
...
...
packages/flutter_test/lib/src/test_pointer.dart
View file @
a4a783b6
...
@@ -66,7 +66,6 @@ class TestPointer {
...
@@ -66,7 +66,6 @@ class TestPointer {
return
new
PointerMoveEvent
(
return
new
PointerMoveEvent
(
timeStamp:
timeStamp
,
timeStamp:
timeStamp
,
pointer:
pointer
,
pointer:
pointer
,
down:
_isDown
,
position:
newLocation
,
position:
newLocation
,
delta:
delta
delta:
delta
);
);
...
...
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