svelte-dnd-action 0.9.22 → 0.9.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -3
- package/dist/index.mjs +6 -3
- package/package.json +1 -1
- package/src/helpers/styler.js +7 -3
package/dist/index.js
CHANGED
|
@@ -1062,8 +1062,9 @@
|
|
|
1062
1062
|
left: (currentMouseX - draggedElRect.left) / draggedElRect.width,
|
|
1063
1063
|
top: (currentMouseY - draggedElRect.top) / draggedElRect.height
|
|
1064
1064
|
};
|
|
1065
|
-
|
|
1066
|
-
draggedEl.style.
|
|
1065
|
+
// The lines below are commented out because of issue 454 - seems like these rect values take time to update when in grid layout, therefore this gets copied from the computed styles now
|
|
1066
|
+
// draggedEl.style.height = `${newRect.height}px`;
|
|
1067
|
+
// draggedEl.style.width = `${newRect.width}px`;
|
|
1067
1068
|
draggedEl.style.left = "".concat(parseFloat(draggedEl.style.left) - relativeDistanceOfMousePointerFromDraggedSides.left * widthChange, "px");
|
|
1068
1069
|
draggedEl.style.top = "".concat(parseFloat(draggedEl.style.top) - relativeDistanceOfMousePointerFromDraggedSides.top * heightChange, "px");
|
|
1069
1070
|
}
|
|
@@ -1076,7 +1077,9 @@
|
|
|
1076
1077
|
function copyStylesFromTo(copyFromEl, copyToEl) {
|
|
1077
1078
|
var computedStyle = window.getComputedStyle(copyFromEl);
|
|
1078
1079
|
Array.from(computedStyle).filter(function (s) {
|
|
1079
|
-
return s.startsWith("background") || s.startsWith("padding") || s.startsWith("font") || s.startsWith("text") || s.startsWith("align") || s.startsWith("justify") || s.startsWith("display") || s.startsWith("flex") || s.startsWith("border") || s === "opacity" || s === "color" || s === "list-style-type"
|
|
1080
|
+
return s.startsWith("background") || s.startsWith("padding") || s.startsWith("font") || s.startsWith("text") || s.startsWith("align") || s.startsWith("justify") || s.startsWith("display") || s.startsWith("flex") || s.startsWith("border") || s === "opacity" || s === "color" || s === "list-style-type" ||
|
|
1081
|
+
// copying with and height to make up for rect update timing issues in some browsers
|
|
1082
|
+
s === "width" || s === "height";
|
|
1080
1083
|
}).forEach(function (s) {
|
|
1081
1084
|
return copyToEl.style.setProperty(s, computedStyle.getPropertyValue(s), computedStyle.getPropertyPriority(s));
|
|
1082
1085
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1056,8 +1056,9 @@ function morphDraggedElementToBeLike(draggedEl, copyFromEl, currentMouseX, curre
|
|
|
1056
1056
|
left: (currentMouseX - draggedElRect.left) / draggedElRect.width,
|
|
1057
1057
|
top: (currentMouseY - draggedElRect.top) / draggedElRect.height
|
|
1058
1058
|
};
|
|
1059
|
-
|
|
1060
|
-
draggedEl.style.
|
|
1059
|
+
// The lines below are commented out because of issue 454 - seems like these rect values take time to update when in grid layout, therefore this gets copied from the computed styles now
|
|
1060
|
+
// draggedEl.style.height = `${newRect.height}px`;
|
|
1061
|
+
// draggedEl.style.width = `${newRect.width}px`;
|
|
1061
1062
|
draggedEl.style.left = "".concat(parseFloat(draggedEl.style.left) - relativeDistanceOfMousePointerFromDraggedSides.left * widthChange, "px");
|
|
1062
1063
|
draggedEl.style.top = "".concat(parseFloat(draggedEl.style.top) - relativeDistanceOfMousePointerFromDraggedSides.top * heightChange, "px");
|
|
1063
1064
|
}
|
|
@@ -1070,7 +1071,9 @@ function morphDraggedElementToBeLike(draggedEl, copyFromEl, currentMouseX, curre
|
|
|
1070
1071
|
function copyStylesFromTo(copyFromEl, copyToEl) {
|
|
1071
1072
|
var computedStyle = window.getComputedStyle(copyFromEl);
|
|
1072
1073
|
Array.from(computedStyle).filter(function (s) {
|
|
1073
|
-
return s.startsWith("background") || s.startsWith("padding") || s.startsWith("font") || s.startsWith("text") || s.startsWith("align") || s.startsWith("justify") || s.startsWith("display") || s.startsWith("flex") || s.startsWith("border") || s === "opacity" || s === "color" || s === "list-style-type"
|
|
1074
|
+
return s.startsWith("background") || s.startsWith("padding") || s.startsWith("font") || s.startsWith("text") || s.startsWith("align") || s.startsWith("justify") || s.startsWith("display") || s.startsWith("flex") || s.startsWith("border") || s === "opacity" || s === "color" || s === "list-style-type" ||
|
|
1075
|
+
// copying with and height to make up for rect update timing issues in some browsers
|
|
1076
|
+
s === "width" || s === "height";
|
|
1074
1077
|
}).forEach(function (s) {
|
|
1075
1078
|
return copyToEl.style.setProperty(s, computedStyle.getPropertyValue(s), computedStyle.getPropertyPriority(s));
|
|
1076
1079
|
});
|
package/package.json
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dist"
|
|
44
44
|
],
|
|
45
45
|
"description": "*An awesome drag and drop library for Svelte 3 (not using the browser's built-in dnd, thanks god): Rich animations, nested containers, touch support and more *",
|
|
46
|
-
"version": "0.9.
|
|
46
|
+
"version": "0.9.23",
|
|
47
47
|
"repository": {
|
|
48
48
|
"type": "git",
|
|
49
49
|
"url": "git+https://github.com/isaacHagoel/svelte-dnd-action.git"
|
package/src/helpers/styler.js
CHANGED
|
@@ -77,8 +77,9 @@ export function morphDraggedElementToBeLike(draggedEl, copyFromEl, currentMouseX
|
|
|
77
77
|
left: (currentMouseX - draggedElRect.left) / draggedElRect.width,
|
|
78
78
|
top: (currentMouseY - draggedElRect.top) / draggedElRect.height
|
|
79
79
|
};
|
|
80
|
-
|
|
81
|
-
draggedEl.style.
|
|
80
|
+
// The lines below are commented out because of issue 454 - seems like these rect values take time to update when in grid layout, therefore this gets copied from the computed styles now
|
|
81
|
+
// draggedEl.style.height = `${newRect.height}px`;
|
|
82
|
+
// draggedEl.style.width = `${newRect.width}px`;
|
|
82
83
|
draggedEl.style.left = `${parseFloat(draggedEl.style.left) - relativeDistanceOfMousePointerFromDraggedSides.left * widthChange}px`;
|
|
83
84
|
draggedEl.style.top = `${parseFloat(draggedEl.style.top) - relativeDistanceOfMousePointerFromDraggedSides.top * heightChange}px`;
|
|
84
85
|
}
|
|
@@ -104,7 +105,10 @@ function copyStylesFromTo(copyFromEl, copyToEl) {
|
|
|
104
105
|
s.startsWith("border") ||
|
|
105
106
|
s === "opacity" ||
|
|
106
107
|
s === "color" ||
|
|
107
|
-
s === "list-style-type"
|
|
108
|
+
s === "list-style-type" ||
|
|
109
|
+
// copying with and height to make up for rect update timing issues in some browsers
|
|
110
|
+
s === "width" ||
|
|
111
|
+
s === "height"
|
|
108
112
|
)
|
|
109
113
|
.forEach(s => copyToEl.style.setProperty(s, computedStyle.getPropertyValue(s), computedStyle.getPropertyPriority(s)));
|
|
110
114
|
}
|