@osm-editor-kit/street-imagery-react 0.1.0-alpha.10 → 0.1.0-alpha.12
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/dist/hooks/useProviderData.d.ts +6 -0
- package/dist/index.js +150 -84
- package/package.json +2 -2
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { Bbox } from '@osm-editor-kit/street-imagery';
|
|
2
2
|
import { type ProviderId } from '@osm-editor-kit/street-imagery';
|
|
3
|
+
import { keepPreviousData } from '@tanstack/react-query';
|
|
4
|
+
/**
|
|
5
|
+
* Keeps the last result on screen while the next viewport loads. Only while the query is on:
|
|
6
|
+
* a query that is off (provider turned off, zoomed out too far) would show that result forever.
|
|
7
|
+
*/
|
|
8
|
+
export declare const previousDataWhile: (enabled: boolean) => typeof keepPreviousData | undefined;
|
|
3
9
|
/** Host limit on top of the provider's own minimum zooms: below it nothing is requested. */
|
|
4
10
|
type ProviderDataOptions = {
|
|
5
11
|
minZoom?: number;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useStreetImageryI18n } from './chunk-6EMFFIL2.js';
|
|
2
2
|
export { STREET_IMAGERY_MESSAGES, StreetImageryLocaleProvider, useStreetImageryI18n } from './chunk-6EMFFIL2.js';
|
|
3
3
|
export { useViewerActions, useViewerBearing, useViewerHfov, useViewerLngLat } from './chunk-25UGGXIE.js';
|
|
4
|
-
import { distanceMeters, sequencesToFeatureCollection, emptyLineCollection, adapterById, providerById, providerCoversBbox, fetchedSequencesMinZoom, viewConeGeoJson, viewShapeRadiusMeters, setStreetImageryConfig, viewfieldLayerId, photoLayerId, photoTargetLayerId, featureLayerId, PROVIDER_IDS, mapFeatureMatchesDateRange, isBrowserAvailableProvider,
|
|
4
|
+
import { distanceMeters, sequencesToFeatureCollection, emptyLineCollection, adapterById, providerById, providerCoversBbox, fetchedSequencesMinZoom, viewConeGeoJson, viewShapeRadiusMeters, setStreetImageryConfig, viewfieldLayerId, photoLayerId, photoTargetLayerId, featureLayerId, PROVIDER_IDS, mapFeatureMatchesDateRange, isBrowserAvailableProvider, photoFilter, resolvePhotoPanoramaUrl, photoFullUrlQueryKey, resolvePhotoThumbnailUrl, photoThumbnailQueryKey, formatLocalDateTime, formatMonth, formatRelativeDate, formatDateTooltip, mapillaryPhotoSource, buildViewSuggestions, yearsToMs, SIGN_TARGET, fetchMapFeatureImages, fetchMapillaryMapFeaturesInBbox, bboxAround, fetchImageDetections, bestTargetImage, findLocationOpener, MAP_FEATURE_COLOR, mapillaryValueName, mapillaryIconUrl, dateRangeToSliderPositions, sliderPositionsToDateRange, dateSliderBins, dateSliderPosition, yearsAgoMs, parseIsoDateStartMs, openLocationInNewTab, formatDate, isIsoDate, alignLineToPoints, coneRadiusMeters, emptyPointCollection, mapFeaturesToFeatureCollection, buildMapFeatureLayerFilter, featureSourceId, buildPhotoLayerFilter, photoSourceId, viewfieldSourceId, sequenceTilesSourceId, renameExpressionProperties, sequenceTilesLayerId, sequenceSourceId, sequenceLayerId, viewfieldLineLayerId, VIEWFIELD_MIN_ZOOM, photosToFeatureCollection, photosToViewfieldsFeatureCollection, emptyPolygonCollection } from '@osm-editor-kit/street-imagery';
|
|
5
5
|
import { Source, Layer, useMap } from 'react-map-gl/maplibre';
|
|
6
6
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
7
|
-
import { lazy, useEffect, Fragment as Fragment$1, Suspense, useState, useRef, useEffectEvent } from 'react';
|
|
8
|
-
import { useQuery, useQueries } from '@tanstack/react-query';
|
|
7
|
+
import { lazy, useEffect, Fragment as Fragment$1, Suspense, useState, useRef, useEffectEvent, useMemo } from 'react';
|
|
8
|
+
import { keepPreviousData, useQuery, useQueries } from '@tanstack/react-query';
|
|
9
9
|
import { create } from 'zustand';
|
|
10
10
|
|
|
11
11
|
var POINTS_SOURCE_ID = "selection-highlight";
|
|
@@ -139,6 +139,7 @@ var withinBbox = (bbox) => (item) => {
|
|
|
139
139
|
const [lng, lat] = item.lngLat;
|
|
140
140
|
return lng >= bbox[0] && lng <= bbox[2] && lat >= bbox[1] && lat <= bbox[3];
|
|
141
141
|
};
|
|
142
|
+
var previousDataWhile = (enabled) => enabled ? keepPreviousData : void 0;
|
|
142
143
|
var useProviderPhotos = (providerId, bbox, zoom, { minZoom = 0 } = {}) => {
|
|
143
144
|
const adapter = adapterById[providerId];
|
|
144
145
|
const meta = providerById[providerId];
|
|
@@ -150,7 +151,7 @@ var useProviderPhotos = (providerId, bbox, zoom, { minZoom = 0 } = {}) => {
|
|
|
150
151
|
return photos.filter(withinBbox(bbox));
|
|
151
152
|
},
|
|
152
153
|
enabled,
|
|
153
|
-
placeholderData: (
|
|
154
|
+
placeholderData: previousDataWhile(enabled)
|
|
154
155
|
});
|
|
155
156
|
};
|
|
156
157
|
var useProviderSequences = (providerId, bbox, zoom, { minZoom = 0 } = {}) => {
|
|
@@ -162,7 +163,7 @@ var useProviderSequences = (providerId, bbox, zoom, { minZoom = 0 } = {}) => {
|
|
|
162
163
|
queryKey: ["provider-sequences", providerId, bboxKey(bbox), zoom],
|
|
163
164
|
queryFn: ({ signal }) => adapter?.fetchSequences?.(bbox, zoom, signal) ?? [],
|
|
164
165
|
enabled,
|
|
165
|
-
placeholderData: (
|
|
166
|
+
placeholderData: previousDataWhile(enabled)
|
|
166
167
|
});
|
|
167
168
|
};
|
|
168
169
|
var useProviderMapFeatures = (providerId, bbox, zoom, { minZoom = 0 } = {}) => {
|
|
@@ -176,7 +177,7 @@ var useProviderMapFeatures = (providerId, bbox, zoom, { minZoom = 0 } = {}) => {
|
|
|
176
177
|
return features.filter(withinBbox(bbox));
|
|
177
178
|
},
|
|
178
179
|
enabled,
|
|
179
|
-
placeholderData: (
|
|
180
|
+
placeholderData: previousDataWhile(enabled)
|
|
180
181
|
});
|
|
181
182
|
};
|
|
182
183
|
var CONE_SOURCE_ID = "view-direction-cone";
|
|
@@ -279,8 +280,95 @@ var AGE_SHADE = [
|
|
|
279
280
|
]
|
|
280
281
|
];
|
|
281
282
|
var PHOTO_TARGET_RADIUS_PX = 10;
|
|
282
|
-
var
|
|
283
|
-
var
|
|
283
|
+
var NO_PHOTOS = [];
|
|
284
|
+
var NO_SEQUENCES = [];
|
|
285
|
+
var NO_MAP_FEATURES = [];
|
|
286
|
+
var bboxesOverlap = (a, b) => a[0] <= b[2] && a[2] >= b[0] && a[1] <= b[3] && a[3] >= b[1];
|
|
287
|
+
var sequenceBbox = ({ geometry }) => {
|
|
288
|
+
const lines = geometry.type === "LineString" ? [geometry.coordinates] : geometry.coordinates;
|
|
289
|
+
const bbox = [Infinity, Infinity, -Infinity, -Infinity];
|
|
290
|
+
for (const line of lines) {
|
|
291
|
+
for (const [lng, lat] of line) {
|
|
292
|
+
if (lng === void 0 || lat === void 0) continue;
|
|
293
|
+
bbox[0] = Math.min(bbox[0], lng);
|
|
294
|
+
bbox[1] = Math.min(bbox[1], lat);
|
|
295
|
+
bbox[2] = Math.max(bbox[2], lng);
|
|
296
|
+
bbox[3] = Math.max(bbox[3], lat);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return bbox;
|
|
300
|
+
};
|
|
301
|
+
var buildPhotoLayerData = ({
|
|
302
|
+
photos,
|
|
303
|
+
sequences,
|
|
304
|
+
bbox,
|
|
305
|
+
photoTypes,
|
|
306
|
+
date,
|
|
307
|
+
showPhotos,
|
|
308
|
+
showSequences,
|
|
309
|
+
viewfieldZoom
|
|
310
|
+
}) => {
|
|
311
|
+
const matchesFilters = photoFilter(photoTypes, date);
|
|
312
|
+
const visiblePhotos = showPhotos ? photos.filter(matchesFilters) : [];
|
|
313
|
+
const drawBbox = bbox ? padBbox(bbox, 0.25) : null;
|
|
314
|
+
const drawnPhotos = drawBbox ? visiblePhotos.filter((photo) => lngLatInBbox(photo.lngLat, drawBbox)) : [...visiblePhotos];
|
|
315
|
+
drawnPhotos.sort((a, b) => (a.capturedAt ?? 0) - (b.capturedAt ?? 0));
|
|
316
|
+
const photoCollection = showPhotos ? photosToFeatureCollection(drawnPhotos) : emptyPointCollection();
|
|
317
|
+
const viewfieldCollection = viewfieldZoom != null ? photosToViewfieldsFeatureCollection(visiblePhotos, viewfieldZoom, { bbox }) : emptyPolygonCollection();
|
|
318
|
+
const sequenceCapturedAtById = /* @__PURE__ */ new Map();
|
|
319
|
+
for (const photo of visiblePhotos) {
|
|
320
|
+
if (photo.sequenceId == null || photo.capturedAt == null) continue;
|
|
321
|
+
const prev = sequenceCapturedAtById.get(photo.sequenceId);
|
|
322
|
+
if (prev == null || photo.capturedAt > prev) {
|
|
323
|
+
sequenceCapturedAtById.set(photo.sequenceId, photo.capturedAt);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const filteredSequences = showSequences ? sequences.map((sequence) => {
|
|
327
|
+
if (sequence.capturedAt != null) return sequence;
|
|
328
|
+
const fromPhotos = sequenceCapturedAtById.get(sequence.sequenceId);
|
|
329
|
+
return fromPhotos != null ? { ...sequence, capturedAt: fromPhotos } : sequence;
|
|
330
|
+
}).filter((sequence) => {
|
|
331
|
+
const asPhoto = {
|
|
332
|
+
providerId: sequence.providerId,
|
|
333
|
+
photoId: sequence.sequenceId,
|
|
334
|
+
sequenceId: sequence.sequenceId,
|
|
335
|
+
capturedAt: sequence.capturedAt,
|
|
336
|
+
isPano: sequence.isPano,
|
|
337
|
+
heading: null,
|
|
338
|
+
lngLat: [0, 0]
|
|
339
|
+
};
|
|
340
|
+
return matchesFilters(asPhoto) && (!drawBbox || bboxesOverlap(sequenceBbox(sequence), drawBbox));
|
|
341
|
+
}) : [];
|
|
342
|
+
const photoLngLatsBySequence = /* @__PURE__ */ new Map();
|
|
343
|
+
for (const photo of photos) {
|
|
344
|
+
if (photo.sequenceId == null) continue;
|
|
345
|
+
const list = photoLngLatsBySequence.get(photo.sequenceId);
|
|
346
|
+
if (list) {
|
|
347
|
+
list.push(photo.lngLat);
|
|
348
|
+
} else {
|
|
349
|
+
photoLngLatsBySequence.set(photo.sequenceId, [photo.lngLat]);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
const alignedSequences = filteredSequences.map((sequence) => {
|
|
353
|
+
const points = photoLngLatsBySequence.get(sequence.sequenceId);
|
|
354
|
+
if (!points) return sequence;
|
|
355
|
+
const { geometry } = sequence;
|
|
356
|
+
return {
|
|
357
|
+
...sequence,
|
|
358
|
+
geometry: geometry.type === "LineString" ? {
|
|
359
|
+
...geometry,
|
|
360
|
+
coordinates: alignLineToPoints(geometry.coordinates, points)
|
|
361
|
+
} : {
|
|
362
|
+
...geometry,
|
|
363
|
+
coordinates: geometry.coordinates.map(
|
|
364
|
+
(line) => alignLineToPoints(line, points)
|
|
365
|
+
)
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
});
|
|
369
|
+
const sequenceCollection = alignedSequences.length > 0 ? sequencesToFeatureCollection(alignedSequences) : emptyLineCollection();
|
|
370
|
+
return { photoCollection, viewfieldCollection, sequenceCollection };
|
|
371
|
+
};
|
|
284
372
|
var PhotoProviderLayer = ({
|
|
285
373
|
providerId,
|
|
286
374
|
bbox,
|
|
@@ -300,15 +388,44 @@ var PhotoProviderLayer = ({
|
|
|
300
388
|
const photosMinZoom = Math.max(meta.minZoom, minZoom);
|
|
301
389
|
const fetchedLinesMinZoom = fetchedSequencesMinZoom(providerId);
|
|
302
390
|
const sequencesMinZoom = Math.max(fetchedLinesMinZoom, minZoom);
|
|
303
|
-
const { data: photos =
|
|
304
|
-
const { data: sequences =
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
const photoCollection = zoom >= photosMinZoom ? photosToFeatureCollection(
|
|
308
|
-
drawBbox ? visiblePhotos.filter((photo) => lngLatInBbox(photo.lngLat, drawBbox)) : visiblePhotos
|
|
309
|
-
) : emptyPointCollection();
|
|
391
|
+
const { data: photos = NO_PHOTOS } = useProviderPhotos(providerId, bbox, zoom, { minZoom });
|
|
392
|
+
const { data: sequences = NO_SEQUENCES } = useProviderSequences(providerId, bbox, zoom, {
|
|
393
|
+
minZoom
|
|
394
|
+
});
|
|
310
395
|
const viewfieldsActive = showViewfields && zoom >= VIEWFIELD_MIN_ZOOM;
|
|
311
|
-
const
|
|
396
|
+
const viewfieldZoom = viewfieldsActive ? Math.floor(zoom * 2) / 2 : null;
|
|
397
|
+
const showPhotos = zoom >= photosMinZoom;
|
|
398
|
+
const showFetchedSequences = showSequences && zoom >= sequencesMinZoom;
|
|
399
|
+
const [west, south, east, north] = bbox ?? [];
|
|
400
|
+
const photoTypesKey = filter?.photoTypes?.join(",");
|
|
401
|
+
const dateFrom = filter?.date?.from;
|
|
402
|
+
const dateTo = filter?.date?.to;
|
|
403
|
+
const { photoCollection, viewfieldCollection, sequenceCollection } = useMemo(
|
|
404
|
+
() => buildPhotoLayerData({
|
|
405
|
+
photos,
|
|
406
|
+
sequences,
|
|
407
|
+
bbox: west !== void 0 && south !== void 0 && east !== void 0 && north !== void 0 ? [west, south, east, north] : null,
|
|
408
|
+
photoTypes: photoTypesKey ? photoTypesKey.split(",") : void 0,
|
|
409
|
+
date: { from: dateFrom, to: dateTo },
|
|
410
|
+
showPhotos,
|
|
411
|
+
showSequences: showFetchedSequences,
|
|
412
|
+
viewfieldZoom
|
|
413
|
+
}),
|
|
414
|
+
[
|
|
415
|
+
photos,
|
|
416
|
+
sequences,
|
|
417
|
+
west,
|
|
418
|
+
south,
|
|
419
|
+
east,
|
|
420
|
+
north,
|
|
421
|
+
photoTypesKey,
|
|
422
|
+
dateFrom,
|
|
423
|
+
dateTo,
|
|
424
|
+
showPhotos,
|
|
425
|
+
showFetchedSequences,
|
|
426
|
+
viewfieldZoom
|
|
427
|
+
]
|
|
428
|
+
);
|
|
312
429
|
const inActiveSequence = [
|
|
313
430
|
"==",
|
|
314
431
|
["get", "sequenceId"],
|
|
@@ -344,63 +461,11 @@ var PhotoProviderLayer = ({
|
|
|
344
461
|
hasActiveSequence ? full * 0.4 : full
|
|
345
462
|
];
|
|
346
463
|
const notShownPhoto = ["!=", ["get", "photoId"], shownPhotoId ?? ""];
|
|
347
|
-
const
|
|
464
|
+
const photoFilter3 = buildPhotoLayerFilter(filter?.photoTypes, filter?.date);
|
|
348
465
|
const photoSrcId = photoSourceId(providerId);
|
|
349
466
|
const viewfieldSrcId = viewfieldSourceId(providerId);
|
|
350
|
-
const sequenceCapturedAtById = /* @__PURE__ */ new Map();
|
|
351
|
-
for (const photo of visiblePhotos) {
|
|
352
|
-
if (photo.sequenceId == null || photo.capturedAt == null) continue;
|
|
353
|
-
const prev = sequenceCapturedAtById.get(photo.sequenceId);
|
|
354
|
-
if (prev == null || photo.capturedAt > prev) {
|
|
355
|
-
sequenceCapturedAtById.set(photo.sequenceId, photo.capturedAt);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
const filteredSequences = showSequences && zoom >= sequencesMinZoom ? sequences.map((sequence) => {
|
|
359
|
-
if (sequence.capturedAt != null) return sequence;
|
|
360
|
-
const fromPhotos = sequenceCapturedAtById.get(sequence.sequenceId);
|
|
361
|
-
return fromPhotos != null ? { ...sequence, capturedAt: fromPhotos } : sequence;
|
|
362
|
-
}).filter((sequence) => {
|
|
363
|
-
const asPhoto = {
|
|
364
|
-
providerId: sequence.providerId,
|
|
365
|
-
photoId: sequence.sequenceId,
|
|
366
|
-
sequenceId: sequence.sequenceId,
|
|
367
|
-
capturedAt: sequence.capturedAt,
|
|
368
|
-
isPano: sequence.isPano,
|
|
369
|
-
heading: null,
|
|
370
|
-
lngLat: [0, 0]
|
|
371
|
-
};
|
|
372
|
-
return photoMatchesFilters(asPhoto, filter?.photoTypes, filter?.date);
|
|
373
|
-
}) : [];
|
|
374
|
-
const photoLngLatsBySequence = /* @__PURE__ */ new Map();
|
|
375
|
-
for (const photo of photos) {
|
|
376
|
-
if (photo.sequenceId == null) continue;
|
|
377
|
-
const list = photoLngLatsBySequence.get(photo.sequenceId);
|
|
378
|
-
if (list) {
|
|
379
|
-
list.push(photo.lngLat);
|
|
380
|
-
} else {
|
|
381
|
-
photoLngLatsBySequence.set(photo.sequenceId, [photo.lngLat]);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
const alignedSequences = filteredSequences.map((sequence) => {
|
|
385
|
-
const points = photoLngLatsBySequence.get(sequence.sequenceId);
|
|
386
|
-
if (!points) return sequence;
|
|
387
|
-
const { geometry } = sequence;
|
|
388
|
-
return {
|
|
389
|
-
...sequence,
|
|
390
|
-
geometry: geometry.type === "LineString" ? {
|
|
391
|
-
...geometry,
|
|
392
|
-
coordinates: alignLineToPoints(geometry.coordinates, points)
|
|
393
|
-
} : {
|
|
394
|
-
...geometry,
|
|
395
|
-
coordinates: geometry.coordinates.map(
|
|
396
|
-
(line) => alignLineToPoints(line, points)
|
|
397
|
-
)
|
|
398
|
-
}
|
|
399
|
-
};
|
|
400
|
-
});
|
|
401
467
|
const sequenceTiles = showSequences ? adapter?.sequenceTiles?.() : null;
|
|
402
468
|
const sequenceTilesMinZoom = sequenceTiles ? Math.max(sequenceTiles.minZoom, minZoom) : 0;
|
|
403
|
-
const sequenceCollection = alignedSequences.length > 0 ? sequencesToFeatureCollection(alignedSequences) : emptyLineCollection();
|
|
404
469
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
405
470
|
meta.coverageTiles ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
406
471
|
/* @__PURE__ */ jsx(
|
|
@@ -447,7 +512,7 @@ var PhotoProviderLayer = ({
|
|
|
447
512
|
"source-layer": sequenceTiles.sourceLayer,
|
|
448
513
|
minzoom: sequenceTilesMinZoom,
|
|
449
514
|
maxzoom: fetchedLinesMinZoom,
|
|
450
|
-
filter: renameExpressionProperties(
|
|
515
|
+
filter: renameExpressionProperties(photoFilter3, sequenceTiles.properties),
|
|
451
516
|
layout: {
|
|
452
517
|
"line-cap": "round",
|
|
453
518
|
"line-join": "round",
|
|
@@ -555,8 +620,7 @@ var PhotoProviderLayer = ({
|
|
|
555
620
|
id: photoTargetLayerId(providerId),
|
|
556
621
|
type: "circle",
|
|
557
622
|
source: photoSrcId,
|
|
558
|
-
filter:
|
|
559
|
-
layout: { "circle-sort-key": PHOTO_SORT_KEY },
|
|
623
|
+
filter: photoFilter3,
|
|
560
624
|
paint: { "circle-radius": PHOTO_TARGET_RADIUS_PX, "circle-opacity": 0 }
|
|
561
625
|
}
|
|
562
626
|
),
|
|
@@ -567,8 +631,7 @@ var PhotoProviderLayer = ({
|
|
|
567
631
|
id: photoLayerId(providerId),
|
|
568
632
|
type: "circle",
|
|
569
633
|
source: photoSrcId,
|
|
570
|
-
filter:
|
|
571
|
-
layout: { "circle-sort-key": PHOTO_SORT_KEY },
|
|
634
|
+
filter: photoFilter3,
|
|
572
635
|
paint: {
|
|
573
636
|
"circle-radius": dotRadius,
|
|
574
637
|
"circle-color": lineAndDotColor
|
|
@@ -587,11 +650,17 @@ var MapFeatureProviderLayer = ({
|
|
|
587
650
|
minZoom
|
|
588
651
|
}) => {
|
|
589
652
|
const meta = providerById[providerId];
|
|
590
|
-
const { data: features =
|
|
653
|
+
const { data: features = NO_MAP_FEATURES } = useProviderMapFeatures(providerId, bbox, zoom, {
|
|
654
|
+
minZoom
|
|
655
|
+
});
|
|
591
656
|
const valueFilter = filter?.mapFeatureValue;
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
|
|
657
|
+
const showFeatures = zoom >= Math.max(meta.minZoom, minZoom);
|
|
658
|
+
const featureCollection = useMemo(() => {
|
|
659
|
+
if (!showFeatures) return emptyPointCollection();
|
|
660
|
+
const drawn = valueFilter ? features.filter((feature) => valueFilter(feature.value)) : [...features];
|
|
661
|
+
drawn.sort((a, b) => (a.lastSeenAt ?? 0) - (b.lastSeenAt ?? 0));
|
|
662
|
+
return mapFeaturesToFeatureCollection(drawn);
|
|
663
|
+
}, [features, valueFilter, showFeatures]);
|
|
595
664
|
const featureFilter = buildMapFeatureLayerFilter(filter?.date);
|
|
596
665
|
const featureSrcId = featureSourceId(providerId);
|
|
597
666
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -613,7 +682,6 @@ var MapFeatureProviderLayer = ({
|
|
|
613
682
|
type: "circle",
|
|
614
683
|
source: featureSrcId,
|
|
615
684
|
filter: featureFilter,
|
|
616
|
-
layout: { "circle-sort-key": FEATURE_SORT_KEY },
|
|
617
685
|
paint: {
|
|
618
686
|
"circle-radius": FEATURE_CIRCLE_RADIUS,
|
|
619
687
|
"circle-color": mapFeatureCircleColor
|
|
@@ -865,10 +933,8 @@ var useAllProviderPhotos = (providerIds, bbox, zoom, photoTypes, date) => {
|
|
|
865
933
|
zoom
|
|
866
934
|
)
|
|
867
935
|
}));
|
|
868
|
-
const
|
|
869
|
-
|
|
870
|
-
return data.filter((photo) => photoMatchesFilters(photo, photoTypes, date));
|
|
871
|
-
});
|
|
936
|
+
const matchesFilters = photoFilter(photoTypes, date);
|
|
937
|
+
const photos = queries.flatMap(({ query }) => (query.data ?? []).filter(matchesFilters));
|
|
872
938
|
const activeQueries = queries.filter(({ providerId }) => enabled.has(providerId));
|
|
873
939
|
const isLoading = activeQueries.some(({ query }) => query.isLoading);
|
|
874
940
|
const isFetching = activeQueries.some(({ query }) => query.isFetching);
|
|
@@ -2057,4 +2123,4 @@ var PhotoDateRangeFilter = ({
|
|
|
2057
2123
|
] });
|
|
2058
2124
|
};
|
|
2059
2125
|
|
|
2060
|
-
export { BASE_COLOR, FloatingPhotoViewer, FloatingViewerInfoButton, LocationPickOnMap, MAPILLARY_FEATURE_BAR_LABELS, MapillaryFeatureBar, PhotoCount, PhotoDate, PhotoDateRangeFilter, SELECTION_COLOR, SelectedMapFeatureLayer, StreetLevelImagerySelectionOverlay, StreetLevelImagerySourcesAndLayers, StreetLevelImageryViewCone, StreetLevelImageryViewer, VIEWPOINT_DEFAULT_COLOR, VIEWPOINT_DIRECTION_LAYER_ID, VIEW_SHAPE_FILL_OPACITY, ViewpointLayer, getViewpointSession, queryStreetImageryFeatures, resolveSelectedSequence, streetImageryInteractiveLayerIds, useActiveDirectionKey, useAllProviderMapFeatures, useAllProviderPhotos, useArmedLocationOpenerId, useCanGoBack, useCanGoForward, useCurrentHistoryEntry, useLocationPickActions, useMapViewportBbox, useMapillaryImageDetections, useMapillaryMapFeatureImages, useMapillaryMapFeaturesNear, usePhotoFullUrl, usePhotoThumbnail, useProviderMapFeatures, useProviderPhotos, useProviderSequences, useSelectedMapillaryFeature, useViewSuggestions, useViewpointLine, useViewpoints, viewDirectionKeyFromFeatures, viewSuggestionLabel };
|
|
2126
|
+
export { BASE_COLOR, FloatingPhotoViewer, FloatingViewerInfoButton, LocationPickOnMap, MAPILLARY_FEATURE_BAR_LABELS, MapillaryFeatureBar, PhotoCount, PhotoDate, PhotoDateRangeFilter, SELECTION_COLOR, SelectedMapFeatureLayer, StreetLevelImagerySelectionOverlay, StreetLevelImagerySourcesAndLayers, StreetLevelImageryViewCone, StreetLevelImageryViewer, VIEWPOINT_DEFAULT_COLOR, VIEWPOINT_DIRECTION_LAYER_ID, VIEW_SHAPE_FILL_OPACITY, ViewpointLayer, getViewpointSession, previousDataWhile, queryStreetImageryFeatures, resolveSelectedSequence, streetImageryInteractiveLayerIds, useActiveDirectionKey, useAllProviderMapFeatures, useAllProviderPhotos, useArmedLocationOpenerId, useCanGoBack, useCanGoForward, useCurrentHistoryEntry, useLocationPickActions, useMapViewportBbox, useMapillaryImageDetections, useMapillaryMapFeatureImages, useMapillaryMapFeaturesNear, usePhotoFullUrl, usePhotoThumbnail, useProviderMapFeatures, useProviderPhotos, useProviderSequences, useSelectedMapillaryFeature, useViewSuggestions, useViewpointLine, useViewpoints, viewDirectionKeyFromFeatures, viewSuggestionLabel };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osm-editor-kit/street-imagery-react",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.12",
|
|
4
4
|
"description": "React MapLibre layers and photo viewers for street-level imagery providers.",
|
|
5
5
|
"homepage": "https://github.com/osmberlin/street-space-editor/tree/main/packages/street-imagery-react",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"zustand": "^5.0.7"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@osm-editor-kit/street-imagery": "^0.1.0-alpha.
|
|
67
|
+
"@osm-editor-kit/street-imagery": "^0.1.0-alpha.9",
|
|
68
68
|
"@panoramax/web-viewer": "^5",
|
|
69
69
|
"@tanstack/react-query": "^5",
|
|
70
70
|
"mapillary-js": "^4",
|