mirror of
https://github.com/google/blockly.git
synced 2026-01-09 01:50:11 +01:00
Updating draw for statement input and value input to use element xPos and more approriate constants.
This commit is contained in:
@@ -191,7 +191,7 @@ Blockly.blockRendering.Drawer.prototype.drawValueInput_ = function(row) {
|
||||
this.positionExternalValueConnection_(row);
|
||||
|
||||
this.outlinePath_ +=
|
||||
Blockly.utils.svgPaths.lineOnAxis('H', row.xPos + row.width) +
|
||||
Blockly.utils.svgPaths.lineOnAxis('H', input.xPos + input.width) +
|
||||
input.connectionShape.pathDown +
|
||||
Blockly.utils.svgPaths.lineOnAxis('v', row.height - input.connectionHeight);
|
||||
};
|
||||
@@ -212,15 +212,18 @@ Blockly.blockRendering.Drawer.prototype.drawStatementInput_ = function(row) {
|
||||
var x = input.xPos + input.width;
|
||||
|
||||
var innerTopLeftCorner =
|
||||
Blockly.blockRendering.constants.NOTCH.pathRight + ' h -' +
|
||||
(Blockly.blockRendering.constants.NOTCH_WIDTH -
|
||||
Blockly.blockRendering.constants.CORNER_RADIUS) +
|
||||
input.notchShape.pathRight +
|
||||
Blockly.utils.svgPaths.lineOnAxis('h',
|
||||
-(Blockly.blockRendering.constants.NOTCH_OFFSET_LEFT -
|
||||
Blockly.blockRendering.constants.INSIDE_CORNERS.width)) +
|
||||
Blockly.blockRendering.constants.INSIDE_CORNERS.pathTop;
|
||||
|
||||
var innerHeight =
|
||||
row.height -(2 * Blockly.blockRendering.constants.INSIDE_CORNERS.height);
|
||||
|
||||
this.outlinePath_ += Blockly.utils.svgPaths.lineOnAxis('H', x) +
|
||||
innerTopLeftCorner +
|
||||
Blockly.utils.svgPaths.lineOnAxis('v',
|
||||
row.height - (2 * Blockly.blockRendering.constants.INSIDE_CORNERS.height)) +
|
||||
Blockly.utils.svgPaths.lineOnAxis('v', innerHeight) +
|
||||
Blockly.blockRendering.constants.INSIDE_CORNERS.pathBottom;
|
||||
|
||||
this.positionStatementInputConnection_(row);
|
||||
|
||||
@@ -115,40 +115,35 @@ Blockly.blockRendering.Highlighter.prototype.drawJaggedEdge_ = function(row) {
|
||||
|
||||
Blockly.blockRendering.Highlighter.prototype.drawValueInput = function(row) {
|
||||
var input = row.getLastInput();
|
||||
var steps = '';
|
||||
if (this.RTL_) {
|
||||
var belowTabHeight = row.height - input.connectionHeight;
|
||||
|
||||
steps =
|
||||
Blockly.utils.svgPaths.moveTo(
|
||||
row.xPos + row.width - this.highlightOffset_, row.yPos) +
|
||||
this.puzzleTabPaths_.pathDown(this.RTL_) +
|
||||
Blockly.utils.svgPaths.lineOnAxis('v', belowTabHeight);
|
||||
this.steps_.push(Blockly.utils.svgPaths.moveTo(
|
||||
input.xPos + input.width - this.highlightOffset_, row.yPos));
|
||||
this.steps_.push(this.puzzleTabPaths_.pathDown(this.RTL_));
|
||||
this.steps_.push(
|
||||
Blockly.utils.svgPaths.lineOnAxis('v', belowTabHeight));
|
||||
} else {
|
||||
steps =
|
||||
Blockly.utils.svgPaths.moveTo(row.xPos + row.width, row.yPos) +
|
||||
this.puzzleTabPaths_.pathDown(this.RTL_);
|
||||
this.steps_.push(
|
||||
Blockly.utils.svgPaths.moveTo(input.xPos + input.width, row.yPos));
|
||||
this.steps_.push(this.puzzleTabPaths_.pathDown(this.RTL_));
|
||||
}
|
||||
|
||||
this.steps_.push(steps);
|
||||
};
|
||||
|
||||
Blockly.blockRendering.Highlighter.prototype.drawStatementInput = function(row) {
|
||||
var steps = '';
|
||||
var statementEdge = row.xPos + row.statementEdge;
|
||||
var input = row.getLastInput();
|
||||
if (this.RTL_) {
|
||||
var innerHeight = row.height - (2 * this.insideCornerPaths_.height);
|
||||
steps =
|
||||
Blockly.utils.svgPaths.moveTo(statementEdge, row.yPos) +
|
||||
this.insideCornerPaths_.pathTop(this.RTL_) +
|
||||
Blockly.utils.svgPaths.lineOnAxis('v', innerHeight) +
|
||||
this.insideCornerPaths_.pathBottom(this.RTL_);
|
||||
this.steps_.push(Blockly.utils.svgPaths.moveTo(input.xPos, row.yPos));
|
||||
this.steps_.push(this.insideCornerPaths_.pathTop(this.RTL_));
|
||||
this.steps_.push(
|
||||
Blockly.utils.svgPaths.lineOnAxis('v', innerHeight));
|
||||
this.steps_.push(this.insideCornerPaths_.pathBottom(this.RTL_));
|
||||
} else {
|
||||
steps =
|
||||
Blockly.utils.svgPaths.moveTo(statementEdge, row.yPos + row.height) +
|
||||
this.insideCornerPaths_.pathBottom(this.RTL_);
|
||||
this.steps_.push(
|
||||
Blockly.utils.svgPaths.moveTo(input.xPos, row.yPos + row.height) +
|
||||
this.insideCornerPaths_.pathBottom(this.RTL_));
|
||||
}
|
||||
this.steps_.push(steps);
|
||||
};
|
||||
|
||||
Blockly.blockRendering.Highlighter.prototype.drawRightSideRow = function(row) {
|
||||
|
||||
@@ -289,6 +289,7 @@ Blockly.blockRendering.constants.INSIDE_CORNERS = (function() {
|
||||
Blockly.utils.svgPaths.point(radius, radius));
|
||||
|
||||
return {
|
||||
width: radius,
|
||||
height: radius,
|
||||
pathTop: innerTopLeftCorner,
|
||||
pathBottom: innerBottomLeftCorner
|
||||
|
||||
Reference in New Issue
Block a user