@maas/vue-equipment 0.21.0 → 0.21.1

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment/nuxt",
3
3
  "configKey": "vueEquipment",
4
- "version": "0.20.1"
4
+ "version": "0.21.0"
5
5
  }
@@ -55,7 +55,17 @@ export function useDrawerDrag(args) {
55
55
  const draggedX = ref(0);
56
56
  const draggedY = ref(0);
57
57
  const hasDragged = computed(() => {
58
- return lastDraggedX.value !== draggedX.value || lastDraggedY.value !== draggedY.value;
58
+ const hasDraggedX = !isWithinRange({
59
+ input: draggedX.value,
60
+ base: lastDraggedY.value,
61
+ threshold: toValue(threshold).lock
62
+ });
63
+ const hasDraggedY = !isWithinRange({
64
+ input: draggedY.value,
65
+ base: lastDraggedY.value,
66
+ threshold: toValue(threshold).lock
67
+ });
68
+ return hasDraggedX || hasDraggedY;
59
69
  });
60
70
  const style = computed(
61
71
  () => `transform: translate(${draggedX.value}px, ${draggedY.value}px)`
@@ -87,6 +97,10 @@ export function useDrawerDrag(args) {
87
97
  position,
88
98
  activeSnapPoint
89
99
  });
100
+ function isWithinRange(args2) {
101
+ const { input, base, threshold: threshold2 } = args2;
102
+ return input >= base - threshold2 && input <= base + threshold2;
103
+ }
90
104
  async function getSizes() {
91
105
  elRect.value = unrefElement(elRef)?.getBoundingClientRect();
92
106
  wrapperRect.value = unrefElement(wrapperRef)?.getBoundingClientRect();
@@ -15,6 +15,7 @@ export type DrawerOptions = {
15
15
  backdrop?: string;
16
16
  };
17
17
  threshold?: {
18
+ lock?: number;
18
19
  distance?: number;
19
20
  momentum?: number;
20
21
  };
@@ -14,6 +14,7 @@ const defaultOptions = {
14
14
  backdrop: "magic-drawer--backdrop"
15
15
  },
16
16
  threshold: {
17
+ lock: 0,
17
18
  distance: 150,
18
19
  momentum: 1
19
20
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment",
3
3
  "description": "A magic collection of Vue composables, plugins, components and directives",
4
- "version": "0.21.0",
4
+ "version": "0.21.1",
5
5
  "author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
6
6
  "devDependencies": {
7
7
  "@antfu/ni": "^0.21.12",