Commit 79a23698 authored by unknown's avatar unknown

Box selection is now working

parent a9a0b9ca
......@@ -14,6 +14,7 @@ export class Graph2D {
this.cy = null;
this.nodes = [];
this.showClearMenu = true;
this.boxSelection = false;
}
......@@ -90,11 +91,18 @@ export class Graph2D {
this.cy.on('mouseout', 'node', this.deEmphasizeNode);
this.cy.on('boxselect', 'node', this.selectNode);
this.cy.on('boxend', () => this.boxSelection = true);
this.cy.on('tap', this.unselectNodes);
}
selectNode = (e) => {
const nodeId = e.target._private.data.id;
this.cy.getElementById(nodeId).style("backgroundColor", 'red');
this.cy.getElementById(nodeId).style('backgroundColor', 'Navy');
}
unselectNodes = () => {
this.cy.nodes().map(node => node.style('backgroundColor', node._private.data.color));
this.boxSelection = false;
}
showTooltip = () => {
......@@ -132,7 +140,13 @@ export class Graph2D {
deEmphasizeNode = (e) => {
let highlightedNode = this.cy.getElementById(this.selectedNodeId);
highlightedNode.style("backgroundColor", this.selectedNodeColor);
if (highlightedNode.selected() && this.boxSelection) {
highlightedNode.style("backgroundColor", "Navy");
}
else {
highlightedNode.style("backgroundColor", this.selectedNodeColor);
highlightedNode.unselect();
}
clearTimeout(this.hoverTimeout);
this.cy.elements().map(element => element.style("opacity", "1"));
const associatedSearchRows = [...document.getElementsByTagName("tr")].filter(row => {
......
module.exports = { version: '195' }
module.exports = { version: '196' }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment