Made blocks return to original position if trash is canceled

This commit is contained in:
hsun1316
2019-02-21 12:07:17 -05:00
committed by Evan W. Patton
parent 65b130840f
commit 44ad45698c

View File

@@ -690,6 +690,7 @@ Blockly.BlockSvg.prototype.onMouseUp_ = function(e) {
new Blockly.Events.Ui(this, 'click', undefined, undefined));
}
Blockly.terminateDrag_();
var oldXY = this.dragStartXY_;
var deleteArea = this.workspace.isDeleteArea(e);
@@ -719,6 +720,11 @@ Blockly.BlockSvg.prototype.onMouseUp_ = function(e) {
}
if (confirmedDelete) {
Blockly.selected.dispose(false, true);
} else {
//Move block back to original position if trash is canceled
var group = Blockly.selected.getSvgRoot();
group.translate_ = 'translate(' + oldXY.x + ',' + oldXY.y + ')';
group.setAttribute('transform', group.translate_ + group.skew_);
}
});
}