hantera global state för meny öppen/stängd
F5 för det är protype
This commit is contained in:
parent
736018b839
commit
dc83521730
@ -35,13 +35,17 @@ let selectedColor = 0;
|
||||
export const shortforms = $state({ standardList: "", subjectLists: [], cache: new Map() })
|
||||
export const importState = $state({ data: "", errors: [] })
|
||||
export const textSettings = $state({ font: "Arial", size: 30, colors: colorSetting, padding: 0, lineheight: 1 })
|
||||
export const appState = $state({ text: "" })
|
||||
export const appState = $state({ text: "", menuOpen: false })
|
||||
|
||||
export const selectNextColor = () => {
|
||||
selectedColor += 1
|
||||
textSettings.colors = colorThemes[(selectedColor % 6)]
|
||||
}
|
||||
|
||||
export const toggleMenuOpen = () => {
|
||||
appState.menuOpen = !appState.menuOpen
|
||||
}
|
||||
|
||||
export const incTextSize = () => {
|
||||
console.log(textSettings.size)
|
||||
if (textSettings.size < 200) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import type { ExpanderType } from "./index.d.ts";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { incTextSize, decTextSize, selectNextColor, appState } from "$lib/stores.svelte"
|
||||
import { incTextSize, decTextSize, selectNextColor, toggleMenuOpen, appState } from "$lib/stores.svelte"
|
||||
|
||||
let fullscreen = true;
|
||||
export const defaultExpanders: Map<string, ExpanderType> = new Map();
|
||||
@ -93,6 +93,15 @@ hotkeys.set("F4", {
|
||||
appState.text = ""
|
||||
}
|
||||
})
|
||||
|
||||
hotkeys.set("F5", {
|
||||
action: (e) => {
|
||||
e.preventDefault()
|
||||
toggleMenuOpen()
|
||||
console.log("Menu open", appState.menuOpen)
|
||||
}
|
||||
})
|
||||
|
||||
hotkeys.set("F6", {
|
||||
action: (e) => {
|
||||
e.preventDefault()
|
||||
|
Loading…
x
Reference in New Issue
Block a user