mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +01:00
fix!: Make IPathObject styling methods optional (#8332)
This commit is contained in:
@@ -849,7 +849,7 @@ export class BlockSvg
|
||||
* @internal
|
||||
*/
|
||||
applyColour() {
|
||||
this.pathObject.applyColour(this);
|
||||
this.pathObject.applyColour?.(this);
|
||||
|
||||
const icons = this.getIcons();
|
||||
for (let i = 0; i < icons.length; i++) {
|
||||
@@ -1115,7 +1115,7 @@ export class BlockSvg
|
||||
.getConstants()
|
||||
.getBlockStyleForColour(this.colour_);
|
||||
|
||||
this.pathObject.setStyle(styleObj.style);
|
||||
this.pathObject.setStyle?.(styleObj.style);
|
||||
this.style = styleObj.style;
|
||||
this.styleName_ = styleObj.name;
|
||||
|
||||
@@ -1137,7 +1137,7 @@ export class BlockSvg
|
||||
|
||||
if (blockStyle) {
|
||||
this.hat = blockStyle.hat;
|
||||
this.pathObject.setStyle(blockStyle);
|
||||
this.pathObject.setStyle?.(blockStyle);
|
||||
// Set colour to match Block.
|
||||
this.colour_ = blockStyle.colourPrimary;
|
||||
this.style = blockStyle;
|
||||
|
||||
@@ -49,21 +49,6 @@ export interface IPathObject {
|
||||
*/
|
||||
setPath(pathString: string): void;
|
||||
|
||||
/**
|
||||
* Apply the stored colours to the block's path, taking into account whether
|
||||
* the paths belong to a shadow block.
|
||||
*
|
||||
* @param block The source block.
|
||||
*/
|
||||
applyColour(block: BlockSvg): void;
|
||||
|
||||
/**
|
||||
* Update the style.
|
||||
*
|
||||
* @param blockStyle The block style to use.
|
||||
*/
|
||||
setStyle(blockStyle: BlockStyle): void;
|
||||
|
||||
/**
|
||||
* Flip the SVG paths in RTL.
|
||||
*/
|
||||
@@ -130,8 +115,23 @@ export interface IPathObject {
|
||||
rtl: boolean,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Apply the stored colours to the block's path, taking into account whether
|
||||
* the paths belong to a shadow block.
|
||||
*
|
||||
* @param block The source block.
|
||||
*/
|
||||
applyColour?(block: BlockSvg): void;
|
||||
|
||||
/**
|
||||
* Removes any highlight associated with the given connection, if it exists.
|
||||
*/
|
||||
removeConnectionHighlight?(connection: RenderedConnection): void;
|
||||
|
||||
/**
|
||||
* Update the style.
|
||||
*
|
||||
* @param blockStyle The block style to use.
|
||||
*/
|
||||
setStyle?(blockStyle: BlockStyle): void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user