Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions plugins/field-colour/src/field_colour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,11 @@ export class FieldColour extends FieldGridDropdown {
constants.FIELD_COLOUR_DEFAULT_WIDTH,
constants.FIELD_COLOUR_DEFAULT_HEIGHT,
);
this.createBorderRect_();
this.getBorderRect().style['fillOpacity'] = '1';
if (this.isFullBlockField()) {
this.clickTarget_ = (this.sourceBlock_ as Blockly.BlockSvg).getSvgRoot();
} else {
this.createBorderRect_();
this.getBorderRect().style['fillOpacity'] = '1';
}

if (this.fieldGroup_) {
Expand Down Expand Up @@ -254,15 +255,14 @@ export class FieldColour extends FieldGridDropdown {
if (!this.fieldGroup_) return;

const borderRect = this.borderRect_;
if (!borderRect) {
throw new Error('The border rect has not been initialized');
}

if (!this.isFullBlockField()) {
if (!borderRect) {
throw new Error('The border rect has not been initialized');
}
borderRect.style.display = 'block';
borderRect.style.fill = this.getValue() as string;
} else {
borderRect.style.display = 'none';
// In general, do *not* let fields control the color of blocks. Having the
// field control the color is unexpected, and could have performance
// impacts.
Expand Down
Loading