We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a4d9304 commit b550e9bCopy full SHA for b550e9b
src/lib/actions/mouse-position.svelte.ts
@@ -15,20 +15,12 @@ export const useMousePosition = () => {
15
const action = (node: HTMLElement | SVGSVGElement) => {
16
const handleMouseMove = (event: MouseEvent) => {
17
const { clientX, clientY } = event;
18
- const tooltipWidth = 190;
19
- const rect = node.getBoundingClientRect();
20
- let tooltipX = event.clientX - rect.left + 12;
21
-
22
- if (tooltipX + tooltipWidth > window.innerWidth) {
23
- tooltipX = clientX - tooltipWidth - 10;
24
- }
25
26
position = {
27
- x: tooltipX,
28
- y: event.clientY - rect.top + 12
+ x: clientX - 12, // Remove rect.left
+ y: clientY + -350 // Remove rect.top
29
};
30
31
32
hover(node, () => {
33
document.addEventListener('mousemove', handleMouseMove);
34
});
0 commit comments