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

Commit e418da8

Browse files
committed
fix minor bugs
1 parent c412815 commit e418da8

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Runtime/widgets/gesture_detector.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,25 @@ public GestureDetector(
107107
bool haveLongPressDrag = onLongPressDragStart != null || onLongPressDragUpdate != null ||
108108
onLongPressDragUp != null;
109109
bool havePan = onPanStart != null || onPanUpdate != null || onPanEnd != null;
110-
if (havePan) {
110+
bool haveScale = onScaleStart != null || onScaleUpdate != null || onScaleEnd != null;
111+
if (havePan || haveScale) {
112+
if (havePan && haveScale) {
113+
throw new UIWidgetsError(
114+
"Incorrect GestureDetector arguments.\n" +
115+
"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+
);
117+
}
118+
119+
string recognizer = havePan ? "pan" : "scale";
111120
if (haveVerticalDrag && haveHorizontalDrag) {
112121
throw new UIWidgetsError(
113122
"Incorrect GestureDetector arguments.\n" +
114-
"Simultaneously having a vertical drag gesture recognizer, a horizontal drag gesture recognizer, and a pan gesture recognizer " +
115-
"will result in the pan gesture recognizer being ignored, since the other two will catch all drags."
123+
$"Simultaneously having a vertical drag gesture recognizer, a horizontal drag gesture recognizer, and a {recognizer} gesture recognizer " +
124+
$"will result in the {recognizer} gesture recognizer being ignored, since the other two will catch all drags."
116125
);
117126
}
118127
}
119-
128+
120129
if (haveLongPress && haveLongPressDrag) {
121130
throw new UIWidgetsError(
122131
"Incorrect GestureDetector arguments.\n" +

Samples/UIWidgetSample/ScaleGestureSample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public override State createState() {
2626
}
2727
}
2828

29-
class ScaleGesturePanelState : State<HoverMainPanel> {
29+
class ScaleGesturePanelState : State<ScaleGesturePanel> {
3030
float scaleValue = 1.0f;
3131

3232
public override Widget build(BuildContext context) {

0 commit comments

Comments
 (0)