Add dark path offset in geras info.

This commit is contained in:
Rachel Fenichel
2019-09-05 16:55:56 -07:00
parent ffd1a157ae
commit e96acf476c
4 changed files with 8 additions and 20 deletions

View File

@@ -92,10 +92,8 @@ Blockly.blockRendering.Drawer.prototype.draw = function() {
Blockly.blockRendering.Drawer.prototype.recordSizeOnBlock_ = function() {
// This is used when the block is reporting its size to anyone else.
// The dark path adds to the size of the block in both X and Y.
this.block_.height = this.info_.height +
this.constants_.DARK_PATH_OFFSET;
this.block_.width = this.info_.widthWithChildren +
this.constants_.DARK_PATH_OFFSET;
this.block_.height = this.info_.height;
this.block_.width = this.info_.widthWithChildren;
};
/**

View File

@@ -70,18 +70,6 @@ Blockly.geras.Drawer.prototype.draw = function() {
this.recordSizeOnBlock_();
};
/**
* @override
*/
Blockly.geras.Drawer.prototype.recordSizeOnBlock_ = function() {
// This is used when the block is reporting its size to anyone else.
// The dark path adds to the size of the block in both X and Y.
this.block_.height = this.info_.height +
this.constants_.DARK_PATH_OFFSET;
this.block_.width = this.info_.widthWithChildren +
this.constants_.DARK_PATH_OFFSET;
};
/**
* @override
*/

View File

@@ -211,7 +211,7 @@ Blockly.geras.Highlighter.prototype.drawLeft = function() {
this.steps_ += Blockly.utils.svgPaths.moveTo(this.info_.startX, tabBottom);
} else {
var left = this.info_.startX + this.highlightOffset_;
var bottom = this.info_.height - this.highlightOffset_;
var bottom = this.info_.bottomRow.baseline - this.highlightOffset_;
this.steps_ += Blockly.utils.svgPaths.moveTo(left, bottom);
this.steps_ += Blockly.utils.svgPaths.lineOnAxis('V', tabBottom);
}

View File

@@ -359,8 +359,10 @@ Blockly.geras.RenderInfo.prototype.finalize_ = function() {
}
this.bottomRow.baseline = yCursor - this.bottomRow.descenderHeight;
this.widthWithChildren = widestRowWithConnectedBlocks + this.startX;
this.height = yCursor;
// The dark (lowlight) adds to the size of the block in both x and y.
this.widthWithChildren = widestRowWithConnectedBlocks +
this.startX + this.constants_.DARK_PATH_OFFSET;
this.width += this.constants_.DARK_PATH_OFFSET;
this.height = yCursor + this.constants_.DARK_PATH_OFFSET;
this.startY = this.topRow.capline;
};