mirror of
https://github.com/google/blockly.git
synced 2026-01-26 02:00:10 +01:00
Adds hat style
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user