adjust kScaleSlop
This commit is contained in:
parent
7fe8b2cee7
commit
811265554a
@ -10,7 +10,8 @@ enum CustomTouchGestureState {
|
|||||||
twoFingerHorizontalDrag,
|
twoFingerHorizontalDrag,
|
||||||
}
|
}
|
||||||
|
|
||||||
const kScaleSlop = kPrecisePointerPanSlop / 15;
|
// Adjust Carefully! balance vertical and pan
|
||||||
|
const kScaleSlop = kPrecisePointerPanSlop / 28;
|
||||||
|
|
||||||
class CustomTouchGestureRecognizer extends ScaleGestureRecognizer {
|
class CustomTouchGestureRecognizer extends ScaleGestureRecognizer {
|
||||||
CustomTouchGestureRecognizer({
|
CustomTouchGestureRecognizer({
|
||||||
@ -154,8 +155,16 @@ class CustomTouchGestureRecognizer extends ScaleGestureRecognizer {
|
|||||||
_sumScale += d.scale - 1;
|
_sumScale += d.scale - 1;
|
||||||
_sumHorizontal += d.focalPointDelta.dx;
|
_sumHorizontal += d.focalPointDelta.dx;
|
||||||
_sumVertical += d.focalPointDelta.dy;
|
_sumVertical += d.focalPointDelta.dy;
|
||||||
// start
|
// start , order is important
|
||||||
if (onTwoFingerVerticalDragUpdate != null &&
|
if (onTwoFingerScaleUpdate != null && _sumScale.abs() > kScaleSlop) {
|
||||||
|
debugPrint("start Scale");
|
||||||
|
_currentState = CustomTouchGestureState.twoFingerScale;
|
||||||
|
if (onTwoFingerScaleStart != null) {
|
||||||
|
onTwoFingerScaleStart!(ScaleStartDetails(
|
||||||
|
localFocalPoint: d.localFocalPoint, focalPoint: d.focalPoint));
|
||||||
|
}
|
||||||
|
_reset();
|
||||||
|
} else if (onTwoFingerVerticalDragUpdate != null &&
|
||||||
_sumVertical.abs() > kPrecisePointerPanSlop &&
|
_sumVertical.abs() > kPrecisePointerPanSlop &&
|
||||||
_sumHorizontal.abs() < kPrecisePointerPanSlop) {
|
_sumHorizontal.abs() < kPrecisePointerPanSlop) {
|
||||||
debugPrint("start Vertical");
|
debugPrint("start Vertical");
|
||||||
@ -164,14 +173,6 @@ class CustomTouchGestureRecognizer extends ScaleGestureRecognizer {
|
|||||||
}
|
}
|
||||||
_currentState = CustomTouchGestureState.twoFingerVerticalDrag;
|
_currentState = CustomTouchGestureState.twoFingerVerticalDrag;
|
||||||
_reset();
|
_reset();
|
||||||
} else if (onTwoFingerScaleUpdate != null && _sumScale.abs() > kScaleSlop) {
|
|
||||||
debugPrint("start Scale");
|
|
||||||
_currentState = CustomTouchGestureState.twoFingerScale;
|
|
||||||
if (onTwoFingerScaleStart != null) {
|
|
||||||
onTwoFingerScaleStart!(ScaleStartDetails(
|
|
||||||
localFocalPoint: d.localFocalPoint, focalPoint: d.focalPoint));
|
|
||||||
}
|
|
||||||
_reset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user