debug, touch screen input
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
parent
c01c8d0afc
commit
2badecba2a
@ -113,13 +113,14 @@ class CustomTouchGestureRecognizer extends ScaleGestureRecognizer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onOneFingerStartDebounce(ScaleUpdateDetails d) {
|
void onOneFingerStartDebounce(ScaleUpdateDetails d) {
|
||||||
final start = (ScaleUpdateDetails d) {
|
start(ScaleUpdateDetails d) {
|
||||||
_currentState = GestureState.oneFingerPan;
|
_currentState = GestureState.oneFingerPan;
|
||||||
if (onOneFingerPanStart != null) {
|
if (onOneFingerPanStart != null) {
|
||||||
onOneFingerPanStart!(DragStartDetails(
|
onOneFingerPanStart!(DragStartDetails(
|
||||||
localPosition: d.localFocalPoint, globalPosition: d.focalPoint));
|
localPosition: d.localFocalPoint, globalPosition: d.focalPoint));
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
if (_currentState != GestureState.none) {
|
if (_currentState != GestureState.none) {
|
||||||
_debounceTimer = Timer(Duration(milliseconds: 200), () {
|
_debounceTimer = Timer(Duration(milliseconds: 200), () {
|
||||||
start(d);
|
start(d);
|
||||||
@ -132,13 +133,14 @@ class CustomTouchGestureRecognizer extends ScaleGestureRecognizer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onTwoFingerStartDebounce(ScaleUpdateDetails d) {
|
void onTwoFingerStartDebounce(ScaleUpdateDetails d) {
|
||||||
final start = (ScaleUpdateDetails d) {
|
start(ScaleUpdateDetails d) {
|
||||||
_currentState = GestureState.twoFingerScale;
|
_currentState = GestureState.twoFingerScale;
|
||||||
if (onTwoFingerScaleStart != null) {
|
if (onTwoFingerScaleStart != null) {
|
||||||
onTwoFingerScaleStart!(ScaleStartDetails(
|
onTwoFingerScaleStart!(ScaleStartDetails(
|
||||||
localFocalPoint: d.localFocalPoint, focalPoint: d.focalPoint));
|
localFocalPoint: d.localFocalPoint, focalPoint: d.focalPoint));
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
if (_currentState == GestureState.threeFingerVerticalDrag) {
|
if (_currentState == GestureState.threeFingerVerticalDrag) {
|
||||||
_debounceTimer = Timer(Duration(milliseconds: 200), () {
|
_debounceTimer = Timer(Duration(milliseconds: 200), () {
|
||||||
start(d);
|
start(d);
|
||||||
@ -266,11 +268,12 @@ class HoldTapMoveGestureRecognizer extends GestureRecognizer {
|
|||||||
if (!_isStart) {
|
if (!_isStart) {
|
||||||
_resolve();
|
_resolve();
|
||||||
}
|
}
|
||||||
if (onHoldDragUpdate != null)
|
if (onHoldDragUpdate != null) {
|
||||||
onHoldDragUpdate!(DragUpdateDetails(
|
onHoldDragUpdate!(DragUpdateDetails(
|
||||||
globalPosition: event.position,
|
globalPosition: event.position,
|
||||||
localPosition: event.localPosition,
|
localPosition: event.localPosition,
|
||||||
delta: event.delta));
|
delta: event.delta));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event is PointerCancelEvent) {
|
} else if (event is PointerCancelEvent) {
|
||||||
@ -498,8 +501,9 @@ class DoubleFinerTapGestureRecognizer extends GestureRecognizer {
|
|||||||
debugPrint("PointerUpEvent");
|
debugPrint("PointerUpEvent");
|
||||||
_upTap.add(tracker.pointer);
|
_upTap.add(tracker.pointer);
|
||||||
} else if (event is PointerMoveEvent) {
|
} else if (event is PointerMoveEvent) {
|
||||||
if (!tracker.isWithinGlobalTolerance(event, kDoubleTapTouchSlop))
|
if (!tracker.isWithinGlobalTolerance(event, kDoubleTapTouchSlop)) {
|
||||||
_reject(tracker);
|
_reject(tracker);
|
||||||
|
}
|
||||||
} else if (event is PointerCancelEvent) {
|
} else if (event is PointerCancelEvent) {
|
||||||
_reject(tracker);
|
_reject(tracker);
|
||||||
}
|
}
|
||||||
|
@ -53,15 +53,15 @@ class RawTouchGestureDetectorRegion extends StatefulWidget {
|
|||||||
_RawTouchGestureDetectorRegionState();
|
_RawTouchGestureDetectorRegionState();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// touchMode only:
|
/// touchMode only:
|
||||||
/// LongPress -> right click
|
/// LongPress -> right click
|
||||||
/// OneFingerPan -> start/end -> left down start/end
|
/// OneFingerPan -> start/end -> left down start/end
|
||||||
/// onDoubleTapDown -> move to
|
/// onDoubleTapDown -> move to
|
||||||
/// onLongPressDown => move to
|
/// onLongPressDown => move to
|
||||||
///
|
///
|
||||||
/// mouseMode only:
|
/// mouseMode only:
|
||||||
/// DoubleFiner -> right click
|
/// DoubleFiner -> right click
|
||||||
/// HoldDrag -> left drag
|
/// HoldDrag -> left drag
|
||||||
class _RawTouchGestureDetectorRegionState
|
class _RawTouchGestureDetectorRegionState
|
||||||
extends State<RawTouchGestureDetectorRegion> {
|
extends State<RawTouchGestureDetectorRegion> {
|
||||||
Offset _cacheLongPressPosition = Offset(0, 0);
|
Offset _cacheLongPressPosition = Offset(0, 0);
|
||||||
@ -139,6 +139,9 @@ class _RawTouchGestureDetectorRegionState
|
|||||||
if (lastDeviceKind != PointerDeviceKind.touch) {
|
if (lastDeviceKind != PointerDeviceKind.touch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (isDesktop) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (handleTouch) {
|
if (handleTouch) {
|
||||||
ffi.cursorModel
|
ffi.cursorModel
|
||||||
.move(_cacheLongPressPosition.dx, _cacheLongPressPosition.dy);
|
.move(_cacheLongPressPosition.dx, _cacheLongPressPosition.dy);
|
||||||
@ -151,7 +154,7 @@ class _RawTouchGestureDetectorRegionState
|
|||||||
if (lastDeviceKind != PointerDeviceKind.touch) {
|
if (lastDeviceKind != PointerDeviceKind.touch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!handleTouch) {
|
if (isDesktop || !handleTouch) {
|
||||||
inputModel.tap(MouseButtons.right);
|
inputModel.tap(MouseButtons.right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,8 +193,8 @@ class _RawTouchGestureDetectorRegionState
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (handleTouch) {
|
if (handleTouch) {
|
||||||
ffi.cursorModel.move(d.localPosition.dx, d.localPosition.dy);
|
|
||||||
inputModel.sendMouse('down', MouseButtons.left);
|
inputModel.sendMouse('down', MouseButtons.left);
|
||||||
|
ffi.cursorModel.move(d.localPosition.dx, d.localPosition.dy);
|
||||||
} else {
|
} else {
|
||||||
final offset = ffi.cursorModel.offset;
|
final offset = ffi.cursorModel.offset;
|
||||||
final cursorX = offset.dx;
|
final cursorX = offset.dx;
|
||||||
@ -250,6 +253,7 @@ class _RawTouchGestureDetectorRegionState
|
|||||||
_scale = 1;
|
_scale = 1;
|
||||||
bind.sessionSetViewStyle(sessionId: sessionId, value: "");
|
bind.sessionSetViewStyle(sessionId: sessionId, value: "");
|
||||||
}
|
}
|
||||||
|
inputModel.sendMouse('up', MouseButtons.left);
|
||||||
}
|
}
|
||||||
|
|
||||||
get onHoldDragCancel => null;
|
get onHoldDragCancel => null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user