Implement ctrl-tab navigation between weight and energy
This commit is contained in:
@@ -3,15 +3,23 @@
|
|||||||
import Router from "$lib/router/Router.svelte";
|
import Router from "$lib/router/Router.svelte";
|
||||||
import { Close } from "$wails/main/App";
|
import { Close } from "$wails/main/App";
|
||||||
import { Toaster } from "svelte-sonner";
|
import { Toaster } from "svelte-sonner";
|
||||||
|
import * as srouter from "svelte-spa-router";
|
||||||
|
import { location } from "svelte-spa-router";
|
||||||
|
|
||||||
function keyDown(event: KeyboardEvent) {
|
function keyDown(event: KeyboardEvent) {
|
||||||
if (event.ctrlKey && event.key == "r") {
|
if (event.ctrlKey && event.key == "r") {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
if (event.ctrlKey && event.key == 'w') {
|
if (event.ctrlKey && event.key == "w") {
|
||||||
console.log("close");
|
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
if (event.ctrlKey && event.key == "Tab") {
|
||||||
|
if ($location == "/") {
|
||||||
|
srouter.replace("/Weight");
|
||||||
|
} else if ($location == "/Weight") {
|
||||||
|
srouter.replace("/");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -19,8 +27,8 @@
|
|||||||
|
|
||||||
<Toaster />
|
<Toaster />
|
||||||
<template>
|
<template>
|
||||||
<Header />
|
<Header />
|
||||||
<main class="flex-1">
|
<main class="flex-1">
|
||||||
<Router />
|
<Router />
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
let forceUpdate = false;
|
let forceUpdate = false;
|
||||||
weightStore.subscribe(() => {
|
weightStore.subscribe(() => {
|
||||||
console.log("updte");
|
|
||||||
forceUpdate = !forceUpdate;
|
forceUpdate = !forceUpdate;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user