From 07ee6eddf701b8a998f5f293383f6d0a5e510b69 Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sun, 10 Apr 2022 17:05:17 +0200 Subject: [PATCH] docs: update node positions --- docs/components/home/Home.vue | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/components/home/Home.vue b/docs/components/home/Home.vue index 21c4ce47..732f302f 100644 --- a/docs/components/home/Home.vue +++ b/docs/components/home/Home.vue @@ -71,16 +71,20 @@ onPaneReady(({ fitView }) => { const setNodes = () => { if (breakpoints.isSmaller('md')) { + const mainNode = getNode.value('intro')! getNodes.value.forEach((node) => { switch (node.id) { case 'intro': - node.position = { x: 0, y: -50 } + node.position = { x: 0, y: 0 } break case 'examples': - node.position = { x: getNode.value('intro')!.dimensions.width / 2 - node.dimensions.width / 2, y: 300 } + node.position = { x: mainNode.dimensions.width / 2 - node.dimensions.width / 2, y: mainNode.dimensions.height * 1.5 } break case 'documentation': - node.position = { x: getNode.value('intro')!.dimensions.width / 2 - node.dimensions.width / 2, y: 500 } + node.position = { + x: mainNode.dimensions.width / 2 - node.dimensions.width / 2, + y: mainNode.dimensions.height * 2 + 50, + } break } }) @@ -88,21 +92,23 @@ onPaneReady(({ fitView }) => { const newEdge = updateEdge(getEdge.value(edgeId.value)!, { source: 'examples', target: 'documentation', - sourceHandle: null, - targetHandle: null, }) if (newEdge) edgeId.value = newEdge.id } else { getNodes.value.forEach((node) => { + const mainNode = getNode.value('intro')! switch (node.id) { case 'intro': node.position = { x: 0, y: 0 } break case 'examples': - node.position = { x: -node.dimensions.width / 2, y: 400 } + node.position = { x: -node.dimensions.width / 2, y: mainNode.dimensions.height * 1.5 } break case 'documentation': - node.position = { x: getNode.value('intro')!.dimensions.width / 2 + node.dimensions.width / 2, y: 400 } + node.position = { + x: mainNode.dimensions.width - node.dimensions.width / 2, + y: mainNode.dimensions.height * 1.5, + } break } }) @@ -110,8 +116,6 @@ onPaneReady(({ fitView }) => { const newEdge = updateEdge(getEdge.value(edgeId.value)!, { source: 'intro', target: 'documentation', - sourceHandle: null, - targetHandle: null, }) if (newEdge) edgeId.value = newEdge.id }