그래프방식 조건선택 기능 추가

This commit is contained in:
Macbook
2026-06-16 10:18:30 +09:00
parent 2670c31d37
commit c7b92dbec5
4 changed files with 105 additions and 5 deletions
@@ -737,6 +737,26 @@ function StrategyEditorCanvasInner({
}
}, [root, extraRoots, orphans, onChange, onOrphansChange, onExtraRootsChange]);
const handleReplaceLogicNode = useCallback((id: string, replaced: LogicNode) => {
if (isOrphanNode(orphans, id)) {
onOrphansChange(orphans.map(o => (o.id === id ? replaced : o)));
return;
}
if (root && findNodeInTree(root, id)) {
onChange(updateNode(root, id, () => replaced));
return;
}
for (const [sid, branch] of Object.entries(extraRoots)) {
if (branch && findNodeInTree(branch, id)) {
onExtraRootsChange?.({
...extraRoots,
[sid]: updateNode(branch, id, () => replaced),
});
return;
}
}
}, [root, extraRoots, orphans, onChange, onOrphansChange, onExtraRootsChange]);
const handleChangeLogicGateType = useCallback((id: string, gateType: 'AND' | 'OR') => {
const patchGate = (n: LogicNode) => (
n.type === 'AND' || n.type === 'OR'
@@ -868,6 +888,7 @@ function StrategyEditorCanvasInner({
const flowCallbacks = useMemo(() => ({
onDelete: handleDelete,
onUpdateCondition: handleUpdateCondition,
onReplaceLogicNode: handleReplaceLogicNode,
onUpdateStochPairSecondary: handleUpdateStochPairSecondary,
onUpdatePriceExtremeFilterLevel: handleUpdatePriceExtremeFilterLevel,
onUpdateInflection33FilterLevel: handleUpdateInflection33FilterLevel,
@@ -879,7 +900,7 @@ function StrategyEditorCanvasInner({
onStartCandleTypesChange: handleStartCandleTypesChange,
onDeleteStart: handleDeleteStart,
}), [
handleDelete, handleUpdateCondition, handleUpdateStochPairSecondary, handleUpdatePriceExtremeFilterLevel, handleUpdateInflection33FilterLevel, handleUpdateStableStrategyFilterLevel, handleChangeLogicGateType,
handleDelete, handleUpdateCondition, handleReplaceLogicNode, handleUpdateStochPairSecondary, handleUpdatePriceExtremeFilterLevel, handleUpdateInflection33FilterLevel, handleUpdateStableStrategyFilterLevel, handleChangeLogicGateType,
handleDropTarget, handleDragOverTarget, handleDragLeaveTarget,
handleStartCandleTypesChange, handleDeleteStart,
]);