Commit 247782c7 authored by Neil Fraser's avatar Neil Fraser

Fix duplicated stacks of collapsed connected blocks.

parent 28829f3f
This diff is collapsed.
......@@ -273,12 +273,12 @@ Blockly.Block.prototype.getConnections_ = function(all) {
if (this.outputConnection) {
myConnections.push(this.outputConnection);
}
if (this.nextConnection) {
myConnections.push(this.nextConnection);
}
if (this.previousConnection) {
myConnections.push(this.previousConnection);
}
if (this.nextConnection) {
myConnections.push(this.nextConnection);
}
if (all || !this.collapsed_) {
for (var i = 0, input; input = this.inputList[i]; i++) {
if (input.connection) {
......@@ -518,18 +518,30 @@ Blockly.Block.prototype.setEditable = function(editable) {
* @param {boolean} hidden True if connections are hidden.
*/
Blockly.Block.prototype.setConnectionsHidden = function(hidden) {
if (!hidden && this.isCollapsed()) {
if (this.outputConnection) {
this.outputConnection.setHidden(hidden);
}
if (this.previousConnection) {
this.previousConnection.setHidden(hidden);
}
if (this.nextConnection) {
this.nextConnection.setHidden(hidden);
var child = this.nextConnection.targetBlock();
if (child) {
child.setConnectionsHidden(hidden);
}
}
} else {
var myConnections = this.getConnections_(true);
for (var i = 0, connection; connection = myConnections[i]; i++) {
if (connection.isSuperior()) {
if (!this.isCollapsed()) {
connection.setHidden(hidden);
if (connection.isSuperior()) {
var child = connection.targetBlock();
if (child) {
child.setConnectionsHidden(hidden);
}
}
} else {
connection.setHidden(hidden);
}
}
};
......
......@@ -666,9 +666,8 @@ Blockly.Connection.prototype.hideAll = function() {
* @return {!Array.<!Blockly.Block>} List of blocks to render.
*/
Blockly.Connection.prototype.unhideAll = function() {
if (!this.hidden_) {
this.dbList_[this.type].addConnection_(this);
}
this.hidden_ = false;
// All blocks that need unhiding must be unhidden before any rendering takes
// place, since rendering requires knowing the dimensions of lower blocks.
// Also, since rendering a block renders all its parents, we only need to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment