chore: editor App and SceneGraph updates

This commit is contained in:
2026-06-14 21:19:29 +08:00
parent 94e0ea9c24
commit f741f73e11
2 changed files with 5 additions and 1 deletions

View File

@@ -122,6 +122,7 @@ onMounted(() => loadDemo())
@select-node="store.selectedNodeId = $event" @select-node="store.selectedNodeId = $event"
@add-edge="editor.onAddEdge" @add-edge="editor.onAddEdge"
@test-scene="testScene" @test-scene="testScene"
@clear-selection="store.selectedNodeId = null"
/> />
<div v-else-if="loading" class="loading-hint">加载剧情数据</div> <div v-else-if="loading" class="loading-hint">加载剧情数据</div>
<PreviewPanel v-if="showPreview" :video-url="previewVideoUrl" /> <PreviewPanel v-if="showPreview" :video-url="previewVideoUrl" />

View File

@@ -20,11 +20,12 @@ const emit = defineEmits<{
selectNode: [id: string] selectNode: [id: string]
addEdge: [source: string, target: string] addEdge: [source: string, target: string]
testScene: [id: string] testScene: [id: string]
clearSelection: []
}>() }>()
const nodes = ref<any[]>([]) const nodes = ref<any[]>([])
const edges = ref<any[]>([]) const edges = ref<any[]>([])
const { onNodeClick, onConnect, onNodeContextMenu, onNodeDragStop, fitView } = useVueFlow() const { onNodeClick, onConnect, onNodeContextMenu, onNodeDragStop, onPaneClick, fitView } = useVueFlow()
const ctxMenuVisible = ref(false) const ctxMenuVisible = ref(false)
const ctxMenuX = ref(0) const ctxMenuX = ref(0)
const ctxMenuY = ref(0) const ctxMenuY = ref(0)
@@ -135,6 +136,8 @@ onNodeDragStop((ev) => {
savePosition(ev.node.id, Math.round(pos.x), Math.round(pos.y)) savePosition(ev.node.id, Math.round(pos.x), Math.round(pos.y))
}) })
onPaneClick(() => emit('clearSelection'))
onConnect((conn: Connection) => { onConnect((conn: Connection) => {
if (conn.source && conn.target) emit('addEdge', conn.source, conn.target) if (conn.source && conn.target) emit('addEdge', conn.source, conn.target)
}) })