diff --git a/core/renderers/common/drawer.js b/core/renderers/common/drawer.js index c59a6ca3d..89209ee6f 100644 --- a/core/renderers/common/drawer.js +++ b/core/renderers/common/drawer.js @@ -392,11 +392,12 @@ Blockly.blockRendering.Drawer.prototype.positionInlineInputConnection_ = functio // Move the connection. if (input.connection) { // xPos already contains info about startX - var connX = input.xPos + input.connectionWidth; + var connX = input.xPos + input.connectionWidth + input.connectionOffsetX; if (this.info_.RTL) { connX *= -1; } - input.connection.setOffsetInBlock(connX, yPos + input.connectionOffsetY); + input.connection.setOffsetInBlock(connX, + yPos + input.connectionOffsetY); } }; @@ -471,7 +472,7 @@ Blockly.blockRendering.Drawer.prototype.positionNextConnection_ = function() { */ Blockly.blockRendering.Drawer.prototype.positionOutputConnection_ = function() { if (this.info_.outputConnection) { - var x = this.info_.startX; + var x = this.info_.startX + this.info_.outputConnection.connectionOffsetX; var connX = this.info_.RTL ? -x : x; this.block_.outputConnection.setOffsetInBlock(connX, this.info_.outputConnection.connectionOffsetY); diff --git a/core/renderers/measurables/connections.js b/core/renderers/measurables/connections.js index 5fb3f1632..5c095433d 100644 --- a/core/renderers/measurables/connections.js +++ b/core/renderers/measurables/connections.js @@ -74,6 +74,7 @@ Blockly.blockRendering.OutputConnection = function(constants, connectionModel) { this.startX = this.width; this.connectionOffsetY = this.constants_.TAB_OFFSET_FROM_TOP; + this.connectionOffsetX = 0; }; Blockly.utils.object.inherits(Blockly.blockRendering.OutputConnection, Blockly.blockRendering.Connection); diff --git a/core/renderers/measurables/inputs.js b/core/renderers/measurables/inputs.js index 966bd4a98..2d505a342 100644 --- a/core/renderers/measurables/inputs.js +++ b/core/renderers/measurables/inputs.js @@ -97,13 +97,18 @@ Blockly.blockRendering.InlineInput = function(constants, input) { this.height = this.connectedBlockHeight; } - this.connectionHeight = this.shape.height; + this.connectionHeight = !this.isDynamicShape ? this.shape.height : + this.shape.height(this.height); this.connectionWidth = !this.isDynamicShape ? this.shape.width : - this.shape.width(this.height); + this.shape.width(this.height); if (!this.connectedBlock) { this.width += this.connectionWidth * (this.isDynamicShape ? 2 : 1); } - this.connectionOffsetY = this.constants_.TAB_OFFSET_FROM_TOP; + this.connectionOffsetY = this.isDynamicShape ? + this.shape.connectionOffsetY(this.connectionHeight) : + this.constants_.TAB_OFFSET_FROM_TOP; + this.connectionOffsetX = this.isDynamicShape ? + this.shape.connectionOffsetX(this.connectionWidth) : 0; }; Blockly.utils.object.inherits(Blockly.blockRendering.InlineInput, Blockly.blockRendering.InputConnection); diff --git a/core/renderers/zelos/constants.js b/core/renderers/zelos/constants.js index e0224ca07..c0ca26000 100644 --- a/core/renderers/zelos/constants.js +++ b/core/renderers/zelos/constants.js @@ -444,6 +444,12 @@ Blockly.zelos.ConstantProvider.prototype.makeHexagonal = function() { height: function(height) { return height; }, + connectionOffsetY: function(connectionHeight) { + return connectionHeight / 2; + }, + connectionOffsetX: function(connectionWidth) { + return - connectionWidth; + }, pathDown: function(height) { return makeMainPath(height, false, false); }, @@ -483,6 +489,12 @@ Blockly.zelos.ConstantProvider.prototype.makeRounded = function() { height: function(height) { return height; }, + connectionOffsetY: function(connectionHeight) { + return connectionHeight / 2; + }, + connectionOffsetX: function(connectionWidth) { + return - connectionWidth; + }, pathDown: function(height) { return makeMainPath(height, false, false); }, diff --git a/core/renderers/zelos/info.js b/core/renderers/zelos/info.js index aea66f2cc..726b51365 100644 --- a/core/renderers/zelos/info.js +++ b/core/renderers/zelos/info.js @@ -295,6 +295,10 @@ Blockly.zelos.RenderInfo.prototype.finalizeOutputConnection_ = function() { this.outputConnection.height = connectionHeight; this.outputConnection.width = connectionWidth; this.outputConnection.startX = connectionWidth; + this.outputConnection.connectionOffsetY = + this.outputConnection.shape.connectionOffsetY(connectionHeight); + this.outputConnection.connectionOffsetX = + this.outputConnection.shape.connectionOffsetX(connectionWidth); // Adjust right side measurable. this.rightSide.height = connectionHeight;