2026-09-06 사용자 지시. 기본 켜짐 목록에서 토량분배(평형선·운반 블록)를 빼고 세션 저장 키 판을 v4 → v5 로 올림 — 안 올리면 이미 켜 둔 브라우저가 옛 값을 그대로 씀. 범례에서 켜면 예전대로 나옴. 두 화면이 같은 키를 쓰므로 두 벌을 함께 고침. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
52 lines
2.2 KiB
TypeScript
52 lines
2.2 KiB
TypeScript
import { MASS_HAUL_DEFAULT_VISIBLE, normalizeVisibleBasis } from "@util/common_util_mass_haul";
|
|
import { MASS_HAUL_HEIGHT, MASS_HAUL_MIN_HEIGHT } from "@util/common_util_mass_haul_view";
|
|
import { LONG_HEIGHT } from "./B06_Section_UI_Section_Common";
|
|
|
|
export const PANEL_CHROME_PX = 102;
|
|
export const BASE_PANEL_HEIGHT = LONG_HEIGHT + MASS_HAUL_HEIGHT + PANEL_CHROME_PX;
|
|
export const MIN_LONG_HEIGHT = 110;
|
|
export const MIN_PANEL_HEIGHT = MIN_LONG_HEIGHT + MASS_HAUL_MIN_HEIGHT + PANEL_CHROME_PX;
|
|
export const MAX_PANEL_HEIGHT_RATIO = 0.8;
|
|
export const PANEL_HEIGHT_KEY = "b06:profile-panel-height";
|
|
export const PANEL_COLLAPSED_KEY = "b06:profile-panel-collapsed";
|
|
export const MASS_HAUL_VISIBLE_KEY = "b06:masshaul-visible-v5";
|
|
|
|
/** 처음 열 때는 **곡선만** — 토량 분배는 범례에서 켠다(2026-09-06 사용자 지시).
|
|
* B05 `_UI_Profile_MassHaul` 과 같은 값이어야 한다(두 화면 공용 키). */
|
|
const DEFAULT_VISIBLE_KEYS = [...MASS_HAUL_DEFAULT_VISIBLE];
|
|
|
|
export function readVisibleSeries(): Set<string> {
|
|
try {
|
|
const raw = sessionStorage.getItem(MASS_HAUL_VISIBLE_KEY);
|
|
if (!raw) return new Set(DEFAULT_VISIBLE_KEYS);
|
|
const parsed: unknown = JSON.parse(raw);
|
|
return Array.isArray(parsed)
|
|
? normalizeVisibleBasis(new Set(parsed.map(String)))
|
|
: new Set(DEFAULT_VISIBLE_KEYS);
|
|
} catch {
|
|
return new Set(DEFAULT_VISIBLE_KEYS);
|
|
}
|
|
}
|
|
|
|
export function chartHeights(availableHeightPx: number): { long: number; mass: number } {
|
|
if (!Number.isFinite(availableHeightPx) || availableHeightPx <= 0) {
|
|
return { long: LONG_HEIGHT, mass: MASS_HAUL_HEIGHT };
|
|
}
|
|
const available = Math.max(availableHeightPx, MIN_LONG_HEIGHT + MASS_HAUL_MIN_HEIGHT);
|
|
if (available >= LONG_HEIGHT + MASS_HAUL_HEIGHT) {
|
|
return { long: LONG_HEIGHT, mass: available - LONG_HEIGHT };
|
|
}
|
|
const ratio = available / (LONG_HEIGHT + MASS_HAUL_HEIGHT);
|
|
const mass = Math.min(
|
|
Math.max(MASS_HAUL_MIN_HEIGHT, Math.round(MASS_HAUL_HEIGHT * ratio)),
|
|
available - MIN_LONG_HEIGHT,
|
|
);
|
|
return { long: available - mass, mass };
|
|
}
|
|
|
|
export function unwrapChart(node: HTMLElement): Element {
|
|
return node.classList.contains("b06-section__chart-wrap") && node.firstElementChild
|
|
? node.firstElementChild
|
|
: node;
|
|
}
|