Commit 941d69db authored by Ian Hickson's avatar Ian Hickson

Merge pull request #2140 from Hixie/mutable-gesture-detector

Just-in-time mutations of GestureDetector
parents d1154c25 0df3730d
......@@ -6,6 +6,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.flutter.MaterialGallery" android:versionCode="1" android:versionName="0.0.1">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET"/>
<application android:icon="@mipmap/ic_launcher" android:label="Flutter Material" android:name="org.domokit.sky.shell.SkyApplication">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize" android:hardwareAccelerated="true" android:launchMode="singleTask" android:name="org.domokit.sky.shell.SkyActivity" android:theme="@android:style/Theme.Black.NoTitleBar">
......
......@@ -143,6 +143,8 @@ class VerticalDragGestureRecognizer extends _DragGestureRecognizer<double> {
double get _initialPendingDragDelta => 0.0;
double _getDragDelta(PointerEvent event) => event.delta.dy;
bool get _hasSufficientPendingDragDeltaToAccept => _pendingDragDelta.abs() > kTouchSlop;
String toStringShort() => 'vertical drag';
}
class HorizontalDragGestureRecognizer extends _DragGestureRecognizer<double> {
......@@ -163,6 +165,8 @@ class HorizontalDragGestureRecognizer extends _DragGestureRecognizer<double> {
double get _initialPendingDragDelta => 0.0;
double _getDragDelta(PointerEvent event) => event.delta.dx;
bool get _hasSufficientPendingDragDeltaToAccept => _pendingDragDelta.abs() > kTouchSlop;
String toStringShort() => 'horizontal drag';
}
class PanGestureRecognizer extends _DragGestureRecognizer<Offset> {
......@@ -185,4 +189,6 @@ class PanGestureRecognizer extends _DragGestureRecognizer<Offset> {
bool get _hasSufficientPendingDragDeltaToAccept {
return _pendingDragDelta.distance > kPanSlop;
}
String toStringShort() => 'pan';
}
......@@ -34,4 +34,6 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer {
if (event is PointerUpEvent)
resolve(GestureDisposition.rejected);
}
String toStringShort() => 'long press';
}
......@@ -250,6 +250,8 @@ class ImmediateMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_Im
_ImmediatePointerState createNewPointerState(PointerDownEvent event) {
return new _ImmediatePointerState(event.position);
}
String toStringShort() => 'multidrag';
}
......@@ -277,6 +279,8 @@ class HorizontalMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_H
_HorizontalPointerState createNewPointerState(PointerDownEvent event) {
return new _HorizontalPointerState(event.position);
}
String toStringShort() => 'horizontal multidrag';
}
......@@ -304,6 +308,8 @@ class VerticalMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_Ver
_VerticalPointerState createNewPointerState(PointerDownEvent event) {
return new _VerticalPointerState(event.position);
}
String toStringShort() => 'vertical multidrag';
}
......@@ -373,4 +379,6 @@ class DelayedMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_Dela
_DelayedPointerState createNewPointerState(PointerDownEvent event) {
return new _DelayedPointerState(event.position, _delay);
}
String toStringShort() => 'long multidrag';
}
......@@ -212,6 +212,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
}
}
String toStringShort() => 'double tap';
}
......@@ -385,4 +386,5 @@ class MultiTapGestureRecognizer extends GestureRecognizer {
_gestureArena = null;
}
String toStringShort() => 'multitap';
}
......@@ -42,6 +42,9 @@ abstract class GestureRecognizer extends GestureArenaMember {
/// GestureDetector widget calls this method).
void dispose() { }
/// Returns a very short pretty description of the gesture that the
/// recognizer looks for, like 'tap' or 'horizontal drag'.
String toStringShort() => toString();
}
/// Base class for gesture recognizers that can only recognize one
......
......@@ -135,4 +135,6 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
}
_state = ScaleState.ready;
}
String toStringShort() => 'scale';
}
......@@ -102,4 +102,6 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
_wonArena = false;
_finalPosition = null;
}
String toStringShort() => 'tap';
}
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