From 96378f9183874ca062c1b3bb93d3adb3327fdde1 Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Tue, 3 Sep 2019 14:38:10 -0700 Subject: [PATCH] Fix slight offset in statement input connection X location. (#2953) * Fix slight offset in statement input connection X location. --- core/renderers/common/drawer.js | 6 ++++-- core/renderers/geras/highlight_constants.js | 1 + core/renderers/geras/highlighter.js | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/renderers/common/drawer.js b/core/renderers/common/drawer.js index 621e2aa33..79e1962de 100644 --- a/core/renderers/common/drawer.js +++ b/core/renderers/common/drawer.js @@ -394,8 +394,9 @@ Blockly.blockRendering.Drawer.prototype.positionStatementInputConnection_ = func var connX = row.xPos + row.statementEdge + input.notchOffset; if (this.info_.RTL) { connX *= -1; + } else { + connX += this.constants_.DARK_PATH_OFFSET; } - connX += 0.5; input.connection.setOffsetInBlock(connX, row.yPos + this.constants_.DARK_PATH_OFFSET); } @@ -443,7 +444,8 @@ Blockly.blockRendering.Drawer.prototype.positionNextConnection_ = function() { if (bottomRow.connection) { var connInfo = bottomRow.connection; var x = connInfo.xPos; // Already contains info about startX - var connX = (this.info_.RTL ? -x : x) + 0.5; + var connX = (this.info_.RTL ? -x : x) + + (this.constants_.DARK_PATH_OFFSET / 2); connInfo.connectionModel.setOffsetInBlock( connX, (connInfo.centerline - connInfo.height / 2) + this.constants_.DARK_PATH_OFFSET); diff --git a/core/renderers/geras/highlight_constants.js b/core/renderers/geras/highlight_constants.js index 6f1ff5c07..162b5644a 100644 --- a/core/renderers/geras/highlight_constants.js +++ b/core/renderers/geras/highlight_constants.js @@ -134,6 +134,7 @@ Blockly.geras.HighlightConstantProvider.prototype.makeInsideCorner = function() distance45outside + offset)); return { + width: radius + offset, height: radius, pathTop: function(rtl) { return rtl ? pathTopRtl : ''; diff --git a/core/renderers/geras/highlighter.js b/core/renderers/geras/highlighter.js index 91aa2dd26..0cc718d92 100644 --- a/core/renderers/geras/highlighter.js +++ b/core/renderers/geras/highlighter.js @@ -144,11 +144,15 @@ Blockly.geras.Highlighter.prototype.drawStatementInput = function(row) { Blockly.utils.svgPaths.moveTo(input.xPos, row.yPos) + this.insideCornerPaths_.pathTop(this.RTL_) + Blockly.utils.svgPaths.lineOnAxis('v', innerHeight) + - this.insideCornerPaths_.pathBottom(this.RTL_); + this.insideCornerPaths_.pathBottom(this.RTL_) + + Blockly.utils.svgPaths.lineTo( + row.width - input.xPos - this.insideCornerPaths_.width, 0); } else { steps = Blockly.utils.svgPaths.moveTo(input.xPos, row.yPos + row.height) + - this.insideCornerPaths_.pathBottom(this.RTL_); + this.insideCornerPaths_.pathBottom(this.RTL_) + + Blockly.utils.svgPaths.lineTo( + row.width - input.xPos - this.insideCornerPaths_.width, 0); } this.steps_.push(steps); };