From 414e076300821a24f680d577aedc652f98b9f2c4 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Fri, 17 May 2024 17:55:52 +0100 Subject: [PATCH] Fix UWP positioning of popovers --- www/js/lib/uiUtil.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/www/js/lib/uiUtil.js b/www/js/lib/uiUtil.js index 4001ca8d..af2b3122 100644 --- a/www/js/lib/uiUtil.js +++ b/www/js/lib/uiUtil.js @@ -1636,13 +1636,16 @@ function attachKiwixPopoverDiv (ev, link, articleBaseUrl, dark) { var linkRect = link.getBoundingClientRect(); // Initially position the div 20px above the link var triangleDirection = 'top'; - var divRectY = (linkRect.top - div.offsetHeight - 20); + var divOffsetHeight = /UWP/.test(params.appType) ? div.offsetHeight * params.relativeFontSize / 100 + 20 : div.offsetHeight - 20; + var divRectY = linkRect.top - divOffsetHeight; + if (/UWP/.test(params.appType)) divRectY = (divRectY * 100 / params.relativeFontSize); var triangleY = divHeight + 6; // If we're less than half margin from the top, move the div below the link if (divRectY < margin / 2) { triangleDirection = 'bottom'; divRectY = linkRect.bottom + 20; triangleY = -16; + if (/UWP/.test(params.appType)) divRectY = divRectY * 100 / params.relativeFontSize; } // Position it horizontally in relation to the pointer position var divRectX, triangleX;