fix: page transitions can be buggy, fixes #55, #23

This commit is contained in:
2023-12-02 20:24:42 +01:00
parent c37ae7da7b
commit fb490b3db6

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import {fly} from "svelte/transition"
import {afterNavigate, beforeNavigate} from "$app/navigation"
import {expoIn, expoOut, quadIn, quadOut} from "svelte/easing"
import {expoIn, expoOut} from "svelte/easing"
let inDirection = 0
let outDirection = 0
@@ -20,15 +20,14 @@
if (!(from && to && routeOrder.includes(from) && routeOrder.includes(to))) {
inDirection = 0
outDirection = 0
return
} else {
const fromIndex = routeOrder.indexOf(from)
const toIndex = routeOrder.indexOf(to)
inDirection = fromIndex > toIndex ? -1 : 1
outDirection = fromIndex > toIndex ? 1 : -1
}
const fromIndex = routeOrder.indexOf(from)
const toIndex = routeOrder.indexOf(to)
inDirection = fromIndex > toIndex ? -1 : 1
outDirection = fromIndex > toIndex ? 1 : -1
animationDone = new Promise(resolve => {
outroEnd = resolve
})