Commit 5b42f83f authored by Ian Hickson's avatar Ian Hickson

Merge pull request #905 from Hixie/bindings

Rename Pointerer to Gesturer.
parents 53575aa7 d29970df
...@@ -16,7 +16,7 @@ import 'events.dart'; ...@@ -16,7 +16,7 @@ import 'events.dart';
import 'hit_test.dart'; import 'hit_test.dart';
import 'pointer_router.dart'; import 'pointer_router.dart';
abstract class Pointerer extends BindingBase implements HitTestTarget, HitTestable { abstract class Gesturer extends BindingBase implements HitTestTarget, HitTestable {
void initInstances() { void initInstances() {
super.initInstances(); super.initInstances();
...@@ -24,8 +24,8 @@ abstract class Pointerer extends BindingBase implements HitTestTarget, HitTestab ...@@ -24,8 +24,8 @@ abstract class Pointerer extends BindingBase implements HitTestTarget, HitTestab
ui.window.onPointerPacket = _handlePointerPacket; ui.window.onPointerPacket = _handlePointerPacket;
} }
static Pointerer _instance; static Gesturer _instance;
static Pointerer get instance => _instance; static Gesturer get instance => _instance;
void _handlePointerPacket(ByteData serializedPacket) { void _handlePointerPacket(ByteData serializedPacket) {
final mojo_bindings.Message message = new mojo_bindings.Message( final mojo_bindings.Message message = new mojo_bindings.Message(
......
...@@ -86,7 +86,7 @@ class _RenderSlider extends RenderConstrainedBox { ...@@ -86,7 +86,7 @@ class _RenderSlider extends RenderConstrainedBox {
_activeColor = activeColor, _activeColor = activeColor,
super(additionalConstraints: const BoxConstraints.tightFor(width: _kTrackWidth + 2 * _kReactionRadius, height: 2 * _kReactionRadius)) { super(additionalConstraints: const BoxConstraints.tightFor(width: _kTrackWidth + 2 * _kReactionRadius, height: 2 * _kReactionRadius)) {
assert(value != null && value >= 0.0 && value <= 1.0); assert(value != null && value >= 0.0 && value <= 1.0);
_drag = new HorizontalDragGestureRecognizer(router: Pointerer.instance.pointerRouter, gestureArena: Pointerer.instance.gestureArena) _drag = new HorizontalDragGestureRecognizer(router: Gesturer.instance.pointerRouter, gestureArena: Gesturer.instance.gestureArena)
..onStart = _handleDragStart ..onStart = _handleDragStart
..onUpdate = _handleDragUpdate ..onUpdate = _handleDragUpdate
..onEnd = _handleDragEnd; ..onEnd = _handleDragEnd;
......
...@@ -115,7 +115,7 @@ class _RenderSwitch extends RenderToggleable { ...@@ -115,7 +115,7 @@ class _RenderSwitch extends RenderToggleable {
) { ) {
_activeTrackColor = activeTrackColor; _activeTrackColor = activeTrackColor;
_inactiveTrackColor = inactiveTrackColor; _inactiveTrackColor = inactiveTrackColor;
_drag = new HorizontalDragGestureRecognizer(router: Pointerer.instance.pointerRouter, gestureArena: Pointerer.instance.gestureArena) _drag = new HorizontalDragGestureRecognizer(router: Gesturer.instance.pointerRouter, gestureArena: Gesturer.instance.gestureArena)
..onStart = _handleDragStart ..onStart = _handleDragStart
..onUpdate = _handleDragUpdate ..onUpdate = _handleDragUpdate
..onEnd = _handleDragEnd; ..onEnd = _handleDragEnd;
......
...@@ -29,7 +29,7 @@ abstract class RenderToggleable extends RenderConstrainedBox { ...@@ -29,7 +29,7 @@ abstract class RenderToggleable extends RenderConstrainedBox {
assert(value != null); assert(value != null);
assert(activeColor != null); assert(activeColor != null);
assert(inactiveColor != null); assert(inactiveColor != null);
_tap = new TapGestureRecognizer(router: Pointerer.instance.pointerRouter, gestureArena: Pointerer.instance.gestureArena) _tap = new TapGestureRecognizer(router: Gesturer.instance.pointerRouter, gestureArena: Gesturer.instance.gestureArena)
..onTapDown = _handleTapDown ..onTapDown = _handleTapDown
..onTap = _handleTap ..onTap = _handleTap
..onTapUp = _handleTapUp ..onTapUp = _handleTapUp
......
...@@ -85,7 +85,7 @@ void debugDumpLayerTree() { ...@@ -85,7 +85,7 @@ void debugDumpLayerTree() {
/// A concrete binding for applications that use the Rendering framework /// A concrete binding for applications that use the Rendering framework
/// directly. This is the glue that binds the framework to the Flutter engine. /// directly. This is the glue that binds the framework to the Flutter engine.
class RenderingFlutterBinding extends BindingBase with Scheduler, Renderer, Pointerer { class RenderingFlutterBinding extends BindingBase with Scheduler, Renderer, Gesturer {
RenderingFlutterBinding({ RenderBox root }) { RenderingFlutterBinding({ RenderBox root }) {
renderView.child = root; renderView.child = root;
} }
......
...@@ -20,7 +20,7 @@ class BindingObserver { ...@@ -20,7 +20,7 @@ class BindingObserver {
/// A concrete binding for applications based on the Widgets framework. /// A concrete binding for applications based on the Widgets framework.
/// This is the glue that binds the framework to the Flutter engine. /// This is the glue that binds the framework to the Flutter engine.
class WidgetFlutterBinding extends BindingBase with Scheduler, Pointerer, Renderer { class WidgetFlutterBinding extends BindingBase with Scheduler, Gesturer, Renderer {
WidgetFlutterBinding._(); WidgetFlutterBinding._();
......
...@@ -96,7 +96,7 @@ class Draggable<T> extends DraggableBase<T> { ...@@ -96,7 +96,7 @@ class Draggable<T> extends DraggableBase<T> {
GestureRecognizer createRecognizer(PointerRouter router, DragStartCallback starter) { GestureRecognizer createRecognizer(PointerRouter router, DragStartCallback starter) {
return new MultiTapGestureRecognizer( return new MultiTapGestureRecognizer(
router: router, router: router,
gestureArena: Pointerer.instance.gestureArena, gestureArena: Gesturer.instance.gestureArena,
onTapDown: starter onTapDown: starter
); );
} }
...@@ -123,7 +123,7 @@ class LongPressDraggable<T> extends DraggableBase<T> { ...@@ -123,7 +123,7 @@ class LongPressDraggable<T> extends DraggableBase<T> {
GestureRecognizer createRecognizer(PointerRouter router, DragStartCallback starter) { GestureRecognizer createRecognizer(PointerRouter router, DragStartCallback starter) {
return new MultiTapGestureRecognizer( return new MultiTapGestureRecognizer(
router: router, router: router,
gestureArena: Pointerer.instance.gestureArena, gestureArena: Gesturer.instance.gestureArena,
longTapDelay: kLongPressTimeout, longTapDelay: kLongPressTimeout,
onLongTapDown: (Point position, int pointer) { onLongTapDown: (Point position, int pointer) {
userFeedback.performHapticFeedback(HapticFeedbackType.VIRTUAL_KEY); userFeedback.performHapticFeedback(HapticFeedbackType.VIRTUAL_KEY);
...@@ -135,7 +135,7 @@ class LongPressDraggable<T> extends DraggableBase<T> { ...@@ -135,7 +135,7 @@ class LongPressDraggable<T> extends DraggableBase<T> {
class _DraggableState<T> extends State<DraggableBase<T>> implements GestureArenaMember { class _DraggableState<T> extends State<DraggableBase<T>> implements GestureArenaMember {
PointerRouter get router => Pointerer.instance.pointerRouter; PointerRouter get router => Gesturer.instance.pointerRouter;
void initState() { void initState() {
super.initState(); super.initState();
...@@ -146,7 +146,7 @@ class _DraggableState<T> extends State<DraggableBase<T>> implements GestureArena ...@@ -146,7 +146,7 @@ class _DraggableState<T> extends State<DraggableBase<T>> implements GestureArena
Map<int, GestureArenaEntry> _activePointers = <int, GestureArenaEntry>{}; Map<int, GestureArenaEntry> _activePointers = <int, GestureArenaEntry>{};
void _routePointer(PointerEvent event) { void _routePointer(PointerEvent event) {
_activePointers[event.pointer] = Pointerer.instance.gestureArena.add(event.pointer, this); _activePointers[event.pointer] = Gesturer.instance.gestureArena.add(event.pointer, this);
_recognizer.addPointer(event); _recognizer.addPointer(event);
} }
......
...@@ -121,7 +121,7 @@ class GestureDetector extends StatefulComponent { ...@@ -121,7 +121,7 @@ class GestureDetector extends StatefulComponent {
} }
class _GestureDetectorState extends State<GestureDetector> { class _GestureDetectorState extends State<GestureDetector> {
PointerRouter get _router => Pointerer.instance.pointerRouter; PointerRouter get _router => Gesturer.instance.pointerRouter;
TapGestureRecognizer _tap; TapGestureRecognizer _tap;
DoubleTapGestureRecognizer _doubleTap; DoubleTapGestureRecognizer _doubleTap;
...@@ -165,7 +165,7 @@ class _GestureDetectorState extends State<GestureDetector> { ...@@ -165,7 +165,7 @@ class _GestureDetectorState extends State<GestureDetector> {
if (config.onTapDown == null && config.onTapUp == null && config.onTap == null && config.onTapCancel == null) { if (config.onTapDown == null && config.onTapUp == null && config.onTap == null && config.onTapCancel == null) {
_tap = _ensureDisposed(_tap); _tap = _ensureDisposed(_tap);
} else { } else {
_tap ??= new TapGestureRecognizer(router: _router, gestureArena: Pointerer.instance.gestureArena); _tap ??= new TapGestureRecognizer(router: _router, gestureArena: Gesturer.instance.gestureArena);
_tap _tap
..onTapDown = config.onTapDown ..onTapDown = config.onTapDown
..onTapUp = config.onTapUp ..onTapUp = config.onTapUp
...@@ -178,7 +178,7 @@ class _GestureDetectorState extends State<GestureDetector> { ...@@ -178,7 +178,7 @@ class _GestureDetectorState extends State<GestureDetector> {
if (config.onDoubleTap == null) { if (config.onDoubleTap == null) {
_doubleTap = _ensureDisposed(_doubleTap); _doubleTap = _ensureDisposed(_doubleTap);
} else { } else {
_doubleTap ??= new DoubleTapGestureRecognizer(router: _router, gestureArena: Pointerer.instance.gestureArena); _doubleTap ??= new DoubleTapGestureRecognizer(router: _router, gestureArena: Gesturer.instance.gestureArena);
_doubleTap.onDoubleTap = config.onDoubleTap; _doubleTap.onDoubleTap = config.onDoubleTap;
} }
} }
...@@ -187,7 +187,7 @@ class _GestureDetectorState extends State<GestureDetector> { ...@@ -187,7 +187,7 @@ class _GestureDetectorState extends State<GestureDetector> {
if (config.onLongPress == null) { if (config.onLongPress == null) {
_longPress = _ensureDisposed(_longPress); _longPress = _ensureDisposed(_longPress);
} else { } else {
_longPress ??= new LongPressGestureRecognizer(router: _router, gestureArena: Pointerer.instance.gestureArena); _longPress ??= new LongPressGestureRecognizer(router: _router, gestureArena: Gesturer.instance.gestureArena);
_longPress.onLongPress = config.onLongPress; _longPress.onLongPress = config.onLongPress;
} }
} }
...@@ -196,7 +196,7 @@ class _GestureDetectorState extends State<GestureDetector> { ...@@ -196,7 +196,7 @@ class _GestureDetectorState extends State<GestureDetector> {
if (config.onVerticalDragStart == null && config.onVerticalDragUpdate == null && config.onVerticalDragEnd == null) { if (config.onVerticalDragStart == null && config.onVerticalDragUpdate == null && config.onVerticalDragEnd == null) {
_verticalDrag = _ensureDisposed(_verticalDrag); _verticalDrag = _ensureDisposed(_verticalDrag);
} else { } else {
_verticalDrag ??= new VerticalDragGestureRecognizer(router: _router, gestureArena: Pointerer.instance.gestureArena); _verticalDrag ??= new VerticalDragGestureRecognizer(router: _router, gestureArena: Gesturer.instance.gestureArena);
_verticalDrag _verticalDrag
..onStart = config.onVerticalDragStart ..onStart = config.onVerticalDragStart
..onUpdate = config.onVerticalDragUpdate ..onUpdate = config.onVerticalDragUpdate
...@@ -208,7 +208,7 @@ class _GestureDetectorState extends State<GestureDetector> { ...@@ -208,7 +208,7 @@ class _GestureDetectorState extends State<GestureDetector> {
if (config.onHorizontalDragStart == null && config.onHorizontalDragUpdate == null && config.onHorizontalDragEnd == null) { if (config.onHorizontalDragStart == null && config.onHorizontalDragUpdate == null && config.onHorizontalDragEnd == null) {
_horizontalDrag = _ensureDisposed(_horizontalDrag); _horizontalDrag = _ensureDisposed(_horizontalDrag);
} else { } else {
_horizontalDrag ??= new HorizontalDragGestureRecognizer(router: _router, gestureArena: Pointerer.instance.gestureArena); _horizontalDrag ??= new HorizontalDragGestureRecognizer(router: _router, gestureArena: Gesturer.instance.gestureArena);
_horizontalDrag _horizontalDrag
..onStart = config.onHorizontalDragStart ..onStart = config.onHorizontalDragStart
..onUpdate = config.onHorizontalDragUpdate ..onUpdate = config.onHorizontalDragUpdate
...@@ -221,7 +221,7 @@ class _GestureDetectorState extends State<GestureDetector> { ...@@ -221,7 +221,7 @@ class _GestureDetectorState extends State<GestureDetector> {
_pan = _ensureDisposed(_pan); _pan = _ensureDisposed(_pan);
} else { } else {
assert(_scale == null); // Scale is a superset of pan; just use scale assert(_scale == null); // Scale is a superset of pan; just use scale
_pan ??= new PanGestureRecognizer(router: _router, gestureArena: Pointerer.instance.gestureArena); _pan ??= new PanGestureRecognizer(router: _router, gestureArena: Gesturer.instance.gestureArena);
_pan _pan
..onStart = config.onPanStart ..onStart = config.onPanStart
..onUpdate = config.onPanUpdate ..onUpdate = config.onPanUpdate
...@@ -234,7 +234,7 @@ class _GestureDetectorState extends State<GestureDetector> { ...@@ -234,7 +234,7 @@ class _GestureDetectorState extends State<GestureDetector> {
_scale = _ensureDisposed(_scale); _scale = _ensureDisposed(_scale);
} else { } else {
assert(_pan == null); // Scale is a superset of pan; just use scale assert(_pan == null); // Scale is a superset of pan; just use scale
_scale ??= new ScaleGestureRecognizer(router: _router, gestureArena: Pointerer.instance.gestureArena); _scale ??= new ScaleGestureRecognizer(router: _router, gestureArena: Gesturer.instance.gestureArena);
_scale _scale
..onStart = config.onScaleStart ..onStart = config.onScaleStart
..onUpdate = config.onScaleUpdate ..onUpdate = config.onScaleUpdate
......
...@@ -25,7 +25,7 @@ enum EnginePhase { ...@@ -25,7 +25,7 @@ enum EnginePhase {
composite composite
} }
class TestRenderingFlutterBinding extends BindingBase with Scheduler, Renderer, Pointerer { class TestRenderingFlutterBinding extends BindingBase with Scheduler, Renderer, Gesturer {
void initRenderView() { void initRenderView() {
if (renderView == null) { if (renderView == null) {
renderView = new TestRenderView(); renderView = new TestRenderView();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment