mirror of
https://github.com/google/blockly.git
synced 2026-01-09 10:00:09 +01:00
deprecate!: removes deprecated connection functions (#5713)
This commit is contained in:
@@ -17,7 +17,6 @@ goog.module('Blockly.Connection');
|
||||
|
||||
const Xml = goog.require('Blockly.Xml');
|
||||
const blocks = goog.require('Blockly.serialization.blocks');
|
||||
const deprecation = goog.require('Blockly.utils.deprecation');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
/* eslint-disable-next-line no-unused-vars */
|
||||
const {Block} = goog.requireType('Blockly.Block');
|
||||
@@ -210,42 +209,6 @@ Connection.prototype.isConnected = function() {
|
||||
return !!this.targetConnection;
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks whether the current connection can connect with the target
|
||||
* connection.
|
||||
* @param {Connection} target Connection to check compatibility with.
|
||||
* @return {number} Connection.CAN_CONNECT if the connection is legal,
|
||||
* an error code otherwise.
|
||||
* @deprecated July 2020. Will be deleted July 2021. Use the workspace's
|
||||
* connectionChecker instead.
|
||||
*/
|
||||
Connection.prototype.canConnectWithReason = function(target) {
|
||||
deprecation.warn(
|
||||
'Connection.prototype.canConnectWithReason', 'July 2020', 'July 2021',
|
||||
'the workspace\'s connection checker');
|
||||
return this.getConnectionChecker().canConnectWithReason(this, target, false);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks whether the current connection and target connection are compatible
|
||||
* and throws an exception if they are not.
|
||||
* @param {Connection} target The connection to check compatibility
|
||||
* with.
|
||||
* @package
|
||||
* @deprecated July 2020. Will be deleted July 2021. Use the workspace's
|
||||
* connectionChecker instead.
|
||||
*/
|
||||
Connection.prototype.checkConnection = function(target) {
|
||||
deprecation.warn(
|
||||
'Connection.prototype.checkConnection', 'July 2020', 'July 2021',
|
||||
'the workspace\'s connection checker');
|
||||
const checker = this.getConnectionChecker();
|
||||
const reason = checker.canConnectWithReason(this, target, false);
|
||||
if (reason !== Connection.CAN_CONNECT) {
|
||||
throw new Error(checker.getErrorMessage(reason, this, target));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the workspace's connection type checker object.
|
||||
* @return {!IConnectionChecker} The connection type checker for the
|
||||
@@ -256,20 +219,6 @@ Connection.prototype.getConnectionChecker = function() {
|
||||
return this.sourceBlock_.workspace.connectionChecker;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the two connections can be dragged to connect to each other.
|
||||
* @param {!Connection} candidate A nearby connection to check.
|
||||
* @return {boolean} True if the connection is allowed, false otherwise.
|
||||
* @deprecated July 2020. Will be deleted July 2021. Use the workspace's
|
||||
* connectionChecker instead.
|
||||
*/
|
||||
Connection.prototype.isConnectionAllowed = function(candidate) {
|
||||
deprecation.warn(
|
||||
'Connection.prototype.isConnectionAllowed', 'July 2020', 'July 2021',
|
||||
'the workspace\'s connection checker');
|
||||
return this.getConnectionChecker().canConnect(this, candidate, true);
|
||||
};
|
||||
|
||||
/**
|
||||
* Called when an attempted connection fails. NOP by default (i.e. for headless
|
||||
* workspaces).
|
||||
@@ -485,38 +434,6 @@ Connection.prototype.targetBlock = function() {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Is this connection compatible with another connection with respect to the
|
||||
* value type system. E.g. square_root("Hello") is not compatible.
|
||||
* @param {!Connection} otherConnection Connection to compare against.
|
||||
* @return {boolean} True if the connections share a type.
|
||||
* @deprecated July 2020. Will be deleted July 2021. Use the workspace's
|
||||
* connectionChecker instead.
|
||||
*/
|
||||
Connection.prototype.checkType = function(otherConnection) {
|
||||
deprecation.warn(
|
||||
'Connection.prototype.checkType', 'October 2019', 'January 2021',
|
||||
'the workspace\'s connection checker');
|
||||
return this.getConnectionChecker().canConnect(this, otherConnection, false);
|
||||
};
|
||||
|
||||
/**
|
||||
* Is this connection compatible with another connection with respect to the
|
||||
* value type system. E.g. square_root("Hello") is not compatible.
|
||||
* @param {!Connection} otherConnection Connection to compare against.
|
||||
* @return {boolean} True if the connections share a type.
|
||||
* @private
|
||||
* @deprecated October 2019. Will be deleted January 2021. Use the workspace's
|
||||
* connectionChecker instead.
|
||||
* @suppress {unusedPrivateMembers}
|
||||
*/
|
||||
Connection.prototype.checkType_ = function(otherConnection) {
|
||||
deprecation.warn(
|
||||
'Connection.prototype.checkType_', 'October 2019', 'January 2021',
|
||||
'the workspace\'s connection checker');
|
||||
return this.checkType(otherConnection);
|
||||
};
|
||||
|
||||
/**
|
||||
* Function to be called when this connection's compatible types have changed.
|
||||
* @protected
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
goog.module('Blockly.RenderedConnection');
|
||||
|
||||
const common = goog.require('Blockly.common');
|
||||
const deprecation = goog.require('Blockly.utils.deprecation');
|
||||
const dom = goog.require('Blockly.utils.dom');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const internalConstants = goog.require('Blockly.internalConstants');
|
||||
@@ -429,28 +428,6 @@ RenderedConnection.prototype.startTrackingAll = function() {
|
||||
return renderList;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the two connections can be dragged to connect to each other.
|
||||
* @param {!Connection} candidate A nearby connection to check.
|
||||
* @param {number=} maxRadius The maximum radius allowed for connections, in
|
||||
* workspace units.
|
||||
* @return {boolean} True if the connection is allowed, false otherwise.
|
||||
* @deprecated July 2020
|
||||
*/
|
||||
RenderedConnection.prototype.isConnectionAllowed = function(
|
||||
candidate, maxRadius) {
|
||||
deprecation.warn(
|
||||
'RenderedConnection.prototype.isConnectionAllowed', 'July 2020',
|
||||
'July 2021',
|
||||
'Blockly.Workspace.prototype.getConnectionChecker().canConnect');
|
||||
if (this.distanceFrom(candidate) > maxRadius) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return RenderedConnection.superClass_.isConnectionAllowed.call(
|
||||
this, candidate);
|
||||
};
|
||||
|
||||
/**
|
||||
* Behavior after a connection attempt fails.
|
||||
* Bumps this connection away from the other connection. Called when an
|
||||
|
||||
Reference in New Issue
Block a user