diff --git a/core/constants.js b/core/constants.js index 7668989f7..622d3a473 100644 --- a/core/constants.js +++ b/core/constants.js @@ -68,6 +68,11 @@ Blockly.INSERTION_MARKER_COLOUR = '#000000'; */ Blockly.BUMP_DELAY = 250; +/** + * Maximum randomness in workspace units for bumping a block. + */ +Blockly.BUMP_RANDOMNESS = 10; + /** * Number of characters to truncate a collapsed block to. */ diff --git a/core/rendered_connection.js b/core/rendered_connection.js index 8b786b26d..d972c60c2 100644 --- a/core/rendered_connection.js +++ b/core/rendered_connection.js @@ -97,8 +97,10 @@ Blockly.RenderedConnection.prototype.bumpAwayFrom_ = function(staticConnection) // Raise it to the top for extra visibility. var selected = Blockly.selected == rootBlock; selected || rootBlock.addSelect(); - var dx = (staticConnection.x_ + Blockly.SNAP_RADIUS) - this.x_; - var dy = (staticConnection.y_ + Blockly.SNAP_RADIUS) - this.y_; + var dx = (staticConnection.x_ + Blockly.SNAP_RADIUS + + Math.floor(Math.random() * Blockly.BUMP_RANDOMNESS)) - this.x_; + var dy = (staticConnection.y_ + Blockly.SNAP_RADIUS + + Math.floor(Math.random() * Blockly.BUMP_RANDOMNESS)) - this.y_; if (reverse) { // When reversing a bump due to an uneditable block, bump up. dy = -dy;