update android to android,adjust two fingers scroll

This commit is contained in:
csf 2022-05-10 14:44:47 +08:00
parent 4840b2744b
commit d2a01a7240
4 changed files with 26 additions and 20 deletions

View File

@ -244,8 +244,6 @@ class FfiModel with ChangeNotifier {
if (isPeerAndroid) {
_touchMode = true;
FFI.setByName('peer_option', '{"name": "view-style", "value": "shrink"}');
FFI.canvasModel.updateViewStyle();
if (FFI.ffiModel.permissions['keyboard'] != false) {
showMobileActionsOverlay();
}
@ -296,6 +294,13 @@ class ImageModel with ChangeNotifier {
FFI.canvasModel.scale = max(xscale, yscale);
}
initializeCursorAndCanvas();
Future.delayed(Duration(milliseconds: 1), () {
if (FFI.ffiModel.isPeerAndroid) {
FFI.setByName(
'peer_option', '{"name": "view-style", "value": "shrink"}');
FFI.canvasModel.updateViewStyle();
}
});
}
_image = image;
if (image != null) notifyListeners();

View File

@ -536,10 +536,15 @@ class _RemotePageState extends State<RemotePage> {
FFI.canvasModel.panX(d.focalPointDelta.dx);
FFI.canvasModel.panY(d.focalPointDelta.dy);
},
onTwoFingerScaleEnd: (d) => _scale = 1,
onTwoFingerVerticalDragUpdate: (d) {
FFI.scroll(d.delta.dy / 2);
});
onTwoFingerScaleEnd: (d) {
_scale = 1;
FFI.setByName('peer_option', '{"name": "view-style", "value": ""}');
},
onTwoFingerVerticalDragUpdate: FFI.ffiModel.isPeerAndroid
? null
: (d) {
FFI.scroll(d.delta.dy / 2);
});
}
Widget getBodyForMobile() {
@ -933,7 +938,6 @@ void showOptions() {
String quality = FFI.getByName('image_quality');
if (quality == '') quality = 'balanced';
String viewStyle = FFI.getByName('peer_option', 'view-style');
if (viewStyle == '') viewStyle = 'original';
var displays = <Widget>[];
final pi = FFI.ffiModel.pi;
final image = FFI.ffiModel.getConnectionImage();

View File

@ -213,10 +213,6 @@ class _PermissionCheckerState extends State<PermissionChecker> {
"* ${translate("android_version_audio_tip")}",
style: TextStyle(color: MyTheme.darkGray),
),
Text(
"DEBUG:VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR",
style: TextStyle(color: MyTheme.darkGray),
),
SizedBox(height: 8),
Row(
crossAxisAlignment: CrossAxisAlignment.center,

View File

@ -155,7 +155,16 @@ class CustomTouchGestureRecognizer extends ScaleGestureRecognizer {
_sumHorizontal += d.focalPointDelta.dx;
_sumVertical += d.focalPointDelta.dy;
// start
if (_sumScale.abs() > kScaleSlop) {
if (onTwoFingerVerticalDragUpdate != null &&
_sumVertical.abs() > kPrecisePointerPanSlop &&
_sumHorizontal.abs() < kPrecisePointerPanSlop) {
debugPrint("start Vertical");
if (onTwoFingerVerticalDragStart != null) {
onTwoFingerVerticalDragStart!(_getDragStartDetails(d));
}
_currentState = CustomTouchGestureState.twoFingerVerticalDrag;
_reset();
} else if (onTwoFingerScaleUpdate != null && _sumScale.abs() > kScaleSlop) {
debugPrint("start Scale");
_currentState = CustomTouchGestureState.twoFingerScale;
if (onTwoFingerScaleStart != null) {
@ -163,14 +172,6 @@ class CustomTouchGestureRecognizer extends ScaleGestureRecognizer {
localFocalPoint: d.localFocalPoint, focalPoint: d.focalPoint));
}
_reset();
} else if (_sumVertical.abs() > kPrecisePointerPanSlop &&
_sumHorizontal.abs() < kPrecisePointerHitSlop) {
debugPrint("start Vertical");
if (onTwoFingerVerticalDragStart != null) {
_getDragStartDetails(d);
}
_currentState = CustomTouchGestureState.twoFingerVerticalDrag;
_reset();
}
}