Move the call to disable resize before placeNewBlock so that it is of… (#777)

* Move the call to disable resize before placeNewBlock so that it is off when workspace resizeContents
gets triggered by placeNewBlock.  This fixes a bug in rtl mode where the workspace was being resized
between when the block was added to the workspace and when it was moved to the proper location.
This commit is contained in:
picklesrus
2016-12-14 14:57:32 -08:00
committed by GitHub
parent 166278e0a5
commit 5b6f1debeb

View File

@@ -1162,6 +1162,10 @@ Blockly.Flyout.prototype.createBlockFunc_ = function(originBlock) {
return;
}
Blockly.Events.disable();
// Disable workspace resizing. Reenable at the end of the drag. This avoids
// a spurious resize between creating the new block and placing it in the
// workspace.
flyout.targetWorkspace_.setResizesEnabled(false);
try {
var block = flyout.placeNewBlock_(originBlock);
} finally {
@@ -1181,8 +1185,6 @@ Blockly.Flyout.prototype.createBlockFunc_ = function(originBlock) {
Blockly.dragMode_ = Blockly.DRAG_FREE;
block.setDragging_(true);
block.moveToDragSurface_();
// Disable workspace resizing. Reenable at the end of the drag.
flyout.targetWorkspace_.setResizesEnabled(false);
};
};