Browse Source

graph: neda se klikat na labely

mj-deploy
Vašek Šraier 4 years ago
parent
commit
c03c6566c5
  1. 6
      frontend/src/App.svelte
  2. 2
      frontend/src/Graph.svelte
  3. 18
      frontend/src/GraphNode.svelte
  4. 3
      frontend/src/TaskPanel.svelte

6
frontend/src/App.svelte

@ -6,6 +6,8 @@
import TaskPanel from "./TaskPanel.svelte";
import Editor from "./Editor.svelte";
import Modal from "svelte-simple-modal";
import GraphEdge from "./GraphEdge.svelte";
import TaskDetailEditor from "./TaskDetailEditor.svelte";
const tasksPromise: Promise<TasksFile> = loadTasks();
@ -39,8 +41,8 @@
<div style="height: 100%">
<Graph
tasks={t}
on:selectTask={(e) => (location.hash = `#task/${e.detail.id}`)}
on:preSelectTask={(e) => taskPanel.preSelect(e.detail)}
on:selectTask={(e) => { if (e.detail.type != "label") (location.hash = `#task/${e.detail.id}`)}}
on:preSelectTask={(e) => taskPanel.preSelect(e.detail) }
on:unPreSelectTask={(e) => taskPanel.unPreselect(e.detail)} />
</div>
</TasksLoader>

2
frontend/src/Graph.svelte

@ -7,8 +7,6 @@
import { createNodesAndEdges } from "./graph-types";
import { taskForce } from "./task-force";
import { taskStatuses } from './task-status-cache'
import { grabTaskStates, isLoggedIn } from "./ksp-task-grabber";
import type { TaskStatus } from "./ksp-task-grabber"
export let tasks: TasksFile;
export let repulsionForce: number = -1000;

18
frontend/src/GraphNode.svelte

@ -73,9 +73,16 @@
</script>
<style>
g {
g:not(.label) {
cursor: pointer;
}
.label {
font-size: 1.5em;
fill: gainsboro;
stroke: gainsboro;
cursor: default;
}
g:hover > .taskNode {
fill: #ffb3a2;
}
@ -88,12 +95,6 @@
.solved .taskNode {
fill: green; /* TODO */
}
.label {
font-size: 1.5em;
fill: gainsboro;
stroke: gainsboro;
}
</style>
<g
@ -104,13 +105,12 @@
on:mouseup={dragStop}
on:mousemove={drag}
on:dblclick={dblclick}
class={status == null ? '' : status.solved ? 'solved' : status.submitted ? 'submitted' : ''}>
class="{status == null ? '' : status.solved ? 'solved' : status.submitted ? 'submitted' : ''} {task.task.type}">
{#if task.task.type == 'label'}
{#if draggingEnabled }
<ellipse rx={ellipse_rx} ry={20} {cx} {cy} />
{/if}
<text
class="label"
bind:this={text_element}
x={cx}
y={cy + 5}

3
frontend/src/TaskPanel.svelte

@ -11,6 +11,9 @@
let heightClass: "closed" | "collapsed" | "full" | "preview" = "collapsed"
export function preSelect(task: TaskDescriptor) {
// don't show anything for labels
if (task.type == "label") return;
if (heightClass != "full") {
selectedTask = task
heightClass = "preview"