atproto explorer

fix drag

handle.invalid 8553732b fe40fb8b

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