mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-06 11:09:54 -04:00
Avoid IE and Edge re-rendering (#1326)
* Fix wrong width of field_dropdown with an image on Edge / IE * Avoid re-rendering on IE and Edge by using getBBox().width to compute the text width on those browsers
This commit is contained in:
parent
c2e7f6dfe8
commit
c55824d619
4 changed files with 7 additions and 40 deletions
core
|
@ -953,21 +953,8 @@ Blockly.WorkspaceSvg.prototype.paste = function(xmlBlock) {
|
|||
Blockly.Events.disable();
|
||||
try {
|
||||
var block = Blockly.Xml.domToBlock(xmlBlock, this);
|
||||
|
||||
// Scratch-specific: Give shadow dom new IDs to prevent duplicating on paste
|
||||
Blockly.utils.changeObscuredShadowIds(block);
|
||||
|
||||
var blocks = block.getDescendants();
|
||||
for (var i = blocks.length - 1; i >= 0; i--) {
|
||||
var descendant = blocks[i];
|
||||
// Rerender to get around problem with IE and Edge not measuring text
|
||||
// correctly when it is hidden.
|
||||
if (goog.userAgent.IE || goog.userAgent.EDGE) {
|
||||
descendant.render(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Move the duplicate to original position.
|
||||
Blockly.utils.changeObscuredShadowIds(block); // Move the duplicate to original position.
|
||||
var blockX = parseInt(xmlBlock.getAttribute('x'), 10);
|
||||
var blockY = parseInt(xmlBlock.getAttribute('y'), 10);
|
||||
if (!isNaN(blockX) && !isNaN(blockY)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue