mirror of
https://github.com/mat-1/matdoesdev.git
synced 2025-08-02 14:46:04 +00:00
fix wrong neko position if it's clicked when page is scrolled
This commit is contained in:
parent
005f8bc636
commit
577a94cca4
1 changed files with 5 additions and 0 deletions
|
@ -79,6 +79,11 @@ export function initNeko(nekoEl: HTMLDivElement, updateSpriteCallback: (name: st
|
|||
}
|
||||
|
||||
function startFollowingMouse() {
|
||||
nekoPosX = nekoEl.offsetLeft - window.scrollX + 16
|
||||
nekoPosY = nekoEl.offsetTop - window.scrollY + 16
|
||||
mousePosX = nekoPosX
|
||||
mousePosY = nekoPosY
|
||||
|
||||
nekoEl.style.position = 'fixed'
|
||||
nekoEl.style.pointerEvents = 'none'
|
||||
nekoEl.style.left = `${nekoPosX - 16}px`
|
||||
|
|
Loading…
Add table
Reference in a new issue