import Button from 'primevue/button'
-import { onMounted, onUnmounted, ref, watch } from 'vue'
+import { onMounted, onUnmounted, ref } from 'vue'
import { useMinimap } from '@/composables/useMinimap'
-import { useCanvasStore } from '@/stores/graphStore'
import MiniMapPanel from './MiniMapPanel.vue'
-const minimap = useMinimap()
-const canvasStore = useCanvasStore()
+const minimapRef = ref()
const {
initialized,
@@ -80,13 +79,13 @@ const {
renderBypass,
renderError,
updateOption,
- init,
destroy,
handlePointerDown,
handlePointerMove,
handlePointerUp,
- handleWheel
-} = minimap
+ handleWheel,
+ setMinimapRef
+} = useMinimap()
const showOptionsPanel = ref(false)
@@ -94,20 +93,8 @@ const toggleOptionsPanel = () => {
showOptionsPanel.value = !showOptionsPanel.value
}
-watch(
- () => canvasStore.canvas,
- async (canvas) => {
- if (canvas && !initialized.value) {
- await init()
- }
- },
- { immediate: true }
-)
-
-onMounted(async () => {
- if (canvasStore.canvas) {
- await init()
- }
+onMounted(() => {
+ setMinimapRef(minimapRef.value)
})
onUnmounted(() => {