@christianriedl/media 1.0.249 → 1.0.250
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/components/PhotoMap.vue +11 -10
- package/src/views/ThumbnailsPage.vue +67 -26
package/package.json
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
<script setup lang="ts">
|
|
3
3
|
import { inject, ref, toRef, computed, onMounted, watch } from 'vue';
|
|
4
4
|
import { GoogleMap } from 'vue3-google-map'
|
|
5
|
-
import {
|
|
5
|
+
import { authorizeSymbol } from '@christianriedl/rest';
|
|
6
6
|
import { IPhotoMarker, IPhotoRegion, IPictureFile, getMediaBinSymbol } from '@christianriedl/media';
|
|
7
7
|
|
|
8
8
|
const props = defineProps<{ location: string, zoom: number, selectRegion?: IPhotoRegion, fotos?: IPhotoMarker[] }>();
|
|
9
9
|
const emits = defineEmits<{ (e: 'select', value: IPhotoRegion): void }>();
|
|
10
10
|
|
|
11
11
|
const authorize = inject(authorizeSymbol)!;
|
|
12
|
-
|
|
13
|
-
const apiKey = authorize.keyGoogleMaps;
|
|
12
|
+
const apiKey = "AIzaSyBXXPRWgozn5kP40fmdk5f6xLRYkImPI9w";
|
|
13
|
+
//const apiKey = authorize.keyGoogleMaps;
|
|
14
14
|
const getMediaService = inject(getMediaBinSymbol)!;
|
|
15
15
|
const mediaService = getMediaService() ;
|
|
16
16
|
|
|
@@ -219,15 +219,16 @@
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
function displayPhoto(photo: IPictureFile) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
222
|
+
let maxHeight = window.innerHeight * 0.8;
|
|
223
|
+
const fac = (photo.height > maxHeight) ? (maxHeight / photo.height) : 1;
|
|
224
|
+
let left = Math.floor((window.innerWidth - photo.width * fac) / 2);
|
|
225
|
+
if (left < 0) left = 0;
|
|
226
|
+
photoLeft.value = { 'left': left + 'px' };
|
|
227
|
+
photoHeight.value = Math.floor(photo.height * fac);
|
|
228
|
+
photoWidth.value = Math.floor(photo.width * fac);
|
|
228
229
|
const albumUrl = mediaService.getFolder(photo.dlnaParentId).url;
|
|
229
230
|
photoUrl = mediaService.getPhotoUrl(albumUrl, photo.url, `${0}x${photoHeight.value}x${photo.orientation}x70`);
|
|
230
|
-
|
|
231
|
+
showPhoto.value = true;
|
|
231
232
|
}
|
|
232
233
|
function createPin(loc: google.maps.LatLng, text: string, color: string, background: string): google.maps.marker.AdvancedMarkerElement {
|
|
233
234
|
const pinGlyph = new google.maps.marker.PinElement({
|
|
@@ -33,11 +33,13 @@
|
|
|
33
33
|
const folder = ref<IMediaFolder | null>(null);
|
|
34
34
|
const selectMode = ref<boolean>(false);
|
|
35
35
|
const showDownload = ref(false);
|
|
36
|
+
const showLocation = ref(false);
|
|
36
37
|
const showText = ref("SHOW");
|
|
37
|
-
|
|
38
|
+
let selectedFotos: IPictureFile[] | null = null;
|
|
38
39
|
// GPS selection
|
|
39
40
|
const center = ref("Wien");
|
|
40
|
-
const
|
|
41
|
+
const location = ref("");
|
|
42
|
+
const zoom = 14;
|
|
41
43
|
const maxMultiple = 10;
|
|
42
44
|
const markersPerDim = 40;
|
|
43
45
|
const showGps = ref(false);
|
|
@@ -74,7 +76,7 @@
|
|
|
74
76
|
withPerson.value = true;
|
|
75
77
|
if (route.query.loc !== undefined)
|
|
76
78
|
withLocation.value = true;
|
|
77
|
-
|
|
79
|
+
onShow();
|
|
78
80
|
return;
|
|
79
81
|
}
|
|
80
82
|
}
|
|
@@ -86,13 +88,15 @@
|
|
|
86
88
|
async function onTitleChanged() {
|
|
87
89
|
if (isMobile || title.value.length < 3)
|
|
88
90
|
return;
|
|
89
|
-
|
|
90
|
-
showText.value = `SHOW ${
|
|
91
|
+
selectedFotos = await MediaHelper.searchPictures (mediaService, title.value, withPerson.value, withLocation.value, mediaService.photoSelection.rating, 100000);
|
|
92
|
+
showText.value = `SHOW ${selectedFotos.length}`;
|
|
91
93
|
}
|
|
92
|
-
async function
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
async function onShow() {
|
|
95
|
+
if (!selectedFotos) {
|
|
96
|
+
selectedFotos = await MediaHelper.searchPictures (mediaService, title.value, withPerson.value, withLocation.value, mediaService.photoSelection.rating, mediaAppConfig.pictureSearchLimit);
|
|
97
|
+
showText.value = `SHOW ${selectedFotos.length}`;
|
|
98
|
+
}
|
|
99
|
+
photos.value.splice(0, photos.value.length, ...selectedFotos);
|
|
96
100
|
console.log(photos.value.length);
|
|
97
101
|
}
|
|
98
102
|
function onClick(item: IPictureFile) {
|
|
@@ -154,28 +158,39 @@
|
|
|
154
158
|
url += '&orientation=' + Number(image.orientation);
|
|
155
159
|
return encodeURI(url);
|
|
156
160
|
}
|
|
161
|
+
function onGps() {
|
|
162
|
+
showGps.value = true;
|
|
163
|
+
}
|
|
164
|
+
function onGoTo() {
|
|
165
|
+
showLocation.value = false;
|
|
166
|
+
center.value = location.value;
|
|
167
|
+
}
|
|
168
|
+
async function onCloseGps () {
|
|
169
|
+
showGps.value = false;
|
|
170
|
+
if (selectedRegion) {
|
|
171
|
+
selectedFotos = await MediaHelper.searchPicturesGPS(mediaService, selectedRegion.latFrom, selectedRegion.latTo, selectedRegion.lngFrom, selectedRegion.lngTo, mediaService.photoSelection.rating);
|
|
172
|
+
showText.value = `SHOW ${selectedFotos.length}`;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
157
175
|
async function onGpsSelect (region: IPhotoRegion) {
|
|
158
|
-
selectedRegion = region;
|
|
159
176
|
latLength = region.latLength;
|
|
160
177
|
lngLength = region.lngLength;
|
|
161
178
|
if (region.key) {
|
|
162
179
|
const arr = region.key.split('|');
|
|
163
|
-
|
|
164
|
-
|
|
180
|
+
const latDelta = Math.max(0.001, latLength / markersPerDim);
|
|
181
|
+
const lngDelta = Math.max(0.001, lngLength / markersPerDim);
|
|
165
182
|
const lat = Number(arr[0]) * latDelta;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
showText.value = `SHOW ${
|
|
169
|
-
photos.value.splice(0, photos.value.length, ...
|
|
183
|
+
const lng = Number(arr[1]) * lngDelta;
|
|
184
|
+
selectedFotos = await MediaHelper.searchPicturesGPS(mediaService, lat, lat + latDelta, lng, lng + lngDelta, mediaService.photoSelection.rating);
|
|
185
|
+
showText.value = `SHOW ${selectedFotos.length}`;
|
|
186
|
+
photos.value.splice(0, photos.value.length, ...selectedFotos);
|
|
170
187
|
console.log(photos.value.length);
|
|
188
|
+
showGps.value = false;
|
|
171
189
|
}
|
|
172
190
|
else {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
valueLngTo.value = region.lngTo;
|
|
177
|
-
const fotos = MediaHelper.searchPicturesGPS(mediaService, region.latFrom, region.latTo, region.lngFrom, region.lngTo, mediaService.photoSelection.rating);
|
|
178
|
-
foundFotos.value = MediaHelper.createMarker(fotos, latLength, lngLength, markersPerDim, maxMultiple);
|
|
191
|
+
selectedRegion = region;
|
|
192
|
+
selectedFotos = await MediaHelper.searchPicturesGPS(mediaService, region.latFrom, region.latTo, region.lngFrom, region.lngTo, mediaService.photoSelection.rating);
|
|
193
|
+
foundFotos.value = MediaHelper.createMarker(selectedFotos, latLength, lngLength, markersPerDim, maxMultiple);
|
|
179
194
|
}
|
|
180
195
|
}
|
|
181
196
|
</script>
|
|
@@ -210,8 +225,8 @@
|
|
|
210
225
|
<v-checkbox v-model="withPerson" hide-details density="compact" label="Pers" @update:modelValue="onLocPersChanged"></v-checkbox>
|
|
211
226
|
</v-col>
|
|
212
227
|
<v-col cols="2">
|
|
213
|
-
<v-btn v-if="isMobile" icon="$search" variant="tonal" @click="
|
|
214
|
-
<v-btn v-else prepend-icon="$search" variant="tonal" @click="
|
|
228
|
+
<v-btn v-if="isMobile" icon="$search" variant="tonal" @click="onShow"></v-btn>
|
|
229
|
+
<v-btn v-else prepend-icon="$search" variant="tonal" @click="onShow">{{showText}}</v-btn>
|
|
215
230
|
<v-btn v-if="!isMobile" prepend-icon="$gps" variant="tonal" @click="onGps">GPS</v-btn>
|
|
216
231
|
</v-col>
|
|
217
232
|
</v-row>
|
|
@@ -239,9 +254,35 @@
|
|
|
239
254
|
<v-dialog v-model="showDownload" v-click-outside="onCloseDownload">
|
|
240
255
|
<photo-download :folder="folder!" :photos="photos" @close="onCloseDownload"></photo-download>
|
|
241
256
|
</v-dialog>
|
|
242
|
-
<v-dialog v-model="showGps"
|
|
243
|
-
<
|
|
257
|
+
<v-dialog v-model="showGps">
|
|
258
|
+
<v-card>
|
|
259
|
+
<v-card-text>
|
|
260
|
+
<photo-map :location="center" :zoom="zoom" :selectRegion="selectedRegion" :fotos="foundFotos" @select="onGpsSelect"></photo-map>
|
|
261
|
+
</v-card-text>
|
|
262
|
+
<v-card-actions>
|
|
263
|
+
<v-btn size="large" @click="onCloseGps">
|
|
264
|
+
<v-icon icon="$back"></v-icon>
|
|
265
|
+
</v-btn>
|
|
266
|
+
<v-btn size="large" @click="showLocation = true">
|
|
267
|
+
<v-icon icon="$gps"></v-icon>
|
|
268
|
+
</v-btn>
|
|
269
|
+
</v-card-actions>
|
|
270
|
+
</v-card>
|
|
244
271
|
</v-dialog>
|
|
272
|
+
<v-dialog v-model="showLocation" width="30%">
|
|
273
|
+
<v-card>
|
|
274
|
+
<v-card-title>Select Location</v-card-title>
|
|
275
|
+
<v-card-text>
|
|
276
|
+
<v-text-field v-model="location" hide-details >
|
|
277
|
+
</v-text-field>
|
|
278
|
+
</v-card-text>
|
|
279
|
+
<v-card-actions>
|
|
280
|
+
<v-btn size="large" @click="onGoTo"><v-icon icon="$back"></v-icon>
|
|
281
|
+
</v-btn>
|
|
282
|
+
</v-card-actions>
|
|
283
|
+
</v-card>
|
|
284
|
+
</v-dialog>
|
|
285
|
+
|
|
245
286
|
</template>
|
|
246
287
|
|
|
247
288
|
<style scoped>
|