refactor: replace useStore with useVueFlow

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-12-20 19:29:52 +01:00
parent 46a76b783e
commit a604dd8ab1
17 changed files with 38 additions and 37 deletions
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { BackgroundVariant } from '../../types'
import { useStore } from '../../composables'
import { useVueFlow } from '../../composables'
interface BackgroundProps {
variant?: BackgroundVariant
@@ -20,7 +20,7 @@ const defaultColors: Record<BackgroundVariant, string> = {
[BackgroundVariant.Lines]: '#eee',
}
const store = useStore()
const { store } = useVueFlow()
const background = computed(() => {
const scaledGap = props.gap && props.gap * store.transform[2]
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { FitViewParams } from '../../types'
import { useZoomPanHelper, useStore } from '../../composables'
import { useZoomPanHelper, useVueFlow } from '../../composables'
import ControlButton from './ControlButton.vue'
import PlusIcon from '~/assets/icons/plus.svg'
import MinusIcon from '~/assets/icons/minus.svg'
@@ -29,7 +29,7 @@ const props = withDefaults(defineProps<ControlProps>(), {
})
const emit = defineEmits<ControlEvents>()
const store = useStore()
const { store } = useVueFlow()
const { zoomIn, zoomOut, fitView } = useZoomPanHelper()
const isInteractive = computed(() => store.nodesDraggable && store.nodesConnectable && store.elementsSelectable)
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { GraphNode, ShapeRendering } from '../../types'
import { useStore, useWindow } from '../../composables'
import { useVueFlow, useWindow } from '../../composables'
import { getBoundsofRects, getRectOfNodes } from '../../utils'
import MiniMapNode from './MiniMapNode.vue'
@@ -29,7 +29,7 @@ const window = useWindow()
const defaultWidth = 200
const defaultHeight = 150
const store = useStore()
const { store } = useVueFlow()
const elementWidth = attrs.style?.width ?? defaultWidth
const elementHeight = attrs.style?.height ?? defaultHeight