mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Flutter web, custom cursor (#7545)
* Flutter web, custom cursor Signed-off-by: fufesou <shuanglongchen@yeah.net> * trivial changes Signed-off-by: fufesou <shuanglongchen@yeah.net> * Flutter web, custom cursor, use date after 'updateGetKey()' Signed-off-by: fufesou <shuanglongchen@yeah.net> * trivial changes Signed-off-by: fufesou <shuanglongchen@yeah.net> --------- Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -333,6 +333,9 @@ window.setByName = (name, value) => {
|
||||
break;
|
||||
case 'change_prefer_codec':
|
||||
curConn.changePreferCodec(value);
|
||||
case 'cursor':
|
||||
setCustomCursor(value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -552,6 +555,23 @@ export function getVersionNumber(v) {
|
||||
}
|
||||
}
|
||||
|
||||
// Set the cursor for the flutter-view element
|
||||
function setCustomCursor(value) {
|
||||
try {
|
||||
const obj = JSON.parse(value);
|
||||
// document querySelector or evaluate can not find the custom element
|
||||
var body = document.body;
|
||||
for (var i = 0; i < body.children.length; i++) {
|
||||
var child = body.children[i];
|
||||
if (child.tagName == 'FLUTTER-VIEW') {
|
||||
child.style.cursor = `url(${obj.url}) ${obj.hotx} ${obj.hoty}, auto`;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to set custom cursor: ' + e.message);
|
||||
}
|
||||
}
|
||||
|
||||
// ========================== options begin ==========================
|
||||
function setUserDefaultOption(value) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user