Add no-op stub .neighbors() for headless Connection.

This commit is contained in:
Andrew n marshall
2017-02-13 13:18:24 -08:00
parent 2e8d107682
commit 79becd6b31
2 changed files with 17 additions and 0 deletions

View File

@@ -330,6 +330,7 @@ Blockly.Block.prototype.lastConnectionInStack_ = function() {
* connected should not coincidentally line up on screen.
* @private
*/
// TODO: Refactor to return early in headless mode.
Blockly.Block.prototype.bumpNeighbours_ = function() {
if (!this.workspace) {
return; // Deleted block.

View File

@@ -622,6 +622,22 @@ Blockly.Connection.prototype.getShadowDom = function() {
return this.shadowDom_;
};
/**
* Find all nearby compatible connections to this connection.
* Type checking does not apply, since this function is used for bumping.
*
* Headless configurations (the default) do not have neighboring connection,
* and always return an empty list (the default).
* {@link Blockly.RenderedConnection} overrides this behavior with a list
* computed from the rendered positioning.
* @param {number} maxLimit The maximum radius to another connection.
* @return {!Array.<!Blockly.Connection>} List of connections.
* @private
*/
Blockly.Connection.prototype.neighbours_ = function(/* maxLimit */) {
return [];
};
/**
* This method returns a string describing this Connection in developer terms
* (English only). Intended to on be used in console logs and errors.