Skip to content

Commit 9a1a44a

Browse files
committed
fix: refine pointer visibility logic based on cursor style and tag names
1 parent 9977e33 commit 9a1a44a

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/lib/components/Pointer.svelte

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,15 @@
3838
follower.target = { x: pageX, y: pageY };
3939
isVisible = true;
4040
41-
if (target instanceof Element) {
42-
const tagName = target.tagName.toLowerCase();
43-
isVisible = tagName !== 'p';
44-
isHovering = ['a', 'button'].includes(tagName);
41+
if (target && target instanceof Element) {
42+
const cursor = getComputedStyle(target).cursor;
43+
isHovering = cursor === 'pointer';
44+
if (!isHovering) {
45+
const tagName = target.tagName.toLowerCase();
46+
isVisible = !['li', 'p'].includes(tagName) || !(target.textContent?.trim() ?? '');
47+
}
4548
}
49+
4650
} else {
4751
isVisible = false;
4852
}

0 commit comments

Comments
 (0)