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 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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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"
|
||||
|
|
Reference in a new issue