From ca0cf9c0cec77b6d2015a732cc91e11f78be5025 Mon Sep 17 00:00:00 2001 From: Ivan Fontosh Date: Thu, 2 Jul 2026 19:14:01 +0800 Subject: [PATCH] fix(control): improve storyline history and graph launch Append history on revisit instead of truncating, highlight the latest duplicate entry, add Start from this scene to the graph context menu, and keep storyline state isolated from project graph edits. Co-authored-by: Cursor --- app/renderer/control/ControlApp.tsx | 18 +++---------- .../control/controlApp.effectsPanel.test.ts | 26 +++++++++++++++++++ app/renderer/editor/EditorApp.tsx | 22 +++++++++++----- app/renderer/editor/graph/SceneGraph.tsx | 18 ++++++++++++- .../graph/sceneGraph.contextMenu.test.ts | 18 +++++++++++++ app/renderer/editor/i18n/editorMessages.ts | 6 +++-- 6 files changed, 84 insertions(+), 24 deletions(-) create mode 100644 app/renderer/editor/graph/sceneGraph.contextMenu.test.ts diff --git a/app/renderer/control/ControlApp.tsx b/app/renderer/control/ControlApp.tsx index cf27ad2..c4117b6 100644 --- a/app/renderer/control/ControlApp.tsx +++ b/app/renderer/control/ControlApp.tsx @@ -51,8 +51,8 @@ export function ControlApp() { const [fxState, fx] = useEffectsState(); const [session, setSession] = useState(null); const historyRef = useRef([]); - const suppressNextHistoryPushRef = useRef(false); const [history, setHistory] = useState([]); + // Сюжетная линия — только UI-состояние пульта. Не меняет граф, сцены и связи проекта. const sceneAudioElsRef = useRef>(new Map()); const sceneAudioMetaRef = useRef>(new Map()); const [sceneAudioStateTick, setSceneAudioStateTick] = useState(0); @@ -104,16 +104,6 @@ export function ControlApp() { const cur = state.project?.currentGraphNodeId ?? null; if (!cur) return; const arr = historyRef.current; - if (suppressNextHistoryPushRef.current) { - suppressNextHistoryPushRef.current = false; - setHistory(arr); - return; - } - // Если мы перемотались на уже существующий шаг, не дублируем его в истории. - if (arr.includes(cur)) { - setHistory(arr); - return; - } if (arr[arr.length - 1] !== cur) { historyRef.current = [...arr, cur]; setHistory(historyRef.current); @@ -150,6 +140,8 @@ export function ControlApp() { const project = session?.project ?? null; const currentGraphNodeId = project?.currentGraphNodeId ?? null; + const currentHistoryIdx = + currentGraphNodeId != null ? history.lastIndexOf(currentGraphNodeId) : -1; const currentScene = project && session?.currentSceneId ? project.scenes[session.currentSceneId] : undefined; const isVideoPreviewScene = currentScene?.previewAssetType === 'video'; @@ -1174,7 +1166,7 @@ export function ControlApp() { {history.map((gnId, idx) => { const gn = project?.sceneGraphNodes.find((n) => n.id === gnId); const s = gn ? project?.scenes[gn.sceneId] : undefined; - const isCurrent = gnId === project?.currentGraphNodeId; + const isCurrent = idx === currentHistoryIdx; return ( +