fix(common): fig click detection
This commit is contained in:
@@ -77,16 +77,6 @@ watch(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
const forceAnimateBLabel = () => {
|
|
||||||
animateLabelChange(
|
|
||||||
(v) => (bButtonOffsetY = v),
|
|
||||||
(l) => (displayedBLabel = l),
|
|
||||||
props.bLabel,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
defineExpose({ forceAnimateBLabel });
|
|
||||||
|
|
||||||
onRender((ctx) => {
|
onRender((ctx) => {
|
||||||
ctx.globalAlpha = props.opacity ?? 1;
|
ctx.globalAlpha = props.opacity ?? 1;
|
||||||
ctx.font = "10px NDS10";
|
ctx.font = "10px NDS10";
|
||||||
@@ -112,21 +102,26 @@ onRender((ctx) => {
|
|||||||
);
|
);
|
||||||
}, 60);
|
}, 60);
|
||||||
|
|
||||||
|
let lastPressedButton: "A" | "B" | null = null;
|
||||||
|
|
||||||
onClick((x, y) => {
|
onClick((x, y) => {
|
||||||
if (props.yOffset !== 0) return;
|
if (props.yOffset !== 0) return;
|
||||||
if (rectContains(B_BUTTON, [x, y])) {
|
if (rectContains(B_BUTTON, [x, y]) && lastPressedButton === "B") {
|
||||||
emit("activateB");
|
emit("activateB");
|
||||||
} else if (rectContains(A_BUTTON, [x, y])) {
|
} else if (rectContains(A_BUTTON, [x, y]) && lastPressedButton === "A") {
|
||||||
emit("activateA");
|
emit("activateA");
|
||||||
}
|
}
|
||||||
|
lastPressedButton = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
onMouseDown((x, y) => {
|
onMouseDown((x, y) => {
|
||||||
if (props.yOffset !== 0) return;
|
if (props.yOffset !== 0) return;
|
||||||
if (rectContains(B_BUTTON, [x, y])) {
|
if (rectContains(B_BUTTON, [x, y])) {
|
||||||
bButtonPressed = true;
|
bButtonPressed = true;
|
||||||
|
lastPressedButton = "B";
|
||||||
} else if (rectContains(A_BUTTON, [x, y])) {
|
} else if (rectContains(A_BUTTON, [x, y])) {
|
||||||
aButtonPressed = true;
|
aButtonPressed = true;
|
||||||
|
lastPressedButton = "A";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user