From 2521b87a2ec3402951909f9d41488f691e237db4 Mon Sep 17 00:00:00 2001 From: Braulio Rivas Abad Date: Tue, 20 Aug 2024 16:13:05 -0500 Subject: [PATCH] add more space for one way view --- js/views/templates/onewayview.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/js/views/templates/onewayview.js b/js/views/templates/onewayview.js index 3f749a6..5c0b486 100644 --- a/js/views/templates/onewayview.js +++ b/js/views/templates/onewayview.js @@ -1,3 +1,6 @@ +const topMargin = 50; +const horizontalGapPercentage = 0.5; + export function oneWayView(viewObjects, fromCollectionName, relationName) { const relations = viewObjects.datatypes[fromCollectionName].oneToOne[relationName]; @@ -11,8 +14,8 @@ export function oneWayView(viewObjects, fromCollectionName, relationName) { const fromWidth = fromCollection[0].width; const toWidth = toCollection[0].width; - const fromHorizontalGap = 0.3 * fromWidth; - const toHorizontalGap = 0.3 * toWidth; + const fromHorizontalGap = horizontalGapPercentage * fromWidth; + const toHorizontalGap = horizontalGapPercentage * toWidth; const gap = 2 * (fromWidth + toWidth); const totalWidth = gap + fromWidth + toWidth; @@ -38,10 +41,10 @@ export function oneWayView(viewObjects, fromCollectionName, relationName) { toCollection[i].x = toX; const space = height + verticalGap; - fromCollection[i].y = accHeight + space / 2 - fromHeight / 2; - toCollection[i].y = accHeight + space / 2 - toHeight / 2; + fromCollection[i].y = topMargin + accHeight + space / 2 - fromHeight / 2; + toCollection[i].y = topMargin + accHeight + space / 2 - toHeight / 2; accHeight += height + verticalGap; } - return [width, totalHeight]; + return [width, totalHeight + topMargin]; }