光标增加点击偏移参数

This commit is contained in:
草莓 2024-12-03 15:06:16 +08:00
parent a74d7a9e02
commit a74756a376

View File

@ -8876,8 +8876,8 @@ core.plugin.animate = {
},
"光标设置": function () {
// 在此增加新插件
this.changeMouse = function (icon, div = 'gameGroup', translateX = 0, translateY = 0, scaleX = 1, scaleY = 1, degree = 0) {
const canvas = document.createElement('canvas'); //CGui画布设置
this.changeMouse = function (icon, div = 'gameGroup', translateX = 0, translateY = 0, scaleX = 1, scaleY = 1, degree = 0, px = 0, py = 0) {
const canvas = document.createElement('canvas');
canvas.width = 64
canvas.height = 64
@ -8890,10 +8890,10 @@ core.plugin.animate = {
core.drawIcon(ctx, icon, 0, 0, 32, 32)
const data = canvas.toDataURL("image/png")
core.dom[div].style.cursor = `url(${data}),auto` //div为你要改变光标的元素默认为包含状态栏的整个游戏画面
core.dom[div].style.cursor = `url(${data}) ${px} ${py},url(${data}),auto` //div为你要改变光标的元素默认为包含状态栏的整个游戏画面,px/py为点击点偏移像素
}
this.removeMouse = function (div = 'gameGroup') {
core.dom[div].style.cursor = ''
core.dom[div].style.cursor = 'auto'
}
}
}