From 5d4769df564a5ed31658849ceb6b5fbae8c6d3f8 Mon Sep 17 00:00:00 2001 From: Omar Ahmed Hassan Date: Tue, 17 Dec 2024 12:47:13 +0200 Subject: [PATCH] Remove unused draggable.js file - Remove draggable.js as the draggability feature already works without and it wasn't used anywhere except in sign.html (which throw an exception already as draggableElement was null, and yet the functionality was working as expected, thus we don't need it) --- src/main/resources/static/js/draggable.js | 36 ----------------------- src/main/resources/templates/sign.html | 3 -- 2 files changed, 39 deletions(-) delete mode 100644 src/main/resources/static/js/draggable.js diff --git a/src/main/resources/static/js/draggable.js b/src/main/resources/static/js/draggable.js deleted file mode 100644 index cba6f3c0268..00000000000 --- a/src/main/resources/static/js/draggable.js +++ /dev/null @@ -1,36 +0,0 @@ -const draggableElement = document.querySelector('.draggable-canvas'); - -// Variables to store the current position of the draggable element -let offsetX, offsetY, isDragging = false; - -draggableElement.addEventListener('mousedown', (e) => { - // Get the offset when the mouse is clicked inside the element - offsetX = e.clientX - draggableElement.getBoundingClientRect().left; - offsetY = e.clientY - draggableElement.getBoundingClientRect().top; - - // Set isDragging to true - isDragging = true; - - // Add event listeners for mouse movement and release - document.addEventListener('mousemove', onMouseMove); - document.addEventListener('mouseup', onMouseUp); -}); - -function onMouseMove(e) { - if (isDragging) { - // Calculate the new position of the element - const left = e.clientX - offsetX; - const top = e.clientY - offsetY; - - // Move the element by setting its style - draggableElement.style.left = `${left}px`; - draggableElement.style.top = `${top}px`; - } -} - -function onMouseUp() { - // Stop dragging and remove event listeners - isDragging = false; - document.removeEventListener('mousemove', onMouseMove); - document.removeEventListener('mouseup', onMouseUp); -} diff --git a/src/main/resources/templates/sign.html b/src/main/resources/templates/sign.html index a0fe2f107bc..88281338ca4 100644 --- a/src/main/resources/templates/sign.html +++ b/src/main/resources/templates/sign.html @@ -236,9 +236,6 @@
- - - \ No newline at end of file