목록형 전략평가 수정

This commit is contained in:
Macbook
2026-06-18 02:05:09 +09:00
parent b96fc64c91
commit bde65b6ef8
3 changed files with 51 additions and 22 deletions
@@ -41,6 +41,7 @@ import {
setHtmlPaletteDropRouter,
setPaletteDragDropHandler,
subscribePaletteDrag,
wasPaletteHtmlDropCommitted,
type PaletteDragPayload,
} from '../../utils/paletteDragSession';
@@ -108,12 +109,18 @@ const TreeNodeComp: React.FC<TreeNodeProps> = ({
e.stopPropagation();
setDragOverKey?.(nodeDropKey);
};
const handleDragLeave = () => setDragOverKey?.(null);
const handleDragLeave = (e: React.DragEvent) => {
const rel = e.relatedTarget as Node | null;
if (!rel) return;
if (e.currentTarget.contains(rel)) return;
setDragOverKey?.(null);
};
const handleDrop = (e: React.DragEvent) => {
if (!isLogic) return;
e.preventDefault();
e.stopPropagation();
setDragOverKey?.(null);
if (wasPaletteHtmlDropCommitted()) return;
try {
const data = JSON.parse(e.dataTransfer.getData('application/json'));
if (data.type === 'start') {
@@ -338,6 +345,7 @@ function StartSectionBlock({
e.preventDefault();
e.stopPropagation();
setDragOverKey(null);
if (wasPaletteHtmlDropCommitted()) return;
const data = readPaletteHtmlDragData(e);
if (!data) return;
applyDrop(null, data);
@@ -375,7 +383,12 @@ function StartSectionBlock({
e.stopPropagation();
setDragOverKey(sectionDropKey);
}}
onDragLeave={() => setDragOverKey(null)}
onDragLeave={e => {
const rel = e.relatedTarget as Node | null;
if (!rel) return;
if (e.currentTarget.contains(rel)) return;
setDragOverKey(null);
}}
onDrop={handleSectionDrop}
>
{!root ? (
@@ -561,13 +574,14 @@ export default function StrategyListEditor({
const handleListDragOver = (e: React.DragEvent) => {
e.preventDefault();
e.dataTransfer.dropEffect = 'copy';
setDragOverKey(LIST_DROP_KEY);
setDragOverKeyThrottled(LIST_DROP_KEY);
};
const handleListDrop = (e: React.DragEvent) => {
e.preventDefault();
e.stopPropagation();
setDragOverKey(null);
if (wasPaletteHtmlDropCommitted()) return;
const data = readPaletteHtmlDragData(e);
if (!data) return;
applyDropRef.current(findPaletteDropKeyAtPoint(e.clientX, e.clientY) ?? LIST_DROP_KEY, data);
@@ -578,7 +592,12 @@ export default function StrategyListEditor({
className={`se-list-editor sp-dropzone${dragOverKey === LIST_DROP_KEY ? ' se-list-editor--over' : ''}`}
data-palette-drop-key={LIST_DROP_KEY}
onDragOver={handleListDragOver}
onDragLeave={() => setDragOverKey(null)}
onDragLeave={e => {
const rel = e.relatedTarget as Node | null;
if (!rel) return;
if (e.currentTarget.contains(rel)) return;
setDragOverKey(null);
}}
onDrop={handleListDrop}
>
{sections.map(section => (
@@ -591,7 +610,7 @@ export default function StrategyListEditor({
signalTab={signalTab}
def={def}
dragOverKey={dragOverKey}
setDragOverKey={setDragOverKey}
setDragOverKey={setDragOverKeyThrottled}
onRootChange={root => handleRootChange(section.startId, root)}
onCandleTypesChange={types => handleCandleTypesChange(section.startId, types)}
onDeleteStart={section.canDelete ? () => handleDeleteStart(section.startId) : undefined}