Skip to content

Commit

Permalink
snap to start of preexisting stack.
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-fenichel committed Mar 4, 2016
1 parent 3287fa3 commit 5af8a2c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/block_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,12 @@ Blockly.BlockSvg.prototype.onMouseUp_ = function(e) {
}
Blockly.terminateDrag_();
if (Blockly.selected && Blockly.highlightedConnection_) {
if (Blockly.localConnection_ == Blockly.selected.nextConnection) {
// Snap to match the position of the pre-existing stack.
Blockly.selected.moveBy(
Blockly.highlightedConnection_.x_ - Blockly.localConnection_.x_,
Blockly.highlightedConnection_.y_ - Blockly.localConnection_.y_);
}
// Connect two blocks together.
Blockly.localConnection_.connect(Blockly.highlightedConnection_);
if (this.rendered) {
Expand Down

0 comments on commit 5af8a2c

Please sign in to comment.