simple cursor controller
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
.cursor_grabbing {
|
||||||
|
cursor: grabbing;
|
||||||
|
}
|
||||||
@@ -6,3 +6,15 @@ document.addEventListener("mousemove", (e) => {
|
|||||||
currentX = e.clientX;
|
currentX = e.clientX;
|
||||||
currentY = e.clientY;
|
currentY = e.clientY;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const CURSOR_NORMAL = "cursor_normal";
|
||||||
|
const CURSOR_GRABBING = "cursor_grabbing";
|
||||||
|
|
||||||
|
document.body.classList.remove(CURSOR_NORMAL);
|
||||||
|
|
||||||
|
let current_cursor_state = CURSOR_NORMAL;
|
||||||
|
function set_cursor_state(new_cursor_state) {
|
||||||
|
document.body.classList.remove(current_cursor_state);
|
||||||
|
document.body.classList.add(new_cursor_state);
|
||||||
|
current_cursor_state = new_cursor_state;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user