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 <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-07-02 19:14:01 +08:00
parent 657e3c862e
commit ca0cf9c0ce
6 changed files with 84 additions and 24 deletions
+17 -1
View File
@@ -67,6 +67,7 @@ export type SceneGraphUiStrings = {
closeMenu: string;
startScene: string;
unsetStartScene: string;
runFromScene: string;
delete: string;
};
@@ -86,6 +87,7 @@ const DEFAULT_SCENE_GRAPH_UI: SceneGraphUiStrings = {
closeMenu: 'Закрыть меню',
startScene: 'Начальная сцена',
unsetStartScene: 'Снять метку «Начальная сцена»',
runFromScene: 'Запустить с этой сцены',
delete: 'Удалить',
};
@@ -104,6 +106,7 @@ export type SceneGraphProps = {
onRemoveGraphNodes: (nodeIds: GraphNodeId[]) => void;
onRemoveGraphNode: (graphNodeId: GraphNodeId) => void;
onSetGraphNodeStart: (graphNodeId: GraphNodeId | null) => void;
onRunFromGraphNode?: (graphNodeId: GraphNodeId) => void;
onDropSceneFromList: (sceneId: SceneId, x: number, y: number) => void;
};
@@ -359,6 +362,7 @@ function SceneGraphCanvas({
onRemoveGraphNodes,
onRemoveGraphNode,
onSetGraphNodeStart,
onRunFromGraphNode,
onDropSceneFromList,
}: SceneGraphProps) {
const ui = graphUi ?? DEFAULT_SCENE_GRAPH_UI;
@@ -490,7 +494,7 @@ function SceneGraphCanvas({
if (!menu) return null;
const pad = 8;
const mw = 220;
const mh = 120;
const mh = 168;
const x = Math.max(pad, Math.min(menu.x, window.innerWidth - mw - pad));
const y = Math.max(pad, Math.min(menu.y, window.innerHeight - mh - pad));
return { x, y };
@@ -595,6 +599,18 @@ function SceneGraphCanvas({
>
{menuNodeIsStart ? ui.unsetStartScene : ui.startScene}
</button>
<button
type="button"
role="menuitem"
className={styles.ctxItem}
disabled={!onRunFromGraphNode}
onClick={() => {
onRunFromGraphNode?.(menu.graphNodeId);
setMenu(null);
}}
>
{ui.runFromScene}
</button>
<button
type="button"
role="menuitem"