From 61ca34cdb8cf04d717d50bfe89af2561e9e2e769 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Fri, 13 Feb 2026 00:22:34 +0100 Subject: [PATCH] fix(common): fig click detection --- app/components/Common/Buttons.vue | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/app/components/Common/Buttons.vue b/app/components/Common/Buttons.vue index e519779..324353e 100644 --- a/app/components/Common/Buttons.vue +++ b/app/components/Common/Buttons.vue @@ -77,16 +77,6 @@ watch( ), ); -const forceAnimateBLabel = () => { - animateLabelChange( - (v) => (bButtonOffsetY = v), - (l) => (displayedBLabel = l), - props.bLabel, - ); -}; - -defineExpose({ forceAnimateBLabel }); - onRender((ctx) => { ctx.globalAlpha = props.opacity ?? 1; ctx.font = "10px NDS10"; @@ -112,21 +102,26 @@ onRender((ctx) => { ); }, 60); +let lastPressedButton: "A" | "B" | null = null; + onClick((x, y) => { if (props.yOffset !== 0) return; - if (rectContains(B_BUTTON, [x, y])) { + if (rectContains(B_BUTTON, [x, y]) && lastPressedButton === "B") { emit("activateB"); - } else if (rectContains(A_BUTTON, [x, y])) { + } else if (rectContains(A_BUTTON, [x, y]) && lastPressedButton === "A") { emit("activateA"); } + lastPressedButton = null; }); onMouseDown((x, y) => { if (props.yOffset !== 0) return; if (rectContains(B_BUTTON, [x, y])) { bButtonPressed = true; + lastPressedButton = "B"; } else if (rectContains(A_BUTTON, [x, y])) { aButtonPressed = true; + lastPressedButton = "A"; } });