From bac9a16da0e9c5b9d889e2117d7d86d9128f3e24 Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Tue, 8 Jan 2019 15:13:00 -0800 Subject: [PATCH] Adds hat style --- core/block.js | 7 +++++++ core/block_render_svg.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) 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;