docs: update node internals on resize
This commit is contained in:
@@ -54,22 +54,23 @@ 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 } =
|
||||||
nodes: [
|
useVueFlow({
|
||||||
{ id: 'intro', type: 'box', position: { x: 0, y: 0 } },
|
nodes: [
|
||||||
{ id: 'examples', type: 'box', position: { x: -50, y: 400 } },
|
{ id: 'intro', type: 'box', position: { x: 0, y: 0 } },
|
||||||
{ id: 'documentation', type: 'box', position: { x: 300, y: 400 } },
|
{ id: 'examples', type: 'box', position: { x: -50, y: 400 } },
|
||||||
{ id: 'acknowledgement', type: 'box', position: { x: 150, y: 500 } },
|
{ id: 'documentation', type: 'box', position: { x: 300, y: 400 } },
|
||||||
],
|
{ id: 'acknowledgement', type: 'box', position: { x: 150, y: 500 } },
|
||||||
edges: initialEdges,
|
],
|
||||||
elementsSelectable: true,
|
edges: initialEdges,
|
||||||
panOnDrag: false,
|
elementsSelectable: true,
|
||||||
zoomOnScroll: false,
|
panOnDrag: false,
|
||||||
zoomOnDoubleClick: false,
|
zoomOnScroll: false,
|
||||||
zoomOnPinch: false,
|
zoomOnDoubleClick: false,
|
||||||
preventScrolling: false,
|
zoomOnPinch: false,
|
||||||
elevateEdgesOnSelect: true,
|
preventScrolling: false,
|
||||||
})
|
elevateEdgesOnSelect: true,
|
||||||
|
})
|
||||||
|
|
||||||
const clickInterval = ref()
|
const clickInterval = ref()
|
||||||
const clicks = ref(0)
|
const clicks = ref(0)
|
||||||
@@ -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