mirror of
https://github.com/google/blockly.git
synced 2026-01-16 21:37:10 +01:00
Prevent selected block from ending up underneath a bumped block.
This commit is contained in:
@@ -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();
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user