跳到主要内容

setCursor 设置鼠标指针

setCursor

类型: MethodDeclaration

所属类: CommandFunctionList

定义位置: command.ts

描述

设置鼠标指针

参数

参数名类型描述默认值
\{ image \}{ image: string }--

返回值

类型: CommandFunction

源代码

位置: 第 8753 行

protected setCursor({ image }: { image: string }): CommandFunction {
const style = document.documentElement.style as any;
const meta = Data.manifest.guidMap[image];
const path = meta?.path ?? "";
let cursor = "default";
let promise: Promise<any> | null = null;
if (path) {
promise = Loader.loadImage({ guid: image, save: true })
.then(image => {
cursor = `${CSS.encodeURL(image.src)}, default`;
promise = null;
})
.catch(error => {
console.warn(error);
});
}
return () => {
if (style.path !== path) {
style.path = path;
style.cursor = cursor;
promise?.then(() => {
if (style.path === path) {
style.cursor = cursor;
}
});
}
return true;
};
}

文档生成时间:2026/2/1 16:51:39