Merge pull request #2676 from RoboErikG/roboerikg-revert-ep

Revert changes related to #2003
This commit is contained in:
Rachel Fenichel
2019-07-19 17:04:08 -07:00
committed by GitHub
3 changed files with 2 additions and 53 deletions

View File

@@ -317,10 +317,6 @@ Blockly.BlockSvg.prototype.getHeightWidth = function() {
* If true, also render block's parent, grandparent, etc. Defaults to true.
*/
Blockly.BlockSvg.prototype.render = function(opt_bubble) {
if (!this.workspace) {
// This block is being deleted so don't try to render it.
return;
}
Blockly.Field.startCache();
this.rendered = true;

View File

@@ -226,7 +226,6 @@ Blockly.RenderedConnection.prototype.highlight = function() {
* attached to this connection. This happens when a block is expanded.
* Also unhides down-stream comments.
* @return {!Array.<!Blockly.Block>} List of blocks to render.
* @protected
*/
Blockly.RenderedConnection.prototype.unhideAll = function() {
this.setHidden(false);
@@ -274,7 +273,6 @@ Blockly.RenderedConnection.prototype.unhighlight = function() {
/**
* Set whether this connections is hidden (not tracked in a database) or not.
* @param {boolean} hidden True if connection is hidden.
* @protected
*/
Blockly.RenderedConnection.prototype.setHidden = function(hidden) {
this.hidden_ = hidden;
@@ -283,19 +281,12 @@ Blockly.RenderedConnection.prototype.setHidden = function(hidden) {
} else if (!hidden && !this.inDB_) {
this.db_.addConnection(this);
}
if (this.isSuperior() && this.targetBlock()) {
var display = hidden ? 'none' : 'block';
var renderedBlock = this.targetBlock();
renderedBlock.getSvgRoot().style.display = display;
renderedBlock.rendered = !hidden;
}
};
/**
* Hide this connection, as well as all down-stream connections on any block
* attached to this connection. This happens when a block is collapsed.
* Also hides down-stream comments.
* @protected
*/
Blockly.RenderedConnection.prototype.hideAll = function() {
this.setHidden(true);
@@ -334,44 +325,6 @@ Blockly.RenderedConnection.prototype.isConnectionAllowed = function(candidate,
candidate);
};
/**
* Connect this connection to another connection.
* @param {!Blockly.Connection} otherConnection Connection to connect to.
* @override
*/
Blockly.RenderedConnection.prototype.connect = function(otherConnection) {
Blockly.RenderedConnection.superClass_.connect.call(this, otherConnection);
// This is a quick check to make sure we aren't doing unecessary work.
if (this.hidden_ || otherConnection.hidden_) {
var superiorConnection = this.isSuperior() ? this : otherConnection;
if (superiorConnection.hidden_) {
superiorConnection.hideAll();
} else {
superiorConnection.unhideAll();
}
}
};
/**
* Disconnect this connection.
* @override
*/
Blockly.RenderedConnection.prototype.disconnect = function() {
var superiorConnection = this.isSuperior() ? this : this.targetConnection;
var rehide = false;
if (this.targetConnection && superiorConnection.hidden_) {
superiorConnection.unhideAll();
rehide = true;
}
Blockly.RenderedConnection.superClass_.disconnect.call(this);
if (rehide) {
// Set the hidden state for the connection back to true so shadow blocks
// will be hidden.
superiorConnection.hideAll();
}
};
/**
* Disconnect two blocks that are connected by this connection.
* @param {!Blockly.Block} parentBlock The superior block.
@@ -409,7 +362,7 @@ Blockly.RenderedConnection.prototype.respawnShadow_ = function() {
}
blockShadow.initSvg();
blockShadow.render(false);
if (parentBlock.rendered && !this.hidden_) {
if (parentBlock.rendered) {
parentBlock.render();
}
}

View File

@@ -2,7 +2,7 @@
suite('Connections', function() {
suite('Rendered', function() {
suite.skip('Rendered', function() {
function assertAllConnectionsHiddenState(block, hidden) {
var connections = block.getConnections_(true);
for (var i = 0; i < connections.length; i++) {