diff --git a/core/block_svg.ts b/core/block_svg.ts index acead527a..0da81f01d 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -1178,7 +1178,10 @@ export class BlockSvg .getRenderer() .getConstants() .getBlockStyle(blockStyleName); - this.styleName_ = blockStyleName; + + if (this.styleName_) { + dom.removeClass(this.svgGroup_, this.styleName_); + } if (blockStyle) { this.hat = blockStyle.hat; @@ -1188,6 +1191,9 @@ export class BlockSvg this.style = blockStyle; this.applyColour(); + + dom.addClass(this.svgGroup_, blockStyleName); + this.styleName_ = blockStyleName; } else { throw Error('Invalid style name: ' + blockStyleName); }