Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
break;
case PopoverOrientering.UnderVenstre:
left = ankerOffset.left;
top = ankerOffset.top + ankerOffset.height + avstandTilAnker;
break;
case PopoverOrientering.Under:
left = ankerOffset.left + (ankerOffset.width / 2) - (popoverOffset.width / 2);
top = ankerOffset.top + ankerOffset.height + avstandTilAnker;
break;
default: // PopoverOrientering.Over
left = ankerOffset.left + (ankerOffset.width / 2) - (popoverOffset.width / 2);
top = ankerOffset.top - avstandTilAnker - popoverOffset.height;
break;
}
const viewPortDimensions = getViewportDimensions();
left = Math.max(0, left);
left = Math.min(Math.abs(left), Math.abs(viewPortDimensions.w - popoverOffset.width));
const pilLeft = ankerOffset.left + (ankerOffset.width / 2) - left - 1;
return { left, top, pilLeft };
}