The dx and dy properties of PointerInputEvents shouldn't be null

They should be 0.0 when there's no offset.

Fixes #1661
This commit is contained in:
Adam Barth 2015-10-19 09:37:20 -07:00
parent 284eaa9cd7
commit ccc98c8f41
2 changed files with 23 additions and 22 deletions

View File

@ -20,28 +20,28 @@ class PointerInputEvent extends InputEvent {
const PointerInputEvent({ const PointerInputEvent({
String type, String type,
double timeStamp: 0.0, double timeStamp: 0.0,
this.pointer, this.pointer: 0,
this.kind, this.kind,
this.x, this.x: 0.0,
this.y, this.y: 0.0,
this.dx, this.dx: 0.0,
this.dy, this.dy: 0.0,
this.buttons, this.buttons: 0,
this.down, this.down: false,
this.primary, this.primary: false,
this.obscured, this.obscured: false,
this.pressure, this.pressure: 0.0,
this.pressureMin, this.pressureMin: 0.0,
this.pressureMax, this.pressureMax: 0.0,
this.distance, this.distance: 0.0,
this.distanceMin, this.distanceMin: 0.0,
this.distanceMax, this.distanceMax: 0.0,
this.radiusMajor, this.radiusMajor: 0.0,
this.radiusMinor, this.radiusMinor: 0.0,
this.radiusMin, this.radiusMin: 0.0,
this.radiusMax, this.radiusMax: 0.0,
this.orientation, this.orientation: 0.0,
this.tilt this.tilt: 0.0
}) : super(type: type, timeStamp: timeStamp); }) : super(type: type, timeStamp: timeStamp);
final int pointer; final int pointer;

View File

@ -62,7 +62,8 @@ class _UiEventConverter {
Point position = new Point(event.x, event.y); Point position = new Point(event.x, event.y);
_PointerState state = _stateForPointer[event.pointer]; _PointerState state = _stateForPointer[event.pointer];
double dx, dy; double dx = 0.0;
double dy = 0.0;
switch (event.type) { switch (event.type) {
case 'pointerdown': case 'pointerdown':
if (state == null) { if (state == null) {