hldy_app/unpackage/dist/dev/mp-weixin/component/public/game/joystick.js

53 lines
1.7 KiB
JavaScript
Raw Normal View History

2025-05-20 16:10:53 +08:00
"use strict";
const common_vendor = require("../../../common/vendor.js");
const common_assets = require("../../../common/assets.js");
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "joystick",
emits: ["movecard"],
setup(__props, { emit: __emit }) {
const emit = __emit;
const icons = common_vendor.reactive({
up: "/static/index/keyimg/up1.png",
right: "/static/index/keyimg/where2.png",
down: "/static/index/keyimg/down1.png",
left: "/static/index/keyimg/where1.png"
});
const key = common_vendor.ref(-1);
let resetTimer = null;
function handleClick(dir) {
if (resetTimer !== null) {
clearTimeout(resetTimer);
}
key.value = dir;
emit("movecard", dir);
resetTimer = setTimeout(() => {
key.value = -1;
resetTimer = null;
}, 500);
}
return (_ctx, _cache) => {
return {
a: key.value === 0,
2025-06-19 17:04:05 +08:00
b: common_assets._imports_0$11,
2025-05-20 16:10:53 +08:00
c: key.value === 2,
2025-06-19 17:04:05 +08:00
d: common_assets._imports_0$11,
2025-05-20 16:10:53 +08:00
e: key.value === 3,
2025-06-19 17:04:05 +08:00
f: common_assets._imports_0$11,
2025-05-20 16:10:53 +08:00
g: key.value === 1,
2025-06-19 17:04:05 +08:00
h: common_assets._imports_0$11,
2025-05-20 16:10:53 +08:00
i: icons.up,
j: common_vendor.o(($event) => handleClick(0)),
k: icons.right,
l: common_vendor.o(($event) => handleClick(1)),
m: icons.down,
n: common_vendor.o(($event) => handleClick(2)),
o: icons.left,
p: common_vendor.o(($event) => handleClick(3))
};
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-293b8ace"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/component/public/game/joystick.js.map