Rename input connection to connectionModel (#3571)

* Remove input measurable's connection property and rename references to connectionModel.
This commit is contained in:
Sam El-Husseini
2020-01-09 18:09:15 -08:00
committed by GitHub
parent 20e55b67d7
commit fe555d9021
4 changed files with 13 additions and 17 deletions

View File

@@ -179,7 +179,7 @@ Blockly.blockRendering.Debug.prototype.drawRenderedElem = function(elem, isRtl)
if (Blockly.blockRendering.Types.isInput(elem) &&
Blockly.blockRendering.Debug.config.connections) {
this.drawConnection(elem.connection);
this.drawConnection(elem.connectionModel);
}
};

View File

@@ -390,13 +390,13 @@ Blockly.blockRendering.Drawer.prototype.drawInlineInput_ = function(input) {
Blockly.blockRendering.Drawer.prototype.positionInlineInputConnection_ = function(input) {
var yPos = input.centerline - input.height / 2;
// Move the connection.
if (input.connection) {
if (input.connectionModel) {
// xPos already contains info about startX
var connX = input.xPos + input.connectionWidth + input.connectionOffsetX;
if (this.info_.RTL) {
connX *= -1;
}
input.connection.setOffsetInBlock(connX,
input.connectionModel.setOffsetInBlock(connX,
yPos + input.connectionOffsetY);
}
};
@@ -410,12 +410,12 @@ Blockly.blockRendering.Drawer.prototype.positionInlineInputConnection_ = functio
*/
Blockly.blockRendering.Drawer.prototype.positionStatementInputConnection_ = function(row) {
var input = row.getLastInput();
if (input.connection) {
if (input.connectionModel) {
var connX = row.xPos + row.statementEdge + input.notchOffset;
if (this.info_.RTL) {
connX *= -1;
}
input.connection.setOffsetInBlock(connX, row.yPos);
input.connectionModel.setOffsetInBlock(connX, row.yPos);
}
};
@@ -428,12 +428,12 @@ Blockly.blockRendering.Drawer.prototype.positionStatementInputConnection_ = func
*/
Blockly.blockRendering.Drawer.prototype.positionExternalValueConnection_ = function(row) {
var input = row.getLastInput();
if (input.connection) {
if (input.connectionModel) {
var connX = row.xPos + row.width;
if (this.info_.RTL) {
connX *= -1;
}
input.connection.setOffsetInBlock(connX, row.yPos);
input.connectionModel.setOffsetInBlock(connX, row.yPos);
}
};

View File

@@ -151,14 +151,14 @@ Blockly.geras.Drawer.prototype.drawInlineInput_ = function(input) {
Blockly.geras.Drawer.prototype.positionInlineInputConnection_ = function(input) {
var yPos = input.centerline - input.height / 2;
// Move the connection.
if (input.connection) {
if (input.connectionModel) {
// xPos already contains info about startX
var connX = input.xPos + input.connectionWidth +
this.constants_.DARK_PATH_OFFSET;
if (this.info_.RTL) {
connX *= -1;
}
input.connection.setOffsetInBlock(
input.connectionModel.setOffsetInBlock(
connX, yPos + input.connectionOffsetY +
this.constants_.DARK_PATH_OFFSET);
}
@@ -169,14 +169,14 @@ Blockly.geras.Drawer.prototype.positionInlineInputConnection_ = function(input)
*/
Blockly.geras.Drawer.prototype.positionStatementInputConnection_ = function(row) {
var input = row.getLastInput();
if (input.connection) {
if (input.connectionModel) {
var connX = row.xPos + row.statementEdge + input.notchOffset;
if (this.info_.RTL) {
connX *= -1;
} else {
connX += this.constants_.DARK_PATH_OFFSET;
}
input.connection.setOffsetInBlock(connX,
input.connectionModel.setOffsetInBlock(connX,
row.yPos + this.constants_.DARK_PATH_OFFSET);
}
};
@@ -186,13 +186,13 @@ Blockly.geras.Drawer.prototype.positionStatementInputConnection_ = function(row)
*/
Blockly.geras.Drawer.prototype.positionExternalValueConnection_ = function(row) {
var input = row.getLastInput();
if (input.connection) {
if (input.connectionModel) {
var connX = row.xPos + row.width +
this.constants_.DARK_PATH_OFFSET;
if (this.info_.RTL) {
connX *= -1;
}
input.connection.setOffsetInBlock(connX, row.yPos);
input.connectionModel.setOffsetInBlock(connX, row.yPos);
}
};

View File

@@ -61,10 +61,6 @@ Blockly.blockRendering.InputConnection = function(constants, input) {
this.connectedBlockHeight = 0;
}
// TODO (#3186): change references to connectionModel, since that's on
// Connection.
this.connection =
/** @type {!Blockly.RenderedConnection} */ (input.connection);
this.connectionOffsetX = 0;
this.connectionOffsetY = 0;
};