cnhis-design-vue 3.3.3-beta.25 → 3.3.3-beta.26
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.
@@ -65,6 +65,7 @@ function useDraggable(target, options = {}) {
|
|
65
65
|
topRightElement();
|
66
66
|
}
|
67
67
|
};
|
68
|
+
const clamp = (val, min, max) => Math.max(min, Math.min(val, max));
|
68
69
|
const onMouseDown = (e) => {
|
69
70
|
var _a;
|
70
71
|
if (!target.value)
|
@@ -87,12 +88,20 @@ function useDraggable(target, options = {}) {
|
|
87
88
|
};
|
88
89
|
const onMouseMove = (e) => {
|
89
90
|
var _a;
|
90
|
-
if (!isDragging.value)
|
91
|
+
if (!isDragging.value || !target.value)
|
91
92
|
return;
|
92
93
|
const dx = e.clientX - startMousePos.value.x;
|
93
94
|
const dy = e.clientY - startMousePos.value.y;
|
94
|
-
|
95
|
-
|
95
|
+
const {
|
96
|
+
width,
|
97
|
+
height
|
98
|
+
} = target.value.getBoundingClientRect();
|
99
|
+
const minX = 0;
|
100
|
+
const minY = 0;
|
101
|
+
const maxX = window.innerWidth - width;
|
102
|
+
const maxY = window.innerHeight - height;
|
103
|
+
x.value = clamp(startPos.value.x + dx, minX, maxX);
|
104
|
+
y.value = clamp(startPos.value.y + dy, minY, maxY);
|
96
105
|
updatePosition();
|
97
106
|
(_a = options.onDrag) == null ? void 0 : _a.call(options, {
|
98
107
|
x: x.value,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cnhis-design-vue",
|
3
|
-
"version": "3.3.3-beta.
|
3
|
+
"version": "3.3.3-beta.26",
|
4
4
|
"license": "ISC",
|
5
5
|
"module": "./es/components/index.js",
|
6
6
|
"main": "./es/components/index.js",
|
@@ -73,5 +73,5 @@
|
|
73
73
|
"iOS 7",
|
74
74
|
"last 3 iOS versions"
|
75
75
|
],
|
76
|
-
"gitHead": "
|
76
|
+
"gitHead": "6ade384bd38c4da713d5dcb430b65b6213a284cd"
|
77
77
|
}
|