mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +01:00
Merge pull request #2709 from moniika/moniika-render-debug-top-bottom
Updating debug rendering for top and bottom block rows.
This commit is contained in:
@@ -84,20 +84,23 @@ Blockly.blockRendering.Debug.prototype.drawSpacerRow = function(row, cursorY) {
|
||||
* @param {!Blockly.BlockSvg.InRowSpacer} elem The spacer to render
|
||||
* @param {number} cursorX The x position of the left of the row.
|
||||
* @param {number} centerY The y position of the center of the row, vertically.
|
||||
* @param {number} rowHeight The height of the container row.
|
||||
* @package
|
||||
*/
|
||||
Blockly.blockRendering.Debug.prototype.drawSpacerElem = function(elem, cursorX, centerY) {
|
||||
var yPos = centerY - elem.height / 2;
|
||||
this.debugElements_.push(Blockly.utils.dom.createSvgElement('rect',
|
||||
{
|
||||
'class': 'elemSpacerRect blockRenderDebug',
|
||||
'x': cursorX,
|
||||
'y': yPos,
|
||||
'width': elem.width,
|
||||
'height': 15,
|
||||
},
|
||||
this.svgRoot_));
|
||||
};
|
||||
Blockly.blockRendering.Debug.prototype.drawSpacerElem =
|
||||
function(elem, cursorX, centerY, rowHeight) {
|
||||
var debugRenderedHeight = Math.min(15, rowHeight);
|
||||
var yPos = centerY - debugRenderedHeight / 2;
|
||||
this.debugElements_.push(Blockly.utils.dom.createSvgElement('rect',
|
||||
{
|
||||
'class': 'elemSpacerRect blockRenderDebug',
|
||||
'x': cursorX,
|
||||
'y': yPos,
|
||||
'width': elem.width,
|
||||
'height': debugRenderedHeight,
|
||||
},
|
||||
this.svgRoot_));
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw a debug rectangle for an in-row element.
|
||||
@@ -193,7 +196,7 @@ Blockly.blockRendering.Debug.prototype.drawRowWithElements = function(row, curso
|
||||
for (var e = 0; e < row.elements.length; e++) {
|
||||
var elem = row.elements[e];
|
||||
if (elem.isSpacer()) {
|
||||
this.drawSpacerElem(elem, cursorX, centerY);
|
||||
this.drawSpacerElem(elem, cursorX, centerY, row.height);
|
||||
} else {
|
||||
this.drawRenderedElem(elem, cursorX, centerY);
|
||||
}
|
||||
|
||||
@@ -453,11 +453,6 @@ Blockly.blockRendering.TopRow = function(block) {
|
||||
};
|
||||
goog.inherits(Blockly.blockRendering.TopRow, Blockly.blockRendering.Row);
|
||||
|
||||
|
||||
Blockly.blockRendering.TopRow.prototype.isSpacer = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
Blockly.blockRendering.BottomRow = function(block) {
|
||||
Blockly.blockRendering.BottomRow.superClass_.constructor.call(this);
|
||||
this.type = 'bottom row';
|
||||
@@ -480,8 +475,3 @@ Blockly.blockRendering.BottomRow = function(block) {
|
||||
};
|
||||
goog.inherits(Blockly.blockRendering.BottomRow,
|
||||
Blockly.blockRendering.Row);
|
||||
|
||||
Blockly.blockRendering.BottomRow.prototype.isSpacer = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user