@fy-/fws-vue 2.0.83 → 2.0.85

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.
@@ -12,6 +12,7 @@ import {
12
12
  } from "@heroicons/vue/24/solid";
13
13
  import DefaultPaging from "./DefaultPaging.vue";
14
14
  import type { Component } from "vue";
15
+ import CollapseTransition from "./transitions/CollapseTransition.vue";
15
16
  const isGalleryOpen = ref<boolean>(false);
16
17
  const eventBus = useEventBus();
17
18
  const sidePanel = ref<boolean>(true);
@@ -98,6 +99,7 @@ const modelValueSrc = computed(() => {
98
99
  const start = reactive({ x: 0, y: 0 });
99
100
 
100
101
  const touchStart = (event: TouchEvent) => {
102
+ event.preventDefault();
101
103
  const touch = event.touches[0];
102
104
  start.x = touch.screenX;
103
105
  start.y = touch.screenY;
@@ -110,7 +112,8 @@ const touchEnd = (event: TouchEvent) => {
110
112
  const diffX = start.x - end.x;
111
113
  const diffY = start.y - end.y;
112
114
 
113
- if (Math.abs(diffX) > Math.abs(diffY)) {
115
+ // Add a threshold to prevent accidental swipes
116
+ if (Math.abs(diffX) > Math.abs(diffY) && Math.abs(diffX) > 50) {
114
117
  if (diffX > 0) {
115
118
  goNextImage();
116
119
  } else {
@@ -118,6 +121,7 @@ const touchEnd = (event: TouchEvent) => {
118
121
  }
119
122
  }
120
123
  };
124
+
121
125
  const getBorderColor = (i: any) => {
122
126
  if (props.borderColor !== undefined) {
123
127
  return props.borderColor(i);
@@ -215,42 +219,40 @@ onUnmounted(() => {
215
219
  </div>
216
220
  <div
217
221
  class="flex-1 flex flex-col items-center justify-center max-w-full lg:max-w-[calc(100vw - 256px)]"
222
+ @touchstart="touchStart"
223
+ @touchend="touchEnd"
218
224
  >
219
225
  <div
220
226
  class="flex-1 w-full max-w-full flex items-center justify-center"
221
227
  >
222
- <template
223
- v-if="videoComponent && isVideo(images[modelValue])"
224
- >
225
- <ClientOnly>
228
+ <CollapseTransition>
229
+ <template
230
+ v-if="videoComponent && isVideo(images[modelValue])"
231
+ >
232
+ <ClientOnly>
233
+ <component
234
+ :is="videoComponent"
235
+ :src="isVideo(images[modelValue])"
236
+ class="shadow max-w-full h-auto object-contain max-h-[85vh]"
237
+ />
238
+ </ClientOnly>
239
+ </template>
240
+ <template v-else>
241
+ <img
242
+ class="shadow max-w-full h-auto object-contain max-h-[85vh]"
243
+ :src="modelValueSrc"
244
+ v-if="modelValueSrc && imageComponent == 'img'"
245
+ />
226
246
  <component
227
- :is="videoComponent"
228
- :src="isVideo(images[modelValue])"
247
+ v-else-if="modelValueSrc && imageComponent"
248
+ :is="imageComponent"
249
+ :image="modelValueSrc.image"
250
+ :variant="modelValueSrc.variant"
251
+ :alt="modelValueSrc.alt"
229
252
  class="shadow max-w-full h-auto object-contain max-h-[85vh]"
230
- @touchstart="touchStart"
231
- @touchend="touchEnd"
232
253
  />
233
- </ClientOnly>
234
- </template>
235
- <template v-else>
236
- <img
237
- class="shadow max-w-full h-auto object-contain max-h-[85vh]"
238
- :src="modelValueSrc"
239
- v-if="modelValueSrc && imageComponent == 'img'"
240
- @touchstart="touchStart"
241
- @touchend="touchEnd"
242
- />
243
- <component
244
- v-else-if="modelValueSrc && imageComponent"
245
- :is="imageComponent"
246
- :image="modelValueSrc.image"
247
- :variant="modelValueSrc.variant"
248
- :alt="modelValueSrc.alt"
249
- @touchstart="touchStart"
250
- @touchend="touchEnd"
251
- class="shadow max-w-full h-auto object-contain max-h-[85vh]"
252
- />
253
- </template>
254
+ </template>
255
+ </CollapseTransition>
254
256
  </div>
255
257
  <div
256
258
  class="flex-0 py-2 flex items-center justify-center max-w-full w-full"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fy-/fws-vue",
3
- "version": "2.0.83",
3
+ "version": "2.0.85",
4
4
  "author": "Florian 'Fy' Gasquez <m@fy.to>",
5
5
  "license": "MIT",
6
6
  "repository": {