@osm-editor-kit/street-imagery-react 0.1.0-alpha.12 → 0.1.0-alpha.14
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/README.md +54 -2
- package/dist/MapillaryPanel-SOHGB7JA.js +3 -0
- package/dist/PanoramaxPanel-NAKCJHT5.js +3 -0
- package/dist/StreetLevelImageryViewer.d.ts +8 -2
- package/dist/{chunk-6EMFFIL2.js → chunk-3DFVM6VK.js} +57 -13
- package/dist/{chunk-XQXYV6SR.js → chunk-BZGY6BZC.js} +338 -139
- package/dist/{chunk-25UGGXIE.js → chunk-GYUS2JVV.js} +24 -4
- package/dist/chunk-LZR5SZDS.js +498 -0
- package/dist/chunk-XLBFXACK.js +56 -0
- package/dist/filters/PhotoDateRangeFilter.d.ts +4 -1
- package/dist/filters/dateSliderPointer.d.ts +21 -0
- package/dist/hooks/useMapViewportBbox.d.ts +3 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3958 -1606
- package/dist/panels/MapillaryPanel.d.ts +7 -2
- package/dist/panels/PanoramaxPanel.d.ts +7 -2
- package/dist/panels/PanoramaxWebViewerPanel.d.ts +7 -2
- package/dist/panels/panoramaxItem.d.ts +2 -0
- package/dist/panels/photoView.d.ts +19 -0
- package/dist/panoramax-web-viewer.js +297 -93
- package/dist/photo-details.js +222 -151
- package/dist/viewer-panels.js +4 -3
- package/dist/viewpoints/FloatingPhotoViewer.d.ts +22 -7
- package/dist/viewpoints/floatingViewerPosition.d.ts +18 -0
- package/dist/viewpoints/usePhotosLookingAt.d.ts +26 -0
- package/package.json +5 -2
- package/dist/MapillaryPanel-FAXVZH37.js +0 -2
- package/dist/PanoramaxPanel-TWKTSOXM.js +0 -2
- package/dist/chunk-SGIB7AVC.js +0 -309
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { watchMapillaryJsView, panoramaxZoomLevel } from './chunk-XLBFXACK.js';
|
|
2
|
+
import { useViewerActions } from './chunk-GYUS2JVV.js';
|
|
3
|
+
import { c } from 'react/compiler-runtime';
|
|
4
|
+
import { providerExternalLink, getStreetImageryConfig } from '@osm-editor-kit/street-imagery';
|
|
3
5
|
import 'mapillary-js/dist/mapillary.css';
|
|
4
6
|
import { DataProviderBase, S2GeometryProvider, Viewer } from 'mapillary-js';
|
|
5
7
|
import { useRef, useState, useEffectEvent, useEffect } from 'react';
|
|
@@ -13,11 +15,16 @@ var toMs = (iso) => {
|
|
|
13
15
|
};
|
|
14
16
|
var orientation = (item) => item.properties?.["pers:interior_orientation"];
|
|
15
17
|
var isPanoramaxItemSpherical = (item) => orientation(item)?.field_of_view === 360;
|
|
18
|
+
var panoramaxItemFieldOfView = (item) => orientation(item)?.field_of_view ?? DEFAULT_FIELD_OF_VIEW_DEG;
|
|
16
19
|
var panoramaxItemSize = (item) => orientation(item)?.sensor_array_dimensions ?? (isPanoramaxItemSpherical(item) ? [2, 1] : [4, 3]);
|
|
17
20
|
var panoramaxItemNeighbour = (item, rel) => item.links?.find((link) => link.rel === rel)?.id ?? null;
|
|
18
21
|
var SD_WIDTH = 2048;
|
|
19
22
|
var panoramaxItemImageUrl = (item) => {
|
|
20
|
-
const {
|
|
23
|
+
const {
|
|
24
|
+
hd,
|
|
25
|
+
sd,
|
|
26
|
+
thumb
|
|
27
|
+
} = item.assets ?? {};
|
|
21
28
|
return sd?.href ?? hd?.href ?? thumb?.href ?? "";
|
|
22
29
|
};
|
|
23
30
|
var TILE_SIZE = 1024;
|
|
@@ -34,7 +41,10 @@ var panoramaxTilesOfLevel = (size, z) => {
|
|
|
34
41
|
const tiles = [];
|
|
35
42
|
for (let y = 0; y < Math.ceil(height / span); y++) {
|
|
36
43
|
for (let x = 0; x < Math.ceil(width / span); x++) {
|
|
37
|
-
tiles.push({
|
|
44
|
+
tiles.push({
|
|
45
|
+
x,
|
|
46
|
+
y
|
|
47
|
+
});
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
50
|
return tiles;
|
|
@@ -75,19 +85,45 @@ var panoramaxPhotoFromItem = (item) => {
|
|
|
75
85
|
const instance = item.links?.find((link) => link.rel === "via")?.instance_name;
|
|
76
86
|
const exifEntries = Object.entries(properties.exif ?? {}).filter(([, value]) => typeof value === "string" || typeof value === "number").map(([key, value]) => [key, String(value)]);
|
|
77
87
|
const details = {
|
|
78
|
-
...properties.license ? {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
...
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
...properties
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
...
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
...
|
|
88
|
+
...properties.license ? {
|
|
89
|
+
license: properties.license
|
|
90
|
+
} : {},
|
|
91
|
+
...licenseUrl ? {
|
|
92
|
+
licenseUrl
|
|
93
|
+
} : {},
|
|
94
|
+
...properties.datetimetz ? {
|
|
95
|
+
capturedAtLocal: properties.datetimetz
|
|
96
|
+
} : {},
|
|
97
|
+
...uploadedAt != null ? {
|
|
98
|
+
uploadedAt
|
|
99
|
+
} : {},
|
|
100
|
+
...cameraName ? {
|
|
101
|
+
camera: cameraName
|
|
102
|
+
} : {},
|
|
103
|
+
...!isPano && camera?.field_of_view ? {
|
|
104
|
+
fieldOfViewDeg: camera.field_of_view
|
|
105
|
+
} : {},
|
|
106
|
+
...properties["quality:horizontal_accuracy"] != null ? {
|
|
107
|
+
positionAccuracyMeters: properties["quality:horizontal_accuracy"]
|
|
108
|
+
} : {},
|
|
109
|
+
...instance ? {
|
|
110
|
+
instance
|
|
111
|
+
} : {},
|
|
112
|
+
...camera?.focal_length != null ? {
|
|
113
|
+
focalLengthMm: camera.focal_length
|
|
114
|
+
} : {},
|
|
115
|
+
...properties["original_file:name"] ? {
|
|
116
|
+
originalFileName: properties["original_file:name"]
|
|
117
|
+
} : {},
|
|
118
|
+
...properties["original_file:size"] != null ? {
|
|
119
|
+
originalFileSizeBytes: properties["original_file:size"]
|
|
120
|
+
} : {},
|
|
121
|
+
...properties["geovisio:rank_in_collection"] != null ? {
|
|
122
|
+
rankInSequence: properties["geovisio:rank_in_collection"]
|
|
123
|
+
} : {},
|
|
124
|
+
...exifEntries.length > 0 ? {
|
|
125
|
+
exif: Object.fromEntries(exifEntries)
|
|
126
|
+
} : {}
|
|
91
127
|
};
|
|
92
128
|
return {
|
|
93
129
|
providerId: "panoramax",
|
|
@@ -97,7 +133,9 @@ var panoramaxPhotoFromItem = (item) => {
|
|
|
97
133
|
isPano,
|
|
98
134
|
heading: properties["view:azimuth"] ?? null,
|
|
99
135
|
lngLat: item.geometry.coordinates,
|
|
100
|
-
...creatorName ? {
|
|
136
|
+
...creatorName ? {
|
|
137
|
+
creatorName
|
|
138
|
+
} : {},
|
|
101
139
|
details
|
|
102
140
|
};
|
|
103
141
|
};
|
|
@@ -119,7 +157,9 @@ var PanoramaxDataProvider = class extends DataProviderBase {
|
|
|
119
157
|
itemRequests = /* @__PURE__ */ new Map();
|
|
120
158
|
imageBuffers = /* @__PURE__ */ new Map();
|
|
121
159
|
pictures = /* @__PURE__ */ new Map();
|
|
122
|
-
constructor({
|
|
160
|
+
constructor({
|
|
161
|
+
endpoint
|
|
162
|
+
}) {
|
|
123
163
|
super(new S2GeometryProvider());
|
|
124
164
|
this.endpoint = endpoint.replace(/\/$/, "");
|
|
125
165
|
}
|
|
@@ -129,11 +169,17 @@ var PanoramaxDataProvider = class extends DataProviderBase {
|
|
|
129
169
|
}
|
|
130
170
|
// Only the arrows to pictures nearby need these, and those need a 3D reconstruction.
|
|
131
171
|
getCoreImages(cellId) {
|
|
132
|
-
return Promise.resolve({
|
|
172
|
+
return Promise.resolve({
|
|
173
|
+
cell_id: cellId,
|
|
174
|
+
images: []
|
|
175
|
+
});
|
|
133
176
|
}
|
|
134
177
|
async getImages(imageIds) {
|
|
135
178
|
const items = await this.loadItems(imageIds);
|
|
136
|
-
return items.map((item) => ({
|
|
179
|
+
return items.map((item) => ({
|
|
180
|
+
node: this.toImageEnt(item),
|
|
181
|
+
node_id: item.id
|
|
182
|
+
}));
|
|
137
183
|
}
|
|
138
184
|
getSpatialImages(imageIds) {
|
|
139
185
|
return this.getImages(imageIds);
|
|
@@ -144,12 +190,11 @@ var PanoramaxDataProvider = class extends DataProviderBase {
|
|
|
144
190
|
if (!item) {
|
|
145
191
|
throw new Error(`Panoramax picture ${imageId} not found`);
|
|
146
192
|
}
|
|
147
|
-
const around = [
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return { id: sequenceId, image_ids: around.filter((id) => id != null) };
|
|
193
|
+
const around = [panoramaxItemNeighbour(item, "prev"), item.id, panoramaxItemNeighbour(item, "next")];
|
|
194
|
+
return {
|
|
195
|
+
id: sequenceId,
|
|
196
|
+
image_ids: around.filter((id) => id != null)
|
|
197
|
+
};
|
|
153
198
|
}
|
|
154
199
|
// The viewer asks for the same file more than once while it starts; one download serves all.
|
|
155
200
|
getImageBuffer(url) {
|
|
@@ -170,7 +215,15 @@ var PanoramaxDataProvider = class extends DataProviderBase {
|
|
|
170
215
|
const tiles = item ? panoramaxTilesOfLevel(panoramaxViewerSize(item), z) : [];
|
|
171
216
|
return {
|
|
172
217
|
node_id: imageId,
|
|
173
|
-
node: tiles.map(({
|
|
218
|
+
node: tiles.map(({
|
|
219
|
+
x,
|
|
220
|
+
y
|
|
221
|
+
}) => ({
|
|
222
|
+
url: `${TILE_PREFIX}${imageId}/${z}/${x}/${y}`,
|
|
223
|
+
x,
|
|
224
|
+
y,
|
|
225
|
+
z
|
|
226
|
+
}))
|
|
174
227
|
};
|
|
175
228
|
}
|
|
176
229
|
async cutTile(url) {
|
|
@@ -180,27 +233,26 @@ var PanoramaxDataProvider = class extends DataProviderBase {
|
|
|
180
233
|
throw new Error(`Panoramax picture ${imageId} not loaded`);
|
|
181
234
|
}
|
|
182
235
|
const size = panoramaxViewerSize(item);
|
|
183
|
-
const {
|
|
236
|
+
const {
|
|
237
|
+
hd,
|
|
238
|
+
sd
|
|
239
|
+
} = item.assets ?? {};
|
|
184
240
|
const file = (panoramaxLevelNeedsOriginal(size, Number(z)) ? hd : sd) ?? hd ?? sd;
|
|
185
241
|
const original = await this.loadPicture(file?.href ?? "");
|
|
186
|
-
const rect = panoramaxTileRect(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
242
|
+
const rect = panoramaxTileRect(size, {
|
|
243
|
+
x: Number(x),
|
|
244
|
+
y: Number(y),
|
|
245
|
+
z: Number(z)
|
|
246
|
+
}, {
|
|
247
|
+
width: original.width,
|
|
248
|
+
height: original.height
|
|
249
|
+
});
|
|
191
250
|
const canvas = new OffscreenCanvas(rect.outWidth, rect.outHeight);
|
|
192
|
-
canvas.getContext("2d")?.drawImage(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
rect.height,
|
|
198
|
-
0,
|
|
199
|
-
0,
|
|
200
|
-
rect.outWidth,
|
|
201
|
-
rect.outHeight
|
|
202
|
-
);
|
|
203
|
-
const blob = await canvas.convertToBlob({ type: "image/jpeg", quality: 0.9 });
|
|
251
|
+
canvas.getContext("2d")?.drawImage(original, rect.x, rect.y, rect.width, rect.height, 0, 0, rect.outWidth, rect.outHeight);
|
|
252
|
+
const blob = await canvas.convertToBlob({
|
|
253
|
+
type: "image/jpeg",
|
|
254
|
+
quality: 0.9
|
|
255
|
+
});
|
|
204
256
|
return blob.arrayBuffer();
|
|
205
257
|
}
|
|
206
258
|
loadPicture(url) {
|
|
@@ -219,15 +271,24 @@ var PanoramaxDataProvider = class extends DataProviderBase {
|
|
|
219
271
|
return picture;
|
|
220
272
|
}
|
|
221
273
|
getMesh() {
|
|
222
|
-
return Promise.resolve({
|
|
274
|
+
return Promise.resolve({
|
|
275
|
+
faces: [],
|
|
276
|
+
vertices: []
|
|
277
|
+
});
|
|
223
278
|
}
|
|
224
279
|
getCluster(url) {
|
|
225
|
-
return Promise.resolve({
|
|
280
|
+
return Promise.resolve({
|
|
281
|
+
id: url,
|
|
282
|
+
points: {},
|
|
283
|
+
reference: {
|
|
284
|
+
lat: 0,
|
|
285
|
+
lng: 0,
|
|
286
|
+
alt: 0
|
|
287
|
+
}
|
|
288
|
+
});
|
|
226
289
|
}
|
|
227
290
|
async loadItems(imageIds) {
|
|
228
|
-
const missing = [
|
|
229
|
-
...new Set(imageIds.filter((id) => !this.items.has(id) && !this.itemRequests.has(id)))
|
|
230
|
-
];
|
|
291
|
+
const missing = [...new Set(imageIds.filter((id) => !this.items.has(id) && !this.itemRequests.has(id)))];
|
|
231
292
|
for (let start = 0; start < missing.length; start += IDS_PER_REQUEST) {
|
|
232
293
|
const ids = missing.slice(start, start + IDS_PER_REQUEST);
|
|
233
294
|
const request = fetch(`${this.endpoint}/search?ids=${ids.join(",")}&limit=${ids.length}`).then((response) => {
|
|
@@ -256,24 +317,37 @@ var PanoramaxDataProvider = class extends DataProviderBase {
|
|
|
256
317
|
const [width, height] = panoramaxViewerSize(item);
|
|
257
318
|
const spherical = isPanoramaxItemSpherical(item);
|
|
258
319
|
const properties = item.properties ?? {};
|
|
259
|
-
const none = {
|
|
320
|
+
const none = {
|
|
321
|
+
id: "",
|
|
322
|
+
url: ""
|
|
323
|
+
};
|
|
260
324
|
return {
|
|
261
325
|
id: item.id,
|
|
262
|
-
geometry: {
|
|
263
|
-
|
|
326
|
+
geometry: {
|
|
327
|
+
lat,
|
|
328
|
+
lng
|
|
329
|
+
},
|
|
330
|
+
sequence: {
|
|
331
|
+
id: `${SEQUENCE_PREFIX}${item.id}`
|
|
332
|
+
},
|
|
264
333
|
altitude: 0,
|
|
265
334
|
camera_type: spherical ? "spherical" : "perspective",
|
|
266
335
|
camera_parameters: spherical ? [] : [panoramaxItemFocal(item), 0, 0],
|
|
267
336
|
captured_at: Date.parse(properties.datetime ?? "") || 0,
|
|
268
337
|
compass_angle: properties["view:azimuth"] ?? 0,
|
|
269
338
|
cluster: none,
|
|
270
|
-
creator: {
|
|
339
|
+
creator: {
|
|
340
|
+
id: "",
|
|
341
|
+
username: properties["geovisio:producer"] ?? ""
|
|
342
|
+
},
|
|
271
343
|
// Panoramax serves its pictures upright.
|
|
272
344
|
exif_orientation: 1,
|
|
273
345
|
width,
|
|
274
346
|
height,
|
|
275
347
|
mesh: none,
|
|
276
|
-
owner: {
|
|
348
|
+
owner: {
|
|
349
|
+
id: ""
|
|
350
|
+
},
|
|
277
351
|
thumb: {
|
|
278
352
|
id: item.id,
|
|
279
353
|
url: panoramaxItemImageUrl(item)
|
|
@@ -281,15 +355,20 @@ var PanoramaxDataProvider = class extends DataProviderBase {
|
|
|
281
355
|
};
|
|
282
356
|
}
|
|
283
357
|
};
|
|
284
|
-
var PanoramaxPanel = ({
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
358
|
+
var PanoramaxPanel = (t0) => {
|
|
359
|
+
const $ = c(33);
|
|
360
|
+
const {
|
|
361
|
+
photo,
|
|
362
|
+
onPhotoSelected,
|
|
363
|
+
onEaseMapToPoint,
|
|
364
|
+
onViewerPhoto,
|
|
365
|
+
onViewerView,
|
|
366
|
+
hideAttribution: t1
|
|
367
|
+
} = t0;
|
|
368
|
+
const hideAttribution = t1 === void 0 ? false : t1;
|
|
291
369
|
const containerRef = useRef(null);
|
|
292
370
|
const viewerRef = useRef(null);
|
|
371
|
+
const dataProviderRef = useRef(null);
|
|
293
372
|
const navigableRef = useRef(false);
|
|
294
373
|
const pendingImageIdRef = useRef(null);
|
|
295
374
|
const lastViewerPhotoIdRef = useRef(null);
|
|
@@ -300,19 +379,40 @@ var PanoramaxPanel = ({
|
|
|
300
379
|
const [shownPhoto, setShownPhoto] = useState(null);
|
|
301
380
|
const emitPhotoSelected = useEffectEvent(onPhotoSelected);
|
|
302
381
|
const emitEaseMapToPoint = useEffectEvent(onEaseMapToPoint);
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
382
|
+
let t2;
|
|
383
|
+
if ($[0] !== onViewerPhoto) {
|
|
384
|
+
t2 = (viewerPhoto) => onViewerPhoto?.(viewerPhoto);
|
|
385
|
+
$[0] = onViewerPhoto;
|
|
386
|
+
$[1] = t2;
|
|
387
|
+
} else {
|
|
388
|
+
t2 = $[1];
|
|
389
|
+
}
|
|
390
|
+
const emitViewerPhoto = useEffectEvent(t2);
|
|
391
|
+
let t3;
|
|
392
|
+
if ($[2] !== actions) {
|
|
393
|
+
t3 = function resetViewerStoreOnProviderChange() {
|
|
308
394
|
return () => {
|
|
309
395
|
actions.reset();
|
|
310
396
|
};
|
|
311
|
-
}
|
|
312
|
-
[actions
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
397
|
+
};
|
|
398
|
+
$[2] = actions;
|
|
399
|
+
$[3] = t3;
|
|
400
|
+
} else {
|
|
401
|
+
t3 = $[3];
|
|
402
|
+
}
|
|
403
|
+
let t4;
|
|
404
|
+
if ($[4] !== actions || $[5] !== photo.providerId) {
|
|
405
|
+
t4 = [actions, photo.providerId];
|
|
406
|
+
$[4] = actions;
|
|
407
|
+
$[5] = photo.providerId;
|
|
408
|
+
$[6] = t4;
|
|
409
|
+
} else {
|
|
410
|
+
t4 = $[6];
|
|
411
|
+
}
|
|
412
|
+
useEffect(t3, t4);
|
|
413
|
+
let t5;
|
|
414
|
+
if ($[7] !== actions || $[8] !== emitEaseMapToPoint || $[9] !== emitPhotoSelected || $[10] !== emitViewerPhoto) {
|
|
415
|
+
t5 = function mountViewer() {
|
|
316
416
|
const container = containerRef.current;
|
|
317
417
|
if (!container) {
|
|
318
418
|
return;
|
|
@@ -320,17 +420,25 @@ var PanoramaxPanel = ({
|
|
|
320
420
|
const dataProvider = new PanoramaxDataProvider({
|
|
321
421
|
endpoint: `${getStreetImageryConfig().panoramaxApiBase}/api`
|
|
322
422
|
});
|
|
423
|
+
dataProviderRef.current = dataProvider;
|
|
323
424
|
const viewer = new Viewer({
|
|
324
425
|
container,
|
|
325
426
|
dataProvider,
|
|
326
427
|
imageId: initialPhotoIdRef.current,
|
|
327
428
|
component: {
|
|
328
|
-
// The attribution of the viewer links to mapillary.com.
|
|
329
429
|
attribution: false,
|
|
330
|
-
|
|
331
|
-
|
|
430
|
+
cache: {
|
|
431
|
+
depth: {
|
|
432
|
+
sequence: 1,
|
|
433
|
+
spherical: 0,
|
|
434
|
+
step: 0,
|
|
435
|
+
turn: 0
|
|
436
|
+
}
|
|
437
|
+
},
|
|
332
438
|
cover: false,
|
|
333
|
-
sequence: {
|
|
439
|
+
sequence: {
|
|
440
|
+
visible: true
|
|
441
|
+
}
|
|
334
442
|
}
|
|
335
443
|
});
|
|
336
444
|
viewerRef.current = viewer;
|
|
@@ -341,8 +449,7 @@ var PanoramaxPanel = ({
|
|
|
341
449
|
return;
|
|
342
450
|
}
|
|
343
451
|
pendingImageIdRef.current = null;
|
|
344
|
-
|
|
345
|
-
});
|
|
452
|
+
viewer.moveTo(pendingId).catch(_temp);
|
|
346
453
|
};
|
|
347
454
|
const onNavigable = (event) => {
|
|
348
455
|
navigableRef.current = event.navigable;
|
|
@@ -350,40 +457,47 @@ var PanoramaxPanel = ({
|
|
|
350
457
|
flushPendingMove();
|
|
351
458
|
}
|
|
352
459
|
};
|
|
353
|
-
const onImage = (
|
|
354
|
-
const {
|
|
460
|
+
const onImage = (event_0) => {
|
|
461
|
+
const {
|
|
462
|
+
image
|
|
463
|
+
} = event_0;
|
|
355
464
|
lastViewerPhotoIdRef.current = image.id;
|
|
356
465
|
const item = dataProvider.getItem(image.id);
|
|
357
466
|
if (!item) {
|
|
358
467
|
return;
|
|
359
468
|
}
|
|
360
|
-
const
|
|
469
|
+
const viewerPhoto_0 = panoramaxPhotoFromItem(item);
|
|
361
470
|
emitPhotoSelected({
|
|
362
471
|
provider: "panoramax",
|
|
363
|
-
sequenceId:
|
|
472
|
+
sequenceId: viewerPhoto_0.sequenceId ?? `photo:${image.id}`,
|
|
364
473
|
photoId: image.id
|
|
365
474
|
});
|
|
366
|
-
setShownPhoto(
|
|
367
|
-
emitViewerPhoto(
|
|
475
|
+
setShownPhoto(viewerPhoto_0);
|
|
476
|
+
emitViewerPhoto(viewerPhoto_0);
|
|
368
477
|
actions.setPov({
|
|
369
|
-
lngLat:
|
|
370
|
-
...!
|
|
478
|
+
lngLat: viewerPhoto_0.lngLat,
|
|
479
|
+
...!viewerPhoto_0.isPano && viewerPhoto_0.heading != null ? {
|
|
480
|
+
bearing: viewerPhoto_0.heading
|
|
481
|
+
} : {}
|
|
371
482
|
});
|
|
372
|
-
emitEaseMapToPoint(...
|
|
483
|
+
emitEaseMapToPoint(...viewerPhoto_0.lngLat);
|
|
373
484
|
};
|
|
374
485
|
const flushBearing = () => {
|
|
375
486
|
bearingRafRef.current = null;
|
|
376
487
|
if (pendingBearingRef.current != null) {
|
|
377
|
-
actions.setPov({
|
|
488
|
+
actions.setPov({
|
|
489
|
+
bearing: pendingBearingRef.current
|
|
490
|
+
});
|
|
378
491
|
pendingBearingRef.current = null;
|
|
379
492
|
}
|
|
380
|
-
|
|
381
|
-
actions.setPov({
|
|
382
|
-
|
|
383
|
-
|
|
493
|
+
viewer.getFieldOfView().then((fov) => {
|
|
494
|
+
actions.setPov({
|
|
495
|
+
hfov: fov
|
|
496
|
+
});
|
|
497
|
+
}).catch(_temp2);
|
|
384
498
|
};
|
|
385
|
-
const onBearing = (
|
|
386
|
-
pendingBearingRef.current =
|
|
499
|
+
const onBearing = (event_1) => {
|
|
500
|
+
pendingBearingRef.current = event_1.bearing;
|
|
387
501
|
if (bearingRafRef.current == null) {
|
|
388
502
|
bearingRafRef.current = requestAnimationFrame(flushBearing);
|
|
389
503
|
}
|
|
@@ -407,60 +521,145 @@ var PanoramaxPanel = ({
|
|
|
407
521
|
viewer.remove();
|
|
408
522
|
viewerRef.current = null;
|
|
409
523
|
};
|
|
410
|
-
}
|
|
411
|
-
[actions
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
524
|
+
};
|
|
525
|
+
$[7] = actions;
|
|
526
|
+
$[8] = emitEaseMapToPoint;
|
|
527
|
+
$[9] = emitPhotoSelected;
|
|
528
|
+
$[10] = emitViewerPhoto;
|
|
529
|
+
$[11] = t5;
|
|
530
|
+
} else {
|
|
531
|
+
t5 = $[11];
|
|
532
|
+
}
|
|
533
|
+
let t6;
|
|
534
|
+
if ($[12] !== actions) {
|
|
535
|
+
t6 = [actions];
|
|
536
|
+
$[12] = actions;
|
|
537
|
+
$[13] = t6;
|
|
538
|
+
} else {
|
|
539
|
+
t6 = $[13];
|
|
540
|
+
}
|
|
541
|
+
useEffect(t5, t6);
|
|
542
|
+
let t7;
|
|
543
|
+
if ($[14] !== onViewerView) {
|
|
544
|
+
t7 = (view) => onViewerView?.(view);
|
|
545
|
+
$[14] = onViewerView;
|
|
546
|
+
$[15] = t7;
|
|
547
|
+
} else {
|
|
548
|
+
t7 = $[15];
|
|
549
|
+
}
|
|
550
|
+
const emitViewerView = useEffectEvent(t7);
|
|
551
|
+
const reportsView = onViewerView !== void 0;
|
|
552
|
+
let t8;
|
|
553
|
+
if ($[16] !== emitViewerView || $[17] !== reportsView) {
|
|
554
|
+
t8 = function reportViewInPhoto() {
|
|
555
|
+
const viewer_0 = viewerRef.current;
|
|
556
|
+
if (!viewer_0 || !reportsView) {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
const read = async () => {
|
|
560
|
+
const [image_0, t92, fov_0] = await Promise.all([viewer_0.getImage(), viewer_0.getPointOfView(), viewer_0.getFieldOfView()]);
|
|
561
|
+
const {
|
|
562
|
+
bearing,
|
|
563
|
+
tilt
|
|
564
|
+
} = t92;
|
|
565
|
+
const item_0 = dataProviderRef.current?.getItem(image_0.id);
|
|
566
|
+
return item_0 ? {
|
|
567
|
+
providerId: "panoramax",
|
|
568
|
+
photoId: image_0.id,
|
|
569
|
+
heading: bearing,
|
|
570
|
+
pitch: tilt,
|
|
571
|
+
zoom: panoramaxZoomLevel(fov_0, panoramaxItemFieldOfView(item_0))
|
|
572
|
+
} : null;
|
|
573
|
+
};
|
|
574
|
+
return watchMapillaryJsView(viewer_0, read, (view_0) => emitViewerView(view_0));
|
|
575
|
+
};
|
|
576
|
+
$[16] = emitViewerView;
|
|
577
|
+
$[17] = reportsView;
|
|
578
|
+
$[18] = t8;
|
|
579
|
+
} else {
|
|
580
|
+
t8 = $[18];
|
|
581
|
+
}
|
|
582
|
+
let t9;
|
|
583
|
+
if ($[19] !== actions || $[20] !== reportsView) {
|
|
584
|
+
t9 = [actions, reportsView];
|
|
585
|
+
$[19] = actions;
|
|
586
|
+
$[20] = reportsView;
|
|
587
|
+
$[21] = t9;
|
|
588
|
+
} else {
|
|
589
|
+
t9 = $[21];
|
|
590
|
+
}
|
|
591
|
+
useEffect(t8, t9);
|
|
592
|
+
let t10;
|
|
593
|
+
let t11;
|
|
594
|
+
if ($[22] !== actions || $[23] !== photo.photoId) {
|
|
595
|
+
t10 = function syncExternalPhotoSelection() {
|
|
596
|
+
const viewer_1 = viewerRef.current;
|
|
597
|
+
if (!viewer_1 || photo.photoId === lastViewerPhotoIdRef.current) {
|
|
417
598
|
return;
|
|
418
599
|
}
|
|
419
600
|
actions.reset();
|
|
420
601
|
lastViewerPhotoIdRef.current = photo.photoId;
|
|
421
602
|
if (navigableRef.current) {
|
|
422
|
-
|
|
423
|
-
});
|
|
603
|
+
viewer_1.moveTo(photo.photoId).catch(_temp3);
|
|
424
604
|
} else {
|
|
425
605
|
pendingImageIdRef.current = photo.photoId;
|
|
426
606
|
}
|
|
427
|
-
}
|
|
428
|
-
[actions, photo.photoId]
|
|
429
|
-
|
|
607
|
+
};
|
|
608
|
+
t11 = [actions, photo.photoId];
|
|
609
|
+
$[22] = actions;
|
|
610
|
+
$[23] = photo.photoId;
|
|
611
|
+
$[24] = t10;
|
|
612
|
+
$[25] = t11;
|
|
613
|
+
} else {
|
|
614
|
+
t10 = $[24];
|
|
615
|
+
t11 = $[25];
|
|
616
|
+
}
|
|
617
|
+
useEffect(t10, t11);
|
|
430
618
|
const attribution = hideAttribution ? null : shownPhoto;
|
|
431
619
|
const license = attribution?.details?.license;
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}
|
|
463
|
-
|
|
620
|
+
let t12;
|
|
621
|
+
let t13;
|
|
622
|
+
if ($[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
623
|
+
t12 = {
|
|
624
|
+
aspectRatio: "4 / 3"
|
|
625
|
+
};
|
|
626
|
+
t13 = /* @__PURE__ */ jsx("div", { ref: containerRef, className: "h-full w-full" });
|
|
627
|
+
$[26] = t12;
|
|
628
|
+
$[27] = t13;
|
|
629
|
+
} else {
|
|
630
|
+
t12 = $[26];
|
|
631
|
+
t13 = $[27];
|
|
632
|
+
}
|
|
633
|
+
let t14;
|
|
634
|
+
if ($[28] !== attribution || $[29] !== license) {
|
|
635
|
+
t14 = attribution ? /* @__PURE__ */ jsxs("div", { className: "absolute right-0 bottom-0 flex gap-1.5 rounded-tl bg-black/50 px-1.5 py-0.5 text-[11px] leading-4 text-white", children: [
|
|
636
|
+
/* @__PURE__ */ jsx("a", { className: "underline-offset-2 hover:underline", href: providerExternalLink(attribution), rel: "noreferrer", target: "_blank", children: ["Panoramax", attribution.creatorName].filter(Boolean).join(" \xB7 ") }),
|
|
637
|
+
license ? attribution.details?.licenseUrl ? /* @__PURE__ */ jsx("a", { className: "underline-offset-2 hover:underline", href: attribution.details.licenseUrl, rel: "noreferrer", target: "_blank", children: license }) : /* @__PURE__ */ jsx("span", { children: license }) : null
|
|
638
|
+
] }) : null;
|
|
639
|
+
$[28] = attribution;
|
|
640
|
+
$[29] = license;
|
|
641
|
+
$[30] = t14;
|
|
642
|
+
} else {
|
|
643
|
+
t14 = $[30];
|
|
644
|
+
}
|
|
645
|
+
let t15;
|
|
646
|
+
if ($[31] !== t14) {
|
|
647
|
+
t15 = /* @__PURE__ */ jsxs("div", { className: "relative min-h-48 overflow-hidden rounded-lg border border-slate-200 bg-slate-900", style: t12, children: [
|
|
648
|
+
t13,
|
|
649
|
+
t14
|
|
650
|
+
] });
|
|
651
|
+
$[31] = t14;
|
|
652
|
+
$[32] = t15;
|
|
653
|
+
} else {
|
|
654
|
+
t15 = $[32];
|
|
655
|
+
}
|
|
656
|
+
return t15;
|
|
464
657
|
};
|
|
658
|
+
function _temp() {
|
|
659
|
+
}
|
|
660
|
+
function _temp2() {
|
|
661
|
+
}
|
|
662
|
+
function _temp3() {
|
|
663
|
+
}
|
|
465
664
|
|
|
466
665
|
export { PanoramaxDataProvider, PanoramaxPanel, panoramaxPhotoFromItem };
|