From 8522acd6801c839ab40b8a1ac1c7cdcd785c055f Mon Sep 17 00:00:00 2001 From: Peyton Lee Date: Fri, 25 Oct 2024 14:29:18 -0700 Subject: [PATCH 1/2] fix: Channels are no longer renamed --- src/aics-image-viewer/shared/utils/viewerState.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aics-image-viewer/shared/utils/viewerState.ts b/src/aics-image-viewer/shared/utils/viewerState.ts index bfe78e27..3a35e8e8 100644 --- a/src/aics-image-viewer/shared/utils/viewerState.ts +++ b/src/aics-image-viewer/shared/utils/viewerState.ts @@ -1,7 +1,7 @@ -import { ColorArray } from "./colorRepresentations"; import { ChannelState, ViewerSettingUpdater, ViewerState } from "../../components/ViewerStateProvider/types"; import { getDefaultChannelState } from "../constants"; -import { ViewerChannelSettings, ViewerChannelSetting, findFirstChannelMatch } from "./viewerChannelSettings"; +import { ColorArray } from "./colorRepresentations"; +import { findFirstChannelMatch, ViewerChannelSetting, ViewerChannelSettings } from "./viewerChannelSettings"; /** Sets all fields of the viewer state to the values of the `newState`. */ export function overrideViewerState(changeViewerSetting: ViewerSettingUpdater, newState: ViewerState): void { @@ -65,7 +65,7 @@ export function initializeOneChannelSetting( } return { - name: initSettings.name ?? channel ?? "Channel " + index, + name: channel ?? "Channel " + index, volumeEnabled: initSettings.enabled ?? defaultChannelState.volumeEnabled, isosurfaceEnabled: initSettings.surfaceEnabled ?? defaultChannelState.isosurfaceEnabled, colorizeEnabled: initSettings.colorizeEnabled ?? defaultChannelState.colorizeEnabled, From 12ad73924bc216b07eb0c6266e32bf96759bebd0 Mon Sep 17 00:00:00 2001 From: Peyton Lee Date: Fri, 25 Oct 2024 14:37:23 -0700 Subject: [PATCH 2/2] refactor: Renamed `channel` to `channelName` --- src/aics-image-viewer/shared/utils/viewerState.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aics-image-viewer/shared/utils/viewerState.ts b/src/aics-image-viewer/shared/utils/viewerState.ts index 3a35e8e8..119a6108 100644 --- a/src/aics-image-viewer/shared/utils/viewerState.ts +++ b/src/aics-image-viewer/shared/utils/viewerState.ts @@ -52,7 +52,7 @@ export function colorHexToArray(hex: string): ColorArray | null { } export function initializeOneChannelSetting( - channel: string, + channelName: string, index: number, defaultColor: ColorArray, viewerChannelSettings?: ViewerChannelSettings, @@ -61,11 +61,11 @@ export function initializeOneChannelSetting( let initSettings = {} as Partial; if (viewerChannelSettings) { // search for channel in settings using groups, names and match values - initSettings = findFirstChannelMatch(channel, index, viewerChannelSettings) ?? {}; + initSettings = findFirstChannelMatch(channelName, index, viewerChannelSettings) ?? {}; } return { - name: channel ?? "Channel " + index, + name: channelName ?? "Channel " + index, volumeEnabled: initSettings.enabled ?? defaultChannelState.volumeEnabled, isosurfaceEnabled: initSettings.surfaceEnabled ?? defaultChannelState.isosurfaceEnabled, colorizeEnabled: initSettings.colorizeEnabled ?? defaultChannelState.colorizeEnabled,