Fix overlapping groups

This commit is contained in:
Ian Gulliver
2019-07-09 20:34:36 +00:00
parent b7d51417d6
commit b0bc1e5f3b
4 changed files with 30 additions and 2 deletions

View File

@@ -4,6 +4,10 @@ class LayoutGroup {
this.nodesByPos_ = nodesByPos;
this.nodes = new Set(nodes);
this.tension = 0;
for (let node of nodes) {
node.groups.push(this);
}
}
setTension() {
@@ -68,6 +72,12 @@ class LayoutGroup {
return [min, max];
}
isContained(pos) {
let [min, max] = this.getMinMax();
return (pos[0] >= min[0] && pos[0] <= max[0] &&
pos[1] >= min[1] && pos[1] <= max[1]);
}
getStep() {
if (!this.graphGroup_) {
return null;