"use strict"; const common_vendor = require("../../../common/vendor.js"); const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ __name: "arrowkeys", props: { movebottom: { type: Number, default: 30 }, moveleft: { type: Number, default: 10 }, leftbuttonname: { type: String, default: "返回" }, rightbuttonname: { type: String, default: "确定" } }, emits: ["movecard"], setup(__props, { emit: __emit }) { const emit = __emit; let clickResetTimer = null; let longPressInterval = null; let isLongPress = false; const beblue = common_vendor.ref(-1); let activeLongPressDir = null; function clearClickResetTimer() { if (clickResetTimer) { clearTimeout(clickResetTimer); clickResetTimer = null; } } function clearLongPressInterval() { if (longPressInterval) { clearInterval(longPressInterval); longPressInterval = null; } isLongPress = false; activeLongPressDir = null; } function onTap(dir) { clearLongPressInterval(); clearClickResetTimer(); beblue.value = dir; emit("movecard", dir); clickResetTimer = setTimeout(() => { beblue.value = -1; clickResetTimer = null; }, 500); } function onLongPressStart(dir, e) { clearClickResetTimer(); clearLongPressInterval(); beblue.value = dir; emit("movecard", dir); activeLongPressDir = dir; isLongPress = true; longPressInterval = setInterval(() => { if (activeLongPressDir !== null) emit("movecard", activeLongPressDir); }, 500); } function onLongPressEnd() { if (!isLongPress) return; clearLongPressInterval(); clearClickResetTimer(); clickResetTimer = setTimeout(() => { beblue.value = -1; clickResetTimer = null; }, 500); } common_vendor.onBeforeUnmount(() => { clearClickResetTimer(); clearLongPressInterval(); }); return (_ctx, _cache) => { return { a: `/static/index/newruler/${beblue.value === 5 ? 1 : 0}.png`, b: common_vendor.t(__props.leftbuttonname), c: common_vendor.n(beblue.value === 5 ? "grad-text" : ""), d: common_vendor.n(beblue.value === 5 ? "click-box-target" : "click-box"), e: common_vendor.o(($event) => onTap(5)), f: common_vendor.o((e) => onLongPressStart(5)), g: `/static/index/newruler/${beblue.value === 0 ? 1 : 0}.png`, h: `/static/index/newruler/fangxiang${beblue.value === 0 ? "target" : ""}.png`, i: common_vendor.n(beblue.value === 0 ? "click-box-target" : "click-box"), j: common_vendor.o(($event) => onTap(0)), k: common_vendor.o((e) => onLongPressStart(0)), l: `/static/index/newruler/${beblue.value === 4 ? 1 : 0}.png`, m: common_vendor.t(__props.rightbuttonname), n: common_vendor.n(beblue.value === 4 ? "grad-text" : ""), o: common_vendor.n(beblue.value === 4 ? "click-box-target" : "click-box"), p: common_vendor.o(($event) => onTap(4)), q: common_vendor.o((e) => onLongPressStart(4)), r: `/static/index/newruler/${beblue.value === 3 ? 1 : 0}.png`, s: `/static/index/newruler/fangxiang${beblue.value === 3 ? "target" : ""}.png`, t: common_vendor.n(beblue.value === 3 ? "click-box-target" : "click-box"), v: common_vendor.o(($event) => onTap(3)), w: common_vendor.o((e) => onLongPressStart(3)), x: `/static/index/newruler/${beblue.value === 2 ? 1 : 0}.png`, y: `/static/index/newruler/fangxiang${beblue.value === 2 ? "target" : ""}.png`, z: common_vendor.n(beblue.value === 2 ? "click-box-target" : "click-box"), A: common_vendor.o(($event) => onTap(2)), B: common_vendor.o((e) => onLongPressStart(2)), C: `/static/index/newruler/${beblue.value === 1 ? 1 : 0}.png`, D: `/static/index/newruler/fangxiang${beblue.value === 1 ? "target" : ""}.png`, E: common_vendor.n(beblue.value === 1 ? "click-box-target" : "click-box"), F: common_vendor.o(($event) => onTap(1)), G: common_vendor.o((e) => onLongPressStart(1)), H: `${__props.movebottom}rpx`, I: `${__props.moveleft}rpx`, J: common_vendor.o(onLongPressEnd), K: common_vendor.o(onLongPressEnd) }; }; } }); const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-7e0708e6"]]); wx.createComponent(Component); //# sourceMappingURL=../../../../.sourcemap/mp-weixin/component/public/newgame/arrowkeys.js.map