forked from enviPath/enviPy
PW interactions
This commit is contained in:
@ -605,7 +605,36 @@ function draw(pathway, elem) {
|
||||
// Check if target is pseudo and draw marker only if not pseudo
|
||||
.attr("class", d => d.target.pseudo ? "link_no_arrow" : "link")
|
||||
.attr("marker-end", d => d.target.pseudo ? '' : d.multi_step ? 'url(#doublearrow)' : 'url(#arrow)')
|
||||
.on("click", function(event, d) {
|
||||
const wasHighlighted = d3.select(this).classed("highlighted");
|
||||
|
||||
d3.selectAll("line").classed("highlighted", false);
|
||||
|
||||
if (!wasHighlighted) {
|
||||
const toHighlight = [];
|
||||
toHighlight.push(d.el);
|
||||
|
||||
if (d.source.pseudo || d.target.pseudo) {
|
||||
if (d.target.pseudo) {
|
||||
d3.selectAll("line").each(e => {
|
||||
if (e !== undefined && e.source.id === d.target.id) {
|
||||
toHighlight.push(e.el);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
d3.selectAll("line").each(e => {
|
||||
if (e !== undefined && (e.target.id === d.source.id || e.source.id === d.source.id)) {
|
||||
toHighlight.push(e.el);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (const e of toHighlight) {
|
||||
d3.select(e).classed("highlighted", true);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// add element to links array
|
||||
link.each(function (d) {
|
||||
@ -624,7 +653,13 @@ function draw(pathway, elem) {
|
||||
.on("drag", dragged)
|
||||
.on("end", dragended))
|
||||
.on("click", function (event, d) {
|
||||
d3.select(this).select("circle").classed("highlighted", !d3.select(this).select("circle").classed("highlighted"));
|
||||
const wasHighlighted = d3.select(this).select("circle").classed("highlighted");
|
||||
|
||||
d3.selectAll('circle.highlighted').classed('highlighted', false);
|
||||
|
||||
if (!wasHighlighted) {
|
||||
d3.select(this).select("circle").classed("highlighted", !d3.select(this).select("circle").classed("highlighted"));
|
||||
}
|
||||
})
|
||||
|
||||
// Kreise für die Knoten hinzufügen
|
||||
|
||||
Reference in New Issue
Block a user