|
525 | 525 | margin-top: -30vh; /* Adjusted for landscape mode */ |
526 | 526 | height: 50vh; |
527 | 527 | } |
528 | | - // ...rest of media query... |
529 | 528 | } |
530 | 529 |
|
531 | 530 | .pagination-controls { |
|
628 | 627 | .scene-name { |
629 | 628 | flex-grow: 1; |
630 | 629 | } |
| 630 | + |
| 631 | + .trash-bin { |
| 632 | + position: fixed; |
| 633 | + bottom: 73%; /* Changed from bottom: 20px */ |
| 634 | + left: 50px; |
| 635 | + width: 50px; |
| 636 | + height: 50px; |
| 637 | + background: rgba(255, 0, 0, 0.2); |
| 638 | + border: 2px dashed #ff0000; |
| 639 | + border-radius: 8px; |
| 640 | + display: flex; |
| 641 | + justify-content: center; |
| 642 | + align-items: center; |
| 643 | + font-size: 24px; |
| 644 | + z-index: 1000; |
| 645 | + transition: all 0.3s ease; |
| 646 | + transform: translateY(50%); /* Added to center vertically */ |
| 647 | + } |
| 648 | + |
| 649 | + .trash-bin.drag-over { |
| 650 | + background: rgba(255, 0, 0, 0.4); |
| 651 | + transform: scale(1.1); |
| 652 | + } |
| 653 | + |
| 654 | + .trash-bin.hidden { |
| 655 | + display: none; |
| 656 | + } |
631 | 657 | </style> |
632 | 658 |
|
633 | 659 | <!-- Add these scripts in the head section --> |
|
764 | 790 | </div> |
765 | 791 | </div> |
766 | 792 |
|
| 793 | + <div class="trash-bin hidden" id="trashBin">🗑️</div> |
| 794 | + |
767 | 795 | <script src="dragndrop.js"></script> |
768 | 796 | <script> |
769 | 797 | // Add loading screen handler at the start of your scripts |
|
1168 | 1196 | initialX = touch.clientX - element.offsetLeft; |
1169 | 1197 | initialY = touch.clientY - element.offsetTop; |
1170 | 1198 | isDragging = true; |
| 1199 | + handleDragStart(); |
1171 | 1200 | } |
1172 | 1201 |
|
1173 | 1202 | function handleTouchMove(e) { |
|
1178 | 1207 | currentY = touch.clientY - initialY; |
1179 | 1208 | element.style.left = `${currentX}px`; |
1180 | 1209 | element.style.top = `${currentY}px`; |
| 1210 | + handleDrag(touch.clientX, touch.clientY); |
1181 | 1211 | } |
1182 | 1212 | } |
1183 | 1213 |
|
1184 | | - function handleTouchEnd() { |
| 1214 | + function handleTouchEnd(e) { |
| 1215 | + if (isDragging) { |
| 1216 | + const touch = e.changedTouches[0]; |
| 1217 | + handleDragEnd(touch.clientX, touch.clientY); |
| 1218 | + } |
1185 | 1219 | isDragging = false; |
1186 | 1220 | } |
1187 | 1221 |
|
1188 | 1222 | function startDragging(e) { |
1189 | 1223 | initialX = e.clientX - element.offsetLeft; |
1190 | 1224 | initialY = e.clientY - element.offsetTop; |
1191 | 1225 | isDragging = true; |
| 1226 | + handleDragStart(); |
1192 | 1227 | } |
1193 | 1228 |
|
1194 | 1229 | function drag(e) { |
|
1198 | 1233 | currentY = e.clientY - initialY; |
1199 | 1234 | element.style.left = `${currentX}px`; |
1200 | 1235 | element.style.top = `${currentY}px`; |
| 1236 | + handleDrag(e.clientX, e.clientY); |
1201 | 1237 | } |
1202 | 1238 | } |
1203 | 1239 |
|
1204 | | - function stopDragging() { |
| 1240 | + function stopDragging(e) { |
| 1241 | + if (isDragging) { |
| 1242 | + handleDragEnd(e.clientX, e.clientY); |
| 1243 | + } |
1205 | 1244 | isDragging = false; |
1206 | 1245 | } |
| 1246 | + |
| 1247 | + const trashBin = document.getElementById('trashBin'); |
| 1248 | + |
| 1249 | + function showTrashBin() { |
| 1250 | + trashBin.classList.remove('hidden'); |
| 1251 | + } |
| 1252 | + |
| 1253 | + function hideTrashBin() { |
| 1254 | + trashBin.classList.remove('drag-over'); |
| 1255 | + trashBin.classList.add('hidden'); |
| 1256 | + } |
| 1257 | + |
| 1258 | + function handleDragStart() { |
| 1259 | + showTrashBin(); |
| 1260 | + } |
| 1261 | + |
| 1262 | + function handleDrag(x, y) { |
| 1263 | + const trashRect = trashBin.getBoundingClientRect(); |
| 1264 | + const isOverTrash = x >= trashRect.left && x <= trashRect.right && |
| 1265 | + y >= trashRect.top && y <= trashRect.bottom; |
| 1266 | + |
| 1267 | + if (isOverTrash) { |
| 1268 | + trashBin.classList.add('drag-over'); |
| 1269 | + } else { |
| 1270 | + trashBin.classList.remove('drag-over'); |
| 1271 | + } |
| 1272 | + } |
| 1273 | + |
| 1274 | + function handleDragEnd(x, y) { |
| 1275 | + const trashRect = trashBin.getBoundingClientRect(); |
| 1276 | + const isOverTrash = x >= trashRect.left && x <= trashRect.right && |
| 1277 | + y >= trashRect.top && y <= trashRect.bottom; |
| 1278 | + |
| 1279 | + if (isOverTrash) { |
| 1280 | + element.remove(); |
| 1281 | + if (currentScene) { |
| 1282 | + saveSceneBtn.disabled = false; |
| 1283 | + } |
| 1284 | + } |
| 1285 | + hideTrashBin(); |
| 1286 | + } |
1207 | 1287 | } |
1208 | 1288 |
|
1209 | 1289 | function exportScenes() { |
|
0 commit comments