docs: fitview mixing edges up on resize

This commit is contained in:
Braks
2022-04-11 11:30:10 +02:00
parent 4ebfb2ada5
commit 0184cdd2a9
2 changed files with 24 additions and 18 deletions
-2
View File
@@ -2,8 +2,6 @@
import { useBreakpoints, breakpointsTailwind } from '@vueuse/core'
import Blobity from 'blobity'
import Intro from './flows/Intro.vue'
import ArrowLeft from '~icons/carbon/arrow-left'
import ArrowRight from '~icons/carbon/arrow-right'
const dark = useDark({
selector: 'html',
+24 -16
View File
@@ -42,10 +42,6 @@ const edgeId = ref('eintro-documentation')
const el = templateRef<HTMLDivElement>('el', null)
onPaneReady(({ fitView }) => {
fitView({
duration: 1500,
})
const setNodes = () => {
if (breakpoints.isSmaller('md')) {
const mainNode = getNode.value('intro')!
@@ -69,14 +65,24 @@ onPaneReady(({ fitView }) => {
}
})
const newEdge = updateEdge(getEdge.value(edgeId.value)!, {
source: 'examples',
target: 'documentation',
targetHandle: null,
sourceHandle: null,
nextTick(() => {
const newEdge = updateEdge(getEdge.value(edgeId.value)!, {
source: 'examples',
target: 'documentation',
targetHandle: null,
sourceHandle: null,
})
if (newEdge) edgeId.value = newEdge.id
fitView({
duration: 1500,
})
})
if (newEdge) edgeId.value = newEdge.id
} else {
fitView({
duration: 1500,
})
getNodes.value.forEach((node) => {
const mainNode = getNode.value('intro')!
switch (node.id) {
@@ -95,13 +101,15 @@ onPaneReady(({ fitView }) => {
}
})
const newEdge = updateEdge(getEdge.value(edgeId.value)!, {
source: 'intro',
target: 'documentation',
targetHandle: null,
sourceHandle: null,
nextTick(() => {
const newEdge = updateEdge(getEdge.value(edgeId.value)!, {
source: 'intro',
target: 'documentation',
targetHandle: null,
sourceHandle: null,
})
if (newEdge) edgeId.value = newEdge.id
})
if (newEdge) edgeId.value = newEdge.id
}
setTimeout(