fix cursor linux force update after remote cursor moved
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
98bb47a81d
commit
7f640b77f0
@ -251,14 +251,12 @@ class _RemotePageState extends State<RemotePage>
|
|||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ImagePaint extends StatelessWidget {
|
class ImagePaint extends StatefulWidget {
|
||||||
final String id;
|
final String id;
|
||||||
final Rx<bool> cursorOverImage;
|
final Rx<bool> cursorOverImage;
|
||||||
final Rx<bool> keyboardEnabled;
|
final Rx<bool> keyboardEnabled;
|
||||||
final Rx<bool> remoteCursorMoved;
|
final Rx<bool> remoteCursorMoved;
|
||||||
final Widget Function(Widget)? listenerBuilder;
|
final Widget Function(Widget)? listenerBuilder;
|
||||||
final ScrollController _horizontal = ScrollController();
|
|
||||||
final ScrollController _vertical = ScrollController();
|
|
||||||
|
|
||||||
ImagePaint(
|
ImagePaint(
|
||||||
{Key? key,
|
{Key? key,
|
||||||
@ -269,6 +267,21 @@ class ImagePaint extends StatelessWidget {
|
|||||||
this.listenerBuilder})
|
this.listenerBuilder})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() => _ImagePaintState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ImagePaintState extends State<ImagePaint> {
|
||||||
|
bool _lastRemoteCursorMoved = false;
|
||||||
|
final ScrollController _horizontal = ScrollController();
|
||||||
|
final ScrollController _vertical = ScrollController();
|
||||||
|
|
||||||
|
String get id => widget.id;
|
||||||
|
Rx<bool> get cursorOverImage => widget.cursorOverImage;
|
||||||
|
Rx<bool> get keyboardEnabled => widget.keyboardEnabled;
|
||||||
|
Rx<bool> get remoteCursorMoved => widget.remoteCursorMoved;
|
||||||
|
Widget Function(Widget)? get listenerBuilder => widget.listenerBuilder;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final m = Provider.of<ImageModel>(context);
|
final m = Provider.of<ImageModel>(context);
|
||||||
@ -278,9 +291,18 @@ class ImagePaint extends StatelessWidget {
|
|||||||
mouseRegion({child}) => Obx(() => MouseRegion(
|
mouseRegion({child}) => Obx(() => MouseRegion(
|
||||||
cursor: cursorOverImage.isTrue
|
cursor: cursorOverImage.isTrue
|
||||||
? keyboardEnabled.isTrue
|
? keyboardEnabled.isTrue
|
||||||
? (remoteCursorMoved.isTrue
|
? (() {
|
||||||
? SystemMouseCursors.none
|
if (remoteCursorMoved.isTrue) {
|
||||||
: _buildCustomCursor(context, s))
|
_lastRemoteCursorMoved = true;
|
||||||
|
return SystemMouseCursors.none;
|
||||||
|
} else {
|
||||||
|
if (_lastRemoteCursorMoved) {
|
||||||
|
_lastRemoteCursorMoved = false;
|
||||||
|
_firstEnterImage.value = true;
|
||||||
|
}
|
||||||
|
return _buildCustomCursor(context, s);
|
||||||
|
}
|
||||||
|
}())
|
||||||
: _buildDisabledCursor(context, s)
|
: _buildDisabledCursor(context, s)
|
||||||
: MouseCursor.defer,
|
: MouseCursor.defer,
|
||||||
onHover: (evt) {},
|
onHover: (evt) {},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user