@maas/vue-equipment 1.0.0-beta.70 → 1.0.0-beta.72
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/nuxt/module.json
CHANGED
|
@@ -97,7 +97,7 @@ export function useTrayDrag(args) {
|
|
|
97
97
|
const right = Math.max(0, state.dragged.right + state.magnetic.right);
|
|
98
98
|
const bottom = Math.max(0, state.dragged.bottom + state.magnetic.bottom);
|
|
99
99
|
const left = Math.max(0, state.dragged.left + state.magnetic.left);
|
|
100
|
-
return `inset(${top}px ${right}px ${bottom}px ${left}px round var(--magic-tray-radius, 0px))`;
|
|
100
|
+
return `inset(var(--magic-tray-clip-top, ${top}px) var(--magic-tray-clip-right, ${right}px) var(--magic-tray-clip-bottom, ${bottom}px) var(--magic-tray-clip-left, ${left}px) round var(--magic-tray-radius-top-left, var(--magic-tray-radius, 0px)) var(--magic-tray-radius-top-right, var(--magic-tray-radius, 0px)) var(--magic-tray-radius-bottom-right, var(--magic-tray-radius, 0px)) var(--magic-tray-radius-bottom-left, var(--magic-tray-radius, 0px)))`;
|
|
101
101
|
});
|
|
102
102
|
function handleStyle(side) {
|
|
103
103
|
const rest = `${state.dragged[side]}px`;
|
|
@@ -136,14 +136,9 @@ export function useTrayMagnetism(args) {
|
|
|
136
136
|
);
|
|
137
137
|
return match ? match.direction : null;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function handleRect(side) {
|
|
140
140
|
const handle = unrefElement(handleRefs[side].value?.[0]);
|
|
141
|
-
|
|
142
|
-
return 0;
|
|
143
|
-
}
|
|
144
|
-
const rect = handle.getBoundingClientRect();
|
|
145
|
-
const size = side === "top" || side === "bottom" ? rect.height : rect.width;
|
|
146
|
-
return size / 2;
|
|
141
|
+
return handle ? handle.getBoundingClientRect() : null;
|
|
147
142
|
}
|
|
148
143
|
function cancelSettle(side) {
|
|
149
144
|
if (settleId[side] !== void 0) {
|
|
@@ -222,7 +217,9 @@ export function useTrayMagnetism(args) {
|
|
|
222
217
|
}
|
|
223
218
|
const allowInner = direction === "inner" || direction === "both";
|
|
224
219
|
const allowOuter = direction === "outer" || direction === "both";
|
|
225
|
-
const
|
|
220
|
+
const hRect = handleRect(side);
|
|
221
|
+
const thickness = hRect ? side === "top" || side === "bottom" ? hRect.height : hRect.width : 0;
|
|
222
|
+
const anchorHalf = thickness / 2;
|
|
226
223
|
const radius = configuredRadius > 0 ? configuredRadius : anchorHalf / 2;
|
|
227
224
|
const pull = configuredPull > 0 ? configuredPull : anchorHalf / 2;
|
|
228
225
|
pullPx[side] = pull;
|
|
@@ -234,30 +231,53 @@ export function useTrayMagnetism(args) {
|
|
|
234
231
|
}
|
|
235
232
|
let perp = 0;
|
|
236
233
|
let overflow = 0;
|
|
234
|
+
let center = 0;
|
|
237
235
|
switch (side) {
|
|
238
|
-
case "top":
|
|
239
|
-
|
|
236
|
+
case "top": {
|
|
237
|
+
const edge = rect.top + state.snapped.top;
|
|
238
|
+
perp = y - edge;
|
|
240
239
|
overflow = axisOverflow(x, rect.left, rect.right);
|
|
240
|
+
if (hRect) {
|
|
241
|
+
center = hRect.top + hRect.height / 2 - edge - state.magnetic.top;
|
|
242
|
+
}
|
|
241
243
|
break;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
+
}
|
|
245
|
+
case "bottom": {
|
|
246
|
+
const edge = rect.bottom - state.snapped.bottom;
|
|
247
|
+
perp = edge - y;
|
|
244
248
|
overflow = axisOverflow(x, rect.left, rect.right);
|
|
249
|
+
if (hRect) {
|
|
250
|
+
center = edge - (hRect.top + hRect.height / 2) - state.magnetic.bottom;
|
|
251
|
+
}
|
|
245
252
|
break;
|
|
246
|
-
|
|
247
|
-
|
|
253
|
+
}
|
|
254
|
+
case "left": {
|
|
255
|
+
const edge = rect.left + state.snapped.left;
|
|
256
|
+
perp = x - edge;
|
|
248
257
|
overflow = axisOverflow(y, rect.top, rect.bottom);
|
|
258
|
+
if (hRect) {
|
|
259
|
+
center = hRect.left + hRect.width / 2 - edge - state.magnetic.left;
|
|
260
|
+
}
|
|
249
261
|
break;
|
|
250
|
-
|
|
251
|
-
|
|
262
|
+
}
|
|
263
|
+
case "right": {
|
|
264
|
+
const edge = rect.right - state.snapped.right;
|
|
265
|
+
perp = edge - x;
|
|
252
266
|
overflow = axisOverflow(y, rect.top, rect.bottom);
|
|
267
|
+
if (hRect) {
|
|
268
|
+
center = edge - (hRect.left + hRect.width / 2) - state.magnetic.right;
|
|
269
|
+
}
|
|
253
270
|
break;
|
|
271
|
+
}
|
|
254
272
|
}
|
|
273
|
+
const innerEdge = center + anchorHalf;
|
|
274
|
+
const outerEdge = center - anchorHalf;
|
|
255
275
|
if (overflow === 0) {
|
|
256
276
|
switch (true) {
|
|
257
|
-
case (allowInner && perp >=
|
|
277
|
+
case (allowInner && perp >= innerEdge):
|
|
258
278
|
armedDir[side] = "inner";
|
|
259
279
|
break;
|
|
260
|
-
case (allowOuter && perp <=
|
|
280
|
+
case (allowOuter && perp <= outerEdge):
|
|
261
281
|
armedDir[side] = "outer";
|
|
262
282
|
break;
|
|
263
283
|
}
|
|
@@ -271,11 +291,11 @@ export function useTrayMagnetism(args) {
|
|
|
271
291
|
let sign = 0;
|
|
272
292
|
switch (dir) {
|
|
273
293
|
case "inner":
|
|
274
|
-
t = clampValue((
|
|
294
|
+
t = clampValue((innerEdge - perp) / radius, 0, 1);
|
|
275
295
|
sign = 1;
|
|
276
296
|
break;
|
|
277
297
|
case "outer":
|
|
278
|
-
t = clampValue((
|
|
298
|
+
t = clampValue((perp - outerEdge) / radius, 0, 1);
|
|
279
299
|
sign = -1;
|
|
280
300
|
break;
|
|
281
301
|
}
|