mirror of
https://github.com/hyprwm/hyprland-website.git
synced 2024-11-17 02:45:59 +01:00
improve pattern mouse follow
This commit is contained in:
parent
cfbacc3356
commit
bddb1f1887
2 changed files with 10 additions and 3 deletions
|
@ -14,5 +14,6 @@ module.exports = {
|
||||||
rules: {
|
rules: {
|
||||||
'no-unused-vars': ['off', { varsIgnorePattern: '.*' }],
|
'no-unused-vars': ['off', { varsIgnorePattern: '.*' }],
|
||||||
'svelte/no-at-html-tags': 'off'
|
'svelte/no-at-html-tags': 'off'
|
||||||
}
|
},
|
||||||
|
globals: { globalThis: true }
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,12 @@
|
||||||
hasJustMounted = false
|
hasJustMounted = false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$: {
|
||||||
|
if (!$isMouseOver$) {
|
||||||
|
globalThis.document?.removeEventListener('mousemove', track)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function resizeGradient() {
|
function resizeGradient() {
|
||||||
if (hasJustMounted || !isMouseOver$) return
|
if (hasJustMounted || !isMouseOver$) return
|
||||||
|
|
||||||
|
@ -69,7 +75,7 @@
|
||||||
function startTrackingMouse() {
|
function startTrackingMouse() {
|
||||||
if ($isMouseOver$) return
|
if ($isMouseOver$) return
|
||||||
|
|
||||||
document.addEventListener('mousemove', track)
|
globalThis.document?.addEventListener('mousemove', track)
|
||||||
}
|
}
|
||||||
|
|
||||||
function track({ clientX, clientY }) {
|
function track({ clientX, clientY }) {
|
||||||
|
@ -77,7 +83,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
document.removeEventListener('mousemove', track)
|
globalThis.document?.removeEventListener('mousemove', track)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue