@christianriedl/media 1.0.25 → 1.0.27
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 +1 -1
- package/src/views/PhotoAlbumPage.vue +55 -11
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { inject, ref, reactive, computed, onMounted, onBeforeMount, onUnmounted, nextTick, watch } from 'vue';
|
|
3
3
|
import { useRouter, useRoute } from 'vue-router';
|
|
4
|
-
import { IAppState, Dictionary, Helper } from '@christianriedl/utils';
|
|
4
|
+
import { IAppState, IAppConfig, Dictionary, Helper } from '@christianriedl/utils';
|
|
5
5
|
import { EMediaType, IPictureFile, MediaService } from '@christianriedl/media';
|
|
6
6
|
|
|
7
7
|
const router = useRouter();
|
|
8
8
|
const route = useRoute();
|
|
9
9
|
const appState = inject<IAppState>('appstate')!;
|
|
10
|
+
const appConfig = inject<IAppState>('appConfig')!;
|
|
10
11
|
const getMediaService = inject<() => MediaService>('get-media')!;
|
|
11
12
|
const mediaService = getMediaService();
|
|
12
13
|
const heightStyle = computed(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'hidden' } });
|
|
13
14
|
const isMobile = appState.isMobile;
|
|
14
15
|
const url = ref('');
|
|
15
|
-
const
|
|
16
|
+
const infoDialog = ref(false);
|
|
17
|
+
const keyDialog = ref(false);
|
|
16
18
|
const folderId = decodeURIComponent(route.query!.id!.toString());
|
|
17
19
|
const index = ref(0);
|
|
18
20
|
const items = reactive<IPictureFile[]>([]);
|
|
@@ -87,8 +89,10 @@
|
|
|
87
89
|
return mediaService.getPhotoUrl(url.value, item.Url, `${width.value}x${0}x${item.Orientation}`);
|
|
88
90
|
}
|
|
89
91
|
function showMap(ev: Event) {
|
|
92
|
+
const current = items[index.value];
|
|
93
|
+
window.history.replaceState(null, "", `${appConfig.urlPrefix}photoalbum?id=${folderId}&start=${current.DLNAID}`);
|
|
90
94
|
router.push({
|
|
91
|
-
path: '
|
|
95
|
+
path: 'map', query: {
|
|
92
96
|
lat: `${gpsLat[0]} ${gpsLat[1]}`,
|
|
93
97
|
lng: `${gpsLng[0]} ${gpsLng[1]}`
|
|
94
98
|
}
|
|
@@ -104,8 +108,8 @@
|
|
|
104
108
|
});
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
|
-
function
|
|
108
|
-
|
|
111
|
+
function onDblClick(ev: Event) {
|
|
112
|
+
keyDialog.value = true;
|
|
109
113
|
}
|
|
110
114
|
async function onKey(ev: KeyboardEvent) {
|
|
111
115
|
switch (ev.code) {
|
|
@@ -124,11 +128,12 @@
|
|
|
124
128
|
const item = items[index.value];
|
|
125
129
|
const exif = await mediaService.getExifInfo(item.DLNAParentID, item.DLNAID);
|
|
126
130
|
setMetaData(exif, item);
|
|
127
|
-
|
|
131
|
+
infoDialog.value = true;
|
|
128
132
|
break;
|
|
129
|
-
case "
|
|
133
|
+
case "KeyC":
|
|
130
134
|
cycle.value = true;
|
|
131
135
|
break;
|
|
136
|
+
case "KeyP":
|
|
132
137
|
case "Digit0":
|
|
133
138
|
cycle.value = false;
|
|
134
139
|
break;
|
|
@@ -161,6 +166,13 @@
|
|
|
161
166
|
break;
|
|
162
167
|
}
|
|
163
168
|
}
|
|
169
|
+
function onKeyClick(code: string) {
|
|
170
|
+
keyDialog.value = false;
|
|
171
|
+
if (code != 'close') {
|
|
172
|
+
const keyEvent = new KeyboardEvent("key", { "code": code, "bubbles": true, "cancelable": false });
|
|
173
|
+
onKey(keyEvent);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
164
176
|
function itemWidth(item: IPictureFile): number {
|
|
165
177
|
const fac = item.Height / height.value;
|
|
166
178
|
return Math.floor(item.Width * fac);
|
|
@@ -236,13 +248,13 @@
|
|
|
236
248
|
<v-container fluid :style="heightStyle">
|
|
237
249
|
<v-carousel hide-delimiters :show-arrows="false" v-model="index"
|
|
238
250
|
:width="width" :height="height" :cycle="cycle" :interval="interval"
|
|
239
|
-
@change="onInput">
|
|
251
|
+
@change="onInput" @dblclick="onDblClick">
|
|
240
252
|
<v-carousel-item v-for="item in items" :key="item.DLNAID">
|
|
241
253
|
<img :src="item.realUrl" />
|
|
242
254
|
</v-carousel-item>
|
|
243
255
|
</v-carousel>
|
|
244
|
-
<v-dialog v-model="
|
|
245
|
-
<v-card v-if="
|
|
256
|
+
<v-dialog v-model="infoDialog" :fullscreen="isMobile">
|
|
257
|
+
<v-card v-if="infoDialog" width="400">
|
|
246
258
|
<v-card-title class="headline">Metadata</v-card-title>
|
|
247
259
|
<v-card-text>
|
|
248
260
|
<v-container>
|
|
@@ -253,7 +265,7 @@
|
|
|
253
265
|
</v-container>
|
|
254
266
|
</v-card-text>
|
|
255
267
|
<v-card-actions>
|
|
256
|
-
<v-btn @click="
|
|
268
|
+
<v-btn @click="infoDialog = false">
|
|
257
269
|
<v-icon large icon="$stop" />
|
|
258
270
|
</v-btn>
|
|
259
271
|
<v-btn v-if="hasCoordinates" @click="showMap">
|
|
@@ -262,6 +274,38 @@
|
|
|
262
274
|
</v-card-actions>
|
|
263
275
|
</v-card>
|
|
264
276
|
</v-dialog>
|
|
277
|
+
<v-dialog v-model="keyDialog" :fullscreen="isMobile">
|
|
278
|
+
<v-card v-if="keyDialog" width="400">
|
|
279
|
+
<v-card-text>
|
|
280
|
+
<v-container>
|
|
281
|
+
<v-row dense>
|
|
282
|
+
<v-col cols="4"><v-btn @click="onKeyClick('Escape')">Back</v-btn></v-col>
|
|
283
|
+
<v-col cols="4"><v-btn @click="onKeyClick('Digit0')">Pause</v-btn></v-col>
|
|
284
|
+
<v-col cols="4"><v-btn @click="onKeyClick('KeyC')">Cont</v-btn></v-col>
|
|
285
|
+
</v-row>
|
|
286
|
+
<v-row dense>
|
|
287
|
+
<v-col cols="4"><v-btn @click="onKeyClick('Digit1')">1</v-btn></v-col>
|
|
288
|
+
<v-col cols="4"><v-btn @click="onKeyClick('Digit2')">2</v-btn></v-col>
|
|
289
|
+
<v-col cols="4"><v-btn @click="onKeyClick('Digit3')">3</v-btn></v-col>
|
|
290
|
+
</v-row>
|
|
291
|
+
<v-row dense>
|
|
292
|
+
<v-col cols="4"><v-btn @click="onKeyClick('Digit4')">4</v-btn></v-col>
|
|
293
|
+
<v-col cols="4"><v-btn @click="onKeyClick('Digit5')">5</v-btn></v-col>
|
|
294
|
+
<v-col cols="4"><v-btn @click="onKeyClick('Digit6')">6</v-btn></v-col>
|
|
295
|
+
</v-row>
|
|
296
|
+
<v-row dense>
|
|
297
|
+
<v-col cols="4"><v-btn @click="onKeyClick('Digit7')">7</v-btn></v-col>
|
|
298
|
+
<v-col cols="4"><v-btn @click="onKeyClick('Digit8')">8</v-btn></v-col>
|
|
299
|
+
<v-col cols="4"><v-btn @click="onKeyClick('Digit9')">9</v-btn></v-col>
|
|
300
|
+
</v-row>
|
|
301
|
+
<v-row dense>
|
|
302
|
+
<v-col cols="4"><v-btn @click="onKeyClick('KeyI')">Info</v-btn></v-col>
|
|
303
|
+
<v-col cols="4"><v-btn @click="onKeyClick('close')">Close</v-btn></v-col>
|
|
304
|
+
</v-row>
|
|
305
|
+
</v-container>
|
|
306
|
+
</v-card-text>
|
|
307
|
+
</v-card>
|
|
308
|
+
</v-dialog>
|
|
265
309
|
</v-container>
|
|
266
310
|
</template>
|
|
267
311
|
|