show cursor on conn is established
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
ca97826b80
commit
0940c93a48
@ -904,10 +904,10 @@ class CursorModel with ChangeNotifier {
|
|||||||
double _hoty = 0;
|
double _hoty = 0;
|
||||||
double _displayOriginX = 0;
|
double _displayOriginX = 0;
|
||||||
double _displayOriginY = 0;
|
double _displayOriginY = 0;
|
||||||
bool _firstUpdateMousePos = false;
|
DateTime? _firstUpdateMouseTime;
|
||||||
bool gotMouseControl = true;
|
bool gotMouseControl = true;
|
||||||
DateTime _lastPeerMouse = DateTime.now()
|
DateTime _lastPeerMouse = DateTime.now()
|
||||||
.subtract(Duration(milliseconds: 2 * kMouseControlTimeoutMSec));
|
.subtract(Duration(milliseconds: 3000 * kMouseControlTimeoutMSec));
|
||||||
String id = '';
|
String id = '';
|
||||||
WeakReference<FFI> parent;
|
WeakReference<FFI> parent;
|
||||||
|
|
||||||
@ -926,6 +926,15 @@ class CursorModel with ChangeNotifier {
|
|||||||
DateTime.now().difference(_lastPeerMouse).inMilliseconds <
|
DateTime.now().difference(_lastPeerMouse).inMilliseconds <
|
||||||
kMouseControlTimeoutMSec;
|
kMouseControlTimeoutMSec;
|
||||||
|
|
||||||
|
bool isConnIn2Secs() {
|
||||||
|
if (_firstUpdateMouseTime == null) {
|
||||||
|
_firstUpdateMouseTime = DateTime.now();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return DateTime.now().difference(_firstUpdateMouseTime!).inSeconds < 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CursorModel(this.parent);
|
CursorModel(this.parent);
|
||||||
|
|
||||||
Set<String> get cachedKeys => _cacheKeys;
|
Set<String> get cachedKeys => _cacheKeys;
|
||||||
@ -1122,12 +1131,10 @@ class CursorModel with ChangeNotifier {
|
|||||||
|
|
||||||
/// Update the cursor position.
|
/// Update the cursor position.
|
||||||
updateCursorPosition(Map<String, dynamic> evt, String id) async {
|
updateCursorPosition(Map<String, dynamic> evt, String id) async {
|
||||||
if (!_firstUpdateMousePos) {
|
if (!isConnIn2Secs()) {
|
||||||
_firstUpdateMousePos = true;
|
|
||||||
} else {
|
|
||||||
gotMouseControl = false;
|
gotMouseControl = false;
|
||||||
|
_lastPeerMouse = DateTime.now();
|
||||||
}
|
}
|
||||||
_lastPeerMouse = DateTime.now();
|
|
||||||
_x = double.parse(evt['x']);
|
_x = double.parse(evt['x']);
|
||||||
_y = double.parse(evt['y']);
|
_y = double.parse(evt['y']);
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user