|
@ -2,7 +2,7 @@ |
|
|
import { getContext } from "svelte"; |
|
|
import { getContext } from "svelte"; |
|
|
|
|
|
|
|
|
import Graph from "./Graph.svelte"; |
|
|
import Graph from "./Graph.svelte"; |
|
|
import { nonNull, saveToLocalDisk } from "./helpers"; |
|
|
import { isEditableElement, nonNull, saveToLocalDisk } from "./helpers"; |
|
|
import type { TaskDescriptor, TasksFile } from "./tasks"; |
|
|
import type { TaskDescriptor, TasksFile } from "./tasks"; |
|
|
import { loadTasks, resetTasks, saveTasks, getCategories, tasksToString } from "./tasks"; |
|
|
import { loadTasks, resetTasks, saveTasks, getCategories, tasksToString } from "./tasks"; |
|
|
import TaskDisplay from "./TaskDisplay.svelte"; |
|
|
import TaskDisplay from "./TaskDisplay.svelte"; |
|
@ -240,6 +240,28 @@ |
|
|
} |
|
|
} |
|
|
tasks = tasks; |
|
|
tasks = tasks; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function keydown(e: KeyboardEvent) { |
|
|
|
|
|
if (isEditableElement(document.activeElement)) { |
|
|
|
|
|
// another element has focus - ignore our shortcuts |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const shortcuts = { |
|
|
|
|
|
"z": showSelection, |
|
|
|
|
|
"s": hideSelection, |
|
|
|
|
|
"o": () => removeTask(clicked[clicked.length - 1]), |
|
|
|
|
|
"n": addTask, |
|
|
|
|
|
"h": addEdge, |
|
|
|
|
|
"<Ctrl>s": saveCurrentState, |
|
|
|
|
|
"r": () => { showHiddenEdges = !showHiddenEdges }, |
|
|
|
|
|
} as { [name: string]: () => void } |
|
|
|
|
|
const keyCode = (e.ctrlKey ? "<Ctrl>" : "") + (e.shiftKey ? "<Shift>" : "") + e.key |
|
|
|
|
|
if (shortcuts[keyCode]) { |
|
|
|
|
|
shortcuts[keyCode]() |
|
|
|
|
|
e.stopPropagation() |
|
|
|
|
|
e.preventDefault() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style> |
|
|
<style> |
|
@ -341,6 +363,8 @@ |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |
|
|
|
|
|
|
|
|
|
|
|
<svelte:window on:keydown={e => keydown(e)} /> |
|
|
|
|
|
|
|
|
<Graph |
|
|
<Graph |
|
|
{tasks} |
|
|
{tasks} |
|
|
selectionToolEnabled={true} |
|
|
selectionToolEnabled={true} |
|
@ -364,24 +388,24 @@ |
|
|
<div class="toolbox"> |
|
|
<div class="toolbox"> |
|
|
<h3>Toolbox</h3> |
|
|
<h3>Toolbox</h3> |
|
|
<div> |
|
|
<div> |
|
|
<button on:click={saveCurrentState}>Uložit aktuální stav</button> |
|
|
<button on:click={saveCurrentState}>Uložit aktuální stav [C+S]</button> |
|
|
<button on:click={resetCurrentState}>Resetovat aktuální stav</button> |
|
|
<button on:click={resetCurrentState}>Resetovat aktuální stav</button> |
|
|
</div> |
|
|
</div> |
|
|
<button on:click={saveLocally}>Stáhnout data lokálně</button> |
|
|
<button on:click={saveLocally}>Stáhnout data lokálně</button> |
|
|
<div class="gap" /> |
|
|
<div class="gap" /> |
|
|
<div> |
|
|
<div> |
|
|
<button on:click={addTask}>Nový node</button> |
|
|
<button on:click={addTask}>[N]ový node</button> |
|
|
<button |
|
|
<button |
|
|
disabled={clicked.length == 0} |
|
|
disabled={clicked.length == 0} |
|
|
on:click={() => removeTask(clicked[clicked.length - 1])}>Odstranit "{clicked[clicked.length - 1] ?? '???'}"</button> |
|
|
on:click={() => removeTask(clicked[clicked.length - 1])}>[O]dstranit {clicked[clicked.length - 1] ?? '???'}</button> |
|
|
</div> |
|
|
</div> |
|
|
<div class="gap" /> |
|
|
<div class="gap" /> |
|
|
<div> |
|
|
<div> |
|
|
<button disabled={clicked.length <= 1} on:click={addEdge}>Přidat hranu {clicked[clicked.length - 2] ?? '???'} |
|
|
<button disabled={clicked.length <= 1} on:click={addEdge}>Přidat [h]ranu {clicked[clicked.length - 2] ?? '???'} |
|
|
-> {clicked[clicked.length - 1] ?? '???'}</button> |
|
|
-> {clicked[clicked.length - 1] ?? '???'}</button> |
|
|
<div class="checkbox"> |
|
|
<div class="checkbox"> |
|
|
<label> |
|
|
<label> |
|
|
<input type="checkbox" bind:checked={showHiddenEdges} /> Zobrazit skryté |
|
|
<input type="checkbox" bind:checked={showHiddenEdges} /> Zob[r]azit skryté |
|
|
hrany |
|
|
hrany |
|
|
</label> |
|
|
</label> |
|
|
</div> |
|
|
</div> |
|
@ -420,8 +444,8 @@ |
|
|
</button> |
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
<div> |
|
|
<div> |
|
|
<button on:click={hideSelection}>Skrýt výběr</button> |
|
|
<button on:click={hideSelection}>[S]krýt výběr</button> |
|
|
<button on:click={showSelection}>Zobrazit výběr</button> |
|
|
<button on:click={showSelection}>[Z]obrazit výběr</button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|