Redo the fixes to event groups in connection.js

This commit is contained in:
Erik Pasternak
2019-07-19 16:08:53 -07:00
committed by Rachel Fenichel
parent 060c2b34df
commit fa6f41f395

View File

@@ -444,6 +444,10 @@ Blockly.Connection.prototype.connect = function(otherConnection) {
return;
}
this.checkConnection_(otherConnection);
var eventGroup = Blockly.Events.getGroup();
if (!eventGroup) {
Blockly.Events.setGroup(true);
}
// Determine which block is superior (higher in the source stack).
if (this.isSuperior()) {
// Superior block.
@@ -452,6 +456,9 @@ Blockly.Connection.prototype.connect = function(otherConnection) {
// Inferior block.
otherConnection.connect_(this);
}
if (!eventGroup) {
Blockly.Events.setGroup(false);
}
};
/**
@@ -541,8 +548,16 @@ Blockly.Connection.prototype.disconnect = function() {
childBlock = this.sourceBlock_;
parentConnection = otherConnection;
}
var eventGroup = Blockly.Events.getGroup();
if (!eventGroup) {
Blockly.Events.setGroup(true);
}
this.disconnectInternal_(parentBlock, childBlock);
parentConnection.respawnShadow_();
if (!eventGroup) {
Blockly.Events.setGroup(false);
}
};
/**