mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
Resize Code demo before injection to eliminate loading reflow.
This commit is contained in:
@@ -365,12 +365,13 @@ Code.init = function() {
|
|||||||
el.style.width = (2 * bBox.width - el.offsetWidth) + 'px';
|
el.style.width = (2 * bBox.width - el.offsetWidth) + 'px';
|
||||||
}
|
}
|
||||||
// Make the 'Blocks' tab line up with the toolbox.
|
// Make the 'Blocks' tab line up with the toolbox.
|
||||||
if (Code.workspace.toolbox_.width) {
|
if (Code.workspace && Code.workspace.toolbox_.width) {
|
||||||
document.getElementById('tab_blocks').style.minWidth =
|
document.getElementById('tab_blocks').style.minWidth =
|
||||||
(Code.workspace.toolbox_.width - 38) + 'px';
|
(Code.workspace.toolbox_.width - 38) + 'px';
|
||||||
// Account for the 19 pixel margin and on each side.
|
// Account for the 19 pixel margin and on each side.
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
onresize();
|
||||||
window.addEventListener('resize', onresize, false);
|
window.addEventListener('resize', onresize, false);
|
||||||
|
|
||||||
var toolbox = document.getElementById('toolbox');
|
var toolbox = document.getElementById('toolbox');
|
||||||
@@ -398,7 +399,6 @@ Code.init = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Code.tabClick(Code.selected);
|
Code.tabClick(Code.selected);
|
||||||
Blockly.fireUiEvent(window, 'resize');
|
|
||||||
|
|
||||||
Code.bindClick('trashButton',
|
Code.bindClick('trashButton',
|
||||||
function() {Code.discard(); Code.renderContent();});
|
function() {Code.discard(); Code.renderContent();});
|
||||||
@@ -422,7 +422,6 @@ Code.init = function() {
|
|||||||
function(name_) {return function() {Code.tabClick(name_);};}(name));
|
function(name_) {return function() {Code.tabClick(name_);};}(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
onresize();
|
|
||||||
// Lazy-load the syntax-highlighting.
|
// Lazy-load the syntax-highlighting.
|
||||||
window.setTimeout(Code.importPrettify, 1);
|
window.setTimeout(Code.importPrettify, 1);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user