added particles to highlighted edges

This commit is contained in:
David Mosbach 2023-05-06 21:29:23 +02:00
parent 3f322eef8e
commit f734d1e57c

View File

@ -15,7 +15,7 @@ var actionIdCounter = workflow.states ? workflow.actions.length : 0;
var actors = [];
workflow.actions.forEach(act => act.actionData.actors.forEach(a => {
var includes = false;
actors.forEach(actor => includes = includes || equalRoles(a, actor)); // TODO check if contents of 'authorized' also match if applicable
actors.forEach(actor => includes = includes || equalRoles(a, actor));
(!includes) && actors.push(a);
(!act.actionData.actorNames) && (act.actionData.actorNames = []);
act.actionData.actorNames.push(getActorName(a));
@ -300,6 +300,10 @@ const Graph = ForceGraph()
context.restore();
})
.linkLineDash(edge => edge.actionData.mode == 'automatic' && [2, 3]) //[dash, gap]
.linkWidth(edge => (edge.actionData.mode != 'automatic' && edge.actionData.actorNames.includes(selectedActor.value)) ? 3 : 1)
.linkDirectionalParticles(2)
.linkDirectionalParticleColor(() => '#00000055')
.linkDirectionalParticleWidth(edge => (edge.actionData.mode != 'automatic' && edge.actionData.actorNames.includes(selectedActor.value)) ? 3 : 0)
.nodeCanvasObject((node, ctx) => {
ctx.fillStyle = getColour(node);
ctx.beginPath();
@ -334,6 +338,7 @@ const Graph = ForceGraph()
var coords = Graph.screen2GraphCoords(event.layerX, event.layerY);
var newState = addState(coords.x, coords.y);
selection = newState;
});
})
.autoPauseRedraw(false);
updateGraph();