Browse Source

grafik: close task dialog when clicking outside of it

mj-deploy
Vašek Šraier 4 years ago
parent
commit
8d8f569997
  1. 3
      frontend/src/App.svelte
  2. 5
      frontend/src/Graph.svelte
  3. 1
      frontend/src/GraphNode.svelte

3
frontend/src/App.svelte

@ -39,7 +39,8 @@
<div style="height: 100%"> <div style="height: 100%">
<Graph <Graph
tasks={t} tasks={t}
on:selectTask={(e) => { if (e.detail.type != "label") (location.hash = `#task/${e.detail.id}`)}}/> on:selectTask={(e) => { if (e.detail.type != "label") (location.hash = `#task/${e.detail.id}`)}}
on:closeTask={() => {location.hash = '#'}} />
</div> </div>
</TasksLoader> </TasksLoader>
{/if} {/if}

5
frontend/src/Graph.svelte

@ -81,6 +81,10 @@ import TaskDetailEditor from "./TaskDetailEditor.svelte";
d3.select(container).call(zoomer); d3.select(container).call(zoomer);
} }
function containerClickHandler(e: MouseEvent) {
eventDispatcher("closeTask");
}
function groupSelectionHandler(e: MouseEvent) { function groupSelectionHandler(e: MouseEvent) {
// not enabled? // not enabled?
if (!selectionToolEnabled) return; if (!selectionToolEnabled) return;
@ -271,6 +275,7 @@ import TaskDetailEditor from "./TaskDetailEditor.svelte";
bind:this={container} bind:this={container}
bind:clientHeight bind:clientHeight
bind:clientWidth bind:clientWidth
on:click={containerClickHandler}
on:mousedown={groupSelectionHandler} on:mousedown={groupSelectionHandler}
on:contextmenu={(e) => { on:contextmenu={(e) => {
if (selectionToolEnabled) { if (selectionToolEnabled) {

1
frontend/src/GraphNode.svelte

@ -25,6 +25,7 @@
} }
function click(e: MouseEvent) { function click(e: MouseEvent) {
e.stopPropagation();
eventDispatcher("click", e); eventDispatcher("click", e);
} }