@osm-editor-kit/street-imagery-react 0.1.0-alpha.5 → 0.1.0-alpha.7
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 +45 -0
- package/dist/MapillaryPanel-N45NQY4C.js +2 -0
- package/dist/PanoramaxPanel-MFI4L67Z.js +2 -0
- package/dist/StreetLevelImagerySelectionOverlay.d.ts +20 -3
- package/dist/StreetLevelImagerySourcesAndLayers.d.ts +9 -1
- package/dist/StreetLevelImageryViewCone.d.ts +11 -1
- package/dist/StreetLevelImageryViewer.d.ts +7 -2
- package/dist/{chunk-72HJV6II.js → chunk-53RA4OSJ.js} +6 -2
- package/dist/chunk-EE7V3OIZ.js +116 -0
- package/dist/chunk-EQ2JKLGT.js +311 -0
- package/dist/hooks/useAllProviderMapFeatures.d.ts +0 -4
- package/dist/i18n/PhotoCount.d.ts +12 -0
- package/dist/i18n/PhotoDate.d.ts +16 -0
- package/dist/i18n/StreetImageryLocaleProvider.d.ts +21 -0
- package/dist/i18n/messages.d.ts +27 -0
- package/dist/index.d.ts +12 -4
- package/dist/index.js +593 -182
- package/dist/mapillary/MapillaryFeatureBar.d.ts +16 -0
- package/dist/mapillary/featureBarLabels.d.ts +16 -0
- package/dist/openers/LocationPickOnMap.d.ts +10 -0
- package/dist/openers/useLocationPickStore.d.ts +9 -0
- package/dist/panels/MapillaryPanel.d.ts +7 -1
- package/dist/panels/PanoramaxPanel.d.ts +8 -1
- package/dist/panels/panoramaxLimitPanning.d.ts +54 -0
- package/dist/panels/panoramaxPhotoFromMetadata.d.ts +8 -0
- package/dist/photo-details/PhotoDetailsDialog.d.ts +21 -0
- package/dist/photo-details/index.d.ts +6 -0
- package/dist/photo-details/labels.d.ts +33 -0
- package/dist/photo-details.js +235 -0
- package/dist/viewpoints/FloatingPhotoViewer.d.ts +33 -4
- package/dist/viewpoints/useViewpointSessionStore.d.ts +6 -10
- package/dist/viewpoints/viewDirectionLabels.d.ts +4 -4
- package/package.json +11 -2
- package/dist/MapillaryPanel-I5GKT6YT.js +0 -2
- package/dist/PanoramaxPanel-J6ANR6LB.js +0 -2
- package/dist/chunk-ZH3TPW4D.js +0 -165
package/dist/chunk-ZH3TPW4D.js
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { useViewerActions } from './chunk-25UGGXIE.js';
|
|
2
|
-
import '@panoramax/web-viewer';
|
|
3
|
-
import { getStreetImageryConfig } from '@osm-editor-kit/street-imagery';
|
|
4
|
-
import { useRef, useEffect } from 'react';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
var panoramaxApiEndpoint = () => `${getStreetImageryConfig().panoramaxApiBase}/api`;
|
|
8
|
-
var normalizeBearing = (degrees) => (degrees % 360 + 360) % 360;
|
|
9
|
-
var PanoramaxPanel = ({
|
|
10
|
-
photo,
|
|
11
|
-
onPhotoSelected,
|
|
12
|
-
onEaseMapToPoint
|
|
13
|
-
}) => {
|
|
14
|
-
const containerRef = useRef(null);
|
|
15
|
-
const viewerRef = useRef(null);
|
|
16
|
-
const lastViewerPhotoIdRef = useRef(null);
|
|
17
|
-
const readyRef = useRef(false);
|
|
18
|
-
const pendingSelectRef = useRef(null);
|
|
19
|
-
const photoRef = useRef(photo);
|
|
20
|
-
const bearingRafRef = useRef(null);
|
|
21
|
-
const pendingBearingRef = useRef(null);
|
|
22
|
-
const pendingHfovRef = useRef(null);
|
|
23
|
-
const actions = useViewerActions();
|
|
24
|
-
useEffect(
|
|
25
|
-
function syncPhotoRef() {
|
|
26
|
-
photoRef.current = photo;
|
|
27
|
-
},
|
|
28
|
-
[photo]
|
|
29
|
-
);
|
|
30
|
-
useEffect(
|
|
31
|
-
function resetViewerStoreOnProviderChange() {
|
|
32
|
-
return () => {
|
|
33
|
-
actions.reset();
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
[actions, photo.providerId]
|
|
37
|
-
);
|
|
38
|
-
useEffect(
|
|
39
|
-
function mountPanoramaxViewer() {
|
|
40
|
-
const viewer = viewerRef.current;
|
|
41
|
-
const container = containerRef.current;
|
|
42
|
-
if (!viewer || !container) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
lastViewerPhotoIdRef.current = photoRef.current.photoId;
|
|
46
|
-
const flushBearing = () => {
|
|
47
|
-
bearingRafRef.current = null;
|
|
48
|
-
if (pendingBearingRef.current != null) {
|
|
49
|
-
actions.setPov({ bearing: pendingBearingRef.current });
|
|
50
|
-
pendingBearingRef.current = null;
|
|
51
|
-
}
|
|
52
|
-
if (pendingHfovRef.current != null) {
|
|
53
|
-
actions.setPov({ hfov: pendingHfovRef.current });
|
|
54
|
-
pendingHfovRef.current = null;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const onSelect = (event) => {
|
|
58
|
-
const { seqId, picId } = event.detail;
|
|
59
|
-
if (!picId) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
lastViewerPhotoIdRef.current = picId;
|
|
63
|
-
const currentPhoto = photoRef.current;
|
|
64
|
-
const sequenceId = seqId ?? (picId === currentPhoto.photoId && currentPhoto.sequenceId ? currentPhoto.sequenceId : `photo:${picId}`);
|
|
65
|
-
onPhotoSelected({
|
|
66
|
-
provider: "panoramax",
|
|
67
|
-
sequenceId,
|
|
68
|
-
photoId: picId
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
const onPictureLoaded = (event) => {
|
|
72
|
-
const detail = event.detail;
|
|
73
|
-
if (detail.lon == null || detail.lat == null) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
actions.setPov({ lngLat: [detail.lon, detail.lat] });
|
|
77
|
-
if (detail.x != null) {
|
|
78
|
-
actions.setPov({ bearing: normalizeBearing(detail.x) });
|
|
79
|
-
}
|
|
80
|
-
const psv = viewer.psv;
|
|
81
|
-
if (psv && detail.z != null) {
|
|
82
|
-
actions.setPov({ hfov: psv.dataHelper.zoomLevelToFov(detail.z) });
|
|
83
|
-
}
|
|
84
|
-
onEaseMapToPoint(detail.lon, detail.lat);
|
|
85
|
-
};
|
|
86
|
-
const onViewRotated = (event) => {
|
|
87
|
-
const detail = event.detail;
|
|
88
|
-
pendingBearingRef.current = normalizeBearing(detail.x);
|
|
89
|
-
const psv = viewer.psv;
|
|
90
|
-
if (psv && detail.z != null) {
|
|
91
|
-
pendingHfovRef.current = psv.dataHelper.zoomLevelToFov(detail.z);
|
|
92
|
-
}
|
|
93
|
-
if (bearingRafRef.current == null) {
|
|
94
|
-
bearingRafRef.current = requestAnimationFrame(flushBearing);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
viewer.addEventListener("select", onSelect);
|
|
98
|
-
viewer.addEventListener("psv:picture-loaded", onPictureLoaded);
|
|
99
|
-
viewer.addEventListener("psv:view-rotated", onViewRotated);
|
|
100
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
101
|
-
viewer.psv?.resize();
|
|
102
|
-
});
|
|
103
|
-
resizeObserver.observe(container);
|
|
104
|
-
readyRef.current = true;
|
|
105
|
-
const pending = pendingSelectRef.current;
|
|
106
|
-
if (pending) {
|
|
107
|
-
pendingSelectRef.current = null;
|
|
108
|
-
if (typeof viewer.select === "function") {
|
|
109
|
-
viewer.select(pending.sequenceId ?? null, pending.photoId);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return () => {
|
|
113
|
-
readyRef.current = false;
|
|
114
|
-
if (bearingRafRef.current != null) {
|
|
115
|
-
cancelAnimationFrame(bearingRafRef.current);
|
|
116
|
-
bearingRafRef.current = null;
|
|
117
|
-
}
|
|
118
|
-
resizeObserver.disconnect();
|
|
119
|
-
viewer.removeEventListener("select", onSelect);
|
|
120
|
-
viewer.removeEventListener("psv:picture-loaded", onPictureLoaded);
|
|
121
|
-
viewer.removeEventListener("psv:view-rotated", onViewRotated);
|
|
122
|
-
};
|
|
123
|
-
},
|
|
124
|
-
[actions, onEaseMapToPoint, onPhotoSelected]
|
|
125
|
-
);
|
|
126
|
-
useEffect(
|
|
127
|
-
function syncExternalPhotoSelection() {
|
|
128
|
-
const viewer = viewerRef.current;
|
|
129
|
-
if (!viewer || photo.photoId === lastViewerPhotoIdRef.current) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
actions.reset();
|
|
133
|
-
lastViewerPhotoIdRef.current = photo.photoId;
|
|
134
|
-
if (!readyRef.current) {
|
|
135
|
-
pendingSelectRef.current = { sequenceId: photo.sequenceId, photoId: photo.photoId };
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (typeof viewer.select === "function") {
|
|
139
|
-
viewer.select(photo.sequenceId ?? null, photo.photoId);
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
[actions, photo.photoId, photo.sequenceId]
|
|
143
|
-
);
|
|
144
|
-
return /* @__PURE__ */ jsx(
|
|
145
|
-
"div",
|
|
146
|
-
{
|
|
147
|
-
ref: containerRef,
|
|
148
|
-
className: "min-h-48 overflow-hidden rounded-lg border border-slate-200 bg-slate-900",
|
|
149
|
-
style: { aspectRatio: "4 / 3" },
|
|
150
|
-
children: /* @__PURE__ */ jsx(
|
|
151
|
-
"pnx-photo-viewer",
|
|
152
|
-
{
|
|
153
|
-
ref: viewerRef,
|
|
154
|
-
className: "block h-full w-full",
|
|
155
|
-
endpoint: panoramaxApiEndpoint(),
|
|
156
|
-
"url-parameters": "false",
|
|
157
|
-
picture: photo.photoId,
|
|
158
|
-
sequence: photo.sequenceId ?? void 0
|
|
159
|
-
}
|
|
160
|
-
)
|
|
161
|
-
}
|
|
162
|
-
);
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export { PanoramaxPanel };
|