Prevent selected block from ending up underneath a bumped block.

This commit is contained in:
Neil Fraser
2016-06-14 17:36:50 -07:00
parent 873e987f85
commit 02b2c219eb

View File

@@ -85,7 +85,8 @@ Blockly.RenderedConnection.prototype.bumpAwayFrom_ = function(staticConnection)
reverse = true;
}
// Raise it to the top for extra visibility.
rootBlock.getSvgRoot().parentNode.appendChild(rootBlock.getSvgRoot());
var selected = Blockly.selected == rootBlock;
selected || rootBlock.select();
var dx = (staticConnection.x_ + Blockly.SNAP_RADIUS) - this.x_;
var dy = (staticConnection.y_ + Blockly.SNAP_RADIUS) - this.y_;
if (reverse) {
@@ -96,6 +97,7 @@ Blockly.RenderedConnection.prototype.bumpAwayFrom_ = function(staticConnection)
dx = -dx;
}
rootBlock.moveBy(dx, dy);
selected || rootBlock.unselect();
};
/**