fix:自定义设置界面手感优化,PC支持鼠标移动修改选中的按钮
This commit is contained in:
parent
024c026b8d
commit
da209cdbac
@ -3896,6 +3896,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.btnList = new Map();
|
this.btnList = new Map();
|
||||||
this.keyEvent = () => { };
|
this.keyEvent = () => { };
|
||||||
|
this.onMoveEvent = undefined;
|
||||||
this.clickEvent = (x, y, px, py) => {
|
this.clickEvent = (x, y, px, py) => {
|
||||||
this.btnList.forEach((btn) => {
|
this.btnList.forEach((btn) => {
|
||||||
if (btn.disable) return;
|
if (btn.disable) return;
|
||||||
@ -3925,12 +3926,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
}
|
}
|
||||||
|
|
||||||
beginListen() {
|
beginListen() {
|
||||||
|
if (core.platform.isPC && this.onMoveEvent) core.registerAction('onmove', this.name, this.onMoveEvent, 100);
|
||||||
core.registerAction('keyDown', this.name, this.keyEvent, 100);
|
core.registerAction('keyDown', this.name, this.keyEvent, 100);
|
||||||
core.registerAction('ondown', this.name, this.clickEvent, 100);
|
core.registerAction('ondown', this.name, this.clickEvent, 100);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
endListen() {
|
endListen() {
|
||||||
|
core.unregisterAction('onmove', this.name);
|
||||||
core.unregisterAction('keyDown', this.name);
|
core.unregisterAction('keyDown', this.name);
|
||||||
core.unregisterAction('ondown', this.name);
|
core.unregisterAction('ondown', this.name);
|
||||||
}
|
}
|
||||||
@ -4808,6 +4810,20 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this.onMoveEvent = (x, y, px, py) => {
|
||||||
|
if (!core.platform.isPC) return;
|
||||||
|
const btnNow = this.selectedBtn;
|
||||||
|
if (btnNow) {
|
||||||
|
if (px >= btnNow.x && px <= btnNow.x + btnNow.w && py > btnNow.y && py <= btnNow.y + btnNow.h)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.btnList.forEach((btn, pos) => {
|
||||||
|
if (btn.disable) return;
|
||||||
|
if (px >= btn.x && px <= btn.x + btn.w && py > btn.y && py <= btn.y + btn.h) {
|
||||||
|
if (btnNow !== btn) this.focus(btn, pos);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
this.keyEvent = (keyCode) => {
|
this.keyEvent = (keyCode) => {
|
||||||
let x, y;
|
let x, y;
|
||||||
const changePos = (newPos) => {
|
const changePos = (newPos) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user