보조지표 소수점 추가, cci 수정

This commit is contained in:
Macbook
2026-05-30 00:13:22 +09:00
parent 6332d198b1
commit ad92dace28
11 changed files with 286 additions and 20 deletions
+47 -1
View File
@@ -20,6 +20,10 @@ export interface ChartRightToolbarProps {
onRestore?: () => void;
focusedId?: string | null;
onDragStart?: (id: string, e: React.PointerEvent) => void;
/** 지표명 툴바 — 표시/숨기기 */
onToggleHidden?: (id: string) => void;
/** 지표명 툴바 — 설정 모달 */
onSettings?: (id: string) => void;
}
const BTN_SIZE = 32;
@@ -89,6 +93,25 @@ const IconMore = () => (
</svg>
);
const IconEye = ({ hidden }: { hidden?: boolean }) => hidden ? (
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" strokeWidth="1.5">
<path d="M1 7 Q4 2.5 7 2.5 Q10 2.5 13 7 Q10 11.5 7 11.5 Q4 11.5 1 7 Z" strokeOpacity="0.35"/>
<line x1="2" y1="2" x2="12" y2="12"/>
</svg>
) : (
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" strokeWidth="1.5">
<path d="M1 7 Q4 2.5 7 2.5 Q10 2.5 13 7 Q10 11.5 7 11.5 Q4 11.5 1 7 Z"/>
<circle cx="7" cy="7" r="2"/>
</svg>
);
const IconGear = () => (
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" strokeWidth="1.4">
<circle cx="7" cy="7" r="2.3"/>
<path d="M7 1 L7.7 2.8 L9.8 2 L9.8 4.2 L11.8 5 L11 7 L11.8 9 L9.8 9.8 L9.8 12 L7.7 11.2 L7 13 L6.3 11.2 L4.2 12 L4.2 9.8 L2.2 9 L3 7 L2.2 5 L4.2 4.2 L4.2 2 L6.3 2.8 Z"/>
</svg>
);
interface MenuItemDef {
key: string;
title: string;
@@ -109,6 +132,8 @@ function buildMenuItems(
onExpand?: (id: string) => void;
onRestore?: () => void;
onRemove?: (id: string) => void;
onToggleHidden?: (id: string) => void;
onSettings?: (id: string) => void;
onDone?: () => void;
},
): MenuItemDef[] {
@@ -119,9 +144,28 @@ function buildMenuItems(
const isFocused = opts.focusedId === item.id;
const showExpand = !!(opts.onExpand || (isFocused && opts.onRestore));
const done = opts.onDone ?? (() => {});
const cfg = indicators.find(ind => ind.id === item.id);
const isHidden = cfg?.hidden === true;
const items: MenuItemDef[] = [];
if (opts.onToggleHidden) {
items.push({
key: 'visibility',
title: isHidden ? '표시' : '숨기기',
icon: <IconEye hidden={isHidden} />,
active: isHidden,
onClick: () => { opts.onToggleHidden?.(item.id); done(); },
});
}
if (opts.onSettings) {
items.push({
key: 'settings',
title: '지표 설정',
icon: <IconGear />,
onClick: () => { opts.onSettings?.(item.id); done(); },
});
}
if (showSplit) {
items.push({
key: 'split',
@@ -168,7 +212,7 @@ const ChartRightToolbar: React.FC<ChartRightToolbarProps> = ({
manager, indicators, chartHeight, paused = false,
onSplit, onRemove, onDuplicate,
onExpand, onRestore, focusedId,
onDragStart,
onDragStart, onToggleHidden, onSettings,
}) => {
const [paneLayouts, setPaneLayouts] = useState<Array<{ paneIndex: number; topY: number; height: number }>>([]);
const [paneItems, setPaneItems] = useState<ReturnType<typeof buildPaneItems>>([]);
@@ -263,6 +307,7 @@ const ChartRightToolbar: React.FC<ChartRightToolbarProps> = ({
const clusterTop = paneBottom - 4 - clusterHeight - stackIdx * (clusterHeight + 4);
const menuItems = buildMenuItems(item, indicators, paneItems, {
focusedId, onSplit, onDuplicate, onExpand, onRestore, onRemove,
onToggleHidden, onSettings,
});
if (menuItems.length === 0 && !allowDrag) return null;
@@ -306,6 +351,7 @@ const ChartRightToolbar: React.FC<ChartRightToolbarProps> = ({
{openItem && openMenuId && (() => {
const menuItems = buildMenuItems(openItem, indicators, paneItems, {
focusedId, onSplit, onDuplicate, onExpand, onRestore, onRemove,
onToggleHidden, onSettings,
onDone: closeFlyout,
});
if (menuItems.length === 0) return null;