Skip to content

Commit

Permalink
Merge pull request #333 from allen-cell-animated/fix/channel-renames
Browse files Browse the repository at this point in the history
fix: Channels are no longer renamed
- `initializeOneChannelSetting` no longer renames channels unless no value is provided.
  • Loading branch information
ShrimpCryptid authored Oct 28, 2024
2 parents 9b57692 + c1db3be commit cebc0d2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/aics-image-viewer/shared/utils/viewerState.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -52,7 +52,7 @@ export function colorHexToArray(hex: string): ColorArray | null {
}

export function initializeOneChannelSetting(
channel: string,
channelName: string,
index: number,
defaultColor: ColorArray,
viewerChannelSettings?: ViewerChannelSettings,
Expand All @@ -61,11 +61,11 @@ export function initializeOneChannelSetting(
let initSettings = {} as Partial<ViewerChannelSetting>;
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: initSettings.name ?? channel ?? "Channel " + index,
name: channelName ?? "Channel " + index,
volumeEnabled: initSettings.enabled ?? defaultChannelState.volumeEnabled,
isosurfaceEnabled: initSettings.surfaceEnabled ?? defaultChannelState.isosurfaceEnabled,
colorizeEnabled: initSettings.colorizeEnabled ?? defaultChannelState.colorizeEnabled,
Expand Down

0 comments on commit cebc0d2

Please sign in to comment.