Skip to content

Commit 0c7bfe8

Browse files
authored
block_render.js -- ACTUALLY fix branched reporters moving connections
1 parent 7185550 commit 0c7bfe8

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

core/block_render.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,10 +1903,14 @@ Blockly.BlockSvg.prototype.positionNewBlock = function(newBlock, newConnection,
19031903
var dx = existingConnection.x_ - newConnection.x_;
19041904
var dy = existingConnection.y_ - newConnection.y_;
19051905

1906-
var offset = newConnection.sourceBlock_.outputLeftPadding_();
1907-
if (offset !== 0) offset += Blockly.BlockSvg.SEP_SPACE_X;
1906+
var paddedOffset = newConnection.sourceBlock_.outputLeftPadding_();
1907+
if (paddedOffset) {
1908+
var bounds = existingConnection.sourceBlock_.getBoundingRectangle();
1909+
dx += ((bounds.bottomRight.y - bounds.topLeft.y) / -2) - paddedOffset
1910+
- (Blockly.BlockSvg.SEP_SPACE_X * 2);
1911+
}
19081912

1909-
newBlock.moveBy(dx + offset, dy);
1913+
newBlock.moveBy(dx, dy);
19101914
}
19111915
};
19121916

0 commit comments

Comments
 (0)