new keyboard offset and scroll
This commit is contained in:
parent
0388e51299
commit
1acb64c35d
@ -319,10 +319,12 @@ class CursorModel with ChangeNotifier {
|
||||
}
|
||||
|
||||
double adjustForKeyboard() {
|
||||
var keyboardHeight = MediaQueryData.fromWindow(ui.window).viewInsets.bottom;
|
||||
final m = MediaQueryData.fromWindow(ui.window);
|
||||
var keyboardHeight = m.viewInsets.bottom;
|
||||
final size = m.size;
|
||||
if (keyboardHeight < 100) return 0;
|
||||
final s = FFI.canvasModel.scale;
|
||||
final thresh = 120;
|
||||
final thresh = (size.height - keyboardHeight) / 2;
|
||||
var h = (_y - getVisibleRect().top) * s; // local physical display height
|
||||
return h - thresh;
|
||||
}
|
||||
|
@ -28,6 +28,8 @@ class _RemotePageState extends State<RemotePage> {
|
||||
String _value = '';
|
||||
double _xOffset = 0;
|
||||
double _yOffset = 0;
|
||||
double _xOffset0 = 0;
|
||||
double _yOffset0 = 0;
|
||||
double _scale = 1;
|
||||
bool _mouseTools = false;
|
||||
var _drag = false;
|
||||
@ -258,8 +260,8 @@ class _RemotePageState extends State<RemotePage> {
|
||||
},
|
||||
onScaleStart: (details) {
|
||||
_scale = 1;
|
||||
_xOffset = details.focalPoint.dx;
|
||||
_yOffset = details.focalPoint.dy;
|
||||
_xOffset = _xOffset0 = details.focalPoint.dx;
|
||||
_yOffset = _yOffset0 = details.focalPoint.dy;
|
||||
if (_drag) {
|
||||
FFI.sendMouse('down', 'left');
|
||||
}
|
||||
@ -275,6 +277,9 @@ class _RemotePageState extends State<RemotePage> {
|
||||
FFI.cursorModel.updatePan(dx, dy);
|
||||
_xOffset = x;
|
||||
_yOffset = y;
|
||||
} else {
|
||||
_xOffset = details.focalPoint.dx;
|
||||
_yOffset = details.focalPoint.dy;
|
||||
}
|
||||
} else if (!_drag && !_scroll) {
|
||||
FFI.canvasModel.updateScale(scale / _scale);
|
||||
@ -285,8 +290,12 @@ class _RemotePageState extends State<RemotePage> {
|
||||
if (_drag) {
|
||||
FFI.sendMouse('up', 'left');
|
||||
} else if (_scroll) {
|
||||
FFI.scroll(
|
||||
details.velocity.pixelsPerSecond.dy > 0 ? -1 : 1);
|
||||
var dy = (_yOffset - _yOffset0) / 10;
|
||||
if (dy.abs() > 0.1) {
|
||||
if (dy > 0 && dy < 1) dy = 1;
|
||||
if (dy < 0 && dy > -1) dy = -1;
|
||||
FFI.scroll(dy);
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
|
Loading…
x
Reference in New Issue
Block a user