Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions core/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
6 changes: 4 additions & 2 deletions core/rendered_connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down