diff options
| author | Fuwn <[email protected]> | 2024-01-15 19:26:46 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-01-15 19:26:46 -0800 |
| commit | e25aa01a2e9c930f4623ae6cfa0331478f9f4165 (patch) | |
| tree | b32955ade49dcb615143b47d1f0c9320c53a285f /src/lib | |
| parent | feat(settings): more useful tooltips (diff) | |
| download | due.moe-e25aa01a2e9c930f4623ae6cfa0331478f9f4165.tar.xz due.moe-e25aa01a2e9c930f4623ae6cfa0331478f9f4165.zip | |
fix(tooltip): off screen alignment
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/Tooltip/tooltip.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/Tooltip/tooltip.ts b/src/lib/Tooltip/tooltip.ts index 9fa4aa87..50ebcc17 100644 --- a/src/lib/Tooltip/tooltip.ts +++ b/src/lib/Tooltip/tooltip.ts @@ -30,7 +30,8 @@ const tooltip = (element: HTMLElement) => { const mouseMove = (event: MouseEvent) => { if (div) { div.style.left = `${ - above && event.pageX - div.offsetWidth / 2 > 0 + event.pageX - div.offsetWidth / 2 > 0 || + event.pageX + div.offsetWidth / 2 > window.innerWidth ? event.pageX - div.offsetWidth / 2 : event.pageX + offset }px`; |