보조지표 설정 저장 오류
This commit is contained in:
@@ -47,6 +47,8 @@ type AllSettings = Record<string, ParamMap>;
|
||||
export interface IndicatorVisual {
|
||||
plots?: PlotDef[];
|
||||
hlines?: HLineDef[];
|
||||
/** 지표선 on/off — plot id → visible */
|
||||
plotVisibility?: Record<string, boolean>;
|
||||
cloudColors?: IchimokuCloudColors;
|
||||
/** 볼린저밴드 어퍼~로우어 배경 (업비트 백그라운드 그리기) */
|
||||
bandBackground?: HlinesBackground;
|
||||
@@ -56,6 +58,7 @@ export interface IndicatorVisual {
|
||||
export interface IndicatorVisualConfig {
|
||||
plots: PlotDef[];
|
||||
hlines: HLineDef[];
|
||||
plotVisibility?: Record<string, boolean>;
|
||||
cloudColors?: IchimokuCloudColors;
|
||||
bandBackground?: HlinesBackground;
|
||||
}
|
||||
@@ -243,6 +246,7 @@ export function useIndicatorSettings(sessionKey = 0, enabled = true) {
|
||||
plots: cfg.plots,
|
||||
hlines: cfg.hlines,
|
||||
};
|
||||
if (cfg.plotVisibility) visual.plotVisibility = cfg.plotVisibility;
|
||||
if (cfg.cloudColors) visual.cloudColors = cfg.cloudColors;
|
||||
if (cfg.type === 'BollingerBands' && cfg.bandBackground) {
|
||||
visual.bandBackground = cfg.bandBackground;
|
||||
@@ -321,10 +325,21 @@ export function useIndicatorSettings(sessionKey = 0, enabled = true) {
|
||||
? resolveBbBandBackground(saved?.bandBackground)
|
||||
: undefined;
|
||||
|
||||
const enriched = enrichIndicatorConfig({
|
||||
id: '',
|
||||
type,
|
||||
params: (def?.defaultParams ?? {}) as Record<string, number | string | boolean>,
|
||||
plots,
|
||||
plotVisibility: saved?.plotVisibility,
|
||||
});
|
||||
|
||||
// 깊은 복사: 여러 슬롯이 같은 참조를 공유하지 않도록
|
||||
return {
|
||||
plots: plots.map(p => ({ ...p })),
|
||||
plots: (enriched.plots ?? plots).map(p => ({ ...p })),
|
||||
hlines: hlines.map(h => ({ ...h })),
|
||||
plotVisibility: enriched.plotVisibility
|
||||
? { ...enriched.plotVisibility }
|
||||
: undefined,
|
||||
cloudColors: cloudColors ? { ...cloudColors } : undefined,
|
||||
bandBackground: bandBackground ? { ...bandBackground } : undefined,
|
||||
};
|
||||
@@ -343,8 +358,10 @@ export function useIndicatorSettings(sessionKey = 0, enabled = true) {
|
||||
hlines?: HLineDef[],
|
||||
cloudColors?: IchimokuCloudColors,
|
||||
bandBackground?: HlinesBackground,
|
||||
plotVisibility?: Record<string, boolean>,
|
||||
) => {
|
||||
const visual: IndicatorVisual = { plots, hlines };
|
||||
if (plotVisibility != null) visual.plotVisibility = plotVisibility;
|
||||
if (cloudColors) visual.cloudColors = cloudColors;
|
||||
if (type === 'BollingerBands') {
|
||||
visual.bandBackground = bandBackground ?? resolveBbBandBackground(_visualCache?.[type]?.bandBackground);
|
||||
|
||||
Reference in New Issue
Block a user