Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 0 additions & 82 deletions appinventor/blocklyeditor/src/block_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,88 +169,6 @@ Blockly.BlockSvg.prototype.dispose = (function(func) {
}
})(Blockly.BlockSvg.prototype.dispose);

/**
* Set this block's error text.
* @param {?string} text The text, or null to delete.
* @param {string=} opt_id An optional ID for the warning text to be able to
* maintain multiple errors.
*/
Blockly.BlockSvg.prototype.setErrorText = function(text, opt_id) {
if (!this.setErrorText.pid_) {
// Create a database of warning PIDs.
// Only runs once per block (and only those with warnings).
this.setErrorText.pid_ = Object.create(null);
}
var id = opt_id || '';
if (!id) {
// Kill all previous pending processes, this edit supercedes them all.
for (var n in this.setErrorText.pid_) {
clearTimeout(this.setErrorText.pid_[n]);
delete this.setErrorText.pid_[n];
}
} else if (this.setErrorText.pid_[id]) {
// Only queue up the latest change. Kill any earlier pending process.
clearTimeout(this.setErrorText.pid_[id]);
delete this.setErrorText.pid_[id];
}
if (this.workspace && this.workspace.isDragging()) {
// Don't change the error text during a drag.
// Wait until the drag finishes.
var thisBlock = this;
this.setErrorText.pid_[id] = setTimeout(function() {
if (thisBlock.workspace) { // Check block wasn't deleted.
delete thisBlock.setErrorText.pid_[id];
thisBlock.setErrorText(text, id);
}
}, 100);
return;
}
if (this.isInFlyout) {
text = null;
}

// Bubble up to add a error on top-most collapsed block.
var parent = this.getSurroundParent();
var collapsedParent = null;
while (parent) {
if (parent.isCollapsed()) {
collapsedParent = parent;
}
parent = parent.getSurroundParent();
}
if (collapsedParent) {
collapsedParent.setErrorText(text, 'collapsed ' + this.id + ' ' + id);
}

var changedState = false;
if (goog.isString(text)) {
if (!this.error) {
this.error = new AI.ErrorIcon(this);
changedState = true;
}
this.error.setText(/** @type {string} */ (text), id);
} else {
// Dispose all errors if no id is given.
if (this.error && !id) {
this.error.dispose();
changedState = true;
} else if (this.error) {
var oldText = this.error.getText();
this.error.setText('', id);
var newText = this.error.getText();
if (!newText) {
this.error.dispose();
}
changedState = oldText == newText;
}
}
if (changedState && this.rendered) {
this.render();
// Adding or removing a error icon will cause the block to change shape.
this.bumpNeighbours();
}
};

/**
* Get the top-most workspace. Typically this is the current workspace except for flyout/flydowns.
* @returns {!Blockly.WorkspaceSvg}
Expand Down