diff --git a/core/block.js b/core/block.js index 426551bb2..07fa108c4 100644 --- a/core/block.js +++ b/core/block.js @@ -152,6 +152,12 @@ Blockly.Block = function(workspace, prototypeName, opt_id) { */ this.isInsertionMarker_ = false; + /** + * True if the block has a hat. + * @type {boolean} + */ + this.hat = false; + // Copy the type-specific functions and data from the prototype. if (prototypeName) { /** @type {string} */ @@ -941,6 +947,7 @@ Blockly.Block.prototype.setStyle = function(blockStyleName) { this.style_ = blockStyle; this.secondaryColour_ = blockStyle.secondaryColour; this.tertiaryColour_ = blockStyle.tertiaryColour; + this.hat = blockStyle.hat; // Set colour will trigger an updateColour() on a block_svg this.setColour(blockStyle.primaryColour); } diff --git a/core/block_render_svg.js b/core/block_render_svg.js index a1d4af37e..2cff473c7 100644 --- a/core/block_render_svg.js +++ b/core/block_render_svg.js @@ -566,7 +566,7 @@ Blockly.BlockSvg.prototype.renderDraw_ = function(iconWidth, inputRows) { if (prevBlock && prevBlock.getNextBlock() == this) { this.squareTopLeftCorner_ = true; } - } else if (Blockly.BlockSvg.START_HAT) { + } else if (Blockly.BlockSvg.START_HAT || this.hat) { // No output or previous connection. this.squareTopLeftCorner_ = true; this.startHat_ = true;