-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add lodash dependency and implement mock pointer functionality with c…
…ursor customization
- Loading branch information
1 parent
d164634
commit 44ca141
Showing
5 changed files
with
64 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
import "./script.js" | ||
import "./script.js" | ||
function m_pointer() { | ||
document.body.classList.add("mock-pointer") | ||
if (document.querySelector("div#m_pointer_0000HELLYEAH")) return document.querySelector("div#m_pointer_0000HELLYEAH") | ||
const p = document.createElement("div") | ||
p.id = "m_pointer_0000HELLYEAH" | ||
p.style.cssText = ` | ||
position: fixed; | ||
transform: translate(-50%, -50%); | ||
z-index: 999999999; | ||
width: 30px; | ||
height: 30px; | ||
border-radius: 50%; | ||
pointer-events: none; | ||
background: rgb(255, 255, 255, .5); | ||
box-shadow: inset 0px 0px 0px 2px rgb(255, 255, 255, .5; | ||
` | ||
document.body.append(p) | ||
return p | ||
} | ||
document.body.addEventListener("pointerenter", (e) => { | ||
const p = m_pointer() | ||
p.style.left = e.pageX + "px" | ||
p.style.top = e.pageY + "px" | ||
}) | ||
window.addEventListener("pointermove", (e) => { | ||
const p = m_pointer() | ||
p.style.left = e.pageX + "px" | ||
p.style.top = e.pageY + "px" | ||
}) | ||
document.body.addEventListener("pointerleave", (e) => { | ||
const p = m_pointer() | ||
p.remove() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters