@christianriedl/media 1.0.49 → 1.0.50

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/media",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -21,7 +21,6 @@
21
21
  const items = reactive<IPictureFile[]>([]);
22
22
  const width = ref(0);
23
23
  const height = ref(0);
24
- const sizeStyle = ref({ height: '512px', width: '1024px' });
25
24
  const landscape = ref(true);
26
25
  const metadata = reactive<Dictionary<any>>({});
27
26
  const cycle = ref(false);
@@ -34,7 +33,6 @@
34
33
  watch([appState.bodyHeight, appState.pageWidth], () => {
35
34
  width.value = appState.pageWidth.value;
36
35
  height.value = appState.bodyHeight.value;
37
- sizeStyle.value = { height: height.value + 'px', width: width.value + 'px' };
38
36
  landscape.value = width.value > height.value;
39
37
  }, { immediate: true });
40
38
 
@@ -77,17 +75,43 @@
77
75
  window.document.removeEventListener('keydown', onKey);
78
76
  });
79
77
 
80
- function getUrl(item: IPictureFile) {
81
- const pictureQuality = mediaAppConfig.pictureQuality;
82
- const quality = pictureQuality % 1000;
78
+ function getQuality(pictureQuality: EPictureQuality) {
79
+ return pictureQuality % 1000;
80
+ }
81
+ function getFactor(pictureQuality: EPictureQuality) {
83
82
  let factor = Math.floor(pictureQuality / 1000);
84
83
  if (factor > 1 && appState.pixelRatio > 1)
85
84
  factor = appState.pixelRatio;
85
+ return factor;
86
+ }
87
+
88
+ function getUrl(item: IPictureFile) {
89
+ const pictureQuality = mediaAppConfig.pictureQuality;
90
+ const quality = getQuality(pictureQuality);
91
+ const factor = getFactor(pictureQuality);
86
92
  if (landscape.value)
87
93
  return mediaService.getPhotoUrl(url.value, item.Url, `${0}x${height.value * factor}x${item.Orientation}x${quality}`);
88
94
  else
89
95
  return mediaService.getPhotoUrl(url.value, item.Url, `${width.value * factor}x${0}x${item.Orientation}x${quality}`);
90
96
  }
97
+ function getHeight(item: IPictureFile) {
98
+ const pictureQuality = mediaAppConfig.pictureQuality;
99
+ const factor = getFactor(pictureQuality);
100
+ if (pictureQuality == EPictureQuality.Full || factor > 1) {
101
+ if (landscape.value)
102
+ return height.value;
103
+ }
104
+ return undefined;
105
+ }
106
+ function getWidth(item: IPictureFile) {
107
+ const pictureQuality = mediaAppConfig.pictureQuality;
108
+ const factor = getFactor(pictureQuality);
109
+ if (pictureQuality == EPictureQuality.Full || factor > 1) {
110
+ if (!landscape.value)
111
+ return width.value;
112
+ }
113
+ return undefined;
114
+ }
91
115
  function showMap(ev: Event) {
92
116
  const current = items[index.value];
93
117
  window.history.replaceState(null, "", `${appConfig.urlPrefix}photoalbum?id=${folderId}&start=${current.DLNAID}`);
@@ -272,7 +296,7 @@
272
296
  :width="width" :height="height" :cycle="cycle" :interval="interval"
273
297
  @dblclick="onDblClick">
274
298
  <v-carousel-item v-for="item in items" :key="item.DLNAID">
275
- <img :src="getUrl(item)" :style="sizeStyle" />
299
+ <img :src="getUrl(item)" :alt="item.Name" :width="getWidth(item)" :height="getHeight(item)" />
276
300
  </v-carousel-item>
277
301
  </v-carousel>
278
302
  <v-dialog v-model="infoDialog" :fullscreen="isMobile" >