mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-09 20:32:45 -04:00
Fix UWP positioning of popovers
This commit is contained in:
parent
5984f28aef
commit
414e076300
@ -1636,13 +1636,16 @@ function attachKiwixPopoverDiv (ev, link, articleBaseUrl, dark) {
|
|||||||
var linkRect = link.getBoundingClientRect();
|
var linkRect = link.getBoundingClientRect();
|
||||||
// Initially position the div 20px above the link
|
// Initially position the div 20px above the link
|
||||||
var triangleDirection = 'top';
|
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;
|
var triangleY = divHeight + 6;
|
||||||
// If we're less than half margin from the top, move the div below the link
|
// If we're less than half margin from the top, move the div below the link
|
||||||
if (divRectY < margin / 2) {
|
if (divRectY < margin / 2) {
|
||||||
triangleDirection = 'bottom';
|
triangleDirection = 'bottom';
|
||||||
divRectY = linkRect.bottom + 20;
|
divRectY = linkRect.bottom + 20;
|
||||||
triangleY = -16;
|
triangleY = -16;
|
||||||
|
if (/UWP/.test(params.appType)) divRectY = divRectY * 100 / params.relativeFontSize;
|
||||||
}
|
}
|
||||||
// Position it horizontally in relation to the pointer position
|
// Position it horizontally in relation to the pointer position
|
||||||
var divRectX, triangleX;
|
var divRectX, triangleX;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user