graph: neda se klikat na labely
This commit is contained in:
parent
c778b879f7
commit
c03c6566c5
4 changed files with 16 additions and 13 deletions
|
@ -6,6 +6,8 @@
|
||||||
import TaskPanel from "./TaskPanel.svelte";
|
import TaskPanel from "./TaskPanel.svelte";
|
||||||
import Editor from "./Editor.svelte";
|
import Editor from "./Editor.svelte";
|
||||||
import Modal from "svelte-simple-modal";
|
import Modal from "svelte-simple-modal";
|
||||||
|
import GraphEdge from "./GraphEdge.svelte";
|
||||||
|
import TaskDetailEditor from "./TaskDetailEditor.svelte";
|
||||||
|
|
||||||
const tasksPromise: Promise<TasksFile> = loadTasks();
|
const tasksPromise: Promise<TasksFile> = loadTasks();
|
||||||
|
|
||||||
|
@ -39,8 +41,8 @@
|
||||||
<div style="height: 100%">
|
<div style="height: 100%">
|
||||||
<Graph
|
<Graph
|
||||||
tasks={t}
|
tasks={t}
|
||||||
on:selectTask={(e) => (location.hash = `#task/${e.detail.id}`)}
|
on:selectTask={(e) => { if (e.detail.type != "label") (location.hash = `#task/${e.detail.id}`)}}
|
||||||
on:preSelectTask={(e) => taskPanel.preSelect(e.detail)}
|
on:preSelectTask={(e) => taskPanel.preSelect(e.detail) }
|
||||||
on:unPreSelectTask={(e) => taskPanel.unPreselect(e.detail)} />
|
on:unPreSelectTask={(e) => taskPanel.unPreselect(e.detail)} />
|
||||||
</div>
|
</div>
|
||||||
</TasksLoader>
|
</TasksLoader>
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
import { createNodesAndEdges } from "./graph-types";
|
import { createNodesAndEdges } from "./graph-types";
|
||||||
import { taskForce } from "./task-force";
|
import { taskForce } from "./task-force";
|
||||||
import { taskStatuses } from './task-status-cache'
|
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 tasks: TasksFile;
|
||||||
export let repulsionForce: number = -1000;
|
export let repulsionForce: number = -1000;
|
||||||
|
|
|
@ -73,9 +73,16 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
g {
|
g:not(.label) {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
.label {
|
||||||
|
font-size: 1.5em;
|
||||||
|
fill: gainsboro;
|
||||||
|
stroke: gainsboro;
|
||||||
|
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
g:hover > .taskNode {
|
g:hover > .taskNode {
|
||||||
fill: #ffb3a2;
|
fill: #ffb3a2;
|
||||||
}
|
}
|
||||||
|
@ -88,12 +95,6 @@
|
||||||
.solved .taskNode {
|
.solved .taskNode {
|
||||||
fill: green; /* TODO */
|
fill: green; /* TODO */
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
|
||||||
font-size: 1.5em;
|
|
||||||
fill: gainsboro;
|
|
||||||
stroke: gainsboro;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<g
|
<g
|
||||||
|
@ -104,13 +105,12 @@
|
||||||
on:mouseup={dragStop}
|
on:mouseup={dragStop}
|
||||||
on:mousemove={drag}
|
on:mousemove={drag}
|
||||||
on:dblclick={dblclick}
|
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 task.task.type == 'label'}
|
||||||
{#if draggingEnabled }
|
{#if draggingEnabled }
|
||||||
<ellipse rx={ellipse_rx} ry={20} {cx} {cy} />
|
<ellipse rx={ellipse_rx} ry={20} {cx} {cy} />
|
||||||
{/if}
|
{/if}
|
||||||
<text
|
<text
|
||||||
class="label"
|
|
||||||
bind:this={text_element}
|
bind:this={text_element}
|
||||||
x={cx}
|
x={cx}
|
||||||
y={cy + 5}
|
y={cy + 5}
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
let heightClass: "closed" | "collapsed" | "full" | "preview" = "collapsed"
|
let heightClass: "closed" | "collapsed" | "full" | "preview" = "collapsed"
|
||||||
|
|
||||||
export function preSelect(task: TaskDescriptor) {
|
export function preSelect(task: TaskDescriptor) {
|
||||||
|
// don't show anything for labels
|
||||||
|
if (task.type == "label") return;
|
||||||
|
|
||||||
if (heightClass != "full") {
|
if (heightClass != "full") {
|
||||||
selectedTask = task
|
selectedTask = task
|
||||||
heightClass = "preview"
|
heightClass = "preview"
|
||||||
|
|
Reference in a new issue