Fixing review comments

This commit is contained in:
alschmiedt
2019-01-10 09:13:02 -08:00
parent caf664db04
commit 9bfb30bcf2
3 changed files with 8 additions and 15 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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();
}