[zelos] Limit vertical tightnesting (#3504)

* Limit vertical tight nesting to blocks with a certain height

* Use const.
This commit is contained in:
Sam El-Husseini
2019-12-10 16:51:36 -08:00
committed by GitHub
parent 5852bef90d
commit 38fe5189bb
2 changed files with 10 additions and 1 deletions

View File

@@ -398,9 +398,12 @@ Blockly.zelos.RenderInfo.prototype.finalizeVerticalAlignment_ = function() {
if (Blockly.blockRendering.Types.isInputRow(row)) {
// Determine if the input row has non-shadow connected blocks.
var hasNonShadowConnectedBlocks = false;
var MIN_VERTICAL_TIGHTNESTING_HEIGHT = 40;
for (var j = 0, elem; (elem = row.elements[j]); j++) {
if (Blockly.blockRendering.Types.isInlineInput(elem) &&
elem.connectedBlock && !elem.connectedBlock.isShadow()) {
elem.connectedBlock && !elem.connectedBlock.isShadow() &&
elem.connectedBlock.getHeightWidth().height >=
MIN_VERTICAL_TIGHTNESTING_HEIGHT) {
hasNonShadowConnectedBlocks = true;
break;
}

View File

@@ -104,6 +104,12 @@ Blockly.zelos.PathObject.prototype.applyColour = function(block) {
if (block.isShadow() && block.getParent()) {
this.svgPath.setAttribute('stroke', block.getParent().style.colourTertiary);
}
// Apply colour to outlines.
for (var i = 0, keys = Object.keys(this.outlines_),
key; (key = keys[i]); i++) {
this.outlines_[key].setAttribute('fill', this.style.colourTertiary);
}
};
/**