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) => {
|
||||
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";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user