From 01c3b94ac65fd60655d07e3ac65dc6756924a9a5 Mon Sep 17 00:00:00 2001 From: Edward Moyse Date: Sat, 21 Sep 2024 14:57:59 +0200 Subject: [PATCH] Correctly reset GUI label colour when loading configuration --- .../ui-manager/phoenix-menu/phoenix-menu-node.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/phoenix-event-display/src/managers/ui-manager/phoenix-menu/phoenix-menu-node.ts b/packages/phoenix-event-display/src/managers/ui-manager/phoenix-menu/phoenix-menu-node.ts index 14b21811..498cd608 100644 --- a/packages/phoenix-event-display/src/managers/ui-manager/phoenix-menu/phoenix-menu-node.ts +++ b/packages/phoenix-event-display/src/managers/ui-manager/phoenix-menu/phoenix-menu-node.ts @@ -150,13 +150,12 @@ export class PhoenixMenuNode { // Apply configs of different config types - manual if (config.type === 'checkbox' && config?.['isChecked']) { config.onChange?.(config?.['isChecked']); - } else if ( - config.type === 'color' && - config?.['color'] && - config.group !== undefined - ) { - // Ignore color by options with `!config.group`, otherwise the collection color is overridden - config.onChange?.(config?.['color']); + } else if (config.type === 'color' && config?.['color']) { + if (config.group !== undefined || this.name === 'Labels') { + // Ignore color by options with `!config.group`, otherwise the collection color is overridden + // Exception for Labels node, which should always have color applied + config.onChange?.(config?.['color']); + } } else if (config.type === 'slider' && config?.['value']) { config.onChange?.(config?.['value']); } else if ( @@ -216,8 +215,6 @@ export class PhoenixMenuNode { nodeConfig.type === configState['type'] && nodeConfig.label === configState['label'], ); - // configs: PhoenixMenuConfigs[keyof PhoenixMenuConfigs][] = []; - if (nodeConfigs.length > 1) { console.error( 'Multiple configs found with same label and type in phoenix menu node.',