fix: zoom pan helper

This commit is contained in:
Braks
2021-10-20 22:39:54 +02:00
parent a895853b64
commit c3fb3cd10a
38 changed files with 214 additions and 277 deletions
@@ -2,7 +2,8 @@
import { HTMLAttributes } from 'vue'
import MiniMapNode from './MiniMapNode.vue'
import { getBoundsofRects, getRectOfNodes } from '~/utils/graph'
import { Node, RevueFlowStore } from '~/types'
import { Node } from '~/types'
import { Store } from '~/context'
type StringFunc = (node: Node) => string
@@ -30,7 +31,7 @@ declare const window: any
const defaultWidth = 200
const defaultHeight = 150
const store = inject<RevueFlowStore>('store')!
const store = inject(Store)!
const elementWidth = attrs.style?.width ?? defaultWidth
const elementHeight = attrs.style?.height ?? defaultHeight
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { computed, CSSProperties } from 'vue'
import { CSSProperties } from 'vue'
interface MiniMapNodeProps {
x?: number
@@ -8,11 +8,13 @@ interface MiniMapNodeProps {
height?: number
borderRadius?: number
color?: string
shapeRendering?: string
shapeRendering?: 'auto' | 'optimizeSpeed' | 'crispEdges' | 'geometricPrecision' | 'inherit'
strokeColor?: string
strokeWidth?: number
}
const props = defineProps<MiniMapNodeProps>()
const props = withDefaults(defineProps<MiniMapNodeProps>(), {
shapeRendering: 'geometricPrecision',
})
const attrs = useAttrs()
const styles = (attrs.style ?? {}) as CSSProperties