mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
fix: colour from colour picker not being updated (#7584)
* fix: colour from colour picker not being updated * chore: clarify what code is doing
This commit is contained in:
@@ -246,12 +246,9 @@ export class FieldColour extends Field<string> {
|
||||
|
||||
const block = this.getSourceBlock() as BlockSvg | null;
|
||||
if (!block) throw new UnattachedFieldError();
|
||||
// In general, do *not* let fields control the color of blocks. Having the
|
||||
// field control the color is unexpected, and could have performance
|
||||
// impacts.
|
||||
// Whenever we render, the field may no longer be a full-block-field so
|
||||
// we need to update the colour.
|
||||
if (this.getConstants()!.FIELD_COLOUR_FULL_BLOCK) block.applyColour();
|
||||
// Calling applyColour updates the UI (full-block vs non-full-block) for the
|
||||
// colour field, and the colour of the field/block.
|
||||
block.applyColour();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user