This commit is contained in:
open-trade 2020-11-27 17:59:42 +08:00
parent 7662ab0a0f
commit 60f48c5326
2 changed files with 17 additions and 10 deletions

View File

@ -163,6 +163,7 @@ class FfiModel with ChangeNotifier {
_display.width = int.parse(evt['width']); _display.width = int.parse(evt['width']);
_display.height = int.parse(evt['height']); _display.height = int.parse(evt['height']);
FFI.cursorModel.updateDisplayOrigin(_display.x, _display.y); FFI.cursorModel.updateDisplayOrigin(_display.x, _display.y);
FFI.canvasModel.resetOffset();
notifyListeners(); notifyListeners();
} }
@ -252,6 +253,12 @@ class CanvasModel with ChangeNotifier {
notifyListeners(); notifyListeners();
} }
void resetOffset() {
_x = 0;
_y = 0;
notifyListeners();
}
void panY(double dy) { void panY(double dy) {
_y += dy; _y += dy;
notifyListeners(); notifyListeners();

View File

@ -721,16 +721,16 @@ void showActions(BuildContext context) {
context: context, context: context,
position: RelativeRect.fromLTRB(x, y, x, y), position: RelativeRect.fromLTRB(x, y, x, y),
items: [ items: [
PopupMenuItem<String>( PopupMenuItem<String>(
child: Text('Insert Ctrl + Alt + Del'), value: 'cad'), child: Text('Insert Ctrl + Alt + Del'), value: 'cad'),
PopupMenuItem<String>( PopupMenuItem<String>(child: Text('Insert Lock'), value: 'lock'),
child: Text('Insert Lock'), value: 'lock'), ] +
] + (FFI.ffiModel.pi.version.isEmpty
FFI.ffiModel.pi.version.isEmpty ? []
? [] : [
: [ PopupMenuItem<String>(
PopupMenuItem<String>(child: Text('Refresh'), value: 'refresh'), child: Text('Refresh'), value: 'refresh'),
], ]),
elevation: 8, elevation: 8,
); );
if (value == 'cad') { if (value == 'cad') {