fix: `replaceButton` not a button.

This commit is contained in:
Rintim 2024-01-10 01:11:52 +08:00
parent 0a3d5216f5
commit f4fe5406c9
No known key found for this signature in database
GPG Key ID: BE9E1EA615BACFCF
5 changed files with 15594 additions and 15580 deletions

View File

@ -1659,6 +1659,11 @@ export class Get extends Uninstantable {
if (obj instanceof lib.element.Dialog) return 'dialog'; if (obj instanceof lib.element.Dialog) return 'dialog';
if (obj instanceof lib.element.GameEvent || if (obj instanceof lib.element.GameEvent ||
obj instanceof lib.element.GameEventPromise) return 'event'; obj instanceof lib.element.GameEventPromise) return 'event';
if (typeof obj !== 'object' || obj === null) return;
if (lib.experimental.symbol.itemType in obj)
return obj[lib.experimental.symbol.itemType]
} }
static equipNum(card) { static equipNum(card) {
if (get.type(card) == 'equip') { if (get.type(card) == 'equip') {

View File

@ -445,17 +445,16 @@ export async function boot() {
config.set('duration', 500); config.set('duration', 500);
if (!config.get('touchscreen')) { if (!config.get('touchscreen')) {
document.addEventListener('mousewheel', ui.click.windowmousewheel, { passive: true }); document.addEventListener('mousewheel', ui.click.windowmousewheel, { passive: true, capture: false });
document.addEventListener('mousemove', ui.click.windowmousemove); document.addEventListener('mousemove', ui.click.windowmousemove, false);
document.addEventListener('mousedown', ui.click.windowmousedown); document.addEventListener('mousedown', ui.click.windowmousedown, false);
document.addEventListener('mouseup', ui.click.windowmouseup); document.addEventListener('mouseup', ui.click.windowmouseup, false);
document.addEventListener('contextmenu', ui.click.right); document.addEventListener('contextmenu', ui.click.right, false);
} } else {
else { document.addEventListener('touchstart', ui.click.touchconfirm, false);
document.addEventListener('touchstart', ui.click.touchconfirm); document.addEventListener('touchstart', ui.click.windowtouchstart, false);
document.addEventListener('touchstart', ui.click.windowtouchstart); document.addEventListener('touchend', ui.click.windowtouchend, false);
document.addEventListener('touchend', ui.click.windowtouchend); document.addEventListener('touchmove', ui.click.windowtouchmove, false);
document.addEventListener('touchmove', ui.click.windowtouchmove);
} }
const stylesLoaded = await Promise.all(stylesLoading); const stylesLoaded = await Promise.all(stylesLoading);
@ -783,6 +782,7 @@ function setWindowListener() {
} }
else if (e.keyCode == 83 && (e.ctrlKey || e.metaKey)) { else if (e.keyCode == 83 && (e.ctrlKey || e.metaKey)) {
if (Reflect.has(window, 'saveNonameInput')) { if (Reflect.has(window, 'saveNonameInput')) {
// @ts-ignore
Reflect.get(window, 'saveNonameInput')(); Reflect.get(window, 'saveNonameInput')();
} }
e.preventDefault(); e.preventDefault();

View File

@ -1,5 +1,8 @@
import { Uninstantable } from "../../util/index.js"; import { Uninstantable } from "../../util/index.js";
export class Experimental extends Uninstantable { import { ExperimentalSymbol } from "./symbol.js";
export class Experimental extends Uninstantable {
static symbol = ExperimentalSymbol
static symbols = ExperimentalSymbol
} }

View File

@ -0,0 +1,5 @@
import { Uninstantable } from "../../util/index.js";
export class ExperimentalSymbol extends Uninstantable {
static itemType = Symbol('noname.experimental.itemType')
}

View File

@ -9790,6 +9790,7 @@ class Create extends Uninstantable {
} }
if (node._replaceButton) { if (node._replaceButton) {
var intro = ui.create.div('.button.replaceButton', node); var intro = ui.create.div('.button.replaceButton', node);
intro[lib.experimental.symbol.itemType] = 'button';
node.node.replaceButton = intro; node.node.replaceButton = intro;
intro.innerHTML = '切换'; intro.innerHTML = '切换';
intro._node = node; intro._node = node;