mirror of
https://github.com/google/blockly.git
synced 2026-01-11 19:07:08 +01:00
This reverts commit 96e8fc794e.
This commit is contained in:
@@ -87,6 +87,7 @@ Blockly.BlockSvg = function(workspace, prototypeName, opt_id) {
|
||||
*/
|
||||
this.renderIsInProgress_ = false;
|
||||
|
||||
|
||||
/** @type {!Blockly.WorkspaceSvg} */
|
||||
this.workspace = workspace;
|
||||
|
||||
@@ -642,21 +643,14 @@ Blockly.BlockSvg.prototype.updateCollapsed_ = function() {
|
||||
var collapsedInputName = Blockly.Block.COLLAPSED_INPUT_NAME;
|
||||
var collapsedFieldName = Blockly.Block.COLLAPSED_FIELD_NAME;
|
||||
|
||||
var renderList = [];
|
||||
// Show/hide the inputs.
|
||||
for (var i = 0, input; (input = this.inputList[i]); i++) {
|
||||
if (input.name != collapsedInputName) {
|
||||
renderList.push.apply(renderList, input.setVisible(!collapsed));
|
||||
input.setVisible(!collapsed);
|
||||
}
|
||||
}
|
||||
|
||||
if (!collapsed) {
|
||||
this.removeInput(collapsedInputName);
|
||||
if (this.rendered) {
|
||||
for (var i = 0, block; (block = renderList[i]); i++) {
|
||||
block.render();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -981,9 +975,7 @@ Blockly.BlockSvg.prototype.updateDisabled = function() {
|
||||
var children = this.getChildren(false);
|
||||
this.applyColour();
|
||||
for (var i = 0, child; (child = children[i]); i++) {
|
||||
if (child.rendered) {
|
||||
child.updateDisabled();
|
||||
}
|
||||
child.updateDisabled();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1634,12 +1626,10 @@ Blockly.BlockSvg.prototype.render = function(opt_bubble) {
|
||||
if (this.isCollapsed()) {
|
||||
this.updateCollapsed_();
|
||||
}
|
||||
|
||||
this.workspace.getRenderer().render(this);
|
||||
this.updateConnectionLocations_();
|
||||
|
||||
if (opt_bubble !== false) {
|
||||
// Render all blocks above this one (propogate a reflow).
|
||||
var parentBlock = this.getParent();
|
||||
if (parentBlock) {
|
||||
parentBlock.render(true);
|
||||
|
||||
@@ -200,9 +200,6 @@ Blockly.Input.prototype.setVisible = function(visible) {
|
||||
}
|
||||
var child = this.connection.targetBlock();
|
||||
if (child) {
|
||||
if (!visible) {
|
||||
child.rendered = false;
|
||||
}
|
||||
child.getSvgRoot().style.display = visible ? 'block' : 'none';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,11 +459,6 @@ Blockly.RenderedConnection.prototype.onFailedConnect = function(
|
||||
*/
|
||||
Blockly.RenderedConnection.prototype.disconnectInternal_ = function(parentBlock,
|
||||
childBlock) {
|
||||
// The input the child block was connected to (if any).
|
||||
var parentInput = parentBlock.getInputWithBlock(childBlock);
|
||||
if (parentInput && !parentInput.isVisible()) {
|
||||
childBlock.rendered = true;
|
||||
}
|
||||
Blockly.RenderedConnection.superClass_.disconnectInternal_.call(this,
|
||||
parentBlock, childBlock);
|
||||
// Rerender the parent so that it may reflow.
|
||||
@@ -549,9 +544,6 @@ Blockly.RenderedConnection.prototype.connect_ = function(childConnection) {
|
||||
var parentInput = parentBlock.getInputWithBlock(childBlock);
|
||||
if (parentInput) {
|
||||
var visible = parentInput.isVisible();
|
||||
if (!visible) {
|
||||
childBlock.rendered = false;
|
||||
}
|
||||
childBlock.getSvgRoot().style.display = visible ? 'block' : 'none';
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user