From 85b4f5f1a8211022c1defdb0d66266856777362e Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Fri, 17 Mar 2017 16:25:45 -0700 Subject: [PATCH] Fix #969 --- core/flyout.js | 11 +++++++++++ core/xml.js | 6 ------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/core/flyout.js b/core/flyout.js index 772208079..6bf4ac0e4 100644 --- a/core/flyout.js +++ b/core/flyout.js @@ -1185,6 +1185,17 @@ Blockly.Flyout.prototype.createBlockFunc_ = function(originBlock) { } else { flyout.filterForCapacity_(); } + + // Re-render the blocks before starting the drag: + // Force a render on IE and Edge to get around the issue described in + // Blockly.Field.getCachedWidth + if (goog.userAgent.IE || goog.userAgent.EDGE) { + var blocks = block.getDescendants(); + for (var i = blocks.length - 1; i >= 0; i--) { + blocks[i].render(false); + } + } + // Start a dragging operation on the new block. block.onMouseDown_(e); Blockly.dragMode_ = Blockly.DRAG_FREE; diff --git a/core/xml.js b/core/xml.js index 198fae004..8506ca51d 100644 --- a/core/xml.js +++ b/core/xml.js @@ -32,7 +32,6 @@ goog.provide('Blockly.Xml'); goog.require('goog.asserts'); goog.require('goog.dom'); -goog.require('goog.userAgent'); /** @@ -430,11 +429,6 @@ Blockly.Xml.domToBlock = function(xmlBlock, workspace) { setTimeout(function() { if (topBlock.workspace) { // Check that the block hasn't been deleted. topBlock.setConnectionsHidden(false); - // Force a render on IE and Edge to get around the issue described in - // Blockly.Field.getCachedWidth - if (goog.userAgent.IE || goog.userAgent.EDGE) { - topBlock.render(); - } } }, 1); topBlock.updateDisabled();