Skip to content

Commit

Permalink
Merge pull request #115 from rachel-fenichel/feature/release_drag
Browse files Browse the repository at this point in the history
Snap to start of preexisting stack.
  • Loading branch information
rachel-fenichel committed Mar 7, 2016
2 parents 3287fa3 + 5af8a2c commit 4bee474
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 4bee474

Please sign in to comment.