Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
move ref initialization to the component
  • Loading branch information
christian-byrne committed Aug 17, 2025
commit 67701b29faa6f8e3ab7d6ad0a54af2642f837e05
11 changes: 0 additions & 11 deletions src/components/graph/GraphCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

<MiniMap
v-if="comfyAppReady && minimapEnabled"
ref="minimapRef"
class="pointer-events-auto"
/>
</template>
Expand Down Expand Up @@ -71,7 +70,6 @@ import { useContextMenuTranslation } from '@/composables/useContextMenuTranslati
import { useCopy } from '@/composables/useCopy'
import { useGlobalLitegraph } from '@/composables/useGlobalLitegraph'
import { useLitegraphSettings } from '@/composables/useLitegraphSettings'
import { useMinimap } from '@/composables/useMinimap'
import { usePaste } from '@/composables/usePaste'
import { useWorkflowAutoSave } from '@/composables/useWorkflowAutoSave'
import { useWorkflowPersistence } from '@/composables/useWorkflowPersistence'
Expand Down Expand Up @@ -119,9 +117,7 @@ const selectionToolboxEnabled = computed(() =>
settingStore.get('Comfy.Canvas.SelectionToolbox')
)

const minimapRef = ref<InstanceType<typeof MiniMap>>()
const minimapEnabled = computed(() => settingStore.get('Comfy.Minimap.Visible'))
const minimap = useMinimap()

watchEffect(() => {
nodeDefStore.showDeprecated = settingStore.get('Comfy.Node.ShowDeprecated')
Expand Down Expand Up @@ -358,13 +354,6 @@ onMounted(async () => {
}
)

whenever(
() => minimapRef.value,
(ref) => {
minimap.setMinimapRef(ref)
}
)

whenever(
() => useCanvasStore().canvas,
(canvas) => {
Expand Down
15 changes: 8 additions & 7 deletions src/components/graph/MiniMap.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div
v-if="visible && initialized"
ref="minimapRef"
class="minimap-main-container flex absolute bottom-[20px] right-[90px] z-[1000]"
>
<MiniMapPanel
Expand Down Expand Up @@ -61,9 +62,10 @@ import { useCanvasStore } from '@/stores/graphStore'

import MiniMapPanel from './MiniMapPanel.vue'

const minimap = useMinimap()
const canvasStore = useCanvasStore()

const minimapRef = ref<HTMLDivElement>()

const {
initialized,
visible,
Expand All @@ -85,8 +87,9 @@ const {
handlePointerDown,
handlePointerMove,
handlePointerUp,
handleWheel
} = minimap
handleWheel,
setMinimapRef
} = useMinimap()

const showOptionsPanel = ref(false)

Expand All @@ -104,10 +107,8 @@ watch(
{ immediate: true }
)

onMounted(async () => {
if (canvasStore.canvas) {
await init()
}
onMounted(() => {
setMinimapRef(minimapRef.value)
})

onUnmounted(() => {
Expand Down