Skip to content

Commit

Permalink
fix: colour from colour picker not being updated (#7584)
Browse files Browse the repository at this point in the history
* fix: colour from colour picker not being updated

* chore: clarify what code is doing
  • Loading branch information
BeksOmega committed Oct 9, 2023
1 parent ead46e7 commit f2fc71a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions core/field_colour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down

0 comments on commit f2fc71a

Please sign in to comment.