@mapvx/web-js 3.6.0-dev.1 → 4.0.0-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/README.md +6 -1
- package/dist/cjs/index.js +2 -95
- package/dist/cjs/index.js.LICENSE.txt +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/controllers/routeController.d.ts.map +1 -1
- package/dist/es/controllers/routeController.js +25 -8
- package/dist/es/controllers/routeController.js.map +1 -1
- package/dist/es/domain/models/scene3D.d.ts +13 -0
- package/dist/es/domain/models/scene3D.d.ts.map +1 -1
- package/dist/es/logger/sentry.js +1 -1
- package/dist/es/map/liveMapFitTransform.d.ts +11 -5
- package/dist/es/map/liveMapFitTransform.d.ts.map +1 -1
- package/dist/es/map/liveMapFitTransform.js +28 -19
- package/dist/es/map/liveMapFitTransform.js.map +1 -1
- package/dist/es/map/map.d.ts +0 -1
- package/dist/es/map/map.d.ts.map +1 -1
- package/dist/es/map/map.js +7 -22
- package/dist/es/map/map.js.map +1 -1
- package/dist/es/map/scene3DController.d.ts +15 -4
- package/dist/es/map/scene3DController.d.ts.map +1 -1
- package/dist/es/map/scene3DController.js +22 -10
- package/dist/es/map/scene3DController.js.map +1 -1
- package/dist/umd/index.js +961 -166
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/styles.css +1 -1
- package/dist/umd/styles.css.map +1 -1
- package/package.json +7 -4
- package/dist/cjs/assets/icons.js +0 -85
- package/dist/cjs/assets/icons.js.map +0 -1
- package/dist/cjs/config/draco.js +0 -15
- package/dist/cjs/config/draco.js.map +0 -1
- package/dist/cjs/config/sdkConfig.js +0 -3
- package/dist/cjs/config/sdkConfig.js.map +0 -1
- package/dist/cjs/controllers/markerLayoutController.js +0 -359
- package/dist/cjs/controllers/markerLayoutController.js.map +0 -1
- package/dist/cjs/controllers/routeController.js +0 -1549
- package/dist/cjs/controllers/routeController.js.map +0 -1
- package/dist/cjs/domain/models/_internal.js +0 -14
- package/dist/cjs/domain/models/_internal.js.map +0 -1
- package/dist/cjs/domain/models/_rtl.js +0 -10
- package/dist/cjs/domain/models/_rtl.js.map +0 -1
- package/dist/cjs/domain/models/animation.js +0 -64
- package/dist/cjs/domain/models/animation.js.map +0 -1
- package/dist/cjs/domain/models/banner.js +0 -24
- package/dist/cjs/domain/models/banner.js.map +0 -1
- package/dist/cjs/domain/models/campaign.js +0 -73
- package/dist/cjs/domain/models/campaign.js.map +0 -1
- package/dist/cjs/domain/models/categories.js +0 -37
- package/dist/cjs/domain/models/categories.js.map +0 -1
- package/dist/cjs/domain/models/circle.js +0 -253
- package/dist/cjs/domain/models/circle.js.map +0 -1
- package/dist/cjs/domain/models/cityFilterOption.js +0 -3
- package/dist/cjs/domain/models/cityFilterOption.js.map +0 -1
- package/dist/cjs/domain/models/configuration.js +0 -3
- package/dist/cjs/domain/models/configuration.js.map +0 -1
- package/dist/cjs/domain/models/cssCustomization.js +0 -3
- package/dist/cjs/domain/models/cssCustomization.js.map +0 -1
- package/dist/cjs/domain/models/fitOptions.js +0 -3
- package/dist/cjs/domain/models/fitOptions.js.map +0 -1
- package/dist/cjs/domain/models/innerFloors.js +0 -3
- package/dist/cjs/domain/models/innerFloors.js.map +0 -1
- package/dist/cjs/domain/models/institution.js +0 -45
- package/dist/cjs/domain/models/institution.js.map +0 -1
- package/dist/cjs/domain/models/latLng.js +0 -3
- package/dist/cjs/domain/models/latLng.js.map +0 -1
- package/dist/cjs/domain/models/location.js +0 -3
- package/dist/cjs/domain/models/location.js.map +0 -1
- package/dist/cjs/domain/models/loggeable.js +0 -52
- package/dist/cjs/domain/models/loggeable.js.map +0 -1
- package/dist/cjs/domain/models/mapCamera.js +0 -3
- package/dist/cjs/domain/models/mapCamera.js.map +0 -1
- package/dist/cjs/domain/models/mapConfig.js +0 -37
- package/dist/cjs/domain/models/mapConfig.js.map +0 -1
- package/dist/cjs/domain/models/marker.js +0 -502
- package/dist/cjs/domain/models/marker.js.map +0 -1
- package/dist/cjs/domain/models/multilanguage.js +0 -17
- package/dist/cjs/domain/models/multilanguage.js.map +0 -1
- package/dist/cjs/domain/models/openingHours.js +0 -3
- package/dist/cjs/domain/models/openingHours.js.map +0 -1
- package/dist/cjs/domain/models/place.js +0 -127
- package/dist/cjs/domain/models/place.js.map +0 -1
- package/dist/cjs/domain/models/platform.js +0 -3
- package/dist/cjs/domain/models/platform.js.map +0 -1
- package/dist/cjs/domain/models/popover.js +0 -3
- package/dist/cjs/domain/models/popover.js.map +0 -1
- package/dist/cjs/domain/models/product.js +0 -3
- package/dist/cjs/domain/models/product.js.map +0 -1
- package/dist/cjs/domain/models/property.js +0 -104
- package/dist/cjs/domain/models/property.js.map +0 -1
- package/dist/cjs/domain/models/route.js +0 -166
- package/dist/cjs/domain/models/route.js.map +0 -1
- package/dist/cjs/domain/models/routeConfiguration.js +0 -82
- package/dist/cjs/domain/models/routeConfiguration.js.map +0 -1
- package/dist/cjs/domain/models/routeInstance.js +0 -30
- package/dist/cjs/domain/models/routeInstance.js.map +0 -1
- package/dist/cjs/domain/models/routeStyle.js +0 -3
- package/dist/cjs/domain/models/routeStyle.js.map +0 -1
- package/dist/cjs/domain/models/scene3D.js +0 -3
- package/dist/cjs/domain/models/scene3D.js.map +0 -1
- package/dist/cjs/domain/models/transport.js +0 -22
- package/dist/cjs/domain/models/transport.js.map +0 -1
- package/dist/cjs/domain/ports/ICache.js +0 -3
- package/dist/cjs/domain/ports/ICache.js.map +0 -1
- package/dist/cjs/domain/ports/IHttpClient.js +0 -3
- package/dist/cjs/domain/ports/IHttpClient.js.map +0 -1
- package/dist/cjs/domain/ports/ILogger.js +0 -23
- package/dist/cjs/domain/ports/ILogger.js.map +0 -1
- package/dist/cjs/domain/ports/index.js +0 -10
- package/dist/cjs/domain/ports/index.js.map +0 -1
- package/dist/cjs/infrastructure/cache/CacheManager.js +0 -258
- package/dist/cjs/infrastructure/cache/CacheManager.js.map +0 -1
- package/dist/cjs/infrastructure/cache/LRUCache.js +0 -153
- package/dist/cjs/infrastructure/cache/LRUCache.js.map +0 -1
- package/dist/cjs/infrastructure/cache/PersistentCache.js +0 -168
- package/dist/cjs/infrastructure/cache/PersistentCache.js.map +0 -1
- package/dist/cjs/infrastructure/cache/cacheConfig.js +0 -70
- package/dist/cjs/infrastructure/cache/cacheConfig.js.map +0 -1
- package/dist/cjs/infrastructure/http/FetchHttpClient.js +0 -75
- package/dist/cjs/infrastructure/http/FetchHttpClient.js.map +0 -1
- package/dist/cjs/infrastructure/logging/MVXLogger.js +0 -80
- package/dist/cjs/infrastructure/logging/MVXLogger.js.map +0 -1
- package/dist/cjs/interfaces/cache.js +0 -3
- package/dist/cjs/interfaces/cache.js.map +0 -1
- package/dist/cjs/interfaces/healthResponse.js +0 -3
- package/dist/cjs/interfaces/healthResponse.js.map +0 -1
- package/dist/cjs/interfaces/institutionResponse.js +0 -3
- package/dist/cjs/interfaces/institutionResponse.js.map +0 -1
- package/dist/cjs/interfaces/metadata.js +0 -3
- package/dist/cjs/interfaces/metadata.js.map +0 -1
- package/dist/cjs/interfaces/placeResponse.js +0 -3
- package/dist/cjs/interfaces/placeResponse.js.map +0 -1
- package/dist/cjs/interfaces/routeCacheResponse.js +0 -3
- package/dist/cjs/interfaces/routeCacheResponse.js.map +0 -1
- package/dist/cjs/interfaces/routeResponse.js +0 -3
- package/dist/cjs/interfaces/routeResponse.js.map +0 -1
- package/dist/cjs/interfaces/styleResponse.js +0 -3
- package/dist/cjs/interfaces/styleResponse.js.map +0 -1
- package/dist/cjs/logger/logger.js +0 -78
- package/dist/cjs/logger/logger.js.map +0 -1
- package/dist/cjs/logger/sentry.js +0 -81
- package/dist/cjs/logger/sentry.js.map +0 -1
- package/dist/cjs/map/fitCamera.js +0 -124
- package/dist/cjs/map/fitCamera.js.map +0 -1
- package/dist/cjs/map/liveMapFitTransform.js +0 -180
- package/dist/cjs/map/liveMapFitTransform.js.map +0 -1
- package/dist/cjs/map/map.js +0 -2766
- package/dist/cjs/map/map.js.map +0 -1
- package/dist/cjs/map/mapInteractionOptions.js +0 -73
- package/dist/cjs/map/mapInteractionOptions.js.map +0 -1
- package/dist/cjs/map/scene3DController.js +0 -849
- package/dist/cjs/map/scene3DController.js.map +0 -1
- package/dist/cjs/repository/repository.js +0 -694
- package/dist/cjs/repository/repository.js.map +0 -1
- package/dist/cjs/repository/requester.js +0 -771
- package/dist/cjs/repository/requester.js.map +0 -1
- package/dist/cjs/sdk.js +0 -438
- package/dist/cjs/sdk.js.map +0 -1
- package/dist/cjs/utils/3d.js +0 -245
- package/dist/cjs/utils/3d.js.map +0 -1
- package/dist/cjs/utils/deckLayers.js +0 -153
- package/dist/cjs/utils/deckLayers.js.map +0 -1
- package/dist/cjs/utils/error.js +0 -19
- package/dist/cjs/utils/error.js.map +0 -1
- package/dist/cjs/utils/images.js +0 -25
- package/dist/cjs/utils/images.js.map +0 -1
- package/dist/cjs/utils/loadGlb.js +0 -190
- package/dist/cjs/utils/loadGlb.js.map +0 -1
- package/dist/cjs/utils/mapvxHostname.js +0 -21
- package/dist/cjs/utils/mapvxHostname.js.map +0 -1
- package/dist/cjs/utils/nav-functions.js +0 -150
- package/dist/cjs/utils/nav-functions.js.map +0 -1
- package/dist/cjs/utils/opening-hours-helper.js +0 -914
- package/dist/cjs/utils/opening-hours-helper.js.map +0 -1
- package/dist/cjs/utils/preconnect.js +0 -131
- package/dist/cjs/utils/preconnect.js.map +0 -1
- package/dist/cjs/utils/route-utils.js +0 -57
- package/dist/cjs/utils/route-utils.js.map +0 -1
- package/dist/cjs/utils/semaphore.js +0 -143
- package/dist/cjs/utils/semaphore.js.map +0 -1
- package/dist/cjs/utils/three.js +0 -113
- package/dist/cjs/utils/three.js.map +0 -1
- package/dist/cjs/utils/threeScene.js +0 -126
- package/dist/cjs/utils/threeScene.js.map +0 -1
- package/dist/cjs/utils/update-css.js +0 -76
- package/dist/cjs/utils/update-css.js.map +0 -1
- package/dist/cjs/utils/utils.js +0 -104
- package/dist/cjs/utils/utils.js.map +0 -1
- package/dist/es/domain/models/_rtl.d.ts +0 -7
- package/dist/es/domain/models/_rtl.d.ts.map +0 -1
- package/dist/es/domain/models/_rtl.js +0 -7
- package/dist/es/domain/models/_rtl.js.map +0 -1
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FetchHttpClient = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* HTTP Client implementation using the Fetch API
|
|
6
|
-
*
|
|
7
|
-
* Implements the IHttpClient interface providing HTTP operations
|
|
8
|
-
* with consistent response handling and JSON serialization.
|
|
9
|
-
*
|
|
10
|
-
* @group Utils
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const client = new FetchHttpClient()
|
|
15
|
-
* const response = await client.get<User>('https://api.example.com/users/1')
|
|
16
|
-
* if (response.ok) {
|
|
17
|
-
* console.log(response.data.name)
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
class FetchHttpClient {
|
|
22
|
-
/**
|
|
23
|
-
* Performs a GET request
|
|
24
|
-
*/
|
|
25
|
-
async get(url, options) {
|
|
26
|
-
return this.request(url, "GET", undefined, options);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Performs a POST request
|
|
30
|
-
*/
|
|
31
|
-
async post(url, body, options) {
|
|
32
|
-
return this.request(url, "POST", body, options);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Performs a PUT request
|
|
36
|
-
*/
|
|
37
|
-
async put(url, body, options) {
|
|
38
|
-
return this.request(url, "PUT", body, options);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Performs a DELETE request
|
|
42
|
-
*/
|
|
43
|
-
async delete(url, options) {
|
|
44
|
-
return this.request(url, "DELETE", undefined, options);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Internal request method that handles all HTTP methods
|
|
48
|
-
*/
|
|
49
|
-
async request(url, method, body, options) {
|
|
50
|
-
const headers = Object.assign({}, options === null || options === void 0 ? void 0 : options.headers);
|
|
51
|
-
// Add Content-Type for requests with body
|
|
52
|
-
if (body !== undefined && !headers["Content-Type"]) {
|
|
53
|
-
headers["Content-Type"] = "application/json";
|
|
54
|
-
}
|
|
55
|
-
const fetchOptions = {
|
|
56
|
-
method,
|
|
57
|
-
headers,
|
|
58
|
-
};
|
|
59
|
-
// Add body for POST/PUT requests
|
|
60
|
-
if (body !== undefined) {
|
|
61
|
-
fetchOptions.body = JSON.stringify(body);
|
|
62
|
-
}
|
|
63
|
-
const response = await fetch(url, fetchOptions);
|
|
64
|
-
// Parse JSON response
|
|
65
|
-
const data = await response.json();
|
|
66
|
-
return {
|
|
67
|
-
ok: response.ok,
|
|
68
|
-
status: response.status,
|
|
69
|
-
statusText: response.statusText,
|
|
70
|
-
data: data,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
exports.FetchHttpClient = FetchHttpClient;
|
|
75
|
-
//# sourceMappingURL=FetchHttpClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FetchHttpClient.js","sourceRoot":"","sources":["../../../../src/infrastructure/http/FetchHttpClient.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,eAAe;IAC1B;;OAEG;IACH,KAAK,CAAC,GAAG,CAAc,GAAW,EAAE,OAA4B;QAC9D,OAAO,IAAI,CAAC,OAAO,CAAI,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;IACxD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CACR,GAAW,EACX,IAAa,EACb,OAA4B;QAE5B,OAAO,IAAI,CAAC,OAAO,CAAI,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACpD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CAC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esModule", { value: true });
|
|
3
|
-
exports.MVXLogger = void 0;
|
|
4
|
-
const logger_1 = require("../../logger/logger");
|
|
5
|
-
/**
|
|
6
|
-
* MapVX Logger Adapter
|
|
7
|
-
*
|
|
8
|
-
* Default {@link ILogger} implementation for the SDK. Provider-agnostic by name
|
|
9
|
-
* so the underlying error-tracking backend can change without affecting the
|
|
10
|
-
* public API. It wraps the internal Logger singleton: errors are captured as
|
|
11
|
-
* exceptions and events/warnings are recorded as breadcrumbs (currently backed
|
|
12
|
-
* by Sentry).
|
|
13
|
-
*
|
|
14
|
-
* @group Utils
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const logger: ILogger = new MVXLogger()
|
|
19
|
-
* logger.logEvent("user_action", { action: "click" })
|
|
20
|
-
* logger.logError(new Error("Something failed"))
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
class MVXLogger {
|
|
24
|
-
constructor() {
|
|
25
|
-
this.logger = logger_1.Logger.getInstance();
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Records an analytics-style event as a Sentry breadcrumb.
|
|
29
|
-
*/
|
|
30
|
-
logEvent(eventName, segmentation) {
|
|
31
|
-
const enrichedSegmentation = this.enrichSegmentation(segmentation);
|
|
32
|
-
this.logger.logEvent(eventName, enrichedSegmentation);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Captures an error as a Sentry exception.
|
|
36
|
-
*/
|
|
37
|
-
logError(error, context) {
|
|
38
|
-
if (error instanceof Error) {
|
|
39
|
-
this.logger.logError(error, context);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
this.logger.logError(String(error), context);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Records a warning as a Sentry breadcrumb.
|
|
47
|
-
*/
|
|
48
|
-
logWarning(error, context) {
|
|
49
|
-
if (error instanceof Error) {
|
|
50
|
-
this.logger.logWarning(error, context);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
this.logger.logWarning(String(error), context);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Logs debug information (only in debug mode)
|
|
58
|
-
*/
|
|
59
|
-
logDebug(...args) {
|
|
60
|
-
this.logger.debugLog(...args);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Sets the API token used to enrich event segmentation.
|
|
64
|
-
*/
|
|
65
|
-
setToken(token) {
|
|
66
|
-
this.token = token;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Enriches segmentation with token if available
|
|
70
|
-
*/
|
|
71
|
-
enrichSegmentation(segmentation) {
|
|
72
|
-
const base = segmentation !== null && segmentation !== void 0 ? segmentation : {};
|
|
73
|
-
if (this.token) {
|
|
74
|
-
return Object.assign(Object.assign({}, base), { token: this.token });
|
|
75
|
-
}
|
|
76
|
-
return base;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.MVXLogger = MVXLogger;
|
|
80
|
-
//# sourceMappingURL=MVXLogger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MVXLogger.js","sourceRoot":"","sources":["../../../../src/infrastructure/logging/MVXLogger.ts"],"names":[],"mappings":";;;AACA,gDAA4C;AAE5C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,SAAS;IAIpB;QACE,IAAI,CAAC,MAAM,GAAG,eAAM,CAAC,WAAW,EAAE,CAAA;IACpC,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,SAAiB,EAAE,YAAqC;QAC/D,MAAM,oBAAoB,GAAG,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAA;QAClE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAA;IACvD,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,KAAc,EAAE,OAAgC;QACvD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACtC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAA;QAC9C,CAAC;IACH,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,KAAc,EAAE,OAAgC;QACzD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACxC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,GAAG,IAAe;QACzB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAA;IAC/B,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED;;OAEG;IACK,kBAAkB,CAAC,YAAqC;QAC9D,MAAM,IAAI,GAAG,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,CAAA;QAE/B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,uCACK,IAAI,KACP,KAAK,EAAE,IAAI,CAAC,KAAK,IAClB;QACH,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAnED,8BAmEC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/interfaces/cache.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"healthResponse.js","sourceRoot":"","sources":["../../../src/interfaces/healthResponse.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"institutionResponse.js","sourceRoot":"","sources":["../../../src/interfaces/institutionResponse.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/interfaces/metadata.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"placeResponse.js","sourceRoot":"","sources":["../../../src/interfaces/placeResponse.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routeCacheResponse.js","sourceRoot":"","sources":["../../../src/interfaces/routeCacheResponse.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routeResponse.js","sourceRoot":"","sources":["../../../src/interfaces/routeResponse.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styleResponse.js","sourceRoot":"","sources":["../../../src/interfaces/styleResponse.ts"],"names":[],"mappings":""}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Logger = void 0;
|
|
4
|
-
const sentry_1 = require("./sentry");
|
|
5
|
-
// DEBUG is a webpack DefinePlugin constant, substituted only in the UMD bundle.
|
|
6
|
-
// The tsc-built ES/CJS outputs keep it as a bare global, so reading it directly
|
|
7
|
-
// throws ReferenceError in consumers of those builds. The typeof guard makes
|
|
8
|
-
// the lookup safe everywhere.
|
|
9
|
-
const IS_DEBUG = typeof DEBUG !== "undefined" ? DEBUG : false;
|
|
10
|
-
class Logger {
|
|
11
|
-
constructor() {
|
|
12
|
-
if (IS_DEBUG) {
|
|
13
|
-
console.log("Initializing logger (debug mode — Sentry disabled)");
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
this.sentry = (0, sentry_1.createSentryScope)();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
static getInstance() {
|
|
20
|
-
var _a;
|
|
21
|
-
(_a = Logger.instance) !== null && _a !== void 0 ? _a : (Logger.instance = new Logger());
|
|
22
|
-
return Logger.instance;
|
|
23
|
-
}
|
|
24
|
-
logEvent(eventName, eventSegmentation) {
|
|
25
|
-
var _a;
|
|
26
|
-
if (IS_DEBUG) {
|
|
27
|
-
console.log(eventName, eventSegmentation);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
// Sentry is an error-tracking service, not an analytics platform, so the
|
|
31
|
-
// former Countly analytics events are recorded as breadcrumbs. They carry
|
|
32
|
-
// no value on their own but add context to the next captured error.
|
|
33
|
-
(_a = this.sentry) === null || _a === void 0 ? void 0 : _a.addBreadcrumb({
|
|
34
|
-
category: "event",
|
|
35
|
-
message: eventName,
|
|
36
|
-
level: "info",
|
|
37
|
-
data: eventSegmentation,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
logDebug(...args) {
|
|
42
|
-
if (IS_DEBUG) {
|
|
43
|
-
console.log(...args);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
logWarning(...args) {
|
|
47
|
-
var _a;
|
|
48
|
-
if (IS_DEBUG) {
|
|
49
|
-
console.warn(...args);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
// Warnings are not reported to Sentry on their own (matching the previous
|
|
53
|
-
// error-only report level) but are kept as breadcrumbs for context.
|
|
54
|
-
(_a = this.sentry) === null || _a === void 0 ? void 0 : _a.addBreadcrumb({
|
|
55
|
-
category: "warning",
|
|
56
|
-
level: "warning",
|
|
57
|
-
message: args.map(sentry_1.stringifyLogArgument).join(" "),
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
logError(...args) {
|
|
62
|
-
var _a;
|
|
63
|
-
if (IS_DEBUG) {
|
|
64
|
-
console.error(...args);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
const [error, ...rest] = args;
|
|
68
|
-
const exception = error instanceof Error ? error : new Error((0, sentry_1.stringifyLogArgument)(error));
|
|
69
|
-
(_a = this.sentry) === null || _a === void 0 ? void 0 : _a.captureException(exception, rest.length > 0 ? { data: { args: rest } } : undefined);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
debugLog(...args) {
|
|
73
|
-
if (IS_DEBUG)
|
|
74
|
-
console.log(...args);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.Logger = Logger;
|
|
78
|
-
//# sourceMappingURL=logger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/logger/logger.ts"],"names":[],"mappings":";;;AACA,qCAAkE;AAIlE,gFAAgF;AAChF,gFAAgF;AAChF,6EAA6E;AAC7E,8BAA8B;AAC9B,MAAM,QAAQ,GAAY,OAAO,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AAEtE,MAAa,MAAM;IAKjB;QACE,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAA;QACnE,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,GAAG,IAAA,0BAAiB,GAAE,CAAA;QACnC,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,WAAW;;QACvB,MAAA,MAAM,CAAC,QAAQ,oCAAf,MAAM,CAAC,QAAQ,GAAK,IAAI,MAAM,EAAE,EAAA;QAChC,OAAO,MAAM,CAAC,QAAQ,CAAA;IACxB,CAAC;IAED,QAAQ,CAAC,SAAiB,EAAE,iBAAyC;;QACnE,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAA;QAC3C,CAAC;aAAM,CAAC;YACN,yEAAyE;YACzE,0EAA0E;YAC1E,oE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AE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CACvD,CAAA;QACH,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,GAAG,IAAe;QACzB,IAAI,QAAQ;YAAE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAA;IACpC,CAAC;CACF;AAtED,wBAsEC"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSentryScope = createSentryScope;
|
|
4
|
-
exports.stringifyLogArgument = stringifyLogArgument;
|
|
5
|
-
const browser_1 = require("@sentry/browser");
|
|
6
|
-
// SENTRY_DSN and VERSION are webpack DefinePlugin constants, substituted only
|
|
7
|
-
// in the UMD bundle. The tsc-built ES/CJS outputs keep them as bare globals, so
|
|
8
|
-
// the typeof guards make the lookup safe everywhere; the version placeholder is
|
|
9
|
-
// replaced with the package version by scripts/inject-build-defines.js. The DSN
|
|
10
|
-
// falls back to the public MapVX Sentry project DSN when none is injected at
|
|
11
|
-
// build time — a DSN's public key is safe to ship in the client bundle.
|
|
12
|
-
//
|
|
13
|
-
// Do NOT rewrite these as `VERSION === undefined`: the `declare const` above
|
|
14
|
-
// exists only for the type-checker, so in the ES/CJS builds the identifier is
|
|
15
|
-
// genuinely absent and a direct comparison throws ReferenceError at module load.
|
|
16
|
-
// `typeof` is the only safe way to probe a possibly-undeclared global.
|
|
17
|
-
const SDK_VERSION = typeof VERSION === "undefined" ? "3.6.0-dev.1" : VERSION;
|
|
18
|
-
const DSN = typeof SENTRY_DSN !== "undefined" && SENTRY_DSN
|
|
19
|
-
? SENTRY_DSN
|
|
20
|
-
: "https://872f598f020e3cd73a0933b562d24c81@sentry.mapvx.app/5";
|
|
21
|
-
/**
|
|
22
|
-
* Default integrations that hook into or mutate global browser state.
|
|
23
|
-
*
|
|
24
|
-
* A library must NOT install these: `GlobalHandlers` overrides
|
|
25
|
-
* `window.onerror`/`onunhandledrejection`, `BrowserApiErrors` wraps global
|
|
26
|
-
* timers/event handlers, `Breadcrumbs` patches `console`/`fetch`/history, and
|
|
27
|
-
* `BrowserSession` tracks page sessions. Enabling them would hijack the host
|
|
28
|
-
* application's own Sentry setup. Manual `scope.addBreadcrumb()` still works
|
|
29
|
-
* without the `Breadcrumbs` integration.
|
|
30
|
-
*/
|
|
31
|
-
const GLOBAL_STATE_INTEGRATIONS = new Set([
|
|
32
|
-
"BrowserApiErrors",
|
|
33
|
-
"BrowserSession",
|
|
34
|
-
"Breadcrumbs",
|
|
35
|
-
"GlobalHandlers",
|
|
36
|
-
]);
|
|
37
|
-
/**
|
|
38
|
-
* Creates an isolated Sentry scope + client for the SDK.
|
|
39
|
-
*
|
|
40
|
-
* Uses the library-safe pattern (a dedicated `BrowserClient` bound to its own
|
|
41
|
-
* `Scope`, initialised via `client.init()`) instead of the global
|
|
42
|
-
* `Sentry.init()`, so the SDK reports errors to its own project without
|
|
43
|
-
* touching the host application's Sentry configuration.
|
|
44
|
-
*
|
|
45
|
-
* @returns A scope whose `captureException`/`addBreadcrumb` calls route to the
|
|
46
|
-
* SDK's dedicated Sentry client.
|
|
47
|
-
*/
|
|
48
|
-
function createSentryScope() {
|
|
49
|
-
const integrations = (0, browser_1.getDefaultIntegrations)({}).filter((integration) => !GLOBAL_STATE_INTEGRATIONS.has(integration.name));
|
|
50
|
-
const client = new browser_1.BrowserClient({
|
|
51
|
-
dsn: DSN,
|
|
52
|
-
transport: browser_1.makeFetchTransport,
|
|
53
|
-
stackParser: browser_1.defaultStackParser,
|
|
54
|
-
integrations,
|
|
55
|
-
release: `@mapvx/web-js@${SDK_VERSION}`,
|
|
56
|
-
environment: "production",
|
|
57
|
-
// Errors only — no performance tracing.
|
|
58
|
-
tracesSampleRate: 0,
|
|
59
|
-
});
|
|
60
|
-
const scope = new browser_1.Scope();
|
|
61
|
-
scope.setClient(client);
|
|
62
|
-
client.init();
|
|
63
|
-
return scope;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Converts an arbitrary log argument into a readable string for breadcrumb and
|
|
67
|
-
* error messages.
|
|
68
|
-
*/
|
|
69
|
-
function stringifyLogArgument(arg) {
|
|
70
|
-
if (typeof arg === "string")
|
|
71
|
-
return arg;
|
|
72
|
-
if (arg instanceof Error)
|
|
73
|
-
return arg.message;
|
|
74
|
-
try {
|
|
75
|
-
return JSON.stringify(arg);
|
|
76
|
-
}
|
|
77
|
-
catch (_a) {
|
|
78
|
-
return String(arg);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=sentry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.js","sourceRoot":"","sources":["../../../src/logger/sentry.ts"],"names":[],"mappings":";;AAwDA,8CAqBC;AAMD,oDAQC;AA3FD,6CAMwB;AAKxB,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAChF,6EAA6E;AAC7E,wEAAwE;AACxE,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,iFAAiF;AACjF,uEAAuE;AACvE,MAAM,WAAW,GAAW,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAA;AACxF,MAAM,GAAG,GACP,OAAO,UAAU,KAAK,WAAW,IAAI,UAAU;IAC7C,CAAC,CAAC,UAAU;IACZ,CAAC,CAAC,6DAA6D,CAAA;AAEnE;;;;;;;;;GASG;AACH,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IACxC,kBAAkB;IAClB,gBAAgB;IAChB,aAAa;IACb,gBAAgB;CACjB,CAAC,CAAA;AAEF;;;;;;;;;;GAUG;AACH,SAAgB,iBAAiB;IAC/B,MAAM,YAAY,GAAG,IAAA,gCAAsB,EAAC,EAAE,CAAC,CAAC,MAAM,CACpD,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,yBAAyB,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAClE,CAAA;IAED,MAAM,MAAM,GAAG,IAAI,uBAAa,CAAC;QAC/B,GAAG,EAAE,GAAG;QACR,SAAS,EAAE,4BAAkB;QAC7B,WAAW,EAAE,4BAAkB;QAC/B,YAAY;QACZ,OAAO,EAAE,iBAAiB,WAAW,EAAE;QACvC,WAAW,EAAE,YAAY;QACzB,wCAAwC;QACxC,gBAAgB,EAAE,CAAC;KACpB,CAAC,CAAA;IAEF,MAAM,KAAK,GAAG,IAAI,eAAK,EAAE,CAAA;IACzB,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IACvB,MAAM,CAAC,IAAI,EAAE,CAAA;IAEb,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,GAAY;IAC/C,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAA;IACvC,IAAI,GAAG,YAAY,KAAK;QAAE,OAAO,GAAG,CAAC,OAAO,CAAA;IAC5C,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IAC5B,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.computeOrientedCamera = computeOrientedCamera;
|
|
4
|
-
exports.refineCameraForPitch = refineCameraForPitch;
|
|
5
|
-
const maplibre_gl_1 = require("maplibre-gl");
|
|
6
|
-
/** maplibre world size (px) at zoom 0: tileSize (512) * 2^0. */
|
|
7
|
-
const TILE_SIZE = 512;
|
|
8
|
-
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
9
|
-
/**
|
|
10
|
-
* Compute the camera (center + zoom) that tightly fits `coordinates` into the
|
|
11
|
-
* padded viewport for a given bearing, using an ORIENTED bounding box.
|
|
12
|
-
*
|
|
13
|
-
* maplibre's `fitBounds` only fits a north-up `LngLatBounds`, which wastes
|
|
14
|
-
* viewport space for diagonal geometries under a bearing. Instead we rotate the
|
|
15
|
-
* mercator-projected points by the bearing, measure their axis-aligned extent in
|
|
16
|
-
* that rotated frame, and derive zoom + center analytically.
|
|
17
|
-
*
|
|
18
|
-
* This calculation is orthographic (assumes `pitch: 0`). For a tilted camera use
|
|
19
|
-
* {@link refineCameraForPitch} to correct for perspective.
|
|
20
|
-
*
|
|
21
|
-
* @param coordinates Points to fit (must contain at least one).
|
|
22
|
-
* @param params Bearing, padding and viewport constraints.
|
|
23
|
-
* @returns The fitting camera center and zoom.
|
|
24
|
-
*/
|
|
25
|
-
function computeOrientedCamera(coordinates, params) {
|
|
26
|
-
const { bearing, padding, containerWidth, containerHeight, maxZoom, minZoom } = params;
|
|
27
|
-
// Rotate the mercator plane by -bearing so the target bearing becomes axis-aligned.
|
|
28
|
-
const rad = (-bearing * Math.PI) / 180;
|
|
29
|
-
const cos = Math.cos(rad);
|
|
30
|
-
const sin = Math.sin(rad);
|
|
31
|
-
let minX = Infinity;
|
|
32
|
-
let minY = Infinity;
|
|
33
|
-
let maxX = -Infinity;
|
|
34
|
-
let maxY = -Infinity;
|
|
35
|
-
for (const coord of coordinates) {
|
|
36
|
-
const m = maplibre_gl_1.MercatorCoordinate.fromLngLat({ lat: coord.lat, lng: coord.lng });
|
|
37
|
-
const rx = m.x * cos - m.y * sin;
|
|
38
|
-
const ry = m.x * sin + m.y * cos;
|
|
39
|
-
minX = Math.min(minX, rx);
|
|
40
|
-
minY = Math.min(minY, ry);
|
|
41
|
-
maxX = Math.max(maxX, rx);
|
|
42
|
-
maxY = Math.max(maxY, ry);
|
|
43
|
-
}
|
|
44
|
-
const boxW = maxX - minX || Number.EPSILON;
|
|
45
|
-
const boxH = maxY - minY || Number.EPSILON;
|
|
46
|
-
const availW = Math.max(1, containerWidth - padding.left - padding.right);
|
|
47
|
-
const availH = Math.max(1, containerHeight - padding.top - padding.bottom);
|
|
48
|
-
// worldSize (px) = TILE_SIZE * 2^zoom
|
|
49
|
-
const worldSize = Math.min(availW / boxW, availH / boxH);
|
|
50
|
-
const zoom = clamp(Math.log2(worldSize / TILE_SIZE), minZoom, maxZoom);
|
|
51
|
-
// Center of the oriented box, rotated back to geographic space.
|
|
52
|
-
const cxr = (minX + maxX) / 2;
|
|
53
|
-
const cyr = (minY + maxY) / 2;
|
|
54
|
-
const center = new maplibre_gl_1.MercatorCoordinate(cxr * cos + cyr * sin, -cxr * sin + cyr * cos, 0).toLngLat();
|
|
55
|
-
return { center, zoom };
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Refine a fit camera for a non-zero pitch.
|
|
59
|
-
*
|
|
60
|
-
* With `pitch > 0` the ground-to-screen mapping is non-linear (perspective), so
|
|
61
|
-
* the orthographic result from {@link computeOrientedCamera} either overshoots
|
|
62
|
-
* (geometry spills past the padding) or leaves extra space. This iteratively
|
|
63
|
-
* projects every point through maplibre's real perspective projection on a cloned
|
|
64
|
-
* transform (no visible camera movement) and adjusts zoom + center until the
|
|
65
|
-
* projected bounding box fits the padded viewport.
|
|
66
|
-
*
|
|
67
|
-
* If any point falls behind the horizon during refinement, it bails out and
|
|
68
|
-
* returns the best camera computed so far (never worse than the flat input).
|
|
69
|
-
*
|
|
70
|
-
* @param transform Camera simulator used purely for projection; the caller owns its lifecycle.
|
|
71
|
-
* @param coordinates Points to fit.
|
|
72
|
-
* @param initial The orthographic camera to refine.
|
|
73
|
-
* @param params Bearing, pitch, padding and viewport constraints.
|
|
74
|
-
* @returns The refined camera center and zoom.
|
|
75
|
-
*/
|
|
76
|
-
function refineCameraForPitch(transform, coordinates, initial, params) {
|
|
77
|
-
const { bearing, pitch, padding, containerWidth, containerHeight, maxZoom, minZoom } = params;
|
|
78
|
-
transform.setBearing(bearing);
|
|
79
|
-
transform.setPitch(pitch);
|
|
80
|
-
transform.setPadding(padding);
|
|
81
|
-
transform.setCenter(initial.center);
|
|
82
|
-
transform.setZoom(initial.zoom);
|
|
83
|
-
const availW = Math.max(1, containerWidth - padding.left - padding.right);
|
|
84
|
-
const availH = Math.max(1, containerHeight - padding.top - padding.bottom);
|
|
85
|
-
const MAX_ITERATIONS = 4;
|
|
86
|
-
const CONVERGENCE_EPSILON = 0.01;
|
|
87
|
-
let best = { center: initial.center, zoom: initial.zoom };
|
|
88
|
-
for (let i = 0; i < MAX_ITERATIONS; i++) {
|
|
89
|
-
let minX = Infinity;
|
|
90
|
-
let minY = Infinity;
|
|
91
|
-
let maxX = -Infinity;
|
|
92
|
-
let maxY = -Infinity;
|
|
93
|
-
let allOnSurface = true;
|
|
94
|
-
for (const coord of coordinates) {
|
|
95
|
-
const screen = transform.locationToScreenPoint(new maplibre_gl_1.LngLat(coord.lng, coord.lat));
|
|
96
|
-
if (!transform.isPointOnMapSurface(screen)) {
|
|
97
|
-
allOnSurface = false;
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
minX = Math.min(minX, screen.x);
|
|
101
|
-
minY = Math.min(minY, screen.y);
|
|
102
|
-
maxX = Math.max(maxX, screen.x);
|
|
103
|
-
maxY = Math.max(maxY, screen.y);
|
|
104
|
-
}
|
|
105
|
-
// A point behind the horizon makes the projected box meaningless; keep the
|
|
106
|
-
// last valid camera rather than risk an over-zoomed result.
|
|
107
|
-
if (!allOnSurface)
|
|
108
|
-
break;
|
|
109
|
-
// Recenter: move the projected box center onto the padded screen center.
|
|
110
|
-
const boxCenter = new maplibre_gl_1.Point((minX + maxX) / 2, (minY + maxY) / 2);
|
|
111
|
-
transform.setCenter(transform.screenPointToLocation(boxCenter));
|
|
112
|
-
// Rescale zoom so the projected box fills the padded viewport.
|
|
113
|
-
const boxW = Math.max(maxX - minX, 1e-6);
|
|
114
|
-
const boxH = Math.max(maxY - minY, 1e-6);
|
|
115
|
-
const scale = Math.min(availW / boxW, availH / boxH);
|
|
116
|
-
const zoomDelta = Math.log2(scale);
|
|
117
|
-
transform.setZoom(clamp(transform.zoom + zoomDelta, minZoom, maxZoom));
|
|
118
|
-
best = { center: transform.center, zoom: transform.zoom };
|
|
119
|
-
if (Math.abs(zoomDelta) < CONVERGENCE_EPSILON)
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
return best;
|
|
123
|
-
}
|
|
124
|
-
//# sourceMappingURL=fitCamera.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fitCamera.js","sourceRoot":"","sources":["../../../src/map/fitCamera.ts"],"names":[],"mappings":";;AAoFA,sDAwCC;AAqBD,oDA4DC;AA7MD,6CAA+D;AA8D/D,gEAAgE;AAChE,MAAM,SAAS,GAAG,GAAG,CAAA;AAErB,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAU,EAAE,CAChE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;AAErC;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,qBAAqB,CACnC,WAAqB,EACrB,MAA4B;IAE5B,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;IAEtF,oFAAoF;IACpF,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAA;IACtC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACzB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAEzB,IAAI,IAAI,GAAG,QAAQ,CAAA;IACnB,IAAI,IAAI,GAAG,QAAQ,CAAA;IACnB,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAA;IACpB,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAA;IACpB,KAAK,MAAM,KAAK,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