Skip to content

Commit d833b2b

Browse files
committed
Large flowcharts fix
1 parent 0bfca42 commit d833b2b

File tree

6 files changed

+14
-52
lines changed

6 files changed

+14
-52
lines changed

demo/flowy.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/flowy.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

engine/flowy.css

Lines changed: 1 addition & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

engine/flowy.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ var flowy = function(canvas, grab, release, snapping, spacing_x, spacing_y) {
463463
}
464464
}
465465
for (var w = 0; w < blocks.length; w++) {
466-
blocks[w].x = (document.querySelector(".blockid[value='" + blocks[w].id + "']").parentNode.getBoundingClientRect().left + window.scrollX) + (canvas_div.getBoundingClientRect().left + window.scrollX) - (parseInt(window.getComputedStyle(document.querySelector(".blockid[value='" + blocks[w].id + "']").parentNode).width) / 2) - 40;
466+
blocks[w].x = (document.querySelector(".blockid[value='" + blocks[w].id + "']").parentNode.getBoundingClientRect().left + window.scrollX) + (canvas_div.getBoundingClientRect().left + canvas_div.scrollLeft) - (parseInt(window.getComputedStyle(document.querySelector(".blockid[value='" + blocks[w].id + "']").parentNode).width) / 2) - 40;
467467
}
468468
offsetleftold = offsetleft;
469469
}
@@ -524,15 +524,17 @@ var flowy = function(canvas, grab, release, snapping, spacing_x, spacing_y) {
524524
}
525525
for (var w = 0; w < blocks.filter(id => id.parent == result[z]).length; w++) {
526526
var children = blocks.filter(id => id.parent == result[z])[w];
527-
document.querySelector(".blockid[value='" + children.id + "']").parentNode.style.top = blocks.filter(id => id.id == result[z]).y + paddingy + "px";
528-
blocks.filter(id => id.id == result[z]).y = blocks.filter(id => id.id == result[z]).y + paddingy;
527+
const r_block = document.querySelector(".blockid[value='" + children.id + "']").parentNode;
528+
const r_array = blocks.filter(id => id.id == result[z]);
529+
r_block.style.top = r_array.y + paddingy + "px";
530+
r_array.y = r_array.y + paddingy;
529531
if (children.childwidth > children.width) {
530-
document.querySelector(".blockid[value='" + children.id + "']").parentNode.style.left = blocks.filter(id => id.id == result[z])[0].x - (totalwidth / 2) + totalremove + (children.childwidth / 2) - (children.width / 2) - (canvas_div.getBoundingClientRect().left + window.scrollX) + "px";
531-
children.x = blocks.filter(id => id.id == result[z])[0].x - (totalwidth / 2) + totalremove + (children.childwidth / 2);
532+
r_block.style.left = r_array[0].x - (totalwidth / 2) + totalremove + (children.childwidth / 2) - (children.width / 2) - (canvas_div.getBoundingClientRect().left + window.scrollX) + "px";
533+
children.x = r_array[0].x - (totalwidth / 2) + totalremove + (children.childwidth / 2);
532534
totalremove += children.childwidth + paddingx;
533535
} else {
534-
document.querySelector(".blockid[value='" + children.id + "']").parentNode.style.left = blocks.filter(id => id.id == result[z])[0].x - (totalwidth / 2) + totalremove - (canvas_div.getBoundingClientRect().left + window.scrollX) + "px";
535-
children.x = blocks.filter(id => id.id == result[z])[0].x - (totalwidth / 2) + totalremove + (children.width / 2);
536+
r_block.style.left = r_array[0].x - (totalwidth / 2) + totalremove - (canvas_div.getBoundingClientRect().left + window.scrollX) + "px";
537+
children.x = r_array[0].x - (totalwidth / 2) + totalremove + (children.width / 2);
536538
totalremove += children.width + paddingx;
537539
}
538540
var arrowhelp = blocks.filter(a => a.id == children.id)[0];

flowy.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)