Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Side by Side Diff: sky/specs/pointer.md

Issue 901493005: Specs: dartification of gestures; move GestureManager from ApplicationDocument to Application; actu… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/specs/modules.md ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Pointer Events 1 Pointer Events
2 ============== 2 ==============
3 3
4 Scope 4 Scope
5 ----- 5 -----
6 6
7 The following input devices are supported by sky: 7 The following input devices are supported by sky:
8 - fingers on multitouch screens 8 - fingers on multitouch screens
9 - mice, including mouse wheels 9 - mice, including mouse wheels
10 - styluses on screens 10 - styluses on screens
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 337
338 338
339 TODO(ianh): add an API that exposes the currently existing pointers, 339 TODO(ianh): add an API that exposes the currently existing pointers,
340 so that you can determine e.g. if you have a mouse. 340 so that you can determine e.g. if you have a mouse.
341 341
342 Here are the class definitions for pointer events: 342 Here are the class definitions for pointer events:
343 343
344 ```dart 344 ```dart
345 enum PointerKind { touch, mouse, stylus, invertedStylus } 345 enum PointerKind { touch, mouse, stylus, invertedStylus }
346 346
347 abstract class PointerEvent extends Event { 347 abstract class PointerEvent<T> extends Event<T> {
348 PointerEvent({ bool bubbles, 348 PointerEvent({ this.pointer,
349 this.pointer,
350 this.kind, 349 this.kind,
351 this.x, this.y, 350 this.x, this.y,
352 this.dx: 0.0, this.dy: 0.0, 351 this.dx: 0.0, this.dy: 0.0,
353 this.buttons: 0, 352 this.buttons: 0,
354 this.down: false, 353 this.down: false,
355 this.primary: false, 354 this.primary: false,
356 this.obscured: false, 355 this.obscured: false,
357 this.pressure, this.minPressure, this.maxPressure, 356 this.pressure, this.minPressure, this.maxPressure,
358 this.distance, this.minDistance, this.maxDistance, 357 this.distance, this.minDistance, this.maxDistance,
359 this.radiusMajor, this.radiusMinor, this.minRadius, this.maxRad ius, 358 this.radiusMajor, this.radiusMinor, this.minRadius, this.maxRad ius,
360 this.orientation, this.tilt 359 this.orientation, this.tilt
361 }): super(bubbles: bubbles); 360 }): super();
362 361
363 final int pointer; 362 final int pointer;
364 final PointerKind kind; 363 final PointerKind kind;
365 final double x; // logical pixels 364 final double x; // logical pixels
366 final double y; // logical pixels 365 final double y; // logical pixels
367 final double dx; // logical pixels 366 final double dx; // logical pixels
368 final double dy; // logical pixels 367 final double dy; // logical pixels
369 368
370 final int buttons; // bit field 369 final int buttons; // bit field
371 static const int primaryMouseButton = 0x01; 370 static const int primaryMouseButton = 0x01;
(...skipping 28 matching lines...) Expand all
400 final double orientation; // radians // meaning is different for touch and sty lus/invertedStylus 399 final double orientation; // radians // meaning is different for touch and sty lus/invertedStylus
401 400
402 // if kind != stylus or invertedStylus, this is null 401 // if kind != stylus or invertedStylus, this is null
403 final double tilt; // radians 402 final double tilt; // radians
404 } 403 }
405 404
406 // the following uses proposed syntax from 405 // the following uses proposed syntax from
407 // https://code.google.com/p/dart/issues/detail?id=22274 406 // https://code.google.com/p/dart/issues/detail?id=22274
408 // to avoid duplicating that entire constructor up there 407 // to avoid duplicating that entire constructor up there
409 408
410 class PointerAddedEvent extends Event { 409 class PointerAddedEvent extends PointerEvent<Null> {
411 PointerAddedEvent = PointerEvent; 410 PointerAddedEvent = PointerEvent;
411 bool get bubbles => false;
412 } 412 }
413 413
414 class PointerRemovedEvent extends Event { 414 class PointerRemovedEvent extends PointerEvent<Null> {
415 PointerRemovedEvent = PointerEvent; 415 PointerRemovedEvent = PointerEvent;
416 bool get bubbles => false;
416 } 417 }
417 418
418 class PointerDownEvent extends Event { 419 class PointerDownEvent extends PointerEvent<List<EventTarget>> {
420 @override void init() { result = new List<EventTarget>(); }
419 PointerDownEvent = PointerEvent; 421 PointerDownEvent = PointerEvent;
422 bool get bubbles => true;
420 } 423 }
421 424
422 class PointerUpEvent extends Event { 425 class PointerUpEvent extends PointerEvent<Null> {
423 PointerUpEvent = PointerEvent; 426 PointerUpEvent = PointerEvent;
427 bool get bubbles => false;
424 } 428 }
425 429
426 class PointerMovedEvent extends Event { 430 class PointerMovedEvent extends PointerEvent<Null> {
427 PointerMovedEvent = PointerEvent; 431 PointerMovedEvent = PointerEvent;
432 bool get bubbles => false;
428 } 433 }
429 ``` 434 ```
430 435
431 Wheel events 436 Wheel events
432 ------------ 437 ------------
433 438
434 When a wheel input device is turned, a ``WheelEvent`` event that 439 When a wheel input device is turned, a ``WheelEvent`` event that
435 bubbles is fired at the application's document, with the following 440 doesn't bubble is fired at the application's document, with the
436 fields: 441 following fields:
437 442
438 wheel: an integer assigned to this wheel by the system. The 443 wheel: an integer assigned to this wheel by the system. The
439 same wheel on the same system must always be given 444 same wheel on the same system must always be given
440 the same ID. The primary wheel (e.g. the vertical 445 the same ID. The primary wheel (e.g. the vertical
441 wheel on a mouse) must be given ID 1. 446 wheel on a mouse) must be given ID 1.
442 447
443 delta: an floating point number representing the fraction of 448 delta: an floating point number representing the fraction of
444 the wheel that was turned, with positive numbers 449 the wheel that was turned, with positive numbers
445 representing a downward movement on vertical wheels, 450 representing a downward movement on vertical wheels,
446 rightward movement on horizontal wheels, and a 451 rightward movement on horizontal wheels, and a
447 clockwise movement on wheels with a user-facing side. 452 clockwise movement on wheels with a user-facing side.
448 453
449 Additionally, if the wheel is associated with a pointer (e.g. a mouse 454 Additionally, if the wheel is associated with a pointer (e.g. a mouse
450 wheel), the following fields must be present also: 455 wheel), the following fields must be present also:
451 456
452 pointer: the integer assigned to the pointer in its 457 pointer: the integer assigned to the pointer in its
453 ``PointerAddEvent`` event (see above). 458 ``PointerAddEvent`` event (see above).
454 459
455 x: x-position relative to the top-left corner of the 460 x: x-position relative to the top-left corner of the
456 display, in global layout coordinates 461 display, in global layout coordinates
457 462
458 y: x-position relative to the top-left corner of the 463 y: x-position relative to the top-left corner of the
459 display, in global layout coordinates 464 display, in global layout coordinates
460 465
461 Note: The only wheels that are supported are mouse wheels and physical 466 Note: The only wheels that are supported are mouse wheels and physical
462 dials. Track balls are not reported as mouse wheels. 467 dials. Track balls are not reported as mouse wheels.
463 468
464 ```dart 469 ```dart
465 abstract class WheelEvent extends Event { 470 class WheelEvent extends Event {
466 PointerEvent({ bool bubbles, 471 PointerEvent({ bool bubbles,
467 this.wheel, 472 this.wheel,
468 this.delta: 0.0, 473 this.delta: 0.0,
469 this.pointer, 474 this.pointer,
470 this.x, this.y, 475 this.x, this.y,
471 }): super(bubbles: bubbles); 476 }): super(bubbles: bubbles);
472 477
473 final int wheel; 478 final int wheel;
474 final double delta; // revolutions (or fractions thereof) 479 final double delta; // revolutions (or fractions thereof)
475 final int pointer; 480 final int pointer;
476 final double x; // logical pixels 481 final double x; // logical pixels
477 final double y; // logical pixels 482 final double y; // logical pixels
483
484 bool get bubbles => false;
478 } 485 }
479 ``` 486 ```
OLDNEW
« no previous file with comments | « sky/specs/modules.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698