parent
1206a05633
commit
7668b12abb
2 changed files with 4 additions and 15 deletions
|
@ -51,16 +51,13 @@
|
||||||
tasks = tasks;
|
tasks = tasks;
|
||||||
|
|
||||||
// run simulation
|
// run simulation
|
||||||
toggleDivnaPromena();
|
graph.runSimulation()
|
||||||
} else {
|
} else {
|
||||||
alert("Nope, prvni musis nekam klikat...");
|
alert("Nope, prvni musis nekam klikat...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let hovnoDivnaPromenaKteraJeFaktFuj = true;
|
let graph: Graph
|
||||||
function toggleDivnaPromena() {
|
|
||||||
hovnoDivnaPromenaKteraJeFaktFuj = !hovnoDivnaPromenaKteraJeFaktFuj;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function saveCurrentState() {
|
async function saveCurrentState() {
|
||||||
await saveTasks(tasks);
|
await saveTasks(tasks);
|
||||||
|
@ -127,7 +124,7 @@
|
||||||
{repulsionForce}
|
{repulsionForce}
|
||||||
bind:selectedTask
|
bind:selectedTask
|
||||||
on:selectTask={clickTask}
|
on:selectTask={clickTask}
|
||||||
runSimulationWeirdHack={hovnoDivnaPromenaKteraJeFaktFuj} />
|
bind:this={graph} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function runSimulation() {
|
export function runSimulation() {
|
||||||
// Let's list the force we wanna apply on the network
|
// Let's list the force we wanna apply on the network
|
||||||
let simulation = d3
|
let simulation = d3
|
||||||
.forceSimulation(nodes) // Force algorithm is applied to data.nodes
|
.forceSimulation(nodes) // Force algorithm is applied to data.nodes
|
||||||
|
@ -84,14 +84,6 @@
|
||||||
let zoomer = d3.zoom().scaleExtent([0.1, 2]).on("zoom", zoomed);
|
let zoomer = d3.zoom().scaleExtent([0.1, 2]).on("zoom", zoomed);
|
||||||
d3.select(container).call(zoomer);
|
d3.select(container).call(zoomer);
|
||||||
});
|
});
|
||||||
|
|
||||||
// don't forget to vomit 🤮🤢
|
|
||||||
export let runSimulationWeirdHack: boolean = false;
|
|
||||||
$: {
|
|
||||||
runSimulationWeirdHack;
|
|
||||||
runSimulation();
|
|
||||||
}
|
|
||||||
// now it's safe to stop vomitting 🤮
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
Reference in a new issue