fix(settings/clock/achievements): animation errors

This commit is contained in:
2026-03-16 13:25:32 +01:00
parent 085e5f20a9
commit 5c0014ca61
2 changed files with 10 additions and 10 deletions

View File

@@ -33,9 +33,9 @@ const achievements = useAchievementsStore();
const achievementsScreen = useAchievementsScreen(); const achievementsScreen = useAchievementsScreen();
const confirmationModal = useConfirmationModal(); const confirmationModal = useConfirmationModal();
const isAnimating = ref(true); const comingFromAchievements = store.returningFromAchievements;
const comingFromAchievements = app.previousScreen === "achievements"; const isAnimating = ref(!comingFromAchievements);
const bLabel = ref(comingFromAchievements ? $t("common.cancel") : $t("common.goBack")); const bLabel = ref(comingFromAchievements ? $t("common.cancel") : $t("common.goBack"));
const aLabel = ref(comingFromAchievements ? $t("common.reset") : $t("common.select")); const aLabel = ref(comingFromAchievements ? $t("common.reset") : $t("common.select"));
@@ -46,9 +46,9 @@ const ARROW_SLIDE_DURATION = 0.167;
const VIEW_ALL_OFFSET = -20; const VIEW_ALL_OFFSET = -20;
const animation = reactive({ const animation = reactive({
offsetY: SLIDE_OFFSET, offsetY: comingFromAchievements ? 0 : SLIDE_OFFSET,
opacity: 0, opacity: comingFromAchievements ? 1 : 0,
viewAllOffsetY: VIEW_ALL_OFFSET, viewAllOffsetY: comingFromAchievements ? 0 : VIEW_ALL_OFFSET,
}); });
const obtainedRef = const obtainedRef =
@@ -107,13 +107,10 @@ const animateOutro = async () => {
}; };
onMounted(() => { onMounted(() => {
store.returningFromAchievements = false;
if (comingFromAchievements) { if (comingFromAchievements) {
obtainedRef.value?.showInstant(); obtainedRef.value?.showInstant();
totalRef.value?.showInstant(); totalRef.value?.showInstant();
animation.offsetY = 0;
animation.opacity = 1;
animation.viewAllOffsetY = 0;
isAnimating.value = false;
return; return;
} }
animateIntro(); animateIntro();
@@ -142,6 +139,7 @@ const handleReset = () => {
const handleVisitAll = () => { const handleVisitAll = () => {
if (isAnimating.value) return; if (isAnimating.value) return;
assets.audio.menuOpen.play(); assets.audio.menuOpen.play();
store.returningFromAchievements = true;
achievementsScreen.animateFadeToBlackIntro(); achievementsScreen.animateFadeToBlackIntro();
}; };
@@ -174,7 +172,7 @@ onRender((ctx) => {
? APP_COLOR_TO_FONT_COLOR[app.color.hex]! ? APP_COLOR_TO_FONT_COLOR[app.color.hex]!
: "#fbfbfb"; : "#fbfbfb";
ctx.fillText("/", 7 * 16 + 3, 4 * 16 + 4 + 39); ctx.fillText("/", 7 * 16 + 3, 4 * 16 + 4 + 39);
}); }, 5);
onRender((ctx) => { onRender((ctx) => {
ctx.translate(0, animation.viewAllOffsetY); ctx.translate(0, animation.viewAllOffsetY);

View File

@@ -58,6 +58,8 @@ export const useSettingsStore = defineStore("settings", {
isIntro: true, isIntro: true,
isOutro: false, isOutro: false,
returningFromAchievements: false,
}), }),
actions: { actions: {