From 60f48c5326fe48692209d786f1a84f5a737903ce Mon Sep 17 00:00:00 2001 From: open-trade Date: Fri, 27 Nov 2020 17:59:42 +0800 Subject: [PATCH] refresh --- flutter_hbb/lib/model.dart | 7 +++++++ flutter_hbb/lib/remote_page.dart | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/flutter_hbb/lib/model.dart b/flutter_hbb/lib/model.dart index 549582211..baf51e1ee 100644 --- a/flutter_hbb/lib/model.dart +++ b/flutter_hbb/lib/model.dart @@ -163,6 +163,7 @@ class FfiModel with ChangeNotifier { _display.width = int.parse(evt['width']); _display.height = int.parse(evt['height']); FFI.cursorModel.updateDisplayOrigin(_display.x, _display.y); + FFI.canvasModel.resetOffset(); notifyListeners(); } @@ -252,6 +253,12 @@ class CanvasModel with ChangeNotifier { notifyListeners(); } + void resetOffset() { + _x = 0; + _y = 0; + notifyListeners(); + } + void panY(double dy) { _y += dy; notifyListeners(); diff --git a/flutter_hbb/lib/remote_page.dart b/flutter_hbb/lib/remote_page.dart index c6fc57e2d..259f33471 100644 --- a/flutter_hbb/lib/remote_page.dart +++ b/flutter_hbb/lib/remote_page.dart @@ -721,16 +721,16 @@ void showActions(BuildContext context) { context: context, position: RelativeRect.fromLTRB(x, y, x, y), items: [ - PopupMenuItem( - child: Text('Insert Ctrl + Alt + Del'), value: 'cad'), - PopupMenuItem( - child: Text('Insert Lock'), value: 'lock'), - ] + - FFI.ffiModel.pi.version.isEmpty - ? [] - : [ - PopupMenuItem(child: Text('Refresh'), value: 'refresh'), - ], + PopupMenuItem( + child: Text('Insert Ctrl + Alt + Del'), value: 'cad'), + PopupMenuItem(child: Text('Insert Lock'), value: 'lock'), + ] + + (FFI.ffiModel.pi.version.isEmpty + ? [] + : [ + PopupMenuItem( + child: Text('Refresh'), value: 'refresh'), + ]), elevation: 8, ); if (value == 'cad') {