Compare commits
2 Commits
23b4e6249f
...
45f8550604
Author | SHA1 | Date | |
---|---|---|---|
45f8550604 | |||
865a8eee24 |
@ -38,39 +38,16 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
let showMenuPermanent = false;
|
let showMenuPermanent = false;
|
||||||
let menuButtonScrollIndex: number | null = null;
|
|
||||||
function onMenuButtonScroll(e: WheelEvent) {
|
|
||||||
if (menuButtonScrollIndex == null) {
|
|
||||||
if (e.deltaY < 0) {
|
|
||||||
menuButtonScrollIndex = navPaths.length - 1;
|
|
||||||
} else if (e.deltaY > 0) {
|
|
||||||
menuButtonScrollIndex = 0;
|
|
||||||
} else {
|
|
||||||
menuButtonScrollIndex = navPaths.length - 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
navPaths[menuButtonScrollIndex].active = false;
|
|
||||||
|
|
||||||
if (e.deltaY > 0) {
|
|
||||||
menuButtonScrollIndex++;
|
|
||||||
} else if (e.deltaY < 0) {
|
|
||||||
menuButtonScrollIndex--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (menuButtonScrollIndex > navPaths.length - 1) {
|
|
||||||
menuButtonScrollIndex = 0;
|
|
||||||
} else if (menuButtonScrollIndex < 0) {
|
|
||||||
menuButtonScrollIndex = navPaths.length - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
navPaths[menuButtonScrollIndex].active = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
let onAdminPage = false;
|
let onAdminPage = false;
|
||||||
$: onAdminPage =
|
$: onAdminPage =
|
||||||
$page.url.pathname.startsWith(`${env.PUBLIC_BASE_PATH}/admin`) &&
|
$page.url.pathname.startsWith(`${env.PUBLIC_BASE_PATH}/admin`) &&
|
||||||
$page.url.pathname !== `${env.PUBLIC_BASE_PATH}/admin/login`;
|
$page.url.pathname !== `${env.PUBLIC_BASE_PATH}/admin/login`;
|
||||||
|
$: {
|
||||||
|
for (let i = 0; i < navPaths.length; i++) {
|
||||||
|
navPaths[i].active = navPaths[i].href === $page.url.pathname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let isTouch = false;
|
let isTouch = false;
|
||||||
let nav: HTMLDivElement;
|
let nav: HTMLDivElement;
|
||||||
@ -120,13 +97,6 @@
|
|||||||
isTouch = true;
|
isTouch = true;
|
||||||
showMenuPermanent = !showMenuPermanent;
|
showMenuPermanent = !showMenuPermanent;
|
||||||
}}
|
}}
|
||||||
on:mouseleave={() => {
|
|
||||||
if (menuButtonScrollIndex !== null) {
|
|
||||||
navPaths[menuButtonScrollIndex].active = false;
|
|
||||||
}
|
|
||||||
menuButtonScrollIndex = null;
|
|
||||||
}}
|
|
||||||
on:wheel|preventDefault={onMenuButtonScroll}
|
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
class="absolute w-full h-full p-1 pixelated"
|
class="absolute w-full h-full p-1 pixelated"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user