atproto explorer pdsls.dev
atproto tool

fix drag

juli.ee 8553732b fe40fb8b

verified
Changed files
+2 -5
src
components
+2 -5
src/components/create.tsx
···
};
const dragBox = (box: HTMLDivElement) => {
-
let currentBox: HTMLDivElement | null = null;
let isDragging = false;
let offsetX: number;
let offsetY: number;
···
e.preventDefault();
isDragging = true;
box.classList.add("cursor-grabbing");
-
currentBox = box;
const rect = box.getBoundingClientRect();
···
};
const handleMouseMove = (e: MouseEvent) => {
-
if (isDragging && box === currentBox) {
+
if (isDragging) {
let newLeft = e.clientX - offsetX;
let newTop = e.clientY - offsetY;
···
};
const handleMouseUp = () => {
-
if (isDragging && box === currentBox) {
+
if (isDragging) {
isDragging = false;
box.classList.remove("cursor-grabbing");
-
currentBox = null;
}
};