fixed cursor + search

This commit is contained in:
2026-05-16 17:31:39 +02:00
parent 458ef7612d
commit a731a5f50f
3 changed files with 177 additions and 31 deletions
+13 -4
View File
@@ -19,7 +19,15 @@
<i class="cs-fx-corner cs-fx-corner--tr"></i>
<i class="cs-fx-corner cs-fx-corner--bl"></i>
<i class="cs-fx-corner cs-fx-corner--br"></i>
<div class="cs-cursor"><span class="cs-cursor-ring"></span></div>
</div>
<!-- Cursor lives in its own top-level, un-contained, max-z root so it floats
above every modal/library (Search + AssetManager are z-[200]). -->
<div class="cs-cursor-root" aria-hidden="true">
<div class="cs-cursor">
<span class="cs-cursor-ring"></span>
<span class="cs-cursor-core"></span>
</div>
</div>
<script>
@@ -28,14 +36,15 @@
if (!root.classList.contains('cybersigil')) return;
const fx = document.querySelector('.cs-fx') as HTMLElement | null;
if (!fx) return;
const cursorRoot = document.querySelector('.cs-cursor-root') as HTMLElement | null;
if (!fx || !cursorRoot) return;
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const finePointer = window.matchMedia('(pointer: fine)').matches;
const noHover = window.matchMedia('(hover: none)').matches;
/* ─── Custom sigil cursor + fading trail ─── */
const cursor = fx.querySelector('.cs-cursor') as HTMLElement | null;
const cursor = cursorRoot.querySelector('.cs-cursor') as HTMLElement | null;
if (cursor && finePointer && !noHover) {
root.classList.add('cs-cursor-on');
let cx = window.innerWidth / 2;
@@ -65,7 +74,7 @@
dot.className = 'cs-trail';
dot.style.left = cx + 'px';
dot.style.top = cy + 'px';
fx!.appendChild(dot);
cursorRoot!.appendChild(dot);
dot.addEventListener('animationend', () => dot.remove(), { once: true });
}
},