simple cursor controller

This commit is contained in:
2026-06-14 07:58:17 -04:00
parent 8859449be5
commit ff5d9724d6
2 changed files with 15 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
.cursor_grabbing {
cursor: grabbing;
}
+12
View File
@@ -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;
}