Remove references to dark path offset; fix highlights while dragging'

This commit is contained in:
Rachel Fenichel
2019-09-05 11:59:28 -07:00
parent 43944f7151
commit 2ffe71f0a0
4 changed files with 10 additions and 33 deletions

View File

@@ -216,14 +216,14 @@ Blockly.RenderedConnection.prototype.highlight = function() {
var yLen = 5;
steps = Blockly.utils.svgPaths.moveBy(0, -yLen) +
Blockly.utils.svgPaths.lineOnAxis('v', yLen) +
Blockly.blockRendering.constants.PUZZLE_TAB.pathDown +
Blockly.blockRendering.getConstants().PUZZLE_TAB.pathDown +
Blockly.utils.svgPaths.lineOnAxis('v', yLen);
} else {
var xLen = 5;
// Horizontal line, notch, horizontal line.
steps = Blockly.utils.svgPaths.moveBy(-xLen, 0) +
Blockly.utils.svgPaths.lineOnAxis('h', xLen) +
Blockly.blockRendering.constants.NOTCH.pathLeft +
Blockly.blockRendering.getConstants().NOTCH.pathLeft +
Blockly.utils.svgPaths.lineOnAxis('h', xLen);
}
var xy = this.sourceBlock_.getRelativeToSurfaceXY();

View File

@@ -43,7 +43,7 @@ Blockly.blockRendering.useDebugger = false;
*/
Blockly.blockRendering.init = function() {
// TODO (#2702): Pick an API for choosing a renderer.
Blockly.blockRendering.renderer = new Blockly.geras.Renderer();
Blockly.blockRendering.renderer = new Blockly.thrasos.Renderer();
Blockly.blockRendering.renderer.init();
};

View File

@@ -190,28 +190,15 @@ Blockly.thrasos.RenderInfo.prototype.getInRowSpacing_ = function(prev, next) {
return this.constants_.NO_PADDING;
}
// Spacing between a square corner and a previous or next connection
if (Blockly.blockRendering.Types.isPreviousConnection(next)) {
if (Blockly.blockRendering.Types.isPreviousConnection(next) ||
Blockly.blockRendering.Types.isNextConnection(next)) {
return next.notchOffset;
} else if (Blockly.blockRendering.Types.isNextConnection(next)) {
// Next connections are shifted slightly to the left (in both LTR and RTL)
// to make the dark path under the previous connection show through.
var offset = (this.RTL ? 1 : -1) *
this.constants_.DARK_PATH_OFFSET / 2;
return next.notchOffset + offset;
}
}
// Spacing between a rounded corner and a previous or next connection.
if (Blockly.blockRendering.Types.isLeftRoundedCorner(prev) && next) {
if (Blockly.blockRendering.Types.isPreviousConnection(next)) {
return next.notchOffset - this.constants_.CORNER_RADIUS;
} else if (Blockly.blockRendering.Types.isNextConnection(next)) {
// Next connections are shifted slightly to the left (in both LTR and RTL)
// to make the dark path under the previous connection show through.
var offset = (this.RTL ? 1 : -1) *
this.constants_.DARK_PATH_OFFSET / 2;
return next.notchOffset - this.constants_.CORNER_RADIUS + offset;
}
return next.notchOffset - this.constants_.CORNER_RADIUS;
}
// Spacing between two fields of the same editability.

View File

@@ -194,27 +194,17 @@ Blockly.zelos.RenderInfo.prototype.getInRowSpacing_ = function(prev, next) {
return this.constants_.NO_PADDING;
}
// Spacing between a square corner and a previous or next connection
if (Blockly.blockRendering.Types.isPreviousConnection(next)) {
if (Blockly.blockRendering.Types.isPreviousConnection(next) ||
Blockly.blockRendering.Types.isNextConnection(next)) {
return next.notchOffset;
} else if (Blockly.blockRendering.Types.isNextConnection(next)) {
// Next connections are shifted slightly to the left (in both LTR and RTL)
// to make the dark path under the previous connection show through.
var offset = (this.RTL ? 1 : -1) *
this.constants_.DARK_PATH_OFFSET / 2;
return next.notchOffset + offset;
}
}
// Spacing between a rounded corner and a previous or next connection.
if (Blockly.blockRendering.Types.isLeftRoundedCorner(prev) && next) {
if (Blockly.blockRendering.Types.isPreviousConnection(next)) {
if (Blockly.blockRendering.Types.isPreviousConnection(next) ||
Blockly.blockRendering.Types.isNextConnection(next)) {
return next.notchOffset - this.constants_.CORNER_RADIUS;
} else if (Blockly.blockRendering.Types.isNextConnection(next)) {
// Next connections are shifted slightly to the left (in both LTR and RTL)
// to make the dark path under the previous connection show through.
var offset = (this.RTL ? 1 : -1) *
this.constants_.DARK_PATH_OFFSET / 2;
return next.notchOffset - this.constants_.CORNER_RADIUS + offset;
}
}