Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit cde853f

Browse files
committed
longpressup support
1 parent 1da4988 commit cde853f

File tree

3 files changed

+12
-19
lines changed

3 files changed

+12
-19
lines changed

Runtime/gestures/long_press.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public LongPressDragGestureRecognizer(object debugOwner = null) : base(
101101
Offset _longPressOrigin;
102102

103103
TimeSpan? _longPressStartTimestamp;
104-
104+
105105
public GestureLongPressDragStartCallback onLongPressStart;
106106

107107
public GestureLongPressDragUpdateCallback onLongPressDragUpdate;

Runtime/widgets/gesture_detector.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ public GestureDetector(
113113
throw new UIWidgetsError(
114114
"Incorrect GestureDetector arguments.\n" +
115115
"Having both a pan gesture recognizer and a scale gesture recognizer is redundant; scale is a superset of pan. Just use the scale gesture recognizer."
116-
);
116+
);
117117
}
118-
118+
119119
string recognizer = havePan ? "pan" : "scale";
120120
if (haveVerticalDrag && haveHorizontalDrag) {
121121
throw new UIWidgetsError(
@@ -125,7 +125,7 @@ public GestureDetector(
125125
);
126126
}
127127
}
128-
128+
129129
if (haveLongPress && haveLongPressDrag) {
130130
throw new UIWidgetsError(
131131
"Incorrect GestureDetector arguments.\n" +

Samples/UIWidgetSample/LongPressSample.cs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1-
using Unity.UIWidgets.animation;
2-
using Unity.UIWidgets.engine;
31
using Unity.UIWidgets.material;
42
using Unity.UIWidgets.widgets;
53
using UnityEngine;
64

75
namespace UIWidgetsSample {
8-
public class LongPressSample: UIWidgetsSamplePanel {
9-
10-
protected override Widget createWidget() {
6+
public class LongPressSample : UIWidgetsSamplePanel {
7+
protected override Widget createWidget() {
118
return new WidgetsApp(
129
home: new LongPressSampleWidget(),
1310
pageRouteBuilder: this.pageRouteBuilder);
1411
}
1512
}
1613

17-
public class LongPressSampleWidget: StatefulWidget {
14+
public class LongPressSampleWidget : StatefulWidget {
1815
public override State createState() {
1916
return new _LongPressSampleWidgetState();
2017
}
@@ -23,15 +20,11 @@ public override State createState() {
2320
class _LongPressSampleWidgetState : State<LongPressSampleWidget> {
2421
public override Widget build(BuildContext context) {
2522
return new GestureDetector(
26-
onLongPressDragStart: (value) => {
27-
Debug.Log($"Long Press Drag Start: {value}");
28-
},
29-
onLongPressDragUpdate: (value) => {
30-
Debug.Log($"Long Press Drag Update: {value}");
31-
},
32-
onLongPressDragUp: (value) => {
33-
Debug.Log($"Long Press Drag Up: {value}");
34-
},
23+
onLongPressDragStart: (value) => { Debug.Log($"Long Press Drag Start: {value}"); },
24+
onLongPressDragUpdate: (value) => { Debug.Log($"Long Press Drag Update: {value}"); },
25+
onLongPressDragUp: (value) => { Debug.Log($"Long Press Drag Up: {value}"); },
26+
onLongPressUp: () => { Debug.Log($"Long Press Up"); },
27+
onLongPress: () => { Debug.Log($"Long Press"); },
3528
child: new Center(
3629
child: new Container(
3730
width: 200,

0 commit comments

Comments
 (0)