goto selected menu item when scrolling with mousewheel on chest and clicking on it

This commit is contained in:
bytedream 2023-08-26 12:09:41 +02:00
parent 3205bb6dc1
commit b16c8a91e6

View File

@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import '../app.css'; import '../app.css';
import { env } from '$env/dynamic/public'; import { env } from '$env/dynamic/public';
import { goto } from '$app/navigation';
let navPaths = [ let navPaths = [
{ {
@ -78,7 +79,14 @@
? 'btn btn-square relative w-16 h-16' ? 'btn btn-square relative w-16 h-16'
: 'btn btn-square group/menu-button relative w-16 h-16'} : 'btn btn-square group/menu-button relative w-16 h-16'}
on:click={() => { on:click={() => {
if (!isTouch) showMenuPermanent = !showMenuPermanent; if (!isTouch) {
let activePath = navPaths.find((path) => path.active);
if (activePath !== undefined) {
goto(activePath.href);
} else {
showMenuPermanent = !showMenuPermanent;
}
}
}} }}
on:touchend={() => { on:touchend={() => {
isTouch = true; isTouch = true;