@@ -463,7 +463,7 @@ var flowy = function(canvas, grab, release, snapping, spacing_x, spacing_y) {
463
463
}
464
464
}
465
465
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 ;
467
467
}
468
468
offsetleftold = offsetleft ;
469
469
}
@@ -524,15 +524,17 @@ var flowy = function(canvas, grab, release, snapping, spacing_x, spacing_y) {
524
524
}
525
525
for ( var w = 0 ; w < blocks . filter ( id => id . parent == result [ z ] ) . length ; w ++ ) {
526
526
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 ;
529
531
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 ) ;
532
534
totalremove += children . childwidth + paddingx ;
533
535
} 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 ) ;
536
538
totalremove += children . width + paddingx ;
537
539
}
538
540
var arrowhelp = blocks . filter ( a => a . id == children . id ) [ 0 ] ;
0 commit comments