From 9bfb30bcf2d7d997676d2398151ee047919fc66e Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Thu, 10 Jan 2019 09:13:02 -0800 Subject: [PATCH] Fixing review comments --- core/block.js | 15 +++------------ core/block_render_svg.js | 5 ++++- core/blockly.js | 3 +-- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/core/block.js b/core/block.js index 7dddd6774..80e70c2d1 100644 --- a/core/block.js +++ b/core/block.js @@ -153,10 +153,10 @@ Blockly.Block = function(workspace, prototypeName, opt_id) { this.isInsertionMarker_ = false; /** - * True if the block has a hat. - * @type {boolean} + * Name of the type of hat. + * @type {string|undefined} */ - this.hat = false; + this.hat = undefined; // Copy the type-specific functions and data from the prototype. if (prototypeName) { @@ -878,14 +878,6 @@ Blockly.Block.prototype.getTertiaryColour = function() { return this.tertiaryColour_; }; -/** - * Get the style of a block. - * @return {?Object} Map of style names (string) to style value (string). - */ -Blockly.Block.prototype.getStyle = function() { - return this.style_; -}; - /** * Get the name of the block style. * @return {?string} Name of the block style. @@ -944,7 +936,6 @@ Blockly.Block.prototype.setStyle = function(blockStyleName) { this.styleName_ = blockStyleName; if (blockStyle) { - this.style_ = blockStyle; this.secondaryColour_ = blockStyle.secondaryColour; this.tertiaryColour_ = blockStyle.tertiaryColour; this.hat = blockStyle.hat; diff --git a/core/block_render_svg.js b/core/block_render_svg.js index c530f6061..37ded88c1 100644 --- a/core/block_render_svg.js +++ b/core/block_render_svg.js @@ -558,6 +558,9 @@ Blockly.BlockSvg.prototype.renderDraw_ = function(iconWidth, inputRows) { this.squareTopLeftCorner_ = true; this.squareBottomLeftCorner_ = true; } else { + var renderCap = typeof this.hat !== undefined ? this.hat === 'cap' : + Blockly.BlockSvg.START_HAT; + this.squareTopLeftCorner_ = false; this.squareBottomLeftCorner_ = false; // If this block is in the middle of a stack, square the corners. @@ -566,7 +569,7 @@ Blockly.BlockSvg.prototype.renderDraw_ = function(iconWidth, inputRows) { if (prevBlock && prevBlock.getNextBlock() == this) { this.squareTopLeftCorner_ = true; } - } else if (Blockly.BlockSvg.START_HAT || this.hat === 'cap') { + } else if (renderCap) { // No output or previous connection. this.squareTopLeftCorner_ = true; this.startHat_ = true; diff --git a/core/blockly.js b/core/blockly.js index 1030f8a7a..5f2a71908 100644 --- a/core/blockly.js +++ b/core/blockly.js @@ -699,8 +699,7 @@ Blockly.setTheme = function(theme) { //update blocks in the flyout if (!ws.toolbox_ && ws.flyout_ && ws.flyout_.workspace_) { this.updateBlockStyles_(ws.flyout_.workspace_.getAllBlocks()); - } - else { + } else { ws.refreshToolboxSelection(); }