events.dart 19.2 KB
Newer Older
Kris Giesing's avatar
Kris Giesing committed
1 2 3 4
// 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.

5
import 'dart:ui' show Offset, PointerDeviceKind;
6

7 8
import 'package:flutter/foundation.dart';

9
export 'dart:ui' show Offset, PointerDeviceKind;
10

11 12 13 14
/// The bit of [PointerEvent.buttons] that corresponds to the primary mouse button.
///
/// The primary mouse button is typically the left button on the top of the
/// mouse but can be reconfigured to be a different physical button.
15
const int kPrimaryMouseButton = 0x01;
16 17 18 19 20

/// The bit of [PointerEvent.buttons] that corresponds to the secondary mouse button.
///
/// The secondary mouse button is typically the right button on the top of the
/// mouse but can be reconfigured to be a different physical button.
21
const int kSecondaryMouseButton = 0x02;
22 23 24 25 26

/// The bit of [PointerEvent.buttons] that corresponds to the primary stylus button.
///
/// The primary stylus button is typically the top of the stylus and near the
/// tip but can be reconfigured to be a different physical button.
27
const int kPrimaryStylusButton = 0x02;
28 29 30 31 32 33

/// The bit of [PointerEvent.buttons] that corresponds to the middle mouse button.
///
/// The middle mouse button is typically between the left and right buttons on
/// the top of the mouse but can be reconfigured to be a different physical
/// button.
34
const int kMiddleMouseButton = 0x04;
35 36 37

/// The bit of [PointerEvent.buttons] that corresponds to the secondary stylus button.
///
38
/// The secondary stylus button is typically on the end of the stylus farthest
39
/// from the tip but can be reconfigured to be a different physical button.
40
const int kSecondaryStylusButton = 0x04;
41 42 43 44 45

/// The bit of [PointerEvent.buttons] that corresponds to the back mouse button.
///
/// The back mouse button is typically on the left side of the mouse but can be
/// reconfigured to be a different physical button.
46
const int kBackMouseButton = 0x08;
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69

/// The bit of [PointerEvent.buttons] that corresponds to the forward mouse button.
///
/// The forward mouse button is typically on the right side of the mouse but can
/// be reconfigured to be a different physical button.
const int kForwardMouseButton = 0x10;

/// The bit of [PointerEvent.buttons] that corresponds to the nth mouse button.
///
/// The number argument can be at most 62.
///
/// See [kPrimaryMouseButton], [kSecondaryMouseButton], [kMiddleMouseButton],
/// [kBackMouseButton], and [kForwardMouseButton] for semantic names for some
/// mouse buttons.
int nthMouseButton(int number) => (kPrimaryMouseButton << (number - 1)) & kMaxUnsignedSMI;

/// The bit of [PointerEvent.buttons] that corresponds to the nth stylus button.
///
/// The number argument can be at most 62.
///
/// See [kPrimaryStylusButton] and [kSecondaryStylusButton] for semantic names
/// for some stylus buttons.
int nthStylusButton(int number) => (kPrimaryStylusButton << (number - 1)) & kMaxUnsignedSMI;
70

Ian Hickson's avatar
Ian Hickson committed
71
/// Base class for touch, stylus, or mouse events.
72 73 74 75 76
///
/// Pointer events operate in the coordinate space of the screen, scaled to
/// logical pixels. Logical pixels approximate a grid with about 38 pixels per
/// centimeter, or 96 pixels per inch.
///
77
/// This allows gestures to be recognized independent of the precise hardware
78 79 80 81 82 83 84 85 86 87 88 89 90 91
/// characteristics of the device. In particular, features such as touch slop
/// (see [kTouchSlop]) can be defined in terms of roughly physical lengths so
/// that the user can shift their finger by the same distance on a high-density
/// display as on a low-resolution device.
///
/// For similar reasons, pointer events are not affected by any transforms in
/// the rendering layer. This means that deltas may need to be scaled before
/// being applied to movement within the rendering. For example, if a scrolling
/// list is shown scaled by 2x, the pointer deltas will have to be scaled by the
/// inverse amount if the list is to appear to scroll with the user's finger.
///
/// See also:
///
///  * [Window.devicePixelRatio], which defines the device's current resolution.
92
@immutable
Ian Hickson's avatar
Ian Hickson committed
93
abstract class PointerEvent {
94 95
  /// Abstract const constructor. This constructor enables subclasses to provide
  /// const constructors so that they can be used in const expressions.
Ian Hickson's avatar
Ian Hickson committed
96 97
  const PointerEvent({
    this.timeStamp: Duration.ZERO,
98
    this.pointer: 0,
Ian Hickson's avatar
Ian Hickson committed
99
    this.kind: PointerDeviceKind.touch,
100
    this.device: 0,
101
    this.position: Offset.zero,
Ian Hickson's avatar
Ian Hickson committed
102
    this.delta: Offset.zero,
103 104 105
    this.buttons: 0,
    this.down: false,
    this.obscured: false,
Ian Hickson's avatar
Ian Hickson committed
106 107 108
    this.pressure: 1.0,
    this.pressureMin: 1.0,
    this.pressureMax: 1.0,
109 110 111 112 113 114 115
    this.distance: 0.0,
    this.distanceMax: 0.0,
    this.radiusMajor: 0.0,
    this.radiusMinor: 0.0,
    this.radiusMin: 0.0,
    this.radiusMax: 0.0,
    this.orientation: 0.0,
116 117
    this.tilt: 0.0,
    this.synthesized: false,
Ian Hickson's avatar
Ian Hickson committed
118
  });
119

Ian Hickson's avatar
Ian Hickson committed
120 121 122 123
  /// Time of event dispatch, relative to an arbitrary timeline.
  final Duration timeStamp;

  /// Unique identifier for the pointer, not reused.
Kris Giesing's avatar
Kris Giesing committed
124
  final int pointer;
Ian Hickson's avatar
Ian Hickson committed
125 126 127 128

  /// The kind of input device for which the event was generated.
  final PointerDeviceKind kind;

129 130 131
  /// Unique identifier for the pointing device, reused across interactions.
  final int device;

Ian Hickson's avatar
Ian Hickson committed
132 133
  /// Coordinate of the position of the pointer, in logical pixels in the global
  /// coordinate space.
134
  final Offset position;
Ian Hickson's avatar
Ian Hickson committed
135 136 137 138 139 140 141 142 143

  /// Distance in logical pixels that the pointer moved since the last
  /// PointerMoveEvent. Always 0.0 for down, up, and cancel events.
  final Offset delta;

  /// Bit field using the *Button constants (primaryMouseButton,
  /// secondaryStylusButton, etc). For example, if this has the value 6 and the
  /// [kind] is [PointerDeviceKind.invertedStylus], then this indicates an
  /// upside-down stylus with both its primary and secondary buttons pressed.
Kris Giesing's avatar
Kris Giesing committed
144
  final int buttons;
Ian Hickson's avatar
Ian Hickson committed
145

146 147 148
  /// Set if the pointer is currently down. For touch and stylus pointers, this
  /// means the object (finger, pen) is in contact with the input surface. For
  /// mice, it means a button is pressed.
Kris Giesing's avatar
Kris Giesing committed
149
  final bool down;
Ian Hickson's avatar
Ian Hickson committed
150

151 152 153
  /// Set if an application from a different security domain is in any way
  /// obscuring this application's window. (Aspirational; not currently
  /// implemented.)
Kris Giesing's avatar
Kris Giesing committed
154
  final bool obscured;
Ian Hickson's avatar
Ian Hickson committed
155 156 157 158 159

  /// The pressure of the touch as a number ranging from 0.0, indicating a touch
  /// with no discernible pressure, to 1.0, indicating a touch with "normal"
  /// pressure, and possibly beyond, indicating a stronger touch. For devices
  /// that do not detect pressure (e.g. mice), returns 1.0.
Kris Giesing's avatar
Kris Giesing committed
160
  final double pressure;
Ian Hickson's avatar
Ian Hickson committed
161 162 163 164

  /// The minimum value that [pressure] can return for this pointer. For devices
  /// that do not detect pressure (e.g. mice), returns 1.0. This will always be
  /// a number less than or equal to 1.0.
Kris Giesing's avatar
Kris Giesing committed
165
  final double pressureMin;
Ian Hickson's avatar
Ian Hickson committed
166 167 168 169

  /// The maximum value that [pressure] can return for this pointer. For devices
  /// that do not detect pressure (e.g. mice), returns 1.0. This will always be
  /// a greater than or equal to 1.0.
Kris Giesing's avatar
Kris Giesing committed
170
  final double pressureMax;
Ian Hickson's avatar
Ian Hickson committed
171 172 173 174 175

  /// The distance of the detected object from the input surface (e.g. the
  /// distance of a stylus or finger from a touch screen), in arbitrary units on
  /// an arbitrary (not necessarily linear) scale. If the pointer is down, this
  /// is 0.0 by definition.
Kris Giesing's avatar
Kris Giesing committed
176
  final double distance;
Ian Hickson's avatar
Ian Hickson committed
177 178 179 180 181 182 183

  /// The minimum value that a distance can return for this pointer (always 0.0).
  final double distanceMin = 0.0;

  /// The maximum value that a distance can return for this pointer. If this
  /// input device cannot detect "hover touch" input events, then this will be
  /// 0.0.
Kris Giesing's avatar
Kris Giesing committed
184
  final double distanceMax;
Ian Hickson's avatar
Ian Hickson committed
185 186

  /// The radius of the contact ellipse along the major axis, in logical pixels.
Kris Giesing's avatar
Kris Giesing committed
187
  final double radiusMajor;
Ian Hickson's avatar
Ian Hickson committed
188 189

  /// The radius of the contact ellipse along the minor axis, in logical pixels.
Kris Giesing's avatar
Kris Giesing committed
190
  final double radiusMinor;
Ian Hickson's avatar
Ian Hickson committed
191 192 193

  /// The minimum value that could be reported for radiusMajor and radiusMinor
  /// for this pointer, in logical pixels.
Kris Giesing's avatar
Kris Giesing committed
194
  final double radiusMin;
Ian Hickson's avatar
Ian Hickson committed
195 196 197

  /// The minimum value that could be reported for radiusMajor and radiusMinor
  /// for this pointer, in logical pixels.
Kris Giesing's avatar
Kris Giesing committed
198
  final double radiusMax;
Ian Hickson's avatar
Ian Hickson committed
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224

  /// For PointerDeviceKind.touch events:
  ///
  /// The angle of the contact ellipse, in radius in the range:
  ///
  ///    -pi/2 < orientation <= pi/2
  ///
  /// ...giving the angle of the major axis of the ellipse with the y-axis
  /// (negative angles indicating an orientation along the top-left /
  /// bottom-right diagonal, positive angles indicating an orientation along the
  /// top-right / bottom-left diagonal, and zero indicating an orientation
  /// parallel with the y-axis).
  ///
  /// For PointerDeviceKind.stylus and PointerDeviceKind.invertedStylus events:
  ///
  /// The angle of the stylus, in radians in the range:
  ///
  ///    -pi < orientation <= pi
  ///
  /// ...giving the angle of the axis of the stylus projected onto the input
  /// surface, relative to the positive y-axis of that surface (thus 0.0
  /// indicates the stylus, if projected onto that surface, would go from the
  /// contact point vertically up in the positive y-axis direction, pi would
  /// indicate that the stylus would go down in the negative y-axis direction;
  /// pi/4 would indicate that the stylus goes up and to the right, -pi/2 would
  /// indicate that the stylus goes to the left, etc).
Kris Giesing's avatar
Kris Giesing committed
225 226
  final double orientation;

Ian Hickson's avatar
Ian Hickson committed
227 228 229 230 231 232 233 234 235 236 237
  /// For PointerDeviceKind.stylus and PointerDeviceKind.invertedStylus events:
  ///
  /// The angle of the stylus, in radians in the range:
  ///
  ///    0 <= tilt <= pi/2
  ///
  /// ...giving the angle of the axis of the stylus, relative to the axis
  /// perpendicular to the input surface (thus 0.0 indicates the stylus is
  /// orthogonal to the plane of the input surface, while pi/2 indicates that
  /// the stylus is flat on that surface).
  final double tilt;
238

239 240
  /// We occasionally synthesize PointerEvents that aren't exact translations
  /// of [ui.PointerData] from the engine to cover small cross-OS discrepancies
Ian Hickson's avatar
Ian Hickson committed
241
  /// in pointer behaviors.
242 243
  ///
  /// For instance, on end events, Android always drops any location changes
244
  /// that happened between its reporting intervals when emitting the end events.
245 246 247 248 249 250
  ///
  /// On iOS, minor incorrect location changes from the previous move events
  /// can be reported on end events. We synthesize a [PointerEvent] to cover
  /// the difference between the 2 events in that case.
  final bool synthesized;

251
  @override
Ian Hickson's avatar
Ian Hickson committed
252
  String toString() => '$runtimeType($position)';
253

254
  /// Returns a complete textual description of this event.
255
  String toStringFull() {
Ian Hickson's avatar
Ian Hickson committed
256 257 258 259
    return '$runtimeType('
             'timeStamp: $timeStamp, '
             'pointer: $pointer, '
             'kind: $kind, '
260
             'device: $device, '
Ian Hickson's avatar
Ian Hickson committed
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
             'position: $position, '
             'delta: $delta, '
             'buttons: $buttons, '
             'down: $down, '
             'obscured: $obscured, '
             'pressure: $pressure, '
             'pressureMin: $pressureMin, '
             'pressureMax: $pressureMax, '
             'distance: $distance, '
             'distanceMin: $distanceMin, '
             'distanceMax: $distanceMax, '
             'radiusMajor: $radiusMajor, '
             'radiusMinor: $radiusMinor, '
             'radiusMin: $radiusMin, '
             'radiusMax: $radiusMax, '
             'orientation: $orientation, '
277 278
             'tilt: $tilt, '
             'synthesized: $synthesized'
Ian Hickson's avatar
Ian Hickson committed
279
           ')';
280
  }
281
}
Ian Hickson's avatar
Ian Hickson committed
282

283 284 285 286
/// The device has started tracking the pointer.
///
/// For example, the pointer might be hovering above the device, having not yet
/// made contact with the surface of the device.
Ian Hickson's avatar
Ian Hickson committed
287
class PointerAddedEvent extends PointerEvent {
288 289 290
  /// Creates a pointer added event.
  ///
  /// All of the argument must be non-null.
Ian Hickson's avatar
Ian Hickson committed
291 292 293
  const PointerAddedEvent({
    Duration timeStamp: Duration.ZERO,
    PointerDeviceKind kind: PointerDeviceKind.touch,
294
    int device: 0,
295
    Offset position: Offset.zero,
Ian Hickson's avatar
Ian Hickson committed
296
    bool obscured: false,
297 298
    double pressureMin: 1.0,
    double pressureMax: 1.0,
Ian Hickson's avatar
Ian Hickson committed
299 300 301 302 303 304 305 306 307
    double distance: 0.0,
    double distanceMax: 0.0,
    double radiusMin: 0.0,
    double radiusMax: 0.0,
    double orientation: 0.0,
    double tilt: 0.0
  }) : super(
    timeStamp: timeStamp,
    kind: kind,
308
    device: device,
Ian Hickson's avatar
Ian Hickson committed
309 310 311 312 313 314 315 316 317 318 319 320 321
    position: position,
    obscured: obscured,
    pressureMin: pressureMin,
    pressureMax: pressureMax,
    distance: distance,
    distanceMax: distanceMax,
    radiusMin: radiusMin,
    radiusMax: radiusMax,
    orientation: orientation,
    tilt: tilt
  );
}

322 323 324 325
/// The device is no longer tracking the pointer.
///
/// For example, the pointer might have drifted out of the device's hover
/// detection range or might have been disconnected from the system entirely.
Ian Hickson's avatar
Ian Hickson committed
326
class PointerRemovedEvent extends PointerEvent {
327 328 329
  /// Creates a pointer removed event.
  ///
  /// All of the argument must be non-null.
Ian Hickson's avatar
Ian Hickson committed
330 331 332
  const PointerRemovedEvent({
    Duration timeStamp: Duration.ZERO,
    PointerDeviceKind kind: PointerDeviceKind.touch,
333
    int device: 0,
Ian Hickson's avatar
Ian Hickson committed
334
    bool obscured: false,
335 336
    double pressureMin: 1.0,
    double pressureMax: 1.0,
Ian Hickson's avatar
Ian Hickson committed
337 338 339 340 341 342
    double distanceMax: 0.0,
    double radiusMin: 0.0,
    double radiusMax: 0.0
  }) : super(
    timeStamp: timeStamp,
    kind: kind,
343
    device: device,
Ian Hickson's avatar
Ian Hickson committed
344 345 346 347 348 349 350 351 352 353
    position: null,
    obscured: obscured,
    pressureMin: pressureMin,
    pressureMax: pressureMax,
    distanceMax: distanceMax,
    radiusMin: radiusMin,
    radiusMax: radiusMax
  );
}

354 355 356 357 358 359 360 361 362 363 364 365 366 367 368
/// 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,
369
    Offset position: Offset.zero,
370 371 372 373 374 375 376 377 378 379 380 381
    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,
382 383
    double tilt: 0.0,
    bool synthesized: false,
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
  }) : 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,
402 403
    tilt: tilt,
    synthesized: synthesized,
404 405 406
  );
}

407
/// The pointer has made contact with the device.
Ian Hickson's avatar
Ian Hickson committed
408
class PointerDownEvent extends PointerEvent {
409 410 411
  /// Creates a pointer down event.
  ///
  /// All of the argument must be non-null.
Ian Hickson's avatar
Ian Hickson committed
412 413 414 415
  const PointerDownEvent({
    Duration timeStamp: Duration.ZERO,
    int pointer: 0,
    PointerDeviceKind kind: PointerDeviceKind.touch,
416
    int device: 0,
417
    Offset position: Offset.zero,
Ian Hickson's avatar
Ian Hickson committed
418 419
    int buttons: 0,
    bool obscured: false,
420 421 422
    double pressure: 1.0,
    double pressureMin: 1.0,
    double pressureMax: 1.0,
Ian Hickson's avatar
Ian Hickson committed
423 424 425 426 427 428 429 430 431 432 433
    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,
    pointer: pointer,
    kind: kind,
434
    device: device,
Ian Hickson's avatar
Ian Hickson committed
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
    position: position,
    buttons: buttons,
    down: true,
    obscured: obscured,
    pressure: pressure,
    pressureMin: pressureMin,
    pressureMax: pressureMax,
    distance: 0.0,
    distanceMax: distanceMax,
    radiusMajor: radiusMajor,
    radiusMinor: radiusMinor,
    radiusMin: radiusMin,
    radiusMax: radiusMax,
    orientation: orientation,
    tilt: tilt
  );
}

453 454 455 456 457 458 459
/// 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.
Ian Hickson's avatar
Ian Hickson committed
460
class PointerMoveEvent extends PointerEvent {
461 462 463
  /// Creates a pointer move event.
  ///
  /// All of the argument must be non-null.
Ian Hickson's avatar
Ian Hickson committed
464 465 466 467
  const PointerMoveEvent({
    Duration timeStamp: Duration.ZERO,
    int pointer: 0,
    PointerDeviceKind kind: PointerDeviceKind.touch,
468
    int device: 0,
469
    Offset position: Offset.zero,
Ian Hickson's avatar
Ian Hickson committed
470 471 472
    Offset delta: Offset.zero,
    int buttons: 0,
    bool obscured: false,
473 474 475
    double pressure: 1.0,
    double pressureMin: 1.0,
    double pressureMax: 1.0,
Ian Hickson's avatar
Ian Hickson committed
476 477 478 479 480 481
    double distanceMax: 0.0,
    double radiusMajor: 0.0,
    double radiusMinor: 0.0,
    double radiusMin: 0.0,
    double radiusMax: 0.0,
    double orientation: 0.0,
482 483
    double tilt: 0.0,
    bool synthesized: false,
Ian Hickson's avatar
Ian Hickson committed
484 485 486 487
  }) : super(
    timeStamp: timeStamp,
    pointer: pointer,
    kind: kind,
488
    device: device,
Ian Hickson's avatar
Ian Hickson committed
489 490 491
    position: position,
    delta: delta,
    buttons: buttons,
492
    down: true,
Ian Hickson's avatar
Ian Hickson committed
493 494 495 496
    obscured: obscured,
    pressure: pressure,
    pressureMin: pressureMin,
    pressureMax: pressureMax,
497
    distance: 0.0,
Ian Hickson's avatar
Ian Hickson committed
498 499 500 501 502 503
    distanceMax: distanceMax,
    radiusMajor: radiusMajor,
    radiusMinor: radiusMinor,
    radiusMin: radiusMin,
    radiusMax: radiusMax,
    orientation: orientation,
504 505
    tilt: tilt,
    synthesized: synthesized,
Ian Hickson's avatar
Ian Hickson committed
506 507 508
  );
}

509
/// The pointer has stopped making contact with the device.
Ian Hickson's avatar
Ian Hickson committed
510
class PointerUpEvent extends PointerEvent {
511 512 513
  /// Creates a pointer up event.
  ///
  /// All of the argument must be non-null.
Ian Hickson's avatar
Ian Hickson committed
514 515 516 517
  const PointerUpEvent({
    Duration timeStamp: Duration.ZERO,
    int pointer: 0,
    PointerDeviceKind kind: PointerDeviceKind.touch,
518
    int device: 0,
519
    Offset position: Offset.zero,
Ian Hickson's avatar
Ian Hickson committed
520 521
    int buttons: 0,
    bool obscured: false,
522 523
    double pressureMin: 1.0,
    double pressureMax: 1.0,
Ian Hickson's avatar
Ian Hickson committed
524 525 526 527 528 529 530 531 532 533
    double distance: 0.0,
    double distanceMax: 0.0,
    double radiusMin: 0.0,
    double radiusMax: 0.0,
    double orientation: 0.0,
    double tilt: 0.0
  }) : super(
    timeStamp: timeStamp,
    pointer: pointer,
    kind: kind,
534
    device: device,
Ian Hickson's avatar
Ian Hickson committed
535 536
    position: position,
    buttons: buttons,
537
    down: false,
Ian Hickson's avatar
Ian Hickson committed
538 539 540 541 542 543 544 545 546 547 548 549
    obscured: obscured,
    pressureMin: pressureMin,
    pressureMax: pressureMax,
    distance: distance,
    distanceMax: distanceMax,
    radiusMin: radiusMin,
    radiusMax: radiusMax,
    orientation: orientation,
    tilt: tilt
  );
}

550
/// The input from the pointer is no longer directed towards this receiver.
Ian Hickson's avatar
Ian Hickson committed
551
class PointerCancelEvent extends PointerEvent {
552 553 554
  /// Creates a pointer cancel event.
  ///
  /// All of the argument must be non-null.
Ian Hickson's avatar
Ian Hickson committed
555 556 557 558
  const PointerCancelEvent({
    Duration timeStamp: Duration.ZERO,
    int pointer: 0,
    PointerDeviceKind kind: PointerDeviceKind.touch,
559
    int device: 0,
560
    Offset position: Offset.zero,
Ian Hickson's avatar
Ian Hickson committed
561 562
    int buttons: 0,
    bool obscured: false,
563 564
    double pressureMin: 1.0,
    double pressureMax: 1.0,
Ian Hickson's avatar
Ian Hickson committed
565 566 567 568 569 570 571 572 573 574
    double distance: 0.0,
    double distanceMax: 0.0,
    double radiusMin: 0.0,
    double radiusMax: 0.0,
    double orientation: 0.0,
    double tilt: 0.0
  }) : super(
    timeStamp: timeStamp,
    pointer: pointer,
    kind: kind,
575
    device: device,
Ian Hickson's avatar
Ian Hickson committed
576 577
    position: position,
    buttons: buttons,
578
    down: false,
Ian Hickson's avatar
Ian Hickson committed
579 580 581 582 583 584 585 586 587 588 589
    obscured: obscured,
    pressureMin: pressureMin,
    pressureMax: pressureMax,
    distance: distance,
    distanceMax: distanceMax,
    radiusMin: radiusMin,
    radiusMax: radiusMax,
    orientation: orientation,
    tilt: tilt
  );
}