kmcom-nuxt-layers 6.2.0 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,6 +18,12 @@ export default defineNuxtPlugin({
|
|
|
18
18
|
const instance = shallowRef<LocomotiveScroll | null>(null)
|
|
19
19
|
const { screen } = useLoading()
|
|
20
20
|
|
|
21
|
+
// Under the loading screen Lenis must be stopped, not just left un-started: an unstopped
|
|
22
|
+
// Lenis still takes wheel/touch input and replays it as a jump once it starts
|
|
23
|
+
function holdForLoadingScreen(scroll: LocomotiveScroll) {
|
|
24
|
+
if (screen.value === 'visible') scroll.lenisInstance?.stop()
|
|
25
|
+
}
|
|
26
|
+
|
|
21
27
|
function init() {
|
|
22
28
|
if (instance.value) return
|
|
23
29
|
instance.value = new LocomotiveScroll({
|
|
@@ -37,6 +43,7 @@ export default defineNuxtPlugin({
|
|
|
37
43
|
ScrollTrigger.update()
|
|
38
44
|
},
|
|
39
45
|
})
|
|
46
|
+
holdForLoadingScreen(instance.value)
|
|
40
47
|
|
|
41
48
|
// ScrollTriggers created before Lenis exists (page:finish can fire first)
|
|
42
49
|
// refresh against a null instance — remeasure once real layout settles.
|
|
@@ -51,6 +58,7 @@ export default defineNuxtPlugin({
|
|
|
51
58
|
|
|
52
59
|
// Hold motion until core's boot loading screen reveals the page: GSAP stays paused while the
|
|
53
60
|
// screen is up, so entrance animations play once it's gone; scrolling unlocks as it exits.
|
|
61
|
+
// Without a mounted screen the state stays 'hidden' and GSAP is never touched.
|
|
54
62
|
watch(
|
|
55
63
|
screen,
|
|
56
64
|
(state) => {
|
|
@@ -64,7 +72,7 @@ export default defineNuxtPlugin({
|
|
|
64
72
|
ScrollTrigger.refresh()
|
|
65
73
|
})
|
|
66
74
|
},
|
|
67
|
-
{ immediate:
|
|
75
|
+
{ immediate: screen.value !== 'hidden' }
|
|
68
76
|
)
|
|
69
77
|
|
|
70
78
|
const router = useRouter()
|
package/package.json
CHANGED