tangled
alpha
login
or
join now
flo-bit.dev
/
blento
21
fork
atom
your personal website on atproto - mirror
blento.app
21
fork
atom
overview
issues
pulls
pipelines
safari drag and drop fix
polijn.tngl.sh
1 month ago
3b043fb7
b935c215
+10
-15
1 changed file
expand all
collapse all
unified
split
src
lib
website
EditableWebsite.svelte
+10
-15
src/lib/website/EditableWebsite.svelte
···
809
809
}}
810
810
ondragend={async (e) => {
811
811
e.preventDefault();
812
812
-
const cell = getDragXY(e);
813
813
-
if (!cell) return;
814
814
-
815
815
-
if (activeDragElement.item) {
816
816
-
if (isMobile) {
817
817
-
activeDragElement.item.mobileX = cell.x;
818
818
-
activeDragElement.item.mobileY = cell.y;
819
819
-
} else {
820
820
-
activeDragElement.item.x = cell.x;
821
821
-
activeDragElement.item.y = cell.y;
822
822
-
}
823
823
-
824
824
-
// Fix collisions and compact items after drag ends
825
825
-
fixCollisions(items, activeDragElement.item, isMobile);
826
826
-
}
812
812
+
// safari fix
827
813
activeDragElement.x = -1;
828
814
activeDragElement.y = -1;
829
815
activeDragElement.element = null;
···
863
849
activeDragElement.w = item.w;
864
850
activeDragElement.h = item.h;
865
851
activeDragElement.item = item;
852
852
+
// fix for div shadow during drag and drop
853
853
+
const transparent = document.createElement('div');
854
854
+
transparent.style.position = 'fixed';
855
855
+
transparent.style.top = '-1000px';
856
856
+
transparent.style.width = '1px';
857
857
+
transparent.style.height = '1px';
858
858
+
document.body.appendChild(transparent);
859
859
+
e.dataTransfer?.setDragImage(transparent, 0, 0);
860
860
+
requestAnimationFrame(() => transparent.remove());
866
861
867
862
// Store original positions of all items
868
863
activeDragElement.originalPositions = new Map();