docs: update node internals on resize
This commit is contained in:
@@ -54,7 +54,8 @@ const initialEdges = [
|
|||||||
style: { strokeWidth: 4, stroke: '#0ea5e9' },
|
style: { strokeWidth: 4, stroke: '#0ea5e9' },
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
const { dimensions, onNodeClick, getNodes, fitView, getNode, getEdge, updateEdge, edges, setEdges } = useVueFlow({
|
const { dimensions, onNodeClick, getNodes, fitView, getNode, getEdge, updateEdge, edges, setEdges, updateNodeInternals } =
|
||||||
|
useVueFlow({
|
||||||
nodes: [
|
nodes: [
|
||||||
{ id: 'intro', type: 'box', position: { x: 0, y: 0 } },
|
{ id: 'intro', type: 'box', position: { x: 0, y: 0 } },
|
||||||
{ id: 'examples', type: 'box', position: { x: -50, y: 400 } },
|
{ id: 'examples', type: 'box', position: { x: -50, y: 400 } },
|
||||||
@@ -121,6 +122,7 @@ const el = templateRef<HTMLDivElement>('el', null)
|
|||||||
const setNodes = () => {
|
const setNodes = () => {
|
||||||
if (breakpoints.isSmaller('md')) {
|
if (breakpoints.isSmaller('md')) {
|
||||||
const mainNode = getNode.value('intro')!
|
const mainNode = getNode.value('intro')!
|
||||||
|
|
||||||
getNodes.value.forEach((node) => {
|
getNodes.value.forEach((node) => {
|
||||||
switch (node.id) {
|
switch (node.id) {
|
||||||
case 'intro':
|
case 'intro':
|
||||||
@@ -201,6 +203,8 @@ const setNodes = () => {
|
|||||||
setEdges(initialEdges)
|
setEdges(initialEdges)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateNodeInternals(getNodes.value.map((n) => n.id))
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
fitView()
|
fitView()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -10,6 +10,9 @@
|
|||||||
backdrop-filter: blur(1px);
|
backdrop-filter: blur(1px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.VPPage {
|
||||||
|
@apply px-8 py-6 md:px-12 lg:px-24;
|
||||||
|
}
|
||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
@apply scrollbar scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-green-500 scrollbar-track-black;
|
@apply scrollbar scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-green-500 scrollbar-track-black;
|
||||||
|
|||||||
Reference in New Issue
Block a user