@mapvx/web-js 4.0.3-dev.1 → 4.0.3-dev.2
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/cjs/index.js +4 -2
- package/dist/es/assets/icons.d.ts +0 -1
- package/dist/es/assets/icons.js +0 -50
- package/dist/es/config/draco.d.ts +0 -1
- package/dist/es/config/draco.js +0 -10
- package/dist/es/config/sdkConfig.d.ts +0 -1
- package/dist/es/config/sdkConfig.js +0 -1
- package/dist/es/controllers/markerLayoutController.d.ts +0 -1
- package/dist/es/controllers/markerLayoutController.js +0 -103
- package/dist/es/controllers/routeController.d.ts +0 -1
- package/dist/es/controllers/routeController.js +1 -473
- package/dist/es/domain/models/_internal.d.ts +0 -1
- package/dist/es/domain/models/_internal.js +0 -8
- package/dist/es/domain/models/animation.d.ts +0 -1
- package/dist/es/domain/models/animation.js +0 -6
- package/dist/es/domain/models/banner.d.ts +0 -1
- package/dist/es/domain/models/banner.js +0 -10
- package/dist/es/domain/models/campaign.d.ts +0 -1
- package/dist/es/domain/models/campaign.js +0 -29
- package/dist/es/domain/models/categories.d.ts +0 -1
- package/dist/es/domain/models/categories.js +0 -20
- package/dist/es/domain/models/circle.d.ts +0 -1
- package/dist/es/domain/models/circle.js +0 -118
- package/dist/es/domain/models/cityFilterOption.d.ts +0 -1
- package/dist/es/domain/models/cityFilterOption.js +0 -1
- package/dist/es/domain/models/configuration.d.ts +0 -1
- package/dist/es/domain/models/configuration.js +0 -1
- package/dist/es/domain/models/cssCustomization.d.ts +0 -1
- package/dist/es/domain/models/cssCustomization.js +0 -1
- package/dist/es/domain/models/fitOptions.d.ts +0 -1
- package/dist/es/domain/models/fitOptions.js +0 -1
- package/dist/es/domain/models/innerFloors.d.ts +0 -1
- package/dist/es/domain/models/innerFloors.js +0 -1
- package/dist/es/domain/models/institution.d.ts +0 -1
- package/dist/es/domain/models/institution.js +0 -26
- package/dist/es/domain/models/latLng.d.ts +0 -1
- package/dist/es/domain/models/latLng.js +0 -1
- package/dist/es/domain/models/location.d.ts +0 -1
- package/dist/es/domain/models/location.js +0 -1
- package/dist/es/domain/models/loggeable.d.ts +0 -1
- package/dist/es/domain/models/loggeable.js +0 -24
- package/dist/es/domain/models/mapCamera.d.ts +0 -1
- package/dist/es/domain/models/mapCamera.js +0 -1
- package/dist/es/domain/models/mapConfig.d.ts +0 -1
- package/dist/es/domain/models/mapConfig.js +1 -17
- package/dist/es/domain/models/marker.d.ts +0 -1
- package/dist/es/domain/models/marker.js +0 -292
- package/dist/es/domain/models/multilanguage.d.ts +0 -1
- package/dist/es/domain/models/multilanguage.js +0 -10
- package/dist/es/domain/models/openingHours.d.ts +0 -1
- package/dist/es/domain/models/openingHours.js +0 -1
- package/dist/es/domain/models/place.d.ts +0 -1
- package/dist/es/domain/models/place.js +0 -68
- package/dist/es/domain/models/platform.d.ts +0 -1
- package/dist/es/domain/models/platform.js +0 -1
- package/dist/es/domain/models/popover.d.ts +0 -1
- package/dist/es/domain/models/popover.js +0 -1
- package/dist/es/domain/models/product.d.ts +0 -1
- package/dist/es/domain/models/product.js +0 -1
- package/dist/es/domain/models/property.d.ts +0 -1
- package/dist/es/domain/models/property.js +0 -16
- package/dist/es/domain/models/route.d.ts +0 -1
- package/dist/es/domain/models/route.js +0 -71
- package/dist/es/domain/models/routeConfiguration.d.ts +0 -1
- package/dist/es/domain/models/routeConfiguration.js +0 -36
- package/dist/es/domain/models/routeInstance.d.ts +0 -1
- package/dist/es/domain/models/routeInstance.js +0 -8
- package/dist/es/domain/models/routeStyle.d.ts +0 -1
- package/dist/es/domain/models/routeStyle.js +0 -1
- package/dist/es/domain/models/scene3D.d.ts +0 -1
- package/dist/es/domain/models/scene3D.js +0 -1
- package/dist/es/domain/models/transport.d.ts +0 -1
- package/dist/es/domain/models/transport.js +0 -12
- package/dist/es/domain/ports/ICache.d.ts +0 -1
- package/dist/es/domain/ports/ICache.js +0 -1
- package/dist/es/domain/ports/IHttpClient.d.ts +0 -1
- package/dist/es/domain/ports/IHttpClient.js +0 -1
- package/dist/es/domain/ports/ILogger.d.ts +0 -1
- package/dist/es/domain/ports/ILogger.js +0 -9
- package/dist/es/domain/ports/index.d.ts +0 -1
- package/dist/es/domain/ports/index.js +0 -5
- package/dist/es/index.d.ts +0 -1
- package/dist/es/index.js +1 -28
- package/dist/es/infrastructure/cache/CacheManager.d.ts +0 -1
- package/dist/es/infrastructure/cache/CacheManager.js +0 -94
- package/dist/es/infrastructure/cache/LRUCache.d.ts +0 -1
- package/dist/es/infrastructure/cache/LRUCache.js +0 -57
- package/dist/es/infrastructure/cache/PersistentCache.d.ts +0 -1
- package/dist/es/infrastructure/cache/PersistentCache.js +0 -51
- package/dist/es/infrastructure/cache/cacheConfig.d.ts +0 -1
- package/dist/es/infrastructure/cache/cacheConfig.js +8 -27
- package/dist/es/infrastructure/http/FetchHttpClient.d.ts +0 -1
- package/dist/es/infrastructure/http/FetchHttpClient.js +0 -36
- package/dist/es/infrastructure/logging/MVXLogger.d.ts +0 -1
- package/dist/es/infrastructure/logging/MVXLogger.js +0 -37
- package/dist/es/interfaces/cache.d.ts +0 -1
- package/dist/es/interfaces/cache.js +0 -1
- package/dist/es/interfaces/healthResponse.d.ts +0 -1
- package/dist/es/interfaces/healthResponse.js +0 -1
- package/dist/es/interfaces/institutionResponse.d.ts +0 -1
- package/dist/es/interfaces/institutionResponse.js +0 -1
- package/dist/es/interfaces/metadata.d.ts +0 -1
- package/dist/es/interfaces/metadata.js +0 -1
- package/dist/es/interfaces/placeResponse.d.ts +0 -1
- package/dist/es/interfaces/placeResponse.js +0 -1
- package/dist/es/interfaces/routeCacheResponse.d.ts +0 -1
- package/dist/es/interfaces/routeCacheResponse.js +0 -1
- package/dist/es/interfaces/routeResponse.d.ts +0 -1
- package/dist/es/interfaces/routeResponse.js +0 -1
- package/dist/es/interfaces/styleResponse.d.ts +0 -1
- package/dist/es/interfaces/styleResponse.js +0 -1
- package/dist/es/logger/logger.d.ts +0 -1
- package/dist/es/logger/logger.js +0 -10
- package/dist/es/logger/sentry.d.ts +0 -1
- package/dist/es/logger/sentry.js +1 -39
- package/dist/es/map/fitCamera.d.ts +0 -1
- package/dist/es/map/fitCamera.js +0 -44
- package/dist/es/map/generated/maplibreWorkerSource.d.ts +0 -1
- package/dist/es/map/generated/maplibreWorkerSource.js +0 -12
- package/dist/es/map/installMapLibreWorker.d.ts +0 -1
- package/dist/es/map/installMapLibreWorker.js +0 -100
- package/dist/es/map/liveMapFitTransform.d.ts +0 -1
- package/dist/es/map/liveMapFitTransform.js +0 -82
- package/dist/es/map/map.d.ts +0 -1
- package/dist/es/map/map.js +4 -681
- package/dist/es/map/mapInteractionOptions.d.ts +0 -1
- package/dist/es/map/mapInteractionOptions.js +0 -35
- package/dist/es/map/scene3DController.d.ts +0 -1
- package/dist/es/map/scene3DController.js +0 -221
- package/dist/es/repository/repository.d.ts +0 -1
- package/dist/es/repository/repository.js +0 -56
- package/dist/es/repository/requester.d.ts +0 -1
- package/dist/es/repository/requester.js +0 -233
- package/dist/es/sdk.d.ts +0 -1
- package/dist/es/sdk.js +0 -35
- package/dist/es/utils/3d.d.ts +0 -1
- package/dist/es/utils/3d.js +0 -79
- package/dist/es/utils/deckLayers.d.ts +0 -1
- package/dist/es/utils/deckLayers.js +1 -27
- package/dist/es/utils/error.d.ts +0 -1
- package/dist/es/utils/error.js +0 -7
- package/dist/es/utils/images.d.ts +0 -1
- package/dist/es/utils/images.js +0 -7
- package/dist/es/utils/loadGlb.d.ts +0 -1
- package/dist/es/utils/loadGlb.js +2 -96
- package/dist/es/utils/mapvxHostname.d.ts +0 -1
- package/dist/es/utils/mapvxHostname.js +0 -11
- package/dist/es/utils/nav-functions.d.ts +0 -1
- package/dist/es/utils/nav-functions.js +0 -82
- package/dist/es/utils/opening-hours-helper.d.ts +0 -1
- package/dist/es/utils/opening-hours-helper.js +6 -382
- package/dist/es/utils/preconnect.d.ts +0 -1
- package/dist/es/utils/preconnect.js +0 -61
- package/dist/es/utils/route-utils.d.ts +0 -1
- package/dist/es/utils/route-utils.js +0 -25
- package/dist/es/utils/semaphore.d.ts +0 -1
- package/dist/es/utils/semaphore.js +0 -78
- package/dist/es/utils/three.d.ts +0 -1
- package/dist/es/utils/three.js +0 -43
- package/dist/es/utils/threeScene.d.ts +0 -1
- package/dist/es/utils/threeScene.js +0 -38
- package/dist/es/utils/update-css.d.ts +0 -1
- package/dist/es/utils/update-css.js +0 -26
- package/dist/es/utils/utils.d.ts +0 -1
- package/dist/es/utils/utils.js +0 -53
- package/dist/umd/index.js +4 -29240
- package/dist/umd/index.js.LICENSE.txt +1 -0
- package/dist/umd/styles.css +0 -1
- package/dist/umd/styles.js +3 -32
- package/package.json +11 -5
- package/dist/cjs/index.js.map +0 -1
- package/dist/es/assets/icons.d.ts.map +0 -1
- package/dist/es/assets/icons.js.map +0 -1
- package/dist/es/config/draco.d.ts.map +0 -1
- package/dist/es/config/draco.js.map +0 -1
- package/dist/es/config/sdkConfig.d.ts.map +0 -1
- package/dist/es/config/sdkConfig.js.map +0 -1
- package/dist/es/controllers/markerLayoutController.d.ts.map +0 -1
- package/dist/es/controllers/markerLayoutController.js.map +0 -1
- package/dist/es/controllers/routeController.d.ts.map +0 -1
- package/dist/es/controllers/routeController.js.map +0 -1
- package/dist/es/domain/models/_internal.d.ts.map +0 -1
- package/dist/es/domain/models/_internal.js.map +0 -1
- package/dist/es/domain/models/animation.d.ts.map +0 -1
- package/dist/es/domain/models/animation.js.map +0 -1
- package/dist/es/domain/models/banner.d.ts.map +0 -1
- package/dist/es/domain/models/banner.js.map +0 -1
- package/dist/es/domain/models/campaign.d.ts.map +0 -1
- package/dist/es/domain/models/campaign.js.map +0 -1
- package/dist/es/domain/models/categories.d.ts.map +0 -1
- package/dist/es/domain/models/categories.js.map +0 -1
- package/dist/es/domain/models/circle.d.ts.map +0 -1
- package/dist/es/domain/models/circle.js.map +0 -1
- package/dist/es/domain/models/cityFilterOption.d.ts.map +0 -1
- package/dist/es/domain/models/cityFilterOption.js.map +0 -1
- package/dist/es/domain/models/configuration.d.ts.map +0 -1
- package/dist/es/domain/models/configuration.js.map +0 -1
- package/dist/es/domain/models/cssCustomization.d.ts.map +0 -1
- package/dist/es/domain/models/cssCustomization.js.map +0 -1
- package/dist/es/domain/models/fitOptions.d.ts.map +0 -1
- package/dist/es/domain/models/fitOptions.js.map +0 -1
- package/dist/es/domain/models/innerFloors.d.ts.map +0 -1
- package/dist/es/domain/models/innerFloors.js.map +0 -1
- package/dist/es/domain/models/institution.d.ts.map +0 -1
- package/dist/es/domain/models/institution.js.map +0 -1
- package/dist/es/domain/models/latLng.d.ts.map +0 -1
- package/dist/es/domain/models/latLng.js.map +0 -1
- package/dist/es/domain/models/location.d.ts.map +0 -1
- package/dist/es/domain/models/location.js.map +0 -1
- package/dist/es/domain/models/loggeable.d.ts.map +0 -1
- package/dist/es/domain/models/loggeable.js.map +0 -1
- package/dist/es/domain/models/mapCamera.d.ts.map +0 -1
- package/dist/es/domain/models/mapCamera.js.map +0 -1
- package/dist/es/domain/models/mapConfig.d.ts.map +0 -1
- package/dist/es/domain/models/mapConfig.js.map +0 -1
- package/dist/es/domain/models/marker.d.ts.map +0 -1
- package/dist/es/domain/models/marker.js.map +0 -1
- package/dist/es/domain/models/multilanguage.d.ts.map +0 -1
- package/dist/es/domain/models/multilanguage.js.map +0 -1
- package/dist/es/domain/models/openingHours.d.ts.map +0 -1
- package/dist/es/domain/models/openingHours.js.map +0 -1
- package/dist/es/domain/models/place.d.ts.map +0 -1
- package/dist/es/domain/models/place.js.map +0 -1
- package/dist/es/domain/models/platform.d.ts.map +0 -1
- package/dist/es/domain/models/platform.js.map +0 -1
- package/dist/es/domain/models/popover.d.ts.map +0 -1
- package/dist/es/domain/models/popover.js.map +0 -1
- package/dist/es/domain/models/product.d.ts.map +0 -1
- package/dist/es/domain/models/product.js.map +0 -1
- package/dist/es/domain/models/property.d.ts.map +0 -1
- package/dist/es/domain/models/property.js.map +0 -1
- package/dist/es/domain/models/route.d.ts.map +0 -1
- package/dist/es/domain/models/route.js.map +0 -1
- package/dist/es/domain/models/routeConfiguration.d.ts.map +0 -1
- package/dist/es/domain/models/routeConfiguration.js.map +0 -1
- package/dist/es/domain/models/routeInstance.d.ts.map +0 -1
- package/dist/es/domain/models/routeInstance.js.map +0 -1
- package/dist/es/domain/models/routeStyle.d.ts.map +0 -1
- package/dist/es/domain/models/routeStyle.js.map +0 -1
- package/dist/es/domain/models/scene3D.d.ts.map +0 -1
- package/dist/es/domain/models/scene3D.js.map +0 -1
- package/dist/es/domain/models/transport.d.ts.map +0 -1
- package/dist/es/domain/models/transport.js.map +0 -1
- package/dist/es/domain/ports/ICache.d.ts.map +0 -1
- package/dist/es/domain/ports/ICache.js.map +0 -1
- package/dist/es/domain/ports/IHttpClient.d.ts.map +0 -1
- package/dist/es/domain/ports/IHttpClient.js.map +0 -1
- package/dist/es/domain/ports/ILogger.d.ts.map +0 -1
- package/dist/es/domain/ports/ILogger.js.map +0 -1
- package/dist/es/domain/ports/index.d.ts.map +0 -1
- package/dist/es/domain/ports/index.js.map +0 -1
- package/dist/es/index.d.ts.map +0 -1
- package/dist/es/index.js.map +0 -1
- package/dist/es/infrastructure/cache/CacheManager.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/CacheManager.js.map +0 -1
- package/dist/es/infrastructure/cache/LRUCache.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/LRUCache.js.map +0 -1
- package/dist/es/infrastructure/cache/PersistentCache.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/PersistentCache.js.map +0 -1
- package/dist/es/infrastructure/cache/cacheConfig.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/cacheConfig.js.map +0 -1
- package/dist/es/infrastructure/http/FetchHttpClient.d.ts.map +0 -1
- package/dist/es/infrastructure/http/FetchHttpClient.js.map +0 -1
- package/dist/es/infrastructure/logging/MVXLogger.d.ts.map +0 -1
- package/dist/es/infrastructure/logging/MVXLogger.js.map +0 -1
- package/dist/es/interfaces/cache.d.ts.map +0 -1
- package/dist/es/interfaces/cache.js.map +0 -1
- package/dist/es/interfaces/healthResponse.d.ts.map +0 -1
- package/dist/es/interfaces/healthResponse.js.map +0 -1
- package/dist/es/interfaces/institutionResponse.d.ts.map +0 -1
- package/dist/es/interfaces/institutionResponse.js.map +0 -1
- package/dist/es/interfaces/metadata.d.ts.map +0 -1
- package/dist/es/interfaces/metadata.js.map +0 -1
- package/dist/es/interfaces/placeResponse.d.ts.map +0 -1
- package/dist/es/interfaces/placeResponse.js.map +0 -1
- package/dist/es/interfaces/routeCacheResponse.d.ts.map +0 -1
- package/dist/es/interfaces/routeCacheResponse.js.map +0 -1
- package/dist/es/interfaces/routeResponse.d.ts.map +0 -1
- package/dist/es/interfaces/routeResponse.js.map +0 -1
- package/dist/es/interfaces/styleResponse.d.ts.map +0 -1
- package/dist/es/interfaces/styleResponse.js.map +0 -1
- package/dist/es/logger/logger.d.ts.map +0 -1
- package/dist/es/logger/logger.js.map +0 -1
- package/dist/es/logger/sentry.d.ts.map +0 -1
- package/dist/es/logger/sentry.js.map +0 -1
- package/dist/es/map/fitCamera.d.ts.map +0 -1
- package/dist/es/map/fitCamera.js.map +0 -1
- package/dist/es/map/generated/maplibreWorkerSource.d.ts.map +0 -1
- package/dist/es/map/generated/maplibreWorkerSource.js.map +0 -1
- package/dist/es/map/installMapLibreWorker.d.ts.map +0 -1
- package/dist/es/map/installMapLibreWorker.js.map +0 -1
- package/dist/es/map/liveMapFitTransform.d.ts.map +0 -1
- package/dist/es/map/liveMapFitTransform.js.map +0 -1
- package/dist/es/map/map.d.ts.map +0 -1
- package/dist/es/map/map.js.map +0 -1
- package/dist/es/map/mapInteractionOptions.d.ts.map +0 -1
- package/dist/es/map/mapInteractionOptions.js.map +0 -1
- package/dist/es/map/scene3DController.d.ts.map +0 -1
- package/dist/es/map/scene3DController.js.map +0 -1
- package/dist/es/repository/repository.d.ts.map +0 -1
- package/dist/es/repository/repository.js.map +0 -1
- package/dist/es/repository/requester.d.ts.map +0 -1
- package/dist/es/repository/requester.js.map +0 -1
- package/dist/es/sdk.d.ts.map +0 -1
- package/dist/es/sdk.js.map +0 -1
- package/dist/es/utils/3d.d.ts.map +0 -1
- package/dist/es/utils/3d.js.map +0 -1
- package/dist/es/utils/deckLayers.d.ts.map +0 -1
- package/dist/es/utils/deckLayers.js.map +0 -1
- package/dist/es/utils/error.d.ts.map +0 -1
- package/dist/es/utils/error.js.map +0 -1
- package/dist/es/utils/images.d.ts.map +0 -1
- package/dist/es/utils/images.js.map +0 -1
- package/dist/es/utils/loadGlb.d.ts.map +0 -1
- package/dist/es/utils/loadGlb.js.map +0 -1
- package/dist/es/utils/mapvxHostname.d.ts.map +0 -1
- package/dist/es/utils/mapvxHostname.js.map +0 -1
- package/dist/es/utils/nav-functions.d.ts.map +0 -1
- package/dist/es/utils/nav-functions.js.map +0 -1
- package/dist/es/utils/opening-hours-helper.d.ts.map +0 -1
- package/dist/es/utils/opening-hours-helper.js.map +0 -1
- package/dist/es/utils/preconnect.d.ts.map +0 -1
- package/dist/es/utils/preconnect.js.map +0 -1
- package/dist/es/utils/route-utils.d.ts.map +0 -1
- package/dist/es/utils/route-utils.js.map +0 -1
- package/dist/es/utils/semaphore.d.ts.map +0 -1
- package/dist/es/utils/semaphore.js.map +0 -1
- package/dist/es/utils/three.d.ts.map +0 -1
- package/dist/es/utils/three.js.map +0 -1
- package/dist/es/utils/threeScene.d.ts.map +0 -1
- package/dist/es/utils/threeScene.js.map +0 -1
- package/dist/es/utils/update-css.d.ts.map +0 -1
- package/dist/es/utils/update-css.js.map +0 -1
- package/dist/es/utils/utils.d.ts.map +0 -1
- package/dist/es/utils/utils.js.map +0 -1
- package/dist/umd/index.js.map +0 -1
- package/dist/umd/styles.css.map +0 -1
- package/dist/umd/styles.js.map +0 -1
|
@@ -1,29 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Highest pitch MapLibre accepts for `minPitch`/`maxPitch` (it rejects anything
|
|
3
|
-
* above 180); a locked pitch is clamped to it so the lock can never contradict
|
|
4
|
-
* the {@link MapConfig.pitch} the map was built with.
|
|
5
|
-
*/
|
|
6
1
|
const MAX_LOCKED_PITCH = 180;
|
|
7
|
-
/**
|
|
8
|
-
* Translates the interaction/rotation flags from {@link MapConfig} into the
|
|
9
|
-
* matching MapLibre constructor options.
|
|
10
|
-
*
|
|
11
|
-
* Only keys that were explicitly provided are returned, so MapLibre's defaults
|
|
12
|
-
* (every interaction enabled) are preserved for any flag left `undefined`. This
|
|
13
|
-
* deliberately avoids writing `undefined` into the options object, which would
|
|
14
|
-
* otherwise override MapLibre defaults with `NaN`/`undefined`.
|
|
15
|
-
*
|
|
16
|
-
* `rotateEnabled: false` disables drag- and pitch-rotation up front. Touch
|
|
17
|
-
* rotation cannot be turned off via the constructor without also killing
|
|
18
|
-
* pinch-to-zoom, so it is handled separately after construction — see
|
|
19
|
-
* {@link shouldDisableTouchRotation}.
|
|
20
|
-
*
|
|
21
|
-
* `pitchEnabled: false` freezes the tilt: the pitch gestures are disabled and
|
|
22
|
-
* `minPitch`/`maxPitch` are pinned to {@link MapConfig.pitch}, so neither the
|
|
23
|
-
* user nor a later camera update can change it.
|
|
24
|
-
*
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
2
|
export function buildInteractionOptions(mapConfig) {
|
|
28
3
|
var _a;
|
|
29
4
|
const options = {};
|
|
@@ -54,16 +29,6 @@ export function buildInteractionOptions(mapConfig) {
|
|
|
54
29
|
}
|
|
55
30
|
return options;
|
|
56
31
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Whether two-finger touch rotation must be disabled after the map is created.
|
|
59
|
-
*
|
|
60
|
-
* `rotateEnabled: false` should keep pinch-to-zoom working, so the touch
|
|
61
|
-
* rotation is disabled via `map.touchZoomRotate.disableRotation()` once the map
|
|
62
|
-
* instance exists rather than through the constructor.
|
|
63
|
-
*
|
|
64
|
-
* @internal
|
|
65
|
-
*/
|
|
66
32
|
export function shouldDisableTouchRotation(mapConfig) {
|
|
67
33
|
return mapConfig.rotateEnabled === false;
|
|
68
34
|
}
|
|
69
|
-
//# sourceMappingURL=mapInteractionOptions.js.map
|
|
@@ -5,58 +5,23 @@ import { loadGlbRoot } from "../utils/loadGlb";
|
|
|
5
5
|
import { Semaphore } from "../utils/semaphore";
|
|
6
6
|
import { loadDeck, loadThree } from "../utils/three";
|
|
7
7
|
import { addScene3DLights, computeGlbBottomAnchor, disposeMaterialsOnly, disposeObject3D, } from "../utils/threeScene";
|
|
8
|
-
/**
|
|
9
|
-
* Owns the experimental 3D scene for a MapLibre map: the deck.gl overlay layers (elevated room
|
|
10
|
-
* outlines, indoor labels, POI icons, store logos) and the declarative GLB custom layer rendered
|
|
11
|
-
* with Three.js.
|
|
12
|
-
*
|
|
13
|
-
* This is the WebGL / deck.gl "glue": creating the `WebGLRenderer`, instantiating deck layers and
|
|
14
|
-
* driving the per-frame render loop all require a real GPU context and a live map, so this module is
|
|
15
|
-
* excluded from unit-test coverage (see `sonar.coverage.exclusions`). The unit-testable logic it
|
|
16
|
-
* relies on lives in `utils/deckLayers.ts`, `utils/threeScene.ts` and `utils/3d.ts`.
|
|
17
|
-
*
|
|
18
|
-
* The map creates one instance only when {@link MapConfig.mode} is `"3D"` and
|
|
19
|
-
* {@link Scene3DConfig.enabled} is not `false`, and forwards its lifecycle to the `on*` methods.
|
|
20
|
-
*
|
|
21
|
-
* @group Map
|
|
22
|
-
*/
|
|
23
8
|
export class Scene3DController {
|
|
24
9
|
constructor(map, scene3DConfig, initialCenter, onModelsProgress) {
|
|
25
10
|
var _a, _b, _c;
|
|
26
|
-
/** Latest known floor key; updated by the floor-change hooks and read when (re)building layers. */
|
|
27
11
|
this.currentFloor = "";
|
|
28
|
-
// Lazily-loaded Three.js / deck.gl runtime handles (see loadThree()/loadDeck()).
|
|
29
12
|
this.threeMod = undefined;
|
|
30
13
|
this.deckMod = undefined;
|
|
31
14
|
this.deckOverlay = undefined;
|
|
32
15
|
this.scene3DGlbScene = undefined;
|
|
33
|
-
/** Loaded GLB roots keyed by URL (deduplicated). */
|
|
34
16
|
this.scene3DGlbRootByUrl = new globalThis.Map();
|
|
35
|
-
/** Per-asset template root and bottom anchor for cloning. */
|
|
36
17
|
this.scene3DGlbTemplateById = new globalThis.Map();
|
|
37
|
-
/** Number of light objects in `scene3DGlbScene` (kept when clearing meshes). */
|
|
38
18
|
this.scene3DGlbLightCount = 0;
|
|
39
|
-
/** Container group holding all placed GLB pivots; rebuilt on each floor change. */
|
|
40
19
|
this.scene3DModelsGroup = undefined;
|
|
41
|
-
/** The GLB custom layer's renderer, stored so {@link dispose} can release it; see `createGlbCustomLayer`. */
|
|
42
20
|
this.glbRenderer = undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Route points currently used for GLB route-transparency collision, tagged with the floor on
|
|
45
|
-
* which each point's route segment is visible. Stored as coordinates (not pivot references) so
|
|
46
|
-
* they survive `placeScene3DModels` rebuilds on floor change. Only points matching the current
|
|
47
|
-
* floor participate, so a model only fades when a route is visibly crossing it on that floor.
|
|
48
|
-
*/
|
|
49
21
|
this.scene3DRouteCollisionPoints = [];
|
|
50
22
|
this.spriteIconMapping = {};
|
|
51
23
|
this.spriteAtlasImage = new Image();
|
|
52
|
-
/** True while the GLB models are unloaded by LOD (camera zoomed out past the threshold). */
|
|
53
24
|
this.modelsUnloadedByLod = false;
|
|
54
|
-
/**
|
|
55
|
-
* True while {@link loadScene3DGlbTemplates} is populating `scene3DGlbRootByUrl` /
|
|
56
|
-
* `scene3DGlbTemplateById` (initial load or an LOD reload). Guards against overlapping reloads
|
|
57
|
-
* and, in {@link updateLodForZoom}, against an LOD unload running concurrently and clearing
|
|
58
|
-
* those same maps out from under the in-flight load.
|
|
59
|
-
*/
|
|
60
25
|
this.glbTemplatesLoadInFlight = false;
|
|
61
26
|
this.map = map;
|
|
62
27
|
this.scene3DConfig = scene3DConfig;
|
|
@@ -66,11 +31,6 @@ export class Scene3DController {
|
|
|
66
31
|
this.useTileWorker = (_c = (_b = scene3DConfig.customLayers) === null || _b === void 0 ? void 0 : _b.useTileWorker) !== null && _c !== void 0 ? _c : false;
|
|
67
32
|
this.lodThresholds = resolveModels3DLodThresholds(scene3DConfig.models);
|
|
68
33
|
}
|
|
69
|
-
// Lifecycle entry points forwarded by the map ---------------------------------------------
|
|
70
|
-
/**
|
|
71
|
-
* Sets up the deck.gl overlay and GLB custom layer once the map style has loaded. Awaits the lazy
|
|
72
|
-
* library load first so the base 2D flow is never blocked by it.
|
|
73
|
-
*/
|
|
74
34
|
async onMapLoad() {
|
|
75
35
|
var _a, _b;
|
|
76
36
|
try {
|
|
@@ -82,15 +42,12 @@ export class Scene3DController {
|
|
|
82
42
|
}
|
|
83
43
|
if (!this.deckMod)
|
|
84
44
|
return;
|
|
85
|
-
// Load the sprite atlas (icons/logos) before building deck layers so the first
|
|
86
|
-
// updateDeckOverlay has the atlas available.
|
|
87
45
|
const spriteUrl = (_b = (_a = this.scene3DConfig.customLayers) === null || _a === void 0 ? void 0 : _a.iconLayers) === null || _b === void 0 ? void 0 : _b.spriteUrl;
|
|
88
46
|
if (spriteUrl) {
|
|
89
47
|
await this.loadSpriteAtlas(spriteUrl).catch((err) => console.error("Failed to load sprite atlas", err));
|
|
90
48
|
}
|
|
91
49
|
this.deckOverlay = new this.deckMod.MapboxOverlay({ layers: [] });
|
|
92
50
|
this.map.addControl(this.deckOverlay);
|
|
93
|
-
// Hide MapLibre icon layers — replaced by deck.gl IconLayer
|
|
94
51
|
this.hideLayers(this.scene3DConfig.hideLayers);
|
|
95
52
|
this.installDebugStatsHook();
|
|
96
53
|
const models = this.scene3DConfig.models;
|
|
@@ -98,59 +55,24 @@ export class Scene3DController {
|
|
|
98
55
|
if (glbModelsActive) {
|
|
99
56
|
this.map.addLayer(this.createGlbCustomLayer());
|
|
100
57
|
}
|
|
101
|
-
// Populate the overlay for the floor that may already be set: the map's floor hooks
|
|
102
|
-
// (onFloorChange/refreshOverlay) run during init and early-return while `deckOverlay` is still
|
|
103
|
-
// undefined during the async library load, so without this the overlay stays empty until the
|
|
104
|
-
// next floor change (e.g. broken on totem/route views that never change floor after load).
|
|
105
58
|
this.updateDeckOverlay();
|
|
106
59
|
}
|
|
107
|
-
/**
|
|
108
|
-
* Re-attaches the style-owned half of the 3D scene after the map style has been fully
|
|
109
|
-
* replaced (`map.setStyle(..., { diff: false })`).
|
|
110
|
-
*
|
|
111
|
-
* A full swap deletes every layer, so MapLibre removes the GLB custom layer and calls
|
|
112
|
-
* its `onRemove` — which runs {@link dispose} and frees the renderer, the GLB roots and
|
|
113
|
-
* the templates. `onMapLoad` is the only other place that adds the layer and it never
|
|
114
|
-
* runs twice, so without this call the models are gone permanently and the MapLibre
|
|
115
|
-
* icon layers that deck.gl replaced come back on top of the deck icons.
|
|
116
|
-
*
|
|
117
|
-
* Only style-owned state is rebuilt. The deck.gl overlay is a map CONTROL, not a style
|
|
118
|
-
* layer, so it survives the swap untouched — re-adding it here would stack a second
|
|
119
|
-
* overlay on the map. Its layers are repopulated separately by the map's
|
|
120
|
-
* `refreshOverlay` call in `whenStyleUpdates`.
|
|
121
|
-
*
|
|
122
|
-
* No-op before `onMapLoad` has run (2D mode, or the lazy 3D libraries still loading):
|
|
123
|
-
* `deckMod` is the same readiness signal `onMapLoad` itself checks, and the initial
|
|
124
|
-
* `onMapLoad` will add the layer once it completes.
|
|
125
|
-
*/
|
|
126
60
|
reattachToStyle() {
|
|
127
61
|
if (!this.deckMod)
|
|
128
62
|
return;
|
|
129
|
-
// Hide MapLibre icon layers again — replaced by deck.gl IconLayer. These are layout
|
|
130
|
-
// properties on the STYLE's layers, so the swap reset them to visible.
|
|
131
63
|
this.hideLayers(this.scene3DConfig.hideLayers);
|
|
132
|
-
// `dispose()` (via the removed layer's `onRemove`) uninstalled this.
|
|
133
64
|
this.installDebugStatsHook();
|
|
134
65
|
const models = this.scene3DConfig.models;
|
|
135
66
|
const glbModelsActive = models !== undefined && models.enabled !== false && models.assets.length > 0;
|
|
136
|
-
// `createGlbCustomLayer` rebuilds the scene, its lights and the renderer (in `onAdd`)
|
|
137
|
-
// and kicks off a fresh template load, so it fully recovers from the dispose.
|
|
138
67
|
if (glbModelsActive) {
|
|
139
68
|
this.map.addLayer(this.createGlbCustomLayer());
|
|
140
69
|
}
|
|
141
70
|
this.updateDeckOverlay();
|
|
142
71
|
}
|
|
143
|
-
/** Re-applies zoom-based model transparency and evaluates LOD; call on every map `zoom`. */
|
|
144
72
|
onZoom() {
|
|
145
73
|
this.applyModelOpacity();
|
|
146
74
|
this.updateLodForZoom();
|
|
147
75
|
}
|
|
148
|
-
/**
|
|
149
|
-
* Evaluates the zoom-based LOD (see {@link Models3DConfig.lod}): unloads the GLB models from
|
|
150
|
-
* memory when the camera drops below the unload boundary and reloads them when it returns to the
|
|
151
|
-
* reload boundary. No-op when LOD is disabled. Cheap enough to call on every `zoom` event — it
|
|
152
|
-
* only acts on a boundary crossing.
|
|
153
|
-
*/
|
|
154
76
|
updateLodForZoom() {
|
|
155
77
|
if (!this.lodThresholds) {
|
|
156
78
|
return;
|
|
@@ -158,8 +80,6 @@ export class Scene3DController {
|
|
|
158
80
|
const action = lodActionForZoom(this.map.getZoom(), this.lodThresholds, this.modelsUnloadedByLod);
|
|
159
81
|
if (action === "unload") {
|
|
160
82
|
if (this.glbTemplatesLoadInFlight) {
|
|
161
|
-
// A load is already populating the model maps; unloading now would race with it.
|
|
162
|
-
// reloadScene3DModelsForLod()/the initial load re-evaluate the zoom once they settle.
|
|
163
83
|
return;
|
|
164
84
|
}
|
|
165
85
|
this.unloadScene3DModelsForLod();
|
|
@@ -168,12 +88,6 @@ export class Scene3DController {
|
|
|
168
88
|
void this.reloadScene3DModelsForLod();
|
|
169
89
|
}
|
|
170
90
|
}
|
|
171
|
-
/**
|
|
172
|
-
* Frees the GLB models' GPU resources (placed group's material clones + every cached template's
|
|
173
|
-
* geometry/textures) while keeping the custom layer, its `WebGLRenderer`, scene and lights alive,
|
|
174
|
-
* so a later {@link reloadScene3DModelsForLod} can repopulate without recreating the map layer.
|
|
175
|
-
* Distinct from {@link dispose}, which tears the whole controller down.
|
|
176
|
-
*/
|
|
177
91
|
unloadScene3DModelsForLod() {
|
|
178
92
|
var _a, _b;
|
|
179
93
|
const three = (_a = this.threeMod) === null || _a === void 0 ? void 0 : _a.THREE;
|
|
@@ -185,7 +99,6 @@ export class Scene3DController {
|
|
|
185
99
|
(_b = this.scene3DGlbScene) === null || _b === void 0 ? void 0 : _b.remove(this.scene3DModelsGroup);
|
|
186
100
|
this.scene3DModelsGroup = undefined;
|
|
187
101
|
}
|
|
188
|
-
// Iterate the deduped-by-URL roots so a shared root is never disposed twice (mirrors dispose()).
|
|
189
102
|
for (const root of this.scene3DGlbRootByUrl.values()) {
|
|
190
103
|
disposeObject3D(three, root);
|
|
191
104
|
}
|
|
@@ -194,11 +107,6 @@ export class Scene3DController {
|
|
|
194
107
|
this.modelsUnloadedByLod = true;
|
|
195
108
|
this.map.triggerRepaint();
|
|
196
109
|
}
|
|
197
|
-
/**
|
|
198
|
-
* Reloads the GLB templates from disk/network and re-places them for the current floor after an
|
|
199
|
-
* LOD unload. Guards against overlapping reloads, and re-evaluates the zoom on completion so a
|
|
200
|
-
* camera that zoomed back out mid-download ends up unloaded again rather than stuck loaded.
|
|
201
|
-
*/
|
|
202
110
|
async reloadScene3DModelsForLod() {
|
|
203
111
|
if (this.glbTemplatesLoadInFlight) {
|
|
204
112
|
return;
|
|
@@ -207,8 +115,6 @@ export class Scene3DController {
|
|
|
207
115
|
try {
|
|
208
116
|
await this.loadScene3DGlbTemplates();
|
|
209
117
|
this.placeScene3DModels();
|
|
210
|
-
// Only mark as loaded once placement actually succeeded, so a failed reload leaves
|
|
211
|
-
// modelsUnloadedByLod = true and the trailing updateLodForZoom() below retries it.
|
|
212
118
|
this.modelsUnloadedByLod = false;
|
|
213
119
|
}
|
|
214
120
|
catch (err) {
|
|
@@ -217,26 +123,13 @@ export class Scene3DController {
|
|
|
217
123
|
finally {
|
|
218
124
|
this.glbTemplatesLoadInFlight = false;
|
|
219
125
|
}
|
|
220
|
-
// The camera may have moved during the async load; re-evaluate so a zoom back out unloads again.
|
|
221
126
|
this.updateLodForZoom();
|
|
222
127
|
}
|
|
223
|
-
/**
|
|
224
|
-
* Sets the route path used for GLB route-transparency collision and re-evaluates which models a
|
|
225
|
-
* route currently crosses. Points are tagged with the floor on which their route segment is
|
|
226
|
-
* visible; only points on the current floor participate, so a model never fades unless a route is
|
|
227
|
-
* visibly crossing it on the displayed floor. Pass an empty array to clear.
|
|
228
|
-
*/
|
|
229
128
|
setRouteCollisionPath(points) {
|
|
230
129
|
this.scene3DRouteCollisionPoints = points;
|
|
231
130
|
this.recomputeRouteAffectedModels();
|
|
232
131
|
this.applyModelOpacity();
|
|
233
132
|
}
|
|
234
|
-
/**
|
|
235
|
-
* Rebuilds the deck overlay and GLB placements for the given floor. Host apps call this on every
|
|
236
|
-
* floor/place-changing navigation, including many that leave the floor unchanged (e.g. re-entering
|
|
237
|
-
* a screen, tapping the already-active floor selector); a no-op floor is skipped so those don't
|
|
238
|
-
* trigger a full, wasteful GLB rebuild.
|
|
239
|
-
*/
|
|
240
133
|
onFloorChange(currentFloor) {
|
|
241
134
|
const nextFloor = currentFloor !== null && currentFloor !== void 0 ? currentFloor : "";
|
|
242
135
|
if (nextFloor === this.currentFloor) {
|
|
@@ -246,20 +139,10 @@ export class Scene3DController {
|
|
|
246
139
|
this.updateDeckOverlay();
|
|
247
140
|
this.placeScene3DModels();
|
|
248
141
|
}
|
|
249
|
-
/** Rebuilds only the deck overlay (no GLB replacement) for the given floor. */
|
|
250
142
|
refreshOverlay(currentFloor) {
|
|
251
143
|
this.currentFloor = currentFloor !== null && currentFloor !== void 0 ? currentFloor : "";
|
|
252
144
|
this.updateDeckOverlay();
|
|
253
145
|
}
|
|
254
|
-
/**
|
|
255
|
-
* A point-in-time snapshot of the 3D scene's memory drivers, for profiling. The Three.js
|
|
256
|
-
* `renderer.info` counters are the best in-page proxy for GLB VRAM (decoded geometries/textures
|
|
257
|
-
* live on the GPU and are not visible to `performance.memory`, which only reports the JS heap).
|
|
258
|
-
* The deck tile counts approximate the overlay's parsed-tile working set — the thing the tile-cache
|
|
259
|
-
* bounds (see {@link DeckTileCacheConfig}) keep from growing without limit as the map pans/zooms.
|
|
260
|
-
*
|
|
261
|
-
* @group Map
|
|
262
|
-
*/
|
|
263
146
|
getDebugStats() {
|
|
264
147
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
265
148
|
const info = (_a = this.glbRenderer) === null || _a === void 0 ? void 0 : _a.info;
|
|
@@ -274,8 +157,6 @@ export class Scene3DController {
|
|
|
274
157
|
: null;
|
|
275
158
|
let deckTiles = null;
|
|
276
159
|
try {
|
|
277
|
-
// Best-effort read of each overlay layer's parsed-tile count. deck.gl internals are private,
|
|
278
|
-
// so this is guarded — it degrades to `null` rather than throwing if the shape changes.
|
|
279
160
|
const overlay = this.deckOverlay;
|
|
280
161
|
const layers = (_e = (_d = overlay === null || overlay === void 0 ? void 0 : overlay._deck) === null || _d === void 0 ? void 0 : _d.layerManager) === null || _e === void 0 ? void 0 : _e.layers;
|
|
281
162
|
if (Array.isArray(layers)) {
|
|
@@ -283,7 +164,6 @@ export class Scene3DController {
|
|
|
283
164
|
for (const layer of layers) {
|
|
284
165
|
const size = (_h = (_g = (_f = layer === null || layer === void 0 ? void 0 : layer.state) === null || _f === void 0 ? void 0 : _f.tileset) === null || _g === void 0 ? void 0 : _g._cache) === null || _h === void 0 ? void 0 : _h.size;
|
|
285
166
|
if (typeof size === "number" && layer.id) {
|
|
286
|
-
// Strip deck's per-sublayer suffixes so the four MVT roots aggregate by base id.
|
|
287
167
|
const baseId = layer.id.split("-sublayer")[0];
|
|
288
168
|
counts[baseId] = Math.max((_j = counts[baseId]) !== null && _j !== void 0 ? _j : 0, size);
|
|
289
169
|
}
|
|
@@ -307,34 +187,18 @@ export class Scene3DController {
|
|
|
307
187
|
lodThresholds: this.lodThresholds,
|
|
308
188
|
};
|
|
309
189
|
}
|
|
310
|
-
/**
|
|
311
|
-
* Exposes {@link getDebugStats} as `globalThis.__mvxScene3DStats()` when the opt-in flag
|
|
312
|
-
* `globalThis.__MVX_SCENE3D_DEBUG__` is truthy, so a profiling session can read the scene's memory
|
|
313
|
-
* drivers from the console/tests without external tooling. No-op (and no global written) otherwise.
|
|
314
|
-
*/
|
|
315
190
|
installDebugStatsHook() {
|
|
316
191
|
const g = globalThis;
|
|
317
192
|
if (g.__MVX_SCENE3D_DEBUG__) {
|
|
318
193
|
g.__mvxScene3DStats = () => this.getDebugStats();
|
|
319
194
|
}
|
|
320
195
|
}
|
|
321
|
-
/** Removes the debug hook if it points at this controller. Called from {@link dispose}. */
|
|
322
196
|
uninstallDebugStatsHook() {
|
|
323
197
|
const g = globalThis;
|
|
324
198
|
if (g.__mvxScene3DStats) {
|
|
325
199
|
delete g.__mvxScene3DStats;
|
|
326
200
|
}
|
|
327
201
|
}
|
|
328
|
-
/**
|
|
329
|
-
* Releases every GPU resource this controller owns: the placed models group's material clones,
|
|
330
|
-
* the cached GLB templates' geometries/materials/textures, and the `WebGLRenderer` created for the
|
|
331
|
-
* declarative GLB layer. Idempotent — safe to call more than once (e.g. once via the custom
|
|
332
|
-
* layer's own `onRemove` and again explicitly).
|
|
333
|
-
*
|
|
334
|
-
* Callers must invoke this themselves before tearing down the map: MapLibre's `map.remove()` does
|
|
335
|
-
* not call a custom layer's `onRemove`, so without an explicit call here nothing ever frees these
|
|
336
|
-
* resources, and every context-loss recovery cycle (destroy + recreate the map) leaks a full scene.
|
|
337
|
-
*/
|
|
338
202
|
dispose() {
|
|
339
203
|
var _a, _b;
|
|
340
204
|
const three = (_a = this.threeMod) === null || _a === void 0 ? void 0 : _a.THREE;
|
|
@@ -343,8 +207,6 @@ export class Scene3DController {
|
|
|
343
207
|
disposeMaterialsOnly(three, this.scene3DModelsGroup);
|
|
344
208
|
this.scene3DModelsGroup = undefined;
|
|
345
209
|
}
|
|
346
|
-
// Iterate the deduplicated-by-URL roots (not `scene3DGlbTemplateById`, which may map several
|
|
347
|
-
// asset ids to the same root) so a shared root is never disposed more than once.
|
|
348
210
|
for (const root of this.scene3DGlbRootByUrl.values()) {
|
|
349
211
|
disposeObject3D(three, root);
|
|
350
212
|
}
|
|
@@ -356,11 +218,6 @@ export class Scene3DController {
|
|
|
356
218
|
this.glbRenderer = undefined;
|
|
357
219
|
this.uninstallDebugStatsHook();
|
|
358
220
|
}
|
|
359
|
-
// Internal implementation -----------------------------------------------------------------
|
|
360
|
-
/**
|
|
361
|
-
* Lazily loads the Three.js / deck.gl runtime handles (dynamic import) and caches them so the
|
|
362
|
-
* heavy libraries stay out of the base 2D bundle.
|
|
363
|
-
*/
|
|
364
221
|
async ensure3DLibs() {
|
|
365
222
|
var _a, _b;
|
|
366
223
|
(_a = this.threeMod) !== null && _a !== void 0 ? _a : (this.threeMod = await loadThree());
|
|
@@ -393,8 +250,6 @@ export class Scene3DController {
|
|
|
393
250
|
})
|
|
394
251
|
.finally(() => {
|
|
395
252
|
this.glbTemplatesLoadInFlight = false;
|
|
396
|
-
// Honor LOD from the first frame: if the map opened below the unload threshold, free the
|
|
397
|
-
// models just loaded (they reload when the user zooms in). No-op when LOD is disabled.
|
|
398
253
|
this.updateLodForZoom();
|
|
399
254
|
});
|
|
400
255
|
let renderer = undefined;
|
|
@@ -412,13 +267,9 @@ export class Scene3DController {
|
|
|
412
267
|
antialias: true,
|
|
413
268
|
});
|
|
414
269
|
renderer.autoClear = false;
|
|
415
|
-
// MapLibre owns canvas dimensions; only sync the GL viewport on resize.
|
|
416
270
|
renderer.setSize = function (width, height) {
|
|
417
271
|
this.setViewport(0, 0, width, height);
|
|
418
272
|
};
|
|
419
|
-
// Stored on the controller (not just this closure) so `dispose()` can release it — MapLibre
|
|
420
|
-
// does not call a custom layer's `onRemove` when the whole map/style is torn down via
|
|
421
|
-
// `map.remove()`, so callers must dispose this controller explicitly before that happens.
|
|
422
273
|
this.glbRenderer = renderer;
|
|
423
274
|
},
|
|
424
275
|
onRemove: () => {
|
|
@@ -436,7 +287,6 @@ export class Scene3DController {
|
|
|
436
287
|
const canvas = this.map.getCanvas();
|
|
437
288
|
const width = canvas.width;
|
|
438
289
|
const height = canvas.height;
|
|
439
|
-
// Skip while the framebuffer has no drawable area (e.g. devtools opening).
|
|
440
290
|
if (width === 0 || height === 0) {
|
|
441
291
|
return;
|
|
442
292
|
}
|
|
@@ -461,16 +311,9 @@ export class Scene3DController {
|
|
|
461
311
|
}
|
|
462
312
|
this.scene3DGlbRootByUrl.clear();
|
|
463
313
|
this.scene3DGlbTemplateById.clear();
|
|
464
|
-
// Load every distinct URL with bounded concurrency (see GLB_LOAD_CONCURRENCY) instead of one
|
|
465
|
-
// at a time, and let each load time out (see loadGlbRoot) — a single hung or malformed/truncated
|
|
466
|
-
// asset is skipped and logged instead of blocking every asset queued behind it. Deduplicating by
|
|
467
|
-
// URL up front — not inside the concurrent task — means assets sharing a URL never trigger
|
|
468
|
-
// duplicate loads and never tie up more than one concurrency slot waiting on the same result.
|
|
469
314
|
const uniqueUrls = [...new Set(models.assets.map((asset) => asset.url))];
|
|
470
315
|
const errorByUrl = new globalThis.Map();
|
|
471
316
|
const semaphore = new Semaphore(Scene3DController.GLB_LOAD_CONCURRENCY);
|
|
472
|
-
// Progress bookkeeping for `onModelsProgress` (e.g. a totem's loading bar). Kept even when no
|
|
473
|
-
// callback is registered — the cost is a handful of Map writes over at most a few dozen assets.
|
|
474
317
|
const loadedBytesByUrl = new globalThis.Map();
|
|
475
318
|
const totalBytesByUrl = new globalThis.Map();
|
|
476
319
|
let settledAssets = 0;
|
|
@@ -496,9 +339,6 @@ export class Scene3DController {
|
|
|
496
339
|
});
|
|
497
340
|
}
|
|
498
341
|
catch (err) {
|
|
499
|
-
// Isolate the SDK's own load bookkeeping from a throwing consumer callback — letting this
|
|
500
|
-
// escape would reject the `Promise.all` below (or, from the `onProgress` path, break
|
|
501
|
-
// three.js's internal stream-reading chain) and lose every already-loaded asset.
|
|
502
342
|
console.error("onScene3DModelsProgress callback threw", err);
|
|
503
343
|
}
|
|
504
344
|
};
|
|
@@ -519,10 +359,6 @@ export class Scene3DController {
|
|
|
519
359
|
}
|
|
520
360
|
finally {
|
|
521
361
|
settledAssets++;
|
|
522
|
-
// Once a URL has settled, its total is knowable even if no progress event ever supplied
|
|
523
|
-
// one (failed before the first byte, or the server omitted Content-Length): fall back to
|
|
524
|
-
// however many bytes actually arrived. Otherwise a single such asset would force the
|
|
525
|
-
// whole batch's `totalBytes` to stay `null` forever, even after `done: true`.
|
|
526
362
|
totalBytesByUrl.set(url, (_b = (_a = totalBytesByUrl.get(url)) !== null && _a !== void 0 ? _a : loadedBytesByUrl.get(url)) !== null && _b !== void 0 ? _b : 0);
|
|
527
363
|
semaphore.release();
|
|
528
364
|
reportProgress(false);
|
|
@@ -550,9 +386,6 @@ export class Scene3DController {
|
|
|
550
386
|
return;
|
|
551
387
|
}
|
|
552
388
|
if (this.scene3DModelsGroup) {
|
|
553
|
-
// Only the per-placement material clones (made below so each placement's zoom-based opacity
|
|
554
|
-
// is independent) are exclusively owned by this group — geometries/textures come from the
|
|
555
|
-
// cached templates and stay alive for the next rebuild, so they must not be disposed here.
|
|
556
389
|
disposeMaterialsOnly(three, this.scene3DModelsGroup);
|
|
557
390
|
this.scene3DGlbScene.remove(this.scene3DModelsGroup);
|
|
558
391
|
this.scene3DModelsGroup = undefined;
|
|
@@ -586,8 +419,6 @@ export class Scene3DController {
|
|
|
586
419
|
const [sx3, sy3, sz3] = mergeGlbScale(asset.defaultScale, placement.scale);
|
|
587
420
|
pivot.scale.set(sx3, sy3, sz3);
|
|
588
421
|
const model = template.root.clone(true);
|
|
589
|
-
// `clone(true)` shares materials between instances; clone them per placement so each
|
|
590
|
-
// placement's zoom-based opacity is independent and does not bleed into sibling models.
|
|
591
422
|
model.traverse((obj) => {
|
|
592
423
|
const mesh = obj;
|
|
593
424
|
if (!mesh.isMesh) {
|
|
@@ -598,15 +429,8 @@ export class Scene3DController {
|
|
|
598
429
|
: mesh.material.clone();
|
|
599
430
|
});
|
|
600
431
|
model.position.set(-template.center.x, -template.center.y, -template.center.z);
|
|
601
|
-
// Stash the resolved zoom-transparency config so it can be re-applied on every zoom change.
|
|
602
432
|
pivot.userData.zoomTransparency = resolveZoomTransparency(models, asset, placement);
|
|
603
|
-
// Stash route-transparency config (may be undefined => feature off for this model) so a
|
|
604
|
-
// route crossing this model can fade it independently of zoom.
|
|
605
433
|
pivot.userData.routeTransparency = resolveRouteTransparency(models, asset, placement);
|
|
606
|
-
// Precompute the model footprint in the pivot's local x/z frame while `model` has no parent
|
|
607
|
-
// (its world matrix equals its local matrix), for cheap point-in-building collision tests.
|
|
608
|
-
// After `pivot.add(model)` the world matrix would fold in the pivot transform, giving a loose
|
|
609
|
-
// world-axis box instead; `pivot.worldToLocal` at test time undoes the pivot transform.
|
|
610
434
|
const localBox = new three.Box3().setFromObject(model);
|
|
611
435
|
pivot.userData.footprint = {
|
|
612
436
|
minX: localBox.min.x,
|
|
@@ -619,18 +443,10 @@ export class Scene3DController {
|
|
|
619
443
|
}
|
|
620
444
|
this.scene3DModelsGroup = modelsGroup;
|
|
621
445
|
this.scene3DGlbScene.add(modelsGroup);
|
|
622
|
-
// Recompute route collision against the freshly rebuilt pivots (footprints/floor changed),
|
|
623
|
-
// then apply the combined opacity.
|
|
624
446
|
this.recomputeRouteAffectedModels();
|
|
625
447
|
this.applyModelOpacity();
|
|
626
448
|
this.map.triggerRepaint();
|
|
627
449
|
}
|
|
628
|
-
/**
|
|
629
|
-
* Recomputes `pivot.userData.routeAffected` for every placed model by testing the current-floor
|
|
630
|
-
* route collision points against each model's precomputed footprint. Cheap point-in-box tests in
|
|
631
|
-
* the pivot's local x/z frame; runs only when the route path or the placed models change, never
|
|
632
|
-
* per zoom frame.
|
|
633
|
-
*/
|
|
634
450
|
recomputeRouteAffectedModels() {
|
|
635
451
|
var _a;
|
|
636
452
|
const three = (_a = this.threeMod) === null || _a === void 0 ? void 0 : _a.THREE;
|
|
@@ -639,10 +455,6 @@ export class Scene3DController {
|
|
|
639
455
|
return;
|
|
640
456
|
}
|
|
641
457
|
const points = this.scene3DRouteCollisionPoints.filter((p) => p.floorKey === this.currentFloor);
|
|
642
|
-
// Convert each route point into the models group's local frame (metres relative to
|
|
643
|
-
// initialCenter), exactly as placements are positioned in `placeScene3DModels`. The group's
|
|
644
|
-
// own transform (globalOffset) is applied via `localToWorld` at test time, so route points and
|
|
645
|
-
// model pivots share one frame regardless of the collective offset.
|
|
646
458
|
const refMercator = MercatorCoordinate.fromLngLat(this.initialCenter, 0);
|
|
647
459
|
const meterScale = refMercator.meterInMercatorCoordinateUnits();
|
|
648
460
|
const groupLocalPoints = points.map((p) => {
|
|
@@ -656,14 +468,11 @@ export class Scene3DController {
|
|
|
656
468
|
for (const pivot of modelsGroup.children) {
|
|
657
469
|
const routeCfg = pivot.userData.routeTransparency;
|
|
658
470
|
const footprint = pivot.userData.footprint;
|
|
659
|
-
// Only models with a route-transparency config participate (feature activation gate).
|
|
660
471
|
if (!routeCfg || !footprint || groupLocalPoints.length === 0) {
|
|
661
472
|
pivot.userData.routeAffected = false;
|
|
662
473
|
continue;
|
|
663
474
|
}
|
|
664
475
|
pivot.userData.routeAffected = groupLocalPoints.some((gp) => {
|
|
665
|
-
// group-local -> world (applies globalOffset) -> pivot-local (undoes position/rotation/
|
|
666
|
-
// scale), then test its x/z against the footprint. y is ignored (floor-level footprint).
|
|
667
476
|
local.copy(gp);
|
|
668
477
|
modelsGroup.localToWorld(local);
|
|
669
478
|
pivot.worldToLocal(local);
|
|
@@ -671,14 +480,6 @@ export class Scene3DController {
|
|
|
671
480
|
});
|
|
672
481
|
}
|
|
673
482
|
}
|
|
674
|
-
/**
|
|
675
|
-
* Applies transparency to placed GLB models, combining zoom-based transparency
|
|
676
|
-
* ({@link ZoomTransparencyConfig}, a hard threshold: fully opaque below the configured zoom,
|
|
677
|
-
* configured opacity at/above it) with route-based transparency
|
|
678
|
-
* ({@link RouteTransparencyConfig}) for models a route currently crosses
|
|
679
|
-
* (`pivot.userData.routeAffected`). The more transparent of the two wins. Only triggers a
|
|
680
|
-
* repaint when at least one material actually changed.
|
|
681
|
-
*/
|
|
682
483
|
applyModelOpacity() {
|
|
683
484
|
if (!this.scene3DModelsGroup) {
|
|
684
485
|
return;
|
|
@@ -700,7 +501,6 @@ export class Scene3DController {
|
|
|
700
501
|
if (material.opacity !== opacity) {
|
|
701
502
|
material.transparent = opacity < 1;
|
|
702
503
|
material.opacity = opacity;
|
|
703
|
-
// Disable depth writes while transparent to avoid draw-order artifacts.
|
|
704
504
|
material.depthWrite = opacity >= 1;
|
|
705
505
|
changed = true;
|
|
706
506
|
}
|
|
@@ -725,17 +525,6 @@ export class Scene3DController {
|
|
|
725
525
|
this.spriteIconMapping = json;
|
|
726
526
|
this.spriteAtlasImage = img;
|
|
727
527
|
}
|
|
728
|
-
/**
|
|
729
|
-
* Props spread onto every deck.gl `MVTLayer`.
|
|
730
|
-
*
|
|
731
|
-
* The cache bounds stop the overlays from keeping an unbounded set of parsed tiles in memory;
|
|
732
|
-
* `maxCacheByteSize` is only included when configured, since deck.gl enforces it only when a
|
|
733
|
-
* tile's byte size is known.
|
|
734
|
-
*
|
|
735
|
-
* `loadOptions.worker` is what keeps the scene off `unpkg.com`: loaders.gl would otherwise fetch
|
|
736
|
-
* its MVT worker from there the first time a tile is parsed, and that request is not something a
|
|
737
|
-
* kiosk can rely on. See {@link CustomLayerConfig.useTileWorker}.
|
|
738
|
-
*/
|
|
739
528
|
get deckTileLayerProps() {
|
|
740
529
|
const { maxCacheSize, maxRequests, refinementStrategy, maxCacheByteSize } = this.deckTileCache;
|
|
741
530
|
const props = {
|
|
@@ -759,7 +548,6 @@ export class Scene3DController {
|
|
|
759
548
|
const paths = buildElevatedPaths((props.data || []), floorKey, (_a = layerConfig.defaultHeight) !== null && _a !== void 0 ? _a : 5);
|
|
760
549
|
if (!paths.length)
|
|
761
550
|
return null;
|
|
762
|
-
// Default color hardcoded to "#cbcbcb" (from the original style) to avoid a type mismatch.
|
|
763
551
|
return new deck.PathLayer(Object.assign(Object.assign({}, props), { id: `${props.id}-paths`, data: paths, getPath: (d) => d.path, getColor: hexToRgb((_b = layerConfig.lineColor) !== null && _b !== void 0 ? _b : "#cbcbcb"), getWidth: (_c = layerConfig.lineWidth) !== null && _c !== void 0 ? _c : 1.5, widthUnits: (_d = layerConfig.widthUnits) !== null && _d !== void 0 ? _d : "pixels", pickable: false }));
|
|
764
552
|
}, updateTriggers: {
|
|
765
553
|
renderSubLayers: [floorKey],
|
|
@@ -772,8 +560,6 @@ export class Scene3DController {
|
|
|
772
560
|
return null;
|
|
773
561
|
return new deck.MVTLayer(Object.assign(Object.assign({}, this.deckTileLayerProps), { id: "indoor-labels", data: layerConfig.dataUrl, binary: (_a = layerConfig.binaryData) !== null && _a !== void 0 ? _a : false, minZoom: (_b = layerConfig.minZoom) !== null && _b !== void 0 ? _b : 19.5, maxZoom: (_c = layerConfig.maxZoom) !== null && _c !== void 0 ? _c : 24, renderSubLayers: (props) => {
|
|
774
562
|
var _a, _b, _c, _d, _e, _f;
|
|
775
|
-
// Use area_name and poi Point features — unique per tile, no duplicates.
|
|
776
|
-
// If a logo-{name} image exists in the sprite, the icon takes priority over the text label.
|
|
777
563
|
const textData = buildLabelData((props.data || []), floorKey, (imageId) => this.map.hasImage(imageId), (_a = layerConfig.defaultHeight) !== null && _a !== void 0 ? _a : 5);
|
|
778
564
|
if (!textData.length)
|
|
779
565
|
return null;
|
|
@@ -847,11 +633,4 @@ export class Scene3DController {
|
|
|
847
633
|
}
|
|
848
634
|
}
|
|
849
635
|
}
|
|
850
|
-
/**
|
|
851
|
-
* Bounded concurrency for loading declarative GLB assets in {@link loadScene3DGlbTemplates}.
|
|
852
|
-
* High enough that one slow/broken asset (see {@link loadGlbRoot}'s timeout) does not stall the
|
|
853
|
-
* rest of the batch, low enough to avoid saturating the browser with concurrent Draco/KTX2
|
|
854
|
-
* decodes when a scene declares many assets.
|
|
855
|
-
*/
|
|
856
636
|
Scene3DController.GLB_LOAD_CONCURRENCY = 4;
|
|
857
|
-
//# sourceMappingURL=scene3DController.js.map
|
|
@@ -90,4 +90,3 @@ export declare class Repository extends Loggeable {
|
|
|
90
90
|
fetchAndParseCssCustomization(type: string): Promise<CssCustomization>;
|
|
91
91
|
postAndParseHealthPing(healthPingId: string, placeId: string, totemId: string, status: boolean): Promise<HealthResponse>;
|
|
92
92
|
}
|
|
93
|
-
//# sourceMappingURL=repository.d.ts.map
|