보조지표 전체보기 후 복귀버튼 추가
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import type { IndicatorConfig } from '../types';
|
||||
import { getPaneHostId } from './indicatorPaneMerge';
|
||||
|
||||
/** 단독 전체보기(focusedId) 대상 pane 항목인지 — 호스트·병합 멤버 id 모두 매칭 */
|
||||
export function isIndicatorPaneFocused(
|
||||
itemId: string,
|
||||
focusedId: string | null | undefined,
|
||||
indicators: IndicatorConfig[],
|
||||
): boolean {
|
||||
if (!focusedId) return false;
|
||||
if (itemId === focusedId) return true;
|
||||
|
||||
const itemCfg = indicators.find(i => i.id === itemId);
|
||||
const focusCfg = indicators.find(i => i.id === focusedId);
|
||||
if (itemCfg?.mergedWith === focusedId) return true;
|
||||
if (focusCfg?.mergedWith === itemId) return true;
|
||||
if (focusCfg?.mergedWith && itemCfg?.mergedWith === focusCfg.mergedWith) return true;
|
||||
|
||||
const itemHost = getPaneHostId(itemId, indicators);
|
||||
const focusHost = getPaneHostId(focusedId, indicators);
|
||||
return itemHost === focusedId || itemHost === focusHost || itemId === focusHost;
|
||||
}
|
||||
|
||||
/** focusedId 에 해당하는 pane 레이아웃 조회용 id (병합 시 호스트 우선) */
|
||||
export function resolveFocusedPaneLayoutId(
|
||||
focusedId: string,
|
||||
indicators: IndicatorConfig[],
|
||||
): string {
|
||||
const cfg = indicators.find(i => i.id === focusedId);
|
||||
if (cfg?.mergedWith) return cfg.mergedWith;
|
||||
return getPaneHostId(focusedId, indicators);
|
||||
}
|
||||
Reference in New Issue
Block a user