Fix slight offset in statement input connection X location. (#2953)

* Fix slight offset in statement input connection X location.
This commit is contained in:
Sam El-Husseini
2019-09-03 14:38:10 -07:00
committed by GitHub
parent ab4b16e9d3
commit 96378f9183
3 changed files with 11 additions and 4 deletions

View File

@@ -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);

View File

@@ -134,6 +134,7 @@ Blockly.geras.HighlightConstantProvider.prototype.makeInsideCorner = function()
distance45outside + offset));
return {
width: radius + offset,
height: radius,
pathTop: function(rtl) {
return rtl ? pathTopRtl : '';

View File

@@ -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);
};