Scrolls should start immediately when possible

If there are no other gestures in the arena, we should kick off the scroll
gesture right away. This change pulled a refactoring of how we dispatch events
to Widgets. Now we dispatch events to Widgets interleaved with their associated
RenderObjects. (Previously we dispatched to all of the RenderObjects first.)
This commit is contained in:
Adam Barth
2015-08-28 22:53:02 -07:00
parent 4adf70215d
commit bef55951a5
15 changed files with 281 additions and 136 deletions

View File

@@ -1,5 +1,7 @@
import 'dart:sky' as sky;
export 'dart:sky' show Point;
class TestPointerEvent extends sky.PointerEvent {
TestPointerEvent({
this.type,
@@ -79,3 +81,60 @@ class TestGestureEvent extends sky.GestureEvent {
double velocityX;
double velocityY;
}
class TestPointer {
TestPointer([ this.pointer = 1 ]);
int pointer;
bool isDown = false;
sky.Point location;
sky.PointerEvent down([sky.Point newLocation = sky.Point.origin ]) {
assert(!isDown);
isDown = true;
location = newLocation;
return new TestPointerEvent(
type: 'pointerdown',
pointer: pointer,
x: location.x,
y: location.y
);
}
sky.PointerEvent move([sky.Point newLocation = sky.Point.origin ]) {
assert(isDown);
sky.Offset delta = newLocation - location;
location = newLocation;
return new TestPointerEvent(
type: 'pointermove',
pointer: pointer,
x: newLocation.x,
y: newLocation.y,
dx: delta.dx,
dy: delta.dy
);
}
sky.PointerEvent up() {
assert(isDown);
isDown = false;
return new TestPointerEvent(
type: 'pointerup',
pointer: pointer,
x: location.x,
y: location.y
);
}
sky.PointerEvent cancel() {
assert(isDown);
isDown = false;
return new TestPointerEvent(
type: 'pointercancel',
pointer: pointer,
x: location.x,
y: location.y
);
}
}