atproto explorer

fix drag

handle.invalid 8553732b fe40fb8b

verified
+2 -5
+2 -5
src/components/create.tsx
··· 151 }; 152 153 const dragBox = (box: HTMLDivElement) => { 154 - let currentBox: HTMLDivElement | null = null; 155 let isDragging = false; 156 let offsetX: number; 157 let offsetY: number; ··· 171 e.preventDefault(); 172 isDragging = true; 173 box.classList.add("cursor-grabbing"); 174 - currentBox = box; 175 176 const rect = box.getBoundingClientRect(); 177 ··· 185 }; 186 187 const handleMouseMove = (e: MouseEvent) => { 188 - if (isDragging && box === currentBox) { 189 let newLeft = e.clientX - offsetX; 190 let newTop = e.clientY - offsetY; 191 ··· 204 }; 205 206 const handleMouseUp = () => { 207 - if (isDragging && box === currentBox) { 208 isDragging = false; 209 box.classList.remove("cursor-grabbing"); 210 - currentBox = null; 211 } 212 }; 213
··· 151 }; 152 153 const dragBox = (box: HTMLDivElement) => { 154 let isDragging = false; 155 let offsetX: number; 156 let offsetY: number; ··· 170 e.preventDefault(); 171 isDragging = true; 172 box.classList.add("cursor-grabbing"); 173 174 const rect = box.getBoundingClientRect(); 175 ··· 183 }; 184 185 const handleMouseMove = (e: MouseEvent) => { 186 + if (isDragging) { 187 let newLeft = e.clientX - offsetX; 188 let newTop = e.clientY - offsetY; 189 ··· 202 }; 203 204 const handleMouseUp = () => { 205 + if (isDragging) { 206 isDragging = false; 207 box.classList.remove("cursor-grabbing"); 208 } 209 }; 210