보조지표 합치기, 분리, 복사하기 기능 오류 수정
This commit is contained in:
@@ -1268,9 +1268,7 @@ const TradingChart: React.FC<TradingChartProps> = ({
|
||||
const currSK = styleKey(indicators);
|
||||
|
||||
const needsRecalc = prevPK !== currPK;
|
||||
const isReorderOnly = needsRecalc
|
||||
&& sortedParamKey(indicators) === sortedParamKey(prevList)
|
||||
&& currSK === prevSK;
|
||||
const chartChange = classifyIndicatorChartChange(prevList, indicators);
|
||||
|
||||
const prevMap = new Map(prevList.map(i => [i.id, i]));
|
||||
const removedIds = prevList
|
||||
@@ -1283,7 +1281,17 @@ const TradingChart: React.FC<TradingChartProps> = ({
|
||||
return singleIndParamKey(p) !== singleIndParamKey(c);
|
||||
});
|
||||
|
||||
if (!needsRecalc && prevSK !== currSK) {
|
||||
if (
|
||||
chartChange.mode === 'reorder-only'
|
||||
|| chartChange.mode === 'layout-changed'
|
||||
) {
|
||||
/** 순서·병합·분리 — 설정에 맞게 sub-pane 전체 재배치 */
|
||||
indicatorSyncInFlightRef.current = true;
|
||||
reloadIndicatorsWithCover(mgr, indicators, () => {
|
||||
syncIndicatorTrackingRefs(indicators);
|
||||
indicatorSyncInFlightRef.current = false;
|
||||
});
|
||||
} else if (!needsRecalc && prevSK !== currSK) {
|
||||
for (const ind of indicators) {
|
||||
mgr.applyIndicatorStyle(ind);
|
||||
}
|
||||
@@ -1336,7 +1344,13 @@ const TradingChart: React.FC<TradingChartProps> = ({
|
||||
) {
|
||||
const savedLR = mgr.getVisibleLogicalRange();
|
||||
indicatorSyncInFlightRef.current = true;
|
||||
void mgr.addIndicatorsBatch(addedConfigs).then(() => {
|
||||
/** 복사 등 목록 중간 삽입 — pane 순서를 맞추려면 전체 재로드 */
|
||||
const insertIdx = addedConfigs.length === 1
|
||||
? indicators.findIndex(i => i.id === addedConfigs[0].id)
|
||||
: -1;
|
||||
const reloadForPaneOrder = insertIdx >= 0 && insertIdx < indicators.length - 1;
|
||||
|
||||
const finishAdd = () => {
|
||||
afterIndicatorPaneMutation(mgr);
|
||||
mgr.notifyPaneLayoutChanged();
|
||||
restoreLogicalRange(mgr, savedLR);
|
||||
@@ -1349,7 +1363,13 @@ const TradingChart: React.FC<TradingChartProps> = ({
|
||||
setTimeout(() => mgr.notifyPaneLayoutChanged(), ms);
|
||||
});
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
||||
if (reloadForPaneOrder) {
|
||||
reloadIndicatorsWithCover(mgr, indicators, finishAdd);
|
||||
} else {
|
||||
void mgr.addIndicatorsBatch(addedConfigs).then(finishAdd);
|
||||
}
|
||||
} else if (
|
||||
paramsChangedConfigs.length > 0
|
||||
&& removedIds.length === 0
|
||||
@@ -1373,19 +1393,12 @@ const TradingChart: React.FC<TradingChartProps> = ({
|
||||
setPaneLegendPaused(false);
|
||||
flushPendingIndicatorResync(mgr, syncGen);
|
||||
});
|
||||
} else if (isReorderOnly) {
|
||||
} else if (chartChange.mode === 'full') {
|
||||
reloadIndicatorsWithCover(mgr, indicators, () => {
|
||||
syncIndicatorTrackingRefs(indicators);
|
||||
});
|
||||
} else {
|
||||
const change = classifyIndicatorChartChange(prevList, indicators);
|
||||
if (change.mode === 'full') {
|
||||
reloadIndicatorsWithCover(mgr, indicators, () => {
|
||||
syncIndicatorTrackingRefs(indicators);
|
||||
});
|
||||
} else {
|
||||
syncIndicatorTrackingRefs(indicators);
|
||||
}
|
||||
syncIndicatorTrackingRefs(indicators);
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
|
||||
Reference in New Issue
Block a user