Handle negative x and y origin

This commit is contained in:
Rachel Fenichel
2019-08-08 15:47:14 -07:00
parent 74238d6e24
commit c901b20486
2 changed files with 4 additions and 4 deletions

View File

@@ -92,7 +92,7 @@ Blockly.blockRendering.Highlighter.prototype.drawTopCorner = function(row) {
}
}
this.steps_.push('H', row.width - this.highlightOffset_);
this.steps_.push('H', this.info_.startX + row.width - this.highlightOffset_);
};
Blockly.blockRendering.Highlighter.prototype.drawJaggedEdge_ = function(row) {

View File

@@ -695,10 +695,10 @@ Blockly.blockRendering.RenderInfo.prototype.finalize_ = function() {
// Performance note: this could be combined with the draw pass, if the time
// that this takes is excessive. But it shouldn't be, because it only
// accesses and sets properties that already exist on the objects.
var yCursor = this.startY;
var yCursor = 0;
for (var r = 0; r < this.rows.length; r++) {
var row = this.rows[r];
row.yPos = yCursor;
row.yPos = yCursor + this.startY;
yCursor += row.height;
// Add padding to the bottom row if block height is less than minimum
if (row == this.bottomRow &&
@@ -721,5 +721,5 @@ Blockly.blockRendering.RenderInfo.prototype.finalize_ = function() {
this.blockBottom = yCursor;
// Don't count the start offset in the recorded height.
this.height = yCursor - this.startY;
this.height = yCursor;
};