@mapvx/web-js 1.2.0 → 1.2.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 +2 -0
- package/dist/cjs/controllers/routeController.js +19 -19
- package/dist/cjs/controllers/routeController.js.map +1 -1
- package/dist/cjs/domain/models/circle.js +38 -3
- package/dist/cjs/domain/models/circle.js.map +1 -1
- package/dist/cjs/domain/models/mapConfig.js +10 -1
- package/dist/cjs/domain/models/mapConfig.js.map +1 -1
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/logger/logger.js +13 -8
- package/dist/cjs/logger/logger.js.map +1 -1
- package/dist/cjs/logger/rollbar.js +11 -6
- package/dist/cjs/logger/rollbar.js.map +1 -1
- package/dist/cjs/map/map.js +200 -52
- package/dist/cjs/map/map.js.map +1 -1
- package/dist/cjs/map/mapInteractionOptions.js +56 -0
- package/dist/cjs/map/mapInteractionOptions.js.map +1 -0
- package/dist/cjs/repository/repository.js +25 -26
- package/dist/cjs/repository/repository.js.map +1 -1
- package/dist/cjs/repository/requester.js +24 -27
- package/dist/cjs/repository/requester.js.map +1 -1
- package/dist/cjs/sdk.js +18 -0
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/cjs/utils/semaphore.js +143 -0
- package/dist/cjs/utils/semaphore.js.map +1 -0
- package/dist/es/controllers/routeController.d.ts.map +1 -1
- package/dist/es/controllers/routeController.js +19 -19
- package/dist/es/controllers/routeController.js.map +1 -1
- package/dist/es/domain/models/circle.d.ts +39 -0
- package/dist/es/domain/models/circle.d.ts.map +1 -1
- package/dist/es/domain/models/circle.js +36 -2
- package/dist/es/domain/models/circle.js.map +1 -1
- package/dist/es/domain/models/configuration.d.ts +8 -0
- package/dist/es/domain/models/configuration.d.ts.map +1 -1
- package/dist/es/domain/models/mapConfig.d.ts +118 -3
- package/dist/es/domain/models/mapConfig.d.ts.map +1 -1
- package/dist/es/domain/models/mapConfig.js +9 -0
- package/dist/es/domain/models/mapConfig.js.map +1 -1
- package/dist/es/index.d.ts +2 -1
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +2 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/logger/logger.d.ts.map +1 -1
- package/dist/es/logger/logger.js +13 -8
- package/dist/es/logger/logger.js.map +1 -1
- package/dist/es/logger/rollbar.d.ts.map +1 -1
- package/dist/es/logger/rollbar.js +11 -6
- package/dist/es/logger/rollbar.js.map +1 -1
- package/dist/es/map/map.d.ts +103 -1
- package/dist/es/map/map.d.ts.map +1 -1
- package/dist/es/map/map.js +202 -54
- package/dist/es/map/map.js.map +1 -1
- package/dist/es/map/mapInteractionOptions.d.ts +37 -0
- package/dist/es/map/mapInteractionOptions.d.ts.map +1 -0
- package/dist/es/map/mapInteractionOptions.js +51 -0
- package/dist/es/map/mapInteractionOptions.js.map +1 -0
- package/dist/es/repository/repository.d.ts +0 -1
- package/dist/es/repository/repository.d.ts.map +1 -1
- package/dist/es/repository/repository.js +25 -26
- package/dist/es/repository/repository.js.map +1 -1
- package/dist/es/repository/requester.d.ts +0 -2
- package/dist/es/repository/requester.d.ts.map +1 -1
- package/dist/es/repository/requester.js +24 -27
- package/dist/es/repository/requester.js.map +1 -1
- package/dist/es/sdk.d.ts +2 -0
- package/dist/es/sdk.d.ts.map +1 -1
- package/dist/es/sdk.js +18 -0
- package/dist/es/sdk.js.map +1 -1
- package/dist/es/utils/semaphore.d.ts +70 -0
- package/dist/es/utils/semaphore.d.ts.map +1 -0
- package/dist/es/utils/semaphore.js +139 -0
- package/dist/es/utils/semaphore.js.map +1 -0
- package/dist/umd/index.js +788 -271
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/umd/index.js
CHANGED
|
@@ -5726,9 +5726,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5726
5726
|
CountlyLogger: () => (/* reexport */ CountlyLogger),
|
|
5727
5727
|
DEFAULT_CACHE_CONFIGS: () => (/* reexport */ DEFAULT_CACHE_CONFIGS),
|
|
5728
5728
|
DEFAULT_MAX_STORAGE_BYTES: () => (/* reexport */ DEFAULT_MAX_STORAGE_BYTES),
|
|
5729
|
+
DEFAULT_TILE_CACHE_CONFIG: () => (/* reexport */ DEFAULT_TILE_CACHE_CONFIG),
|
|
5729
5730
|
FetchHttpClient: () => (/* reexport */ FetchHttpClient),
|
|
5730
5731
|
Institution: () => (/* reexport */ Institution),
|
|
5731
5732
|
LRUCache: () => (/* reexport */ LRUCache),
|
|
5733
|
+
MAPLIBRE_MAX_TILE_CACHE_HARD_CAP: () => (/* reexport */ MAPLIBRE_MAX_TILE_CACHE_HARD_CAP),
|
|
5732
5734
|
MAPVX_BRAND_COLOR: () => (/* reexport */ MAPVX_BRAND_COLOR),
|
|
5733
5735
|
MAPVX_DEFAULT_PRECONNECT_HOSTS: () => (/* reexport */ MAPVX_DEFAULT_PRECONNECT_HOSTS),
|
|
5734
5736
|
MVXPlace: () => (/* reexport */ place_MVXPlace),
|
|
@@ -6790,13 +6792,16 @@ var countly_default = /*#__PURE__*/__webpack_require__.n(countly);
|
|
|
6790
6792
|
var rollbar_umd_min = __webpack_require__(916);
|
|
6791
6793
|
var rollbar_umd_min_default = /*#__PURE__*/__webpack_require__.n(rollbar_umd_min);
|
|
6792
6794
|
;// ./src/logger/rollbar.ts
|
|
6793
|
-
// VERSION
|
|
6794
|
-
// bundle. The tsc-built ES/CJS outputs keep
|
|
6795
|
-
// typeof
|
|
6796
|
-
// replaced with the package version by
|
|
6797
|
-
|
|
6795
|
+
// VERSION and ROLLBAR_ACCESS_TOKEN are webpack DefinePlugin constants,
|
|
6796
|
+
// substituted only in the UMD bundle. The tsc-built ES/CJS outputs keep them
|
|
6797
|
+
// as bare globals, so the typeof guards make the lookup safe everywhere; the
|
|
6798
|
+
// version placeholder is replaced with the package version by
|
|
6799
|
+
// scripts/inject-build-defines.js. The access token falls back to the MapVX
|
|
6800
|
+
// SDK-web Rollbar project token when none is injected at build time.
|
|
6801
|
+
var SDK_VERSION = true ? "1.2.2" : 0;
|
|
6802
|
+
var ACCESS_TOKEN = false ? 0 : "28279d52df43411ebd138c2bee0ab1df";
|
|
6798
6803
|
var _rollbarConfig = {
|
|
6799
|
-
accessToken:
|
|
6804
|
+
accessToken: ACCESS_TOKEN,
|
|
6800
6805
|
// Only report what the SDK logs explicitly via logError. Capturing every
|
|
6801
6806
|
// uncaught error / unhandled rejection on the host page floods Rollbar
|
|
6802
6807
|
// with items from third-party code (e.g. Countly, the host app itself)
|
|
@@ -6832,17 +6837,20 @@ function logger_toPrimitive(t, r) { if ("object" != logger_typeof(t) || !t) retu
|
|
|
6832
6837
|
|
|
6833
6838
|
|
|
6834
6839
|
|
|
6840
|
+
// DEBUG, VERSION and COUNTLY_KEY are webpack DefinePlugin constants,
|
|
6841
|
+
// substituted only in the UMD bundle. The tsc-built ES/CJS outputs keep them
|
|
6842
|
+
// as bare globals, so reading them directly throws ReferenceError in
|
|
6843
|
+
// consumers of those builds. The typeof guards make the lookup safe
|
|
6844
|
+
// everywhere; the version placeholder is replaced with the package version
|
|
6845
|
+
// by scripts/inject-build-defines.js. The Countly key falls back to the
|
|
6846
|
+
// MapVX key when none is injected at build time.
|
|
6847
|
+
var IS_DEBUG = true ? false : 0;
|
|
6848
|
+
var logger_SDK_VERSION = true ? "1.2.2" : 0;
|
|
6849
|
+
var COUNTLY_API_KEY = false ? 0 : "f0c8d3b96d336e857a8628f49dd1baf7d7add0e9";
|
|
6835
6850
|
var logger_countly = {
|
|
6836
|
-
apiKey:
|
|
6851
|
+
apiKey: COUNTLY_API_KEY,
|
|
6837
6852
|
url: "https://countly.lazarillo.app"
|
|
6838
6853
|
};
|
|
6839
|
-
// DEBUG and VERSION are webpack DefinePlugin constants, substituted only in
|
|
6840
|
-
// the UMD bundle. The tsc-built ES/CJS outputs keep them as bare globals, so
|
|
6841
|
-
// reading them directly throws ReferenceError in consumers of those builds.
|
|
6842
|
-
// The typeof guards make the lookup safe everywhere; the version placeholder
|
|
6843
|
-
// is replaced with the package version by scripts/inject-build-defines.js.
|
|
6844
|
-
var IS_DEBUG = true ? false : 0;
|
|
6845
|
-
var logger_SDK_VERSION = true ? "1.2.0" : 0;
|
|
6846
6854
|
var Logger = /*#__PURE__*/function () {
|
|
6847
6855
|
function Logger() {
|
|
6848
6856
|
logger_classCallCheck(this, Logger);
|
|
@@ -7034,6 +7042,174 @@ var CountlyLogger = /*#__PURE__*/function () {
|
|
|
7034
7042
|
// EXTERNAL MODULE: ./node_modules/.pnpm/maplibre-gl@5.7.0/node_modules/maplibre-gl/dist/maplibre-gl.js
|
|
7035
7043
|
var maplibre_gl = __webpack_require__(997);
|
|
7036
7044
|
var maplibre_gl_default = /*#__PURE__*/__webpack_require__.n(maplibre_gl);
|
|
7045
|
+
;// ./src/utils/semaphore.ts
|
|
7046
|
+
function semaphore_typeof(o) { "@babel/helpers - typeof"; return semaphore_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, semaphore_typeof(o); }
|
|
7047
|
+
function semaphore_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
7048
|
+
function semaphore_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, semaphore_toPropertyKey(o.key), o); } }
|
|
7049
|
+
function semaphore_createClass(e, r, t) { return r && semaphore_defineProperties(e.prototype, r), t && semaphore_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
7050
|
+
function semaphore_defineProperty(e, r, t) { return (r = semaphore_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7051
|
+
function semaphore_toPropertyKey(t) { var i = semaphore_toPrimitive(t, "string"); return "symbol" == semaphore_typeof(i) ? i : i + ""; }
|
|
7052
|
+
function semaphore_toPrimitive(t, r) { if ("object" != semaphore_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != semaphore_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7053
|
+
/**
|
|
7054
|
+
* Lower bound (inclusive) for the semaphore concurrency limit.
|
|
7055
|
+
*
|
|
7056
|
+
* A value of 1 means at least one operation can run at a time, which keeps the
|
|
7057
|
+
* semaphore meaningful: zero or negative limits would deadlock every caller.
|
|
7058
|
+
*/
|
|
7059
|
+
var MIN_LIMIT = 1;
|
|
7060
|
+
|
|
7061
|
+
/**
|
|
7062
|
+
* Upper bound (inclusive) for the semaphore concurrency limit.
|
|
7063
|
+
*
|
|
7064
|
+
* 64 is high enough for any practical browser-side fan-out (network requests,
|
|
7065
|
+
* tile fetches, etc.) while still protecting downstream services from being
|
|
7066
|
+
* overwhelmed by misconfigured callers.
|
|
7067
|
+
*/
|
|
7068
|
+
var MAX_LIMIT = 64;
|
|
7069
|
+
|
|
7070
|
+
/**
|
|
7071
|
+
* Validate and normalize a candidate concurrency limit.
|
|
7072
|
+
*
|
|
7073
|
+
* @param limit - Candidate value to validate.
|
|
7074
|
+
* @returns The validated integer limit, or `null` if the value is invalid.
|
|
7075
|
+
*/
|
|
7076
|
+
function normalizeLimit(limit) {
|
|
7077
|
+
if (!Number.isFinite(limit)) return null;
|
|
7078
|
+
var floored = Math.floor(limit);
|
|
7079
|
+
if (floored < MIN_LIMIT || floored > MAX_LIMIT) return null;
|
|
7080
|
+
return floored;
|
|
7081
|
+
}
|
|
7082
|
+
|
|
7083
|
+
/**
|
|
7084
|
+
* Counting semaphore that caps the number of concurrent operations.
|
|
7085
|
+
*
|
|
7086
|
+
* Useful when calling APIs, CDNs, or other shared resources where unbounded
|
|
7087
|
+
* parallelism can trigger rate limiting, WAF blocks, or excessive memory use.
|
|
7088
|
+
* Waiters are released in FIFO order as slots become free.
|
|
7089
|
+
*
|
|
7090
|
+
* @example
|
|
7091
|
+
* ```typescript
|
|
7092
|
+
* const sem = new Semaphore(4);
|
|
7093
|
+
*
|
|
7094
|
+
* async function fetchTile(url: string) {
|
|
7095
|
+
* await sem.acquire();
|
|
7096
|
+
* try {
|
|
7097
|
+
* return await fetch(url);
|
|
7098
|
+
* } finally {
|
|
7099
|
+
* sem.release();
|
|
7100
|
+
* }
|
|
7101
|
+
* }
|
|
7102
|
+
* ```
|
|
7103
|
+
*
|
|
7104
|
+
* @group Utils
|
|
7105
|
+
*/
|
|
7106
|
+
var Semaphore = /*#__PURE__*/function () {
|
|
7107
|
+
/**
|
|
7108
|
+
* @param limit - Maximum number of concurrent slots. Must be a finite
|
|
7109
|
+
* integer in `[1, 64]`; invalid values fall back to `1`.
|
|
7110
|
+
*/
|
|
7111
|
+
function Semaphore() {
|
|
7112
|
+
var _normalizeLimit;
|
|
7113
|
+
var limit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MIN_LIMIT;
|
|
7114
|
+
semaphore_classCallCheck(this, Semaphore);
|
|
7115
|
+
semaphore_defineProperty(this, "waiters", []);
|
|
7116
|
+
semaphore_defineProperty(this, "slotsInUse", 0);
|
|
7117
|
+
this.slotLimit = (_normalizeLimit = normalizeLimit(limit)) !== null && _normalizeLimit !== void 0 ? _normalizeLimit : MIN_LIMIT;
|
|
7118
|
+
}
|
|
7119
|
+
|
|
7120
|
+
/**
|
|
7121
|
+
* Maximum number of slots that can be acquired concurrently.
|
|
7122
|
+
*/
|
|
7123
|
+
return semaphore_createClass(Semaphore, [{
|
|
7124
|
+
key: "limit",
|
|
7125
|
+
get: function get() {
|
|
7126
|
+
return this.slotLimit;
|
|
7127
|
+
}
|
|
7128
|
+
|
|
7129
|
+
/**
|
|
7130
|
+
* Number of slots currently held by callers (acquired but not released).
|
|
7131
|
+
*/
|
|
7132
|
+
}, {
|
|
7133
|
+
key: "inUse",
|
|
7134
|
+
get: function get() {
|
|
7135
|
+
return this.slotsInUse;
|
|
7136
|
+
}
|
|
7137
|
+
|
|
7138
|
+
/**
|
|
7139
|
+
* Number of callers currently waiting for a slot.
|
|
7140
|
+
*/
|
|
7141
|
+
}, {
|
|
7142
|
+
key: "waiting",
|
|
7143
|
+
get: function get() {
|
|
7144
|
+
return this.waiters.length;
|
|
7145
|
+
}
|
|
7146
|
+
|
|
7147
|
+
/**
|
|
7148
|
+
* Acquire one slot. Resolves immediately if a slot is free; otherwise waits
|
|
7149
|
+
* in FIFO order until `release()` is called.
|
|
7150
|
+
*
|
|
7151
|
+
* Every successful `acquire()` must be paired with exactly one `release()`,
|
|
7152
|
+
* typically from a `finally` block. If the promise rejects (e.g. the optional
|
|
7153
|
+
* `signal` aborts while queued) no slot was granted, so `release()` must NOT
|
|
7154
|
+
* be called.
|
|
7155
|
+
*
|
|
7156
|
+
* @param signal - Optional `AbortSignal`. If it aborts while the caller is
|
|
7157
|
+
* still queued, the waiter is removed from the queue and the promise rejects
|
|
7158
|
+
* with an `AbortError`, so cancelled work never occupies a slot.
|
|
7159
|
+
* @returns A promise that resolves once a slot has been granted.
|
|
7160
|
+
*/
|
|
7161
|
+
}, {
|
|
7162
|
+
key: "acquire",
|
|
7163
|
+
value: function acquire(signal) {
|
|
7164
|
+
var _this = this;
|
|
7165
|
+
if (signal !== null && signal !== void 0 && signal.aborted) {
|
|
7166
|
+
return Promise.reject(new DOMException("Aborted", "AbortError"));
|
|
7167
|
+
}
|
|
7168
|
+
if (this.slotsInUse < this.slotLimit) {
|
|
7169
|
+
this.slotsInUse++;
|
|
7170
|
+
return Promise.resolve();
|
|
7171
|
+
}
|
|
7172
|
+
return new Promise(function (resolve, reject) {
|
|
7173
|
+
var waiter = function waiter() {
|
|
7174
|
+
_this.slotsInUse++;
|
|
7175
|
+
resolve();
|
|
7176
|
+
};
|
|
7177
|
+
_this.waiters.push(waiter);
|
|
7178
|
+
if (signal) {
|
|
7179
|
+
signal.addEventListener("abort", function () {
|
|
7180
|
+
var index = _this.waiters.indexOf(waiter);
|
|
7181
|
+
if (index !== -1) {
|
|
7182
|
+
_this.waiters.splice(index, 1);
|
|
7183
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
7184
|
+
}
|
|
7185
|
+
}, {
|
|
7186
|
+
once: true
|
|
7187
|
+
});
|
|
7188
|
+
}
|
|
7189
|
+
});
|
|
7190
|
+
}
|
|
7191
|
+
|
|
7192
|
+
/**
|
|
7193
|
+
* Release one slot, waking the next FIFO waiter only when a slot was actually
|
|
7194
|
+
* freed.
|
|
7195
|
+
*
|
|
7196
|
+
* Safe to call even when no slots are in use: it is a true no-op in that case,
|
|
7197
|
+
* so cleanup code in `finally` blocks is defensive against double-releases and
|
|
7198
|
+
* a stray release can never admit a waiter beyond {@link limit}.
|
|
7199
|
+
*/
|
|
7200
|
+
}, {
|
|
7201
|
+
key: "release",
|
|
7202
|
+
value: function release() {
|
|
7203
|
+
if (this.slotsInUse > 0) {
|
|
7204
|
+
this.slotsInUse--;
|
|
7205
|
+
var next = this.waiters.shift();
|
|
7206
|
+
if (next) {
|
|
7207
|
+
next();
|
|
7208
|
+
}
|
|
7209
|
+
}
|
|
7210
|
+
}
|
|
7211
|
+
}]);
|
|
7212
|
+
}();
|
|
7037
7213
|
;// ./src/assets/icons.ts
|
|
7038
7214
|
var userLocationDataUrl = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20aria-hidden%3D%22false%22%20role%3D%22img%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%226%22%20fill%3D%22var(--icon-fill%2C%20%23007aff)%22%20stroke%3D%22var(--icon-stroke%2C%20%23ffffff)%22%20stroke-width%3D%222%22/%3E%3C/svg%3E";
|
|
7039
7215
|
|
|
@@ -7738,6 +7914,52 @@ var MarkerAttribute = /*#__PURE__*/function (_Marker) {
|
|
|
7738
7914
|
}
|
|
7739
7915
|
}]);
|
|
7740
7916
|
}(maplibre_gl.Marker);
|
|
7917
|
+
;// ./src/domain/models/routeInstance.ts
|
|
7918
|
+
/**
|
|
7919
|
+
* Represents the conditions for the step animation.
|
|
7920
|
+
* @group Routes
|
|
7921
|
+
*/
|
|
7922
|
+
|
|
7923
|
+
/**
|
|
7924
|
+
* Represents a single route instance on the map with its own
|
|
7925
|
+
* MapLibre sources/layers, GeoJSON data, animation state, and marker.
|
|
7926
|
+
* @group Routes
|
|
7927
|
+
*/
|
|
7928
|
+
|
|
7929
|
+
/**
|
|
7930
|
+
* Creates a new RouteInstance from a route.
|
|
7931
|
+
* Each instance gets unique MapLibre source/layer IDs based on the route's UUID.
|
|
7932
|
+
* @param route The route to create an instance for.
|
|
7933
|
+
* @returns A new RouteInstance with initialized GeoJSON data structures.
|
|
7934
|
+
* @group Routes
|
|
7935
|
+
*/
|
|
7936
|
+
function createRouteInstance(route) {
|
|
7937
|
+
return {
|
|
7938
|
+
id: route.id,
|
|
7939
|
+
route: route,
|
|
7940
|
+
aheadId: "AHEAD_".concat(route.id),
|
|
7941
|
+
behindId: "BEHIND_".concat(route.id),
|
|
7942
|
+
currentId: "CURRENT_".concat(route.id),
|
|
7943
|
+
aheadSourceData: {
|
|
7944
|
+
type: "FeatureCollection",
|
|
7945
|
+
features: []
|
|
7946
|
+
},
|
|
7947
|
+
behindSourceData: {
|
|
7948
|
+
type: "FeatureCollection",
|
|
7949
|
+
features: []
|
|
7950
|
+
},
|
|
7951
|
+
currentSourceData: {
|
|
7952
|
+
type: "Feature",
|
|
7953
|
+
properties: {},
|
|
7954
|
+
geometry: {
|
|
7955
|
+
type: "LineString",
|
|
7956
|
+
coordinates: []
|
|
7957
|
+
}
|
|
7958
|
+
},
|
|
7959
|
+
animationStatus: "NO_ROUTE",
|
|
7960
|
+
stepAnimationStatus: "NO_ROUTE"
|
|
7961
|
+
};
|
|
7962
|
+
}
|
|
7741
7963
|
;// ./src/utils/nav-functions.ts
|
|
7742
7964
|
function nav_functions_typeof(o) { "@babel/helpers - typeof"; return nav_functions_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, nav_functions_typeof(o); }
|
|
7743
7965
|
function nav_functions_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -7917,52 +8139,6 @@ var NavFunctions = /*#__PURE__*/function () {
|
|
|
7917
8139
|
* The radius of the Earth in meters.
|
|
7918
8140
|
*/
|
|
7919
8141
|
nav_functions_defineProperty(NavFunctions, "EARTH_RADIUS", 6378000);
|
|
7920
|
-
;// ./src/domain/models/routeInstance.ts
|
|
7921
|
-
/**
|
|
7922
|
-
* Represents the conditions for the step animation.
|
|
7923
|
-
* @group Routes
|
|
7924
|
-
*/
|
|
7925
|
-
|
|
7926
|
-
/**
|
|
7927
|
-
* Represents a single route instance on the map with its own
|
|
7928
|
-
* MapLibre sources/layers, GeoJSON data, animation state, and marker.
|
|
7929
|
-
* @group Routes
|
|
7930
|
-
*/
|
|
7931
|
-
|
|
7932
|
-
/**
|
|
7933
|
-
* Creates a new RouteInstance from a route.
|
|
7934
|
-
* Each instance gets unique MapLibre source/layer IDs based on the route's UUID.
|
|
7935
|
-
* @param route The route to create an instance for.
|
|
7936
|
-
* @returns A new RouteInstance with initialized GeoJSON data structures.
|
|
7937
|
-
* @group Routes
|
|
7938
|
-
*/
|
|
7939
|
-
function createRouteInstance(route) {
|
|
7940
|
-
return {
|
|
7941
|
-
id: route.id,
|
|
7942
|
-
route: route,
|
|
7943
|
-
aheadId: "AHEAD_".concat(route.id),
|
|
7944
|
-
behindId: "BEHIND_".concat(route.id),
|
|
7945
|
-
currentId: "CURRENT_".concat(route.id),
|
|
7946
|
-
aheadSourceData: {
|
|
7947
|
-
type: "FeatureCollection",
|
|
7948
|
-
features: []
|
|
7949
|
-
},
|
|
7950
|
-
behindSourceData: {
|
|
7951
|
-
type: "FeatureCollection",
|
|
7952
|
-
features: []
|
|
7953
|
-
},
|
|
7954
|
-
currentSourceData: {
|
|
7955
|
-
type: "Feature",
|
|
7956
|
-
properties: {},
|
|
7957
|
-
geometry: {
|
|
7958
|
-
type: "LineString",
|
|
7959
|
-
coordinates: []
|
|
7960
|
-
}
|
|
7961
|
-
},
|
|
7962
|
-
animationStatus: "NO_ROUTE",
|
|
7963
|
-
stepAnimationStatus: "NO_ROUTE"
|
|
7964
|
-
};
|
|
7965
|
-
}
|
|
7966
8142
|
;// ./src/controllers/routeController.ts
|
|
7967
8143
|
function routeController_typeof(o) { "@babel/helpers - typeof"; return routeController_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, routeController_typeof(o); }
|
|
7968
8144
|
function routeController_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -9136,6 +9312,27 @@ var RouteController = /*#__PURE__*/function () {
|
|
|
9136
9312
|
return;
|
|
9137
9313
|
}
|
|
9138
9314
|
}
|
|
9315
|
+
if (step.startInsideFloor !== step.endInsideFloor) {
|
|
9316
|
+
if (waitStartTime == null) {
|
|
9317
|
+
instance.conditions.waitStartTime = timestamp;
|
|
9318
|
+
instance.conditions.animationId = requestAnimationFrame(function (time) {
|
|
9319
|
+
return _this8.animateStep(time, instance);
|
|
9320
|
+
});
|
|
9321
|
+
return;
|
|
9322
|
+
}
|
|
9323
|
+
if (timestamp - waitStartTime < changeFloorTime * 1000) {
|
|
9324
|
+
instance.conditions.animationId = requestAnimationFrame(function (time) {
|
|
9325
|
+
return _this8.animateStep(time, instance);
|
|
9326
|
+
});
|
|
9327
|
+
return;
|
|
9328
|
+
} else {
|
|
9329
|
+
this.updatePlaceFloorForRouting(instance, step.endInsidePlace, step.endInsideFloor);
|
|
9330
|
+
this.setMarkerLngLat(instance, step.endLocation);
|
|
9331
|
+
instance.conditions.waitStartTime = undefined;
|
|
9332
|
+
onFinish === null || onFinish === void 0 || onFinish(timestamp);
|
|
9333
|
+
return;
|
|
9334
|
+
}
|
|
9335
|
+
}
|
|
9139
9336
|
var distance = NavFunctions.distance(start, end);
|
|
9140
9337
|
var speed = Math.max(step.distance / stepTime, minimumSpeed !== null && minimumSpeed !== void 0 ? minimumSpeed : 0);
|
|
9141
9338
|
if (speed * progressInSeconds > distance) {
|
|
@@ -9161,26 +9358,6 @@ var RouteController = /*#__PURE__*/function () {
|
|
|
9161
9358
|
return _this8.animateStep(time, instance);
|
|
9162
9359
|
});
|
|
9163
9360
|
return;
|
|
9164
|
-
} else if (step.startInsideFloor !== step.endInsideFloor) {
|
|
9165
|
-
if (waitStartTime == null) {
|
|
9166
|
-
instance.conditions.waitStartTime = timestamp;
|
|
9167
|
-
instance.conditions.animationId = requestAnimationFrame(function (time) {
|
|
9168
|
-
return _this8.animateStep(time, instance);
|
|
9169
|
-
});
|
|
9170
|
-
return;
|
|
9171
|
-
}
|
|
9172
|
-
if (timestamp - waitStartTime < changeFloorTime * 1000) {
|
|
9173
|
-
instance.conditions.animationId = requestAnimationFrame(function (time) {
|
|
9174
|
-
return _this8.animateStep(time, instance);
|
|
9175
|
-
});
|
|
9176
|
-
return;
|
|
9177
|
-
} else {
|
|
9178
|
-
this.updatePlaceFloorForRouting(instance, step.endInsidePlace, step.endInsideFloor);
|
|
9179
|
-
this.setMarkerLngLat(instance, step.endLocation);
|
|
9180
|
-
instance.conditions.waitStartTime = undefined;
|
|
9181
|
-
onFinish === null || onFinish === void 0 || onFinish(timestamp);
|
|
9182
|
-
return;
|
|
9183
|
-
}
|
|
9184
9361
|
} else {
|
|
9185
9362
|
onFinish === null || onFinish === void 0 || onFinish(timestamp);
|
|
9186
9363
|
return;
|
|
@@ -9566,7 +9743,8 @@ var Loggeable = /*#__PURE__*/function () {
|
|
|
9566
9743
|
* maxTiles: 500,
|
|
9567
9744
|
* ttlMs: 60 * 60 * 1000, // 1 hour
|
|
9568
9745
|
* persistToServiceWorker: true,
|
|
9569
|
-
* preloadAdjacentZooms: false
|
|
9746
|
+
* preloadAdjacentZooms: false,
|
|
9747
|
+
* maxConcurrentTileFetches: 6
|
|
9570
9748
|
* };
|
|
9571
9749
|
* ```
|
|
9572
9750
|
*
|
|
@@ -9583,9 +9761,19 @@ var DEFAULT_TILE_CACHE_CONFIG = {
|
|
|
9583
9761
|
ttlMs: 30 * 60 * 1000,
|
|
9584
9762
|
// 30 minutes
|
|
9585
9763
|
persistToServiceWorker: true,
|
|
9586
|
-
preloadAdjacentZooms: false
|
|
9764
|
+
preloadAdjacentZooms: false,
|
|
9765
|
+
maxConcurrentTileFetches: 6
|
|
9587
9766
|
};
|
|
9588
9767
|
|
|
9768
|
+
/**
|
|
9769
|
+
* Hard cap for {@link MapTileCacheConfig.maxTiles}.
|
|
9770
|
+
* Configurations above this (e.g. millions) are clamped to avoid memory pressure
|
|
9771
|
+
* and excessive interaction with the tile CDN / service worker.
|
|
9772
|
+
*
|
|
9773
|
+
* @internal
|
|
9774
|
+
*/
|
|
9775
|
+
var MAPLIBRE_MAX_TILE_CACHE_HARD_CAP = 100000;
|
|
9776
|
+
|
|
9589
9777
|
/**
|
|
9590
9778
|
* Basic configuration for the map.
|
|
9591
9779
|
* Provides essential settings for initializing and customizing map behavior.
|
|
@@ -9623,6 +9811,14 @@ var DEFAULT_TILE_CACHE_CONFIG = {
|
|
|
9623
9811
|
* @property showZoom - (Optional) Whether to display the zoom control.
|
|
9624
9812
|
* @property navigationPosition - (Optional) Position of the navigation controls on the map.
|
|
9625
9813
|
* @property bearingSnap - (Optional) The bearing snap threshold in degrees.
|
|
9814
|
+
* @property bearing - (Optional) Initial bearing (rotation) of the map in degrees, clockwise from north.
|
|
9815
|
+
* @property interactive - (Optional) Master switch for all user interaction (pan/zoom/rotate).
|
|
9816
|
+
* @property rotateEnabled - (Optional) Whether the user can rotate the map; keeps pinch-zoom when disabled.
|
|
9817
|
+
* @property dragPan - (Optional) Whether the user can pan by dragging/swiping.
|
|
9818
|
+
* @property scrollZoom - (Optional) Whether the scroll wheel/trackpad can zoom the map.
|
|
9819
|
+
* @property doubleClickZoom - (Optional) Whether double-click/double-tap zooms the map.
|
|
9820
|
+
* @property touchZoomRotate - (Optional) Whether pinch gestures can zoom the map on touch devices.
|
|
9821
|
+
* @property keyboard - (Optional) Whether keyboard shortcuts can pan/zoom/rotate the map.
|
|
9626
9822
|
* @property institutionId - (Optional) The institution identifier for map context. Required for loading map related data from Portal.
|
|
9627
9823
|
* @property authToken - (Optional) Authentication token for accessing protected map resources. Required for loading map related data from Portal.
|
|
9628
9824
|
* @property apiUrl - (Optional) Injected by SDK when creating map; base API URL for map requests.
|
|
@@ -9630,6 +9826,11 @@ var DEFAULT_TILE_CACHE_CONFIG = {
|
|
|
9630
9826
|
*/
|
|
9631
9827
|
;// ./src/domain/models/circle.ts
|
|
9632
9828
|
function circle_typeof(o) { "@babel/helpers - typeof"; return circle_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, circle_typeof(o); }
|
|
9829
|
+
function circle_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9830
|
+
function circle_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? circle_ownKeys(Object(t), !0).forEach(function (r) { circle_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : circle_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9831
|
+
function circle_defineProperty(e, r, t) { return (r = circle_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
9832
|
+
function circle_toPropertyKey(t) { var i = circle_toPrimitive(t, "string"); return "symbol" == circle_typeof(i) ? i : i + ""; }
|
|
9833
|
+
function circle_toPrimitive(t, r) { if ("object" != circle_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != circle_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9633
9834
|
|
|
9634
9835
|
/**
|
|
9635
9836
|
* MapVX brand color used as the default for circle styling and other
|
|
@@ -9639,6 +9840,27 @@ function circle_typeof(o) { "@babel/helpers - typeof"; return circle_typeof = "f
|
|
|
9639
9840
|
*/
|
|
9640
9841
|
var MAPVX_BRAND_COLOR = "#276EF1";
|
|
9641
9842
|
|
|
9843
|
+
/**
|
|
9844
|
+
* Where a circle renders relative to the other map layers.
|
|
9845
|
+
*
|
|
9846
|
+
* - `"aboveBasemap"` (default): above every basemap geometry layer —
|
|
9847
|
+
* including indoor floor-plate and building polygons — but below the
|
|
9848
|
+
* labels that follow them. A circle is never occluded by basemap fills.
|
|
9849
|
+
* - `"belowLabels"`: below the first symbol (label) layer of the style.
|
|
9850
|
+
* On indoor styles, floor-plate polygons ordered after that layer will
|
|
9851
|
+
* paint over the circle.
|
|
9852
|
+
* - `"top"`: above everything, including labels and markers drawn in
|
|
9853
|
+
* style layers.
|
|
9854
|
+
*
|
|
9855
|
+
* @group Circles
|
|
9856
|
+
*/
|
|
9857
|
+
|
|
9858
|
+
/**
|
|
9859
|
+
* Valid values for {@link CircleRenderOrder}, in rendering order.
|
|
9860
|
+
* @internal
|
|
9861
|
+
*/
|
|
9862
|
+
var CIRCLE_RENDER_ORDERS = ["belowLabels", "aboveBasemap", "top"];
|
|
9863
|
+
|
|
9642
9864
|
/**
|
|
9643
9865
|
* Default styling values applied to a circle when the corresponding
|
|
9644
9866
|
* {@link CircleConfig} fields are omitted.
|
|
@@ -9650,7 +9872,8 @@ var CIRCLE_DEFAULTS = {
|
|
|
9650
9872
|
fillOpacity: 0.14,
|
|
9651
9873
|
strokeColor: MAPVX_BRAND_COLOR,
|
|
9652
9874
|
strokeWidth: 2,
|
|
9653
|
-
strokeOpacity: 0.65
|
|
9875
|
+
strokeOpacity: 0.65,
|
|
9876
|
+
renderOrder: "aboveBasemap"
|
|
9654
9877
|
};
|
|
9655
9878
|
|
|
9656
9879
|
/**
|
|
@@ -9679,6 +9902,22 @@ var CIRCLE_DEFAULTS = {
|
|
|
9679
9902
|
* restyles: a circle hidden via `hideCircle` stays hidden until `showCircle`.
|
|
9680
9903
|
*/
|
|
9681
9904
|
|
|
9905
|
+
/**
|
|
9906
|
+
* Returns a deep copy of a {@link CircleRecord}, including the nested
|
|
9907
|
+
* coordinate. Used by the map accessors so callers can't mutate internal
|
|
9908
|
+
* circle state by writing to a returned record.
|
|
9909
|
+
*
|
|
9910
|
+
* @param record The circle record to clone.
|
|
9911
|
+
* @returns An independent copy of the record.
|
|
9912
|
+
*
|
|
9913
|
+
* @group Circles
|
|
9914
|
+
*/
|
|
9915
|
+
function cloneCircleRecord(record) {
|
|
9916
|
+
return circle_objectSpread(circle_objectSpread({}, record), {}, {
|
|
9917
|
+
coordinate: circle_objectSpread({}, record.coordinate)
|
|
9918
|
+
});
|
|
9919
|
+
}
|
|
9920
|
+
|
|
9682
9921
|
/**
|
|
9683
9922
|
* Validates that a radius in meters is positive and finite.
|
|
9684
9923
|
* @param radius The radius value to validate.
|
|
@@ -9762,6 +10001,9 @@ function isValidCircleConfig(config) {
|
|
|
9762
10001
|
if (typeof c.strokeOpacity !== "number" || !Number.isFinite(c.strokeOpacity)) return false;
|
|
9763
10002
|
}
|
|
9764
10003
|
if (c.floorId !== undefined && typeof c.floorId !== "string") return false;
|
|
10004
|
+
if (c.renderOrder !== undefined && !CIRCLE_RENDER_ORDERS.includes(c.renderOrder)) {
|
|
10005
|
+
return false;
|
|
10006
|
+
}
|
|
9765
10007
|
return true;
|
|
9766
10008
|
}
|
|
9767
10009
|
|
|
@@ -9777,13 +10019,21 @@ function isValidCircleConfig(config) {
|
|
|
9777
10019
|
* @group Circles
|
|
9778
10020
|
*/
|
|
9779
10021
|
function resolveCircleConfig(config) {
|
|
9780
|
-
var _config$id, _config$fillColor, _config$strokeColor, _config$strokeWidth;
|
|
10022
|
+
var _config$id, _config$fillColor, _config$strokeColor, _config$strokeWidth, _config$renderOrder;
|
|
9781
10023
|
var hidden = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
9782
10024
|
validateRadiusMeters(config.radiusMeters);
|
|
9783
10025
|
validateCoordinate(config.coordinate);
|
|
10026
|
+
if (config.renderOrder !== undefined && !CIRCLE_RENDER_ORDERS.includes(config.renderOrder)) {
|
|
10027
|
+
throw new Error("Invalid renderOrder: ".concat(String(config.renderOrder), ". ") + "Must be one of: ".concat(CIRCLE_RENDER_ORDERS.join(", "), "."));
|
|
10028
|
+
}
|
|
9784
10029
|
return {
|
|
9785
10030
|
id: (_config$id = config.id) !== null && _config$id !== void 0 ? _config$id : generateHexadecimalKey(),
|
|
9786
|
-
coordinate
|
|
10031
|
+
// Copy the coordinate so later mutations of the caller's object
|
|
10032
|
+
// can't change internal circle state
|
|
10033
|
+
coordinate: {
|
|
10034
|
+
lat: config.coordinate.lat,
|
|
10035
|
+
lng: config.coordinate.lng
|
|
10036
|
+
},
|
|
9787
10037
|
radiusMeters: config.radiusMeters,
|
|
9788
10038
|
fillColor: (_config$fillColor = config.fillColor) !== null && _config$fillColor !== void 0 ? _config$fillColor : CIRCLE_DEFAULTS.fillColor,
|
|
9789
10039
|
fillOpacity: clampOpacity(config.fillOpacity, CIRCLE_DEFAULTS.fillOpacity),
|
|
@@ -9791,6 +10041,7 @@ function resolveCircleConfig(config) {
|
|
|
9791
10041
|
strokeWidth: (_config$strokeWidth = config.strokeWidth) !== null && _config$strokeWidth !== void 0 ? _config$strokeWidth : CIRCLE_DEFAULTS.strokeWidth,
|
|
9792
10042
|
strokeOpacity: clampOpacity(config.strokeOpacity, CIRCLE_DEFAULTS.strokeOpacity),
|
|
9793
10043
|
floorId: config.floorId,
|
|
10044
|
+
renderOrder: (_config$renderOrder = config.renderOrder) !== null && _config$renderOrder !== void 0 ? _config$renderOrder : CIRCLE_DEFAULTS.renderOrder,
|
|
9794
10045
|
hidden: hidden
|
|
9795
10046
|
};
|
|
9796
10047
|
}
|
|
@@ -11049,11 +11300,9 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11049
11300
|
// Ensure we have an absolute URL (required for new URL() in fetchFromUrl)
|
|
11050
11301
|
var withProtocol = apiUrl.startsWith("http://") || apiUrl.startsWith("https://") ? apiUrl : "https://".concat(apiUrl);
|
|
11051
11302
|
var cleanApiUrl = withProtocol.endsWith("/") ? withProtocol.slice(0, -1) : withProtocol;
|
|
11052
|
-
this.baseUrl = "".concat(cleanApiUrl, "/api/sdk/");
|
|
11053
|
-
this.baseUrlV2 = "".concat(cleanApiUrl, "/api/sdk/v2/");
|
|
11054
|
-
this.baseUrlApi = "".concat(cleanApiUrl, "/api/");
|
|
11303
|
+
this.baseUrl = "".concat(cleanApiUrl, "/api/sdk/v2/");
|
|
11055
11304
|
this.baseUrlPortal = "".concat(cleanApiUrl, "/api/portal/");
|
|
11056
|
-
this.baseUrlHealth = "https://api.mapvx.com/api/health
|
|
11305
|
+
this.baseUrlHealth = "https://api.mapvx.com/api/sdk/v2/health";
|
|
11057
11306
|
this.oldBaseUrl = "https://api.mapvx.com/api/sdk/";
|
|
11058
11307
|
this.routeBaseUrl = "https://api.mapvx.com/sdk/";
|
|
11059
11308
|
}
|
|
@@ -11146,11 +11395,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11146
11395
|
options = {
|
|
11147
11396
|
method: "GET",
|
|
11148
11397
|
headers: {
|
|
11149
|
-
"content-type": "application/json"
|
|
11398
|
+
"content-type": "application/json",
|
|
11399
|
+
Authorization: "Bearer ".concat(token)
|
|
11150
11400
|
}
|
|
11151
11401
|
};
|
|
11152
11402
|
params = {
|
|
11153
|
-
token: token,
|
|
11154
11403
|
stopId: stopId,
|
|
11155
11404
|
lang: this.lang
|
|
11156
11405
|
};
|
|
@@ -11182,11 +11431,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11182
11431
|
options = {
|
|
11183
11432
|
method: "GET",
|
|
11184
11433
|
headers: {
|
|
11185
|
-
"content-type": "application/json"
|
|
11434
|
+
"content-type": "application/json",
|
|
11435
|
+
Authorization: "Bearer ".concat(token)
|
|
11186
11436
|
}
|
|
11187
11437
|
};
|
|
11188
11438
|
params = {
|
|
11189
|
-
token: token,
|
|
11190
11439
|
stopId: stopId,
|
|
11191
11440
|
vehicleId: vehicleId,
|
|
11192
11441
|
lang: this.lang
|
|
@@ -11218,11 +11467,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11218
11467
|
options = {
|
|
11219
11468
|
method: "GET",
|
|
11220
11469
|
headers: {
|
|
11221
|
-
"content-type": "application/json"
|
|
11470
|
+
"content-type": "application/json",
|
|
11471
|
+
Authorization: "Bearer ".concat(token)
|
|
11222
11472
|
}
|
|
11223
11473
|
};
|
|
11224
11474
|
params = {
|
|
11225
|
-
token: token,
|
|
11226
11475
|
lang: this.lang
|
|
11227
11476
|
};
|
|
11228
11477
|
if (placeId != null) {
|
|
@@ -11295,11 +11544,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11295
11544
|
options = {
|
|
11296
11545
|
method: "GET",
|
|
11297
11546
|
headers: {
|
|
11298
|
-
"content-type": "application/json"
|
|
11547
|
+
"content-type": "application/json",
|
|
11548
|
+
Authorization: "Bearer ".concat(token)
|
|
11299
11549
|
}
|
|
11300
11550
|
};
|
|
11301
11551
|
params = {
|
|
11302
|
-
token: token,
|
|
11303
11552
|
lang: this.lang
|
|
11304
11553
|
};
|
|
11305
11554
|
return _context6.a(2, this.fetchFromUrl(this.baseUrl + "availablePlaces", params, options));
|
|
@@ -11368,11 +11617,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11368
11617
|
options = {
|
|
11369
11618
|
method: "GET",
|
|
11370
11619
|
headers: {
|
|
11371
|
-
"content-type": "application/json"
|
|
11620
|
+
"content-type": "application/json",
|
|
11621
|
+
Authorization: "Bearer ".concat(token)
|
|
11372
11622
|
}
|
|
11373
11623
|
};
|
|
11374
11624
|
params = {
|
|
11375
|
-
token: token,
|
|
11376
11625
|
place_id: placeId,
|
|
11377
11626
|
lang: this.lang
|
|
11378
11627
|
};
|
|
@@ -11442,11 +11691,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11442
11691
|
options = {
|
|
11443
11692
|
method: "GET",
|
|
11444
11693
|
headers: {
|
|
11445
|
-
"content-type": "application/json"
|
|
11694
|
+
"content-type": "application/json",
|
|
11695
|
+
Authorization: "Bearer ".concat(token)
|
|
11446
11696
|
}
|
|
11447
11697
|
};
|
|
11448
11698
|
params = {
|
|
11449
|
-
token: token,
|
|
11450
11699
|
targetPlace: targetPlaceId,
|
|
11451
11700
|
lang: this.lang
|
|
11452
11701
|
};
|
|
@@ -11517,7 +11766,8 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11517
11766
|
options = {
|
|
11518
11767
|
method: "GET",
|
|
11519
11768
|
headers: {
|
|
11520
|
-
"content-type": "application/json"
|
|
11769
|
+
"content-type": "application/json",
|
|
11770
|
+
Authorization: "Bearer ".concat(token)
|
|
11521
11771
|
}
|
|
11522
11772
|
};
|
|
11523
11773
|
params = {
|
|
@@ -11534,8 +11784,7 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11534
11784
|
announceFormat: routeConfig.announceFormat,
|
|
11535
11785
|
userBearing: 0,
|
|
11536
11786
|
lang: this.lang,
|
|
11537
|
-
unitSystem: routeConfig.unitSystem
|
|
11538
|
-
token: token
|
|
11787
|
+
unitSystem: routeConfig.unitSystem
|
|
11539
11788
|
};
|
|
11540
11789
|
if ("id" in routeConfig.initialLocation) {
|
|
11541
11790
|
params.fromPlaceId = routeConfig.initialLocation.id;
|
|
@@ -11592,7 +11841,8 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11592
11841
|
options = {
|
|
11593
11842
|
method: "GET",
|
|
11594
11843
|
headers: {
|
|
11595
|
-
"content-type": "application/json"
|
|
11844
|
+
"content-type": "application/json",
|
|
11845
|
+
Authorization: "Bearer ".concat(token)
|
|
11596
11846
|
}
|
|
11597
11847
|
};
|
|
11598
11848
|
params = {
|
|
@@ -11609,8 +11859,7 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11609
11859
|
announceFormat: routeConfig.announceFormat,
|
|
11610
11860
|
userBearing: 0,
|
|
11611
11861
|
lang: this.lang,
|
|
11612
|
-
unitSystem: routeConfig.unitSystem
|
|
11613
|
-
token: token
|
|
11862
|
+
unitSystem: routeConfig.unitSystem
|
|
11614
11863
|
};
|
|
11615
11864
|
if ("id" in routeConfig.initialLocation) {
|
|
11616
11865
|
params.fromPlaceId = routeConfig.initialLocation.id;
|
|
@@ -11669,11 +11918,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11669
11918
|
options = {
|
|
11670
11919
|
method: "GET",
|
|
11671
11920
|
headers: {
|
|
11672
|
-
"content-type": "application/json"
|
|
11921
|
+
"content-type": "application/json",
|
|
11922
|
+
Authorization: "Bearer ".concat(token)
|
|
11673
11923
|
}
|
|
11674
11924
|
};
|
|
11675
11925
|
params = {
|
|
11676
|
-
token: token,
|
|
11677
11926
|
lang: this.lang
|
|
11678
11927
|
};
|
|
11679
11928
|
return _context12.a(2, this.fetchFromUrl(this.baseUrl + "institution", params, options));
|
|
@@ -11709,14 +11958,14 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11709
11958
|
options = {
|
|
11710
11959
|
method: "GET",
|
|
11711
11960
|
headers: {
|
|
11712
|
-
"content-type": "application/json"
|
|
11961
|
+
"content-type": "application/json",
|
|
11962
|
+
Authorization: "Bearer ".concat(token)
|
|
11713
11963
|
}
|
|
11714
11964
|
};
|
|
11715
11965
|
params = {
|
|
11716
11966
|
institution_id: institutionId,
|
|
11717
11967
|
input: input,
|
|
11718
|
-
lang: this.lang
|
|
11719
|
-
token: token
|
|
11968
|
+
lang: this.lang
|
|
11720
11969
|
};
|
|
11721
11970
|
if (parentIds) {
|
|
11722
11971
|
params.parentPlaces = requester_toConsumableArray(parentIds);
|
|
@@ -11769,7 +12018,7 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11769
12018
|
return requester_regenerator().w(function (_context14) {
|
|
11770
12019
|
while (1) switch (_context14.n) {
|
|
11771
12020
|
case 0:
|
|
11772
|
-
// The v2
|
|
12021
|
+
// The v2 endpoints authenticate via the Authorization header (Bearer),
|
|
11773
12022
|
// not via a `token` query parameter like the legacy /api/sdk/* routes.
|
|
11774
12023
|
options = {
|
|
11775
12024
|
method: "GET",
|
|
@@ -11801,7 +12050,7 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11801
12050
|
if (floor) {
|
|
11802
12051
|
params.floor = floor;
|
|
11803
12052
|
}
|
|
11804
|
-
return _context14.a(2, this.fetchFromUrl(this.
|
|
12053
|
+
return _context14.a(2, this.fetchFromUrl(this.baseUrl + "searchPlacesByTags", params, options));
|
|
11805
12054
|
}
|
|
11806
12055
|
}, _callee14, this);
|
|
11807
12056
|
}));
|
|
@@ -11821,16 +12070,16 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11821
12070
|
options = {
|
|
11822
12071
|
method: "GET",
|
|
11823
12072
|
headers: {
|
|
11824
|
-
"content-type": "application/json"
|
|
12073
|
+
"content-type": "application/json",
|
|
12074
|
+
Authorization: "Bearer ".concat(token)
|
|
11825
12075
|
}
|
|
11826
12076
|
};
|
|
11827
12077
|
params = {
|
|
11828
|
-
token: token,
|
|
11829
12078
|
lang: this.lang
|
|
11830
12079
|
};
|
|
11831
12080
|
if (place_id) params.place_id = place_id;
|
|
11832
12081
|
if (product) params.product = product;
|
|
11833
|
-
return _context15.a(2, this.fetchFromUrl(this.
|
|
12082
|
+
return _context15.a(2, this.fetchFromUrl(this.baseUrl + "configuration", params, options));
|
|
11834
12083
|
}
|
|
11835
12084
|
}, _callee15, this);
|
|
11836
12085
|
}));
|
|
@@ -11850,15 +12099,15 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11850
12099
|
options = {
|
|
11851
12100
|
method: "GET",
|
|
11852
12101
|
headers: {
|
|
11853
|
-
"content-type": "application/json"
|
|
12102
|
+
"content-type": "application/json",
|
|
12103
|
+
Authorization: "Bearer ".concat(token)
|
|
11854
12104
|
}
|
|
11855
12105
|
};
|
|
11856
12106
|
params = {
|
|
11857
|
-
token: token,
|
|
11858
12107
|
lang: this.lang
|
|
11859
12108
|
};
|
|
11860
12109
|
if (place_id) params.id = place_id;
|
|
11861
|
-
return _context16.a(2, this.fetchFromUrl(this.
|
|
12110
|
+
return _context16.a(2, this.fetchFromUrl(this.baseUrl + "category", params, options));
|
|
11862
12111
|
}
|
|
11863
12112
|
}, _callee16, this);
|
|
11864
12113
|
}));
|
|
@@ -11878,11 +12127,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11878
12127
|
options = {
|
|
11879
12128
|
method: "GET",
|
|
11880
12129
|
headers: {
|
|
11881
|
-
"content-type": "application/json"
|
|
12130
|
+
"content-type": "application/json",
|
|
12131
|
+
Authorization: "Bearer ".concat(token)
|
|
11882
12132
|
}
|
|
11883
12133
|
};
|
|
11884
12134
|
params = {
|
|
11885
|
-
token: token,
|
|
11886
12135
|
placeId: parentPlaceId,
|
|
11887
12136
|
fromPlace: fromPlaceId,
|
|
11888
12137
|
announceFormat: announceFormat,
|
|
@@ -11910,11 +12159,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11910
12159
|
options = {
|
|
11911
12160
|
method: "GET",
|
|
11912
12161
|
headers: {
|
|
11913
|
-
"content-type": "application/json"
|
|
12162
|
+
"content-type": "application/json",
|
|
12163
|
+
Authorization: "Bearer ".concat(token)
|
|
11914
12164
|
}
|
|
11915
12165
|
};
|
|
11916
12166
|
params = {
|
|
11917
|
-
token: token,
|
|
11918
12167
|
placeId: placeId
|
|
11919
12168
|
};
|
|
11920
12169
|
return _context18.a(2, this.fetchFromUrl(this.routeBaseUrl + "cache_timestamp", params, options));
|
|
@@ -11937,14 +12186,14 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11937
12186
|
options = {
|
|
11938
12187
|
method: "GET",
|
|
11939
12188
|
headers: {
|
|
11940
|
-
"content-type": "application/json"
|
|
12189
|
+
"content-type": "application/json",
|
|
12190
|
+
Authorization: "Bearer ".concat(token)
|
|
11941
12191
|
}
|
|
11942
12192
|
};
|
|
11943
12193
|
params = {
|
|
11944
|
-
token: token,
|
|
11945
12194
|
type: type
|
|
11946
12195
|
};
|
|
11947
|
-
return _context19.a(2, this.fetchFromUrl(this.
|
|
12196
|
+
return _context19.a(2, this.fetchFromUrl(this.baseUrl + "styles/customStyles", params, options));
|
|
11948
12197
|
}
|
|
11949
12198
|
}, _callee19, this);
|
|
11950
12199
|
}));
|
|
@@ -11967,14 +12216,13 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11967
12216
|
totemId: totemId,
|
|
11968
12217
|
status: status
|
|
11969
12218
|
});
|
|
11970
|
-
params = {
|
|
11971
|
-
token: token
|
|
11972
|
-
};
|
|
12219
|
+
params = {};
|
|
11973
12220
|
options = {
|
|
11974
12221
|
method: "POST",
|
|
11975
12222
|
headers: {
|
|
11976
12223
|
accept: "application/json",
|
|
11977
|
-
"Content-Type": "application/json"
|
|
12224
|
+
"Content-Type": "application/json",
|
|
12225
|
+
Authorization: "Bearer ".concat(token)
|
|
11978
12226
|
},
|
|
11979
12227
|
body: requestData
|
|
11980
12228
|
};
|
|
@@ -12054,7 +12302,6 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12054
12302
|
_this.token = token;
|
|
12055
12303
|
_this.currentLang = lang;
|
|
12056
12304
|
_this.requester = new Requester(lang, apiUrl, mapvxRequestContext);
|
|
12057
|
-
_this.lang = lang;
|
|
12058
12305
|
_this.cache = cache !== null && cache !== void 0 ? cache : new CacheManager();
|
|
12059
12306
|
return _this;
|
|
12060
12307
|
}
|
|
@@ -12261,7 +12508,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12261
12508
|
while (1) switch (_context4.p = _context4.n) {
|
|
12262
12509
|
case 0:
|
|
12263
12510
|
_context4.p = 0;
|
|
12264
|
-
cachedPlace = this.cache.getPlace(placeId, this.
|
|
12511
|
+
cachedPlace = this.cache.getPlace(placeId, this.currentLang);
|
|
12265
12512
|
if (!(cachedPlace != null)) {
|
|
12266
12513
|
_context4.n = 1;
|
|
12267
12514
|
break;
|
|
@@ -12290,9 +12537,9 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12290
12537
|
case 5:
|
|
12291
12538
|
responseData = _context4.v;
|
|
12292
12539
|
place = new place_MVXPlace(responseData);
|
|
12293
|
-
this.cache.setPlace(place.mapvxId, place, this.
|
|
12540
|
+
this.cache.setPlace(place.mapvxId, place, this.currentLang);
|
|
12294
12541
|
if (place.clientId != null) {
|
|
12295
|
-
this.cache.setPlace(place.clientId, place, this.
|
|
12542
|
+
this.cache.setPlace(place.clientId, place, this.currentLang);
|
|
12296
12543
|
}
|
|
12297
12544
|
this.logEvent("fetchAndParsePlaceDetail", {
|
|
12298
12545
|
cached: "false"
|
|
@@ -12321,7 +12568,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12321
12568
|
while (1) switch (_context5.p = _context5.n) {
|
|
12322
12569
|
case 0:
|
|
12323
12570
|
_context5.p = 0;
|
|
12324
|
-
cachedPlace = this.cache.getPlace(placeId, this.
|
|
12571
|
+
cachedPlace = this.cache.getPlace(placeId, this.currentLang);
|
|
12325
12572
|
if (!(cachedPlace != null)) {
|
|
12326
12573
|
_context5.n = 1;
|
|
12327
12574
|
break;
|
|
@@ -12350,9 +12597,9 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12350
12597
|
case 5:
|
|
12351
12598
|
responseData = _context5.v;
|
|
12352
12599
|
place = new place_MVXPlace(responseData);
|
|
12353
|
-
this.cache.setPlace(place.mapvxId, place, this.
|
|
12600
|
+
this.cache.setPlace(place.mapvxId, place, this.currentLang);
|
|
12354
12601
|
if (place.clientId != null) {
|
|
12355
|
-
this.cache.setPlace(place.clientId, place, this.
|
|
12602
|
+
this.cache.setPlace(place.clientId, place, this.currentLang);
|
|
12356
12603
|
}
|
|
12357
12604
|
this.logEvent("fetchAndParseAnyPlaceDetail", {
|
|
12358
12605
|
cached: "false"
|
|
@@ -12477,11 +12724,11 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12477
12724
|
});
|
|
12478
12725
|
this.logEvent("fetchAndParseAnySubPlaces");
|
|
12479
12726
|
subPlaces.forEach(function (place) {
|
|
12480
|
-
if (!_this3.cache.hasPlace(place.mapvxId, _this3.
|
|
12481
|
-
_this3.cache.setPlace(place.mapvxId, place, _this3.
|
|
12727
|
+
if (!_this3.cache.hasPlace(place.mapvxId, _this3.currentLang)) {
|
|
12728
|
+
_this3.cache.setPlace(place.mapvxId, place, _this3.currentLang);
|
|
12482
12729
|
}
|
|
12483
|
-
if (place.clientId != null && !_this3.cache.hasPlace(place.clientId, _this3.
|
|
12484
|
-
_this3.cache.setPlace(place.clientId, place, _this3.
|
|
12730
|
+
if (place.clientId != null && !_this3.cache.hasPlace(place.clientId, _this3.currentLang)) {
|
|
12731
|
+
_this3.cache.setPlace(place.clientId, place, _this3.currentLang);
|
|
12485
12732
|
}
|
|
12486
12733
|
});
|
|
12487
12734
|
return _context7.a(2, subPlaces);
|
|
@@ -12532,11 +12779,11 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12532
12779
|
});
|
|
12533
12780
|
this.logEvent("fetchAndParseAvailablePlaces");
|
|
12534
12781
|
data.forEach(function (place) {
|
|
12535
|
-
if (!_this4.cache.hasPlace(place.mapvxId, _this4.
|
|
12536
|
-
_this4.cache.setPlace(place.mapvxId, place, _this4.
|
|
12782
|
+
if (!_this4.cache.hasPlace(place.mapvxId, _this4.currentLang)) {
|
|
12783
|
+
_this4.cache.setPlace(place.mapvxId, place, _this4.currentLang);
|
|
12537
12784
|
}
|
|
12538
|
-
if (place.clientId != null && !_this4.cache.hasPlace(place.clientId, _this4.
|
|
12539
|
-
_this4.cache.setPlace(place.clientId, place, _this4.
|
|
12785
|
+
if (place.clientId != null && !_this4.cache.hasPlace(place.clientId, _this4.currentLang)) {
|
|
12786
|
+
_this4.cache.setPlace(place.clientId, place, _this4.currentLang);
|
|
12540
12787
|
}
|
|
12541
12788
|
});
|
|
12542
12789
|
return _context8.a(2, data);
|
|
@@ -12590,11 +12837,11 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12590
12837
|
});
|
|
12591
12838
|
this.logEvent("fetchAndParsePlacesFromInstitution");
|
|
12592
12839
|
data.forEach(function (place) {
|
|
12593
|
-
if (!_this5.cache.hasPlace(place.mapvxId, _this5.
|
|
12594
|
-
_this5.cache.setPlace(place.mapvxId, place, _this5.
|
|
12840
|
+
if (!_this5.cache.hasPlace(place.mapvxId, _this5.currentLang)) {
|
|
12841
|
+
_this5.cache.setPlace(place.mapvxId, place, _this5.currentLang);
|
|
12595
12842
|
}
|
|
12596
|
-
if (place.clientId != null && !_this5.cache.hasPlace(place.clientId, _this5.
|
|
12597
|
-
_this5.cache.setPlace(place.clientId, place, _this5.
|
|
12843
|
+
if (place.clientId != null && !_this5.cache.hasPlace(place.clientId, _this5.currentLang)) {
|
|
12844
|
+
_this5.cache.setPlace(place.clientId, place, _this5.currentLang);
|
|
12598
12845
|
}
|
|
12599
12846
|
});
|
|
12600
12847
|
return _context9.a(2, data);
|
|
@@ -12621,7 +12868,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12621
12868
|
var _this6 = this;
|
|
12622
12869
|
var places = [];
|
|
12623
12870
|
ids.forEach(function (id) {
|
|
12624
|
-
var place = _this6.cache.getPlace(id, _this6.
|
|
12871
|
+
var place = _this6.cache.getPlace(id, _this6.currentLang);
|
|
12625
12872
|
if (place != null) {
|
|
12626
12873
|
places.push(place);
|
|
12627
12874
|
}
|
|
@@ -12770,8 +13017,8 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12770
13017
|
while (1) switch (_context10.p = _context10.n) {
|
|
12771
13018
|
case 0:
|
|
12772
13019
|
_context10.p = 0;
|
|
12773
|
-
cachedResponse = this.cache.getVehicle(stopId, this.
|
|
12774
|
-
if (!(cachedResponse != null && (Date.now() - cachedResponse.timestamp < 60 *
|
|
13020
|
+
cachedResponse = this.cache.getVehicle(stopId, this.currentLang);
|
|
13021
|
+
if (!(cachedResponse != null && (Date.now() - cachedResponse.timestamp < 60 * 1000 || cachedResponse.data.routes.length === 0))) {
|
|
12775
13022
|
_context10.n = 1;
|
|
12776
13023
|
break;
|
|
12777
13024
|
}
|
|
@@ -12822,7 +13069,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12822
13069
|
this.cache.setVehicle(stopId, {
|
|
12823
13070
|
timestamp: Date.now(),
|
|
12824
13071
|
data: transport
|
|
12825
|
-
}, this.
|
|
13072
|
+
}, this.currentLang);
|
|
12826
13073
|
this.logEvent("fetchAndParseTransport", {
|
|
12827
13074
|
cached: "false"
|
|
12828
13075
|
});
|
|
@@ -12830,7 +13077,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12830
13077
|
case 8:
|
|
12831
13078
|
_context10.p = 8;
|
|
12832
13079
|
_t10 = _context10.v;
|
|
12833
|
-
_cachedResponse = this.cache.getVehicle(stopId, this.
|
|
13080
|
+
_cachedResponse = this.cache.getVehicle(stopId, this.currentLang);
|
|
12834
13081
|
if (!(_cachedResponse != null)) {
|
|
12835
13082
|
_context10.n = 9;
|
|
12836
13083
|
break;
|
|
@@ -12864,7 +13111,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12864
13111
|
while (1) switch (_context11.p = _context11.n) {
|
|
12865
13112
|
case 0:
|
|
12866
13113
|
_context11.p = 0;
|
|
12867
|
-
cachedResponse = this.cache.getStops(stopId + vehicleId, this.
|
|
13114
|
+
cachedResponse = this.cache.getStops(stopId + vehicleId, this.currentLang);
|
|
12868
13115
|
if (!(cachedResponse != null && Date.now() - cachedResponse.timestamp < 60 * 1000)) {
|
|
12869
13116
|
_context11.n = 1;
|
|
12870
13117
|
break;
|
|
@@ -12901,7 +13148,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12901
13148
|
this.cache.setStops(stopId + vehicleId, {
|
|
12902
13149
|
timestamp: Date.now(),
|
|
12903
13150
|
data: data
|
|
12904
|
-
}, this.
|
|
13151
|
+
}, this.currentLang);
|
|
12905
13152
|
this.logEvent("fetchAndParseStops", {
|
|
12906
13153
|
cached: "false"
|
|
12907
13154
|
});
|
|
@@ -13408,17 +13655,69 @@ function extractStepCoordinates(step) {
|
|
|
13408
13655
|
}
|
|
13409
13656
|
return coords;
|
|
13410
13657
|
}
|
|
13658
|
+
;// ./src/map/mapInteractionOptions.ts
|
|
13659
|
+
/**
|
|
13660
|
+
* Subset of MapLibre {@link MapOptions} that can be derived from the interaction
|
|
13661
|
+
* restriction flags on {@link MapConfig}.
|
|
13662
|
+
*
|
|
13663
|
+
* @internal
|
|
13664
|
+
*/
|
|
13665
|
+
|
|
13666
|
+
/**
|
|
13667
|
+
* Translates the interaction/rotation flags from {@link MapConfig} into the
|
|
13668
|
+
* matching MapLibre constructor options.
|
|
13669
|
+
*
|
|
13670
|
+
* Only keys that were explicitly provided are returned, so MapLibre's defaults
|
|
13671
|
+
* (every interaction enabled) are preserved for any flag left `undefined`. This
|
|
13672
|
+
* deliberately avoids writing `undefined` into the options object, which would
|
|
13673
|
+
* otherwise override MapLibre defaults with `NaN`/`undefined`.
|
|
13674
|
+
*
|
|
13675
|
+
* `rotateEnabled: false` disables drag- and pitch-rotation up front. Touch
|
|
13676
|
+
* rotation cannot be turned off via the constructor without also killing
|
|
13677
|
+
* pinch-to-zoom, so it is handled separately after construction — see
|
|
13678
|
+
* {@link shouldDisableTouchRotation}.
|
|
13679
|
+
*
|
|
13680
|
+
* @internal
|
|
13681
|
+
*/
|
|
13682
|
+
function buildInteractionOptions(mapConfig) {
|
|
13683
|
+
var options = {};
|
|
13684
|
+
if (mapConfig.bearing !== undefined) options.bearing = mapConfig.bearing;
|
|
13685
|
+
if (mapConfig.interactive !== undefined) options.interactive = mapConfig.interactive;
|
|
13686
|
+
if (mapConfig.dragPan !== undefined) options.dragPan = mapConfig.dragPan;
|
|
13687
|
+
if (mapConfig.scrollZoom !== undefined) options.scrollZoom = mapConfig.scrollZoom;
|
|
13688
|
+
if (mapConfig.doubleClickZoom !== undefined) options.doubleClickZoom = mapConfig.doubleClickZoom;
|
|
13689
|
+
if (mapConfig.touchZoomRotate !== undefined) options.touchZoomRotate = mapConfig.touchZoomRotate;
|
|
13690
|
+
if (mapConfig.keyboard !== undefined) options.keyboard = mapConfig.keyboard;
|
|
13691
|
+
if (mapConfig.rotateEnabled === false) {
|
|
13692
|
+
options.dragRotate = false;
|
|
13693
|
+
options.pitchWithRotate = false;
|
|
13694
|
+
}
|
|
13695
|
+
return options;
|
|
13696
|
+
}
|
|
13697
|
+
|
|
13698
|
+
/**
|
|
13699
|
+
* Whether two-finger touch rotation must be disabled after the map is created.
|
|
13700
|
+
*
|
|
13701
|
+
* `rotateEnabled: false` should keep pinch-to-zoom working, so the touch
|
|
13702
|
+
* rotation is disabled via `map.touchZoomRotate.disableRotation()` once the map
|
|
13703
|
+
* instance exists rather than through the constructor.
|
|
13704
|
+
*
|
|
13705
|
+
* @internal
|
|
13706
|
+
*/
|
|
13707
|
+
function shouldDisableTouchRotation(mapConfig) {
|
|
13708
|
+
return mapConfig.rotateEnabled === false;
|
|
13709
|
+
}
|
|
13411
13710
|
;// ./src/map/map.ts
|
|
13412
13711
|
function map_typeof(o) { "@babel/helpers - typeof"; return map_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, map_typeof(o); }
|
|
13413
13712
|
function map_regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return map_regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (map_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, map_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, map_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), map_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", map_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), map_regeneratorDefine2(u), map_regeneratorDefine2(u, o, "Generator"), map_regeneratorDefine2(u, n, function () { return this; }), map_regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (map_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
13414
13713
|
function map_regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } map_regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { map_regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, map_regeneratorDefine2(e, r, n, t); }
|
|
13415
13714
|
function map_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
13416
13715
|
function map_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { map_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { map_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
13417
|
-
function map_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = map_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
13418
13716
|
function map_slicedToArray(r, e) { return map_arrayWithHoles(r) || map_iterableToArrayLimit(r, e) || map_unsupportedIterableToArray(r, e) || map_nonIterableRest(); }
|
|
13419
13717
|
function map_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13420
13718
|
function map_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13421
13719
|
function map_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13720
|
+
function map_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = map_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
13422
13721
|
function map_toConsumableArray(r) { return map_arrayWithoutHoles(r) || map_iterableToArray(r) || map_unsupportedIterableToArray(r) || map_nonIterableSpread(); }
|
|
13423
13722
|
function map_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13424
13723
|
function map_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return map_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? map_arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -13441,6 +13740,8 @@ function map_defineProperty(e, r, t) { return (r = map_toPropertyKey(r)) in e ?
|
|
|
13441
13740
|
function map_toPropertyKey(t) { var i = map_toPrimitive(t, "string"); return "symbol" == map_typeof(i) ? i : i + ""; }
|
|
13442
13741
|
function map_toPrimitive(t, r) { if ("object" != map_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != map_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13443
13742
|
|
|
13743
|
+
|
|
13744
|
+
|
|
13444
13745
|
/** Shared GeoJSON source holding every circle drawn through the circle API. */
|
|
13445
13746
|
var CIRCLE_SOURCE_ID = "mapvx-circles";
|
|
13446
13747
|
/** Fill layer rendering the translucent interior of the circles. */
|
|
@@ -13448,6 +13749,30 @@ var CIRCLE_FILL_LAYER_ID = "mapvx-circles-fill";
|
|
|
13448
13749
|
/** Line layer rendering the circle outlines. */
|
|
13449
13750
|
var CIRCLE_LINE_LAYER_ID = "mapvx-circles-line";
|
|
13450
13751
|
|
|
13752
|
+
/**
|
|
13753
|
+
* Layer-id suffix per circle render order. The default placement keeps the
|
|
13754
|
+
* unsuffixed ids so existing consumers referencing them keep working.
|
|
13755
|
+
*/
|
|
13756
|
+
var CIRCLE_LAYER_SUFFIXES = {
|
|
13757
|
+
aboveBasemap: "",
|
|
13758
|
+
belowLabels: "-below-labels",
|
|
13759
|
+
top: "-top"
|
|
13760
|
+
};
|
|
13761
|
+
|
|
13762
|
+
/** Fill/line layer ids for one circle render-order bucket. */
|
|
13763
|
+
function circleLayerIdsFor(order) {
|
|
13764
|
+
var suffix = CIRCLE_LAYER_SUFFIXES[order];
|
|
13765
|
+
return {
|
|
13766
|
+
fill: CIRCLE_FILL_LAYER_ID + suffix,
|
|
13767
|
+
line: CIRCLE_LINE_LAYER_ID + suffix
|
|
13768
|
+
};
|
|
13769
|
+
}
|
|
13770
|
+
|
|
13771
|
+
/** True for the layer ids owned by the circle API, regardless of bucket. */
|
|
13772
|
+
function isCircleLayerId(id) {
|
|
13773
|
+
return id.startsWith(CIRCLE_FILL_LAYER_ID) || id.startsWith(CIRCLE_LINE_LAYER_ID);
|
|
13774
|
+
}
|
|
13775
|
+
|
|
13451
13776
|
// Flag to track if cached-tile protocol has been registered
|
|
13452
13777
|
var cachedTileProtocolRegistered = false;
|
|
13453
13778
|
|
|
@@ -13470,23 +13795,40 @@ function deepClone(obj) {
|
|
|
13470
13795
|
/**
|
|
13471
13796
|
* Register a custom protocol for cached tiles that routes requests through the main thread.
|
|
13472
13797
|
* This allows the service worker to intercept and cache tile requests.
|
|
13798
|
+
*
|
|
13799
|
+
* Wraps fetches in a {@link Semaphore} so tile CDN / WAFs are not hit with
|
|
13800
|
+
* unbounded parallel requests (same host as the service worker cache). The
|
|
13801
|
+
* semaphore is created once with the limit from the first map's config; later
|
|
13802
|
+
* calls are no-ops because the protocol can only be registered once globally
|
|
13803
|
+
* on MapLibre.
|
|
13804
|
+
*
|
|
13805
|
+
* @param maxConcurrentFetches - Maximum number of in-flight tile fetches.
|
|
13473
13806
|
*/
|
|
13474
|
-
function registerCachedTileProtocol() {
|
|
13807
|
+
function registerCachedTileProtocol(maxConcurrentFetches) {
|
|
13475
13808
|
if (cachedTileProtocolRegistered) return;
|
|
13809
|
+
var semaphore = new Semaphore(maxConcurrentFetches);
|
|
13476
13810
|
maplibre_gl_default().addProtocol("cached-tile", function (params, abortController) {
|
|
13477
|
-
// Convert cached-tile:// URL back to https://
|
|
13478
13811
|
var url = params.url.replace("cached-tile://", "https://");
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13482
|
-
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
return
|
|
13486
|
-
|
|
13487
|
-
|
|
13488
|
-
|
|
13489
|
-
|
|
13812
|
+
|
|
13813
|
+
// Pass the abort signal to acquire() so a request cancelled while still
|
|
13814
|
+
// queued (e.g. during rapid zoom) drops out of the FIFO queue instead of
|
|
13815
|
+
// waiting for a slot just to bail. release() runs only inside this chain,
|
|
13816
|
+
// i.e. only after a slot was actually granted.
|
|
13817
|
+
return semaphore.acquire(abortController.signal).then(function () {
|
|
13818
|
+
return fetch(url, {
|
|
13819
|
+
signal: abortController.signal
|
|
13820
|
+
}).then(function (response) {
|
|
13821
|
+
if (!response.ok) {
|
|
13822
|
+
throw new Error("HTTP error! status: ".concat(response.status));
|
|
13823
|
+
}
|
|
13824
|
+
return response.arrayBuffer();
|
|
13825
|
+
}).then(function (data) {
|
|
13826
|
+
return {
|
|
13827
|
+
data: data
|
|
13828
|
+
};
|
|
13829
|
+
})["finally"](function () {
|
|
13830
|
+
semaphore.release();
|
|
13831
|
+
});
|
|
13490
13832
|
});
|
|
13491
13833
|
});
|
|
13492
13834
|
cachedTileProtocolRegistered = true;
|
|
@@ -13562,6 +13904,7 @@ function convertPaddingToPixels(padding, containerWidth, containerHeight) {
|
|
|
13562
13904
|
|
|
13563
13905
|
|
|
13564
13906
|
|
|
13907
|
+
|
|
13565
13908
|
/**
|
|
13566
13909
|
* @group Map
|
|
13567
13910
|
*/
|
|
@@ -13607,8 +13950,11 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13607
13950
|
_this.watchPositionID = undefined;
|
|
13608
13951
|
_this.onFloorChange = mapConfig.onFloorChange;
|
|
13609
13952
|
_this.onParentPlaceChange = mapConfig.onParentPlaceChange;
|
|
13610
|
-
|
|
13611
|
-
|
|
13953
|
+
_this.tileCacheConfig = function () {
|
|
13954
|
+
var merged = map_objectSpread(map_objectSpread({}, DEFAULT_TILE_CACHE_CONFIG), mapConfig.tileCache);
|
|
13955
|
+
merged.maxTiles = Math.min(merged.maxTiles, MAPLIBRE_MAX_TILE_CACHE_HARD_CAP);
|
|
13956
|
+
return merged;
|
|
13957
|
+
}();
|
|
13612
13958
|
if (mapConfig.parentPlaceId != null) {
|
|
13613
13959
|
_this.initialPlaceDetailSetUp(mapConfig.parentPlaceId, mapConfig.authToken);
|
|
13614
13960
|
}
|
|
@@ -13718,15 +14064,13 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13718
14064
|
_this6 = this;
|
|
13719
14065
|
// Determine if service worker caching should be enabled
|
|
13720
14066
|
var useServiceWorkerCaching = this.tileCacheConfig.enabled && this.tileCacheConfig.persistToServiceWorker;
|
|
13721
|
-
|
|
13722
|
-
// Register cached-tile protocol only if service worker caching is enabled
|
|
13723
14067
|
if (useServiceWorkerCaching) {
|
|
13724
|
-
registerCachedTileProtocol();
|
|
14068
|
+
registerCachedTileProtocol(this.tileCacheConfig.maxConcurrentTileFetches);
|
|
13725
14069
|
}
|
|
13726
14070
|
|
|
13727
14071
|
// Transform tile URLs only if service worker caching is enabled
|
|
13728
14072
|
var finalStyle = useServiceWorkerCaching ? this.transformStyleForCaching(style) : style;
|
|
13729
|
-
var mapOptions = {
|
|
14073
|
+
var mapOptions = map_objectSpread({
|
|
13730
14074
|
container: container,
|
|
13731
14075
|
style: finalStyle,
|
|
13732
14076
|
center: mapConfig.center,
|
|
@@ -13735,10 +14079,10 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13735
14079
|
attributionControl: false,
|
|
13736
14080
|
maplibreLogo: false,
|
|
13737
14081
|
bearingSnap: (_mapConfig$bearingSna = mapConfig.bearingSnap) !== null && _mapConfig$bearingSna !== void 0 ? _mapConfig$bearingSna : 0,
|
|
13738
|
-
cancelPendingTileRequestsWhileZooming:
|
|
14082
|
+
cancelPendingTileRequestsWhileZooming: true,
|
|
13739
14083
|
// Use configured maxTiles for MapLibre's memory cache
|
|
13740
14084
|
maxTileCacheSize: this.tileCacheConfig.maxTiles
|
|
13741
|
-
};
|
|
14085
|
+
}, buildInteractionOptions(mapConfig));
|
|
13742
14086
|
if (mapConfig.maxZoom) mapOptions.maxZoom = mapConfig.maxZoom;
|
|
13743
14087
|
if (mapConfig.minZoom) mapOptions.minZoom = mapConfig.minZoom;
|
|
13744
14088
|
if (mapConfig.maxBounds && mapConfig.maxBounds.length > 1) {
|
|
@@ -13746,6 +14090,12 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13746
14090
|
mapOptions.maxBounds = new maplibre_gl.LngLatBounds([boundingBox[0].lng, boundingBox[0].lat], [boundingBox[1].lng, boundingBox[1].lat]);
|
|
13747
14091
|
}
|
|
13748
14092
|
this.map = new maplibre_gl.Map(mapOptions);
|
|
14093
|
+
// When rotation is disabled we still want pinch-to-zoom to work, so the
|
|
14094
|
+
// two-finger rotation is turned off here instead of via the constructor.
|
|
14095
|
+
if (shouldDisableTouchRotation(mapConfig)) {
|
|
14096
|
+
var _this$map$touchZoomRo, _this$map$touchZoomRo2;
|
|
14097
|
+
(_this$map$touchZoomRo = this.map.touchZoomRotate) === null || _this$map$touchZoomRo === void 0 || (_this$map$touchZoomRo2 = _this$map$touchZoomRo.disableRotation) === null || _this$map$touchZoomRo2 === void 0 || _this$map$touchZoomRo2.call(_this$map$touchZoomRo);
|
|
14098
|
+
}
|
|
13749
14099
|
this.map.addControl(new maplibre_gl.NavigationControl({
|
|
13750
14100
|
showCompass: mapConfig.showCompass !== undefined ? mapConfig.showCompass : true,
|
|
13751
14101
|
showZoom: mapConfig.showZoom !== undefined ? mapConfig.showZoom : true
|
|
@@ -13969,7 +14319,22 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13969
14319
|
}, {
|
|
13970
14320
|
key: "setLang",
|
|
13971
14321
|
value: function setLang(lang) {
|
|
14322
|
+
var _this0 = this;
|
|
13972
14323
|
this.repository.setLang(lang);
|
|
14324
|
+
if (rtlLanguages.includes(lang)) {
|
|
14325
|
+
this.setRTLSupport();
|
|
14326
|
+
}
|
|
14327
|
+
// setLayersForLanguage reads this.map.getStyle()?.layers, which is empty
|
|
14328
|
+
// until the style finishes loading. If setLang is called right after
|
|
14329
|
+
// createMap (before the "load" event), apply it once the style is ready
|
|
14330
|
+
// so the language change is not silently dropped.
|
|
14331
|
+
if (this.map.isStyleLoaded()) {
|
|
14332
|
+
this.setLayersForLanguage(lang);
|
|
14333
|
+
} else {
|
|
14334
|
+
this.map.once("load", function () {
|
|
14335
|
+
return _this0.setLayersForLanguage(lang);
|
|
14336
|
+
});
|
|
14337
|
+
}
|
|
13973
14338
|
}
|
|
13974
14339
|
}, {
|
|
13975
14340
|
key: "setParentPlace",
|
|
@@ -14004,7 +14369,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14004
14369
|
}, {
|
|
14005
14370
|
key: "addMarker",
|
|
14006
14371
|
value: function addMarker(marker) {
|
|
14007
|
-
var
|
|
14372
|
+
var _this1 = this;
|
|
14008
14373
|
try {
|
|
14009
14374
|
var _this$innerFloors$fin4, _this$innerFloors$fin5;
|
|
14010
14375
|
// Check if a marker with the same ID already exists and remove it
|
|
@@ -14024,7 +14389,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14024
14389
|
}
|
|
14025
14390
|
var markerCreated = new MarkerAttribute(marker);
|
|
14026
14391
|
var isOutdoor = !this.parentPlace || ((_this$innerFloors$fin4 = (_this$innerFloors$fin5 = this.innerFloors.find(function (floor) {
|
|
14027
|
-
return floor.key ===
|
|
14392
|
+
return floor.key === _this1.currentFloor;
|
|
14028
14393
|
})) === null || _this$innerFloors$fin5 === void 0 ? void 0 : _this$innerFloors$fin5.reachableFromGPS) !== null && _this$innerFloors$fin4 !== void 0 ? _this$innerFloors$fin4 : false);
|
|
14029
14394
|
markerCreated.changeFloor(this.currentFloor, this.map, isOutdoor);
|
|
14030
14395
|
this.markers.push(markerCreated);
|
|
@@ -14168,14 +14533,15 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14168
14533
|
}, {
|
|
14169
14534
|
key: "getCircle",
|
|
14170
14535
|
value: function getCircle(circleId) {
|
|
14171
|
-
|
|
14536
|
+
var circle = this.circles.find(function (c) {
|
|
14172
14537
|
return c.id === circleId;
|
|
14173
14538
|
});
|
|
14539
|
+
return circle ? cloneCircleRecord(circle) : undefined;
|
|
14174
14540
|
}
|
|
14175
14541
|
}, {
|
|
14176
14542
|
key: "getCircles",
|
|
14177
14543
|
value: function getCircles() {
|
|
14178
|
-
return this.circles.
|
|
14544
|
+
return this.circles.map(cloneCircleRecord);
|
|
14179
14545
|
}
|
|
14180
14546
|
}, {
|
|
14181
14547
|
key: "hasCircle",
|
|
@@ -14210,7 +14576,10 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14210
14576
|
throw new Error("Invalid radiusMeters: ".concat(radiusMeters, ". Must be a positive finite number."));
|
|
14211
14577
|
}
|
|
14212
14578
|
}
|
|
14213
|
-
_circle.coordinate =
|
|
14579
|
+
_circle.coordinate = {
|
|
14580
|
+
lat: center.lat,
|
|
14581
|
+
lng: center.lng
|
|
14582
|
+
};
|
|
14214
14583
|
if (radiusMeters !== undefined) {
|
|
14215
14584
|
_circle.radiusMeters = radiusMeters;
|
|
14216
14585
|
}
|
|
@@ -14332,7 +14701,8 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14332
14701
|
fillOpacity: circle.fillOpacity,
|
|
14333
14702
|
strokeColor: circle.strokeColor,
|
|
14334
14703
|
strokeWidth: circle.strokeWidth,
|
|
14335
|
-
strokeOpacity: circle.strokeOpacity
|
|
14704
|
+
strokeOpacity: circle.strokeOpacity,
|
|
14705
|
+
renderOrder: circle.renderOrder
|
|
14336
14706
|
},
|
|
14337
14707
|
geometry: {
|
|
14338
14708
|
type: "Polygon",
|
|
@@ -14353,45 +14723,119 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14353
14723
|
* time: a style that is still loading simply rejects the calls, and the
|
|
14354
14724
|
* styledata listener retries once the style is ready.
|
|
14355
14725
|
*/
|
|
14726
|
+
/**
|
|
14727
|
+
* Resolves the layer id to insert circle layers before, for one render
|
|
14728
|
+
* order. `undefined` means "append on top".
|
|
14729
|
+
*
|
|
14730
|
+
* `aboveBasemap` finds the topmost non-symbol layer of the style and
|
|
14731
|
+
* inserts before the first symbol layer that follows it. On indoor styles
|
|
14732
|
+
* the floor-plate and building polygons are ordered after the first symbol
|
|
14733
|
+
* layer, so anchoring on the topmost geometry layer — instead of the first
|
|
14734
|
+
* symbol layer — guarantees circles are never occluded by basemap fills
|
|
14735
|
+
* while still rendering below the labels that follow them.
|
|
14736
|
+
*/
|
|
14737
|
+
}, {
|
|
14738
|
+
key: "circleBeforeIdFor",
|
|
14739
|
+
value: function circleBeforeIdFor(order) {
|
|
14740
|
+
var _this$map$getStyle$la2, _this$map$getStyle2, _layers$slice$find;
|
|
14741
|
+
if (order === "top") return undefined;
|
|
14742
|
+
var layers = ((_this$map$getStyle$la2 = (_this$map$getStyle2 = this.map.getStyle()) === null || _this$map$getStyle2 === void 0 ? void 0 : _this$map$getStyle2.layers) !== null && _this$map$getStyle$la2 !== void 0 ? _this$map$getStyle$la2 : []).filter(function (layer) {
|
|
14743
|
+
return !isCircleLayerId(layer.id);
|
|
14744
|
+
});
|
|
14745
|
+
if (order === "belowLabels") {
|
|
14746
|
+
var _layers$find;
|
|
14747
|
+
return (_layers$find = layers.find(function (layer) {
|
|
14748
|
+
return layer.type === "symbol";
|
|
14749
|
+
})) === null || _layers$find === void 0 ? void 0 : _layers$find.id;
|
|
14750
|
+
}
|
|
14751
|
+
|
|
14752
|
+
// aboveBasemap
|
|
14753
|
+
var lastNonSymbolIndex = -1;
|
|
14754
|
+
layers.forEach(function (layer, index) {
|
|
14755
|
+
if (layer.type !== "symbol") lastNonSymbolIndex = index;
|
|
14756
|
+
});
|
|
14757
|
+
return (_layers$slice$find = layers.slice(lastNonSymbolIndex + 1).find(function (layer) {
|
|
14758
|
+
return layer.type === "symbol";
|
|
14759
|
+
})) === null || _layers$slice$find === void 0 ? void 0 : _layers$slice$find.id;
|
|
14760
|
+
}
|
|
14761
|
+
|
|
14762
|
+
/**
|
|
14763
|
+
* Idempotently ensures the shared circle source and one fill/line layer
|
|
14764
|
+
* pair per render order in use, at the placement that order requires.
|
|
14765
|
+
* Placement is recomputed and re-asserted (via moveLayer) on every call,
|
|
14766
|
+
* so circles regain their correct z-order after any style reload or
|
|
14767
|
+
* floor/parent-place change. Safe to call at any time: a style that is
|
|
14768
|
+
* still loading simply rejects the calls, and the styledata listener
|
|
14769
|
+
* retries once the style is ready.
|
|
14770
|
+
*/
|
|
14356
14771
|
}, {
|
|
14357
14772
|
key: "ensureCircleLayers",
|
|
14358
14773
|
value: function ensureCircleLayers() {
|
|
14359
14774
|
if (!this.map) return;
|
|
14360
14775
|
try {
|
|
14361
|
-
var _this$map$getStyle2;
|
|
14362
14776
|
if (!this.map.getSource(CIRCLE_SOURCE_ID)) {
|
|
14363
14777
|
this.map.addSource(CIRCLE_SOURCE_ID, {
|
|
14364
14778
|
type: "geojson",
|
|
14365
14779
|
data: this.circleFeatureCollection()
|
|
14366
14780
|
});
|
|
14367
14781
|
}
|
|
14368
|
-
var
|
|
14369
|
-
return
|
|
14370
|
-
}))
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
|
|
14380
|
-
|
|
14381
|
-
|
|
14382
|
-
|
|
14383
|
-
|
|
14384
|
-
|
|
14385
|
-
|
|
14386
|
-
|
|
14387
|
-
|
|
14388
|
-
|
|
14389
|
-
|
|
14390
|
-
|
|
14391
|
-
|
|
14782
|
+
var ordersInUse = new Set(this.circles.map(function (c) {
|
|
14783
|
+
return c.renderOrder;
|
|
14784
|
+
}));
|
|
14785
|
+
// Always keep the default bucket alive so an empty map still renders
|
|
14786
|
+
// newly added circles without a layer rebuild
|
|
14787
|
+
ordersInUse.add("aboveBasemap");
|
|
14788
|
+
|
|
14789
|
+
// Process buckets lowest-first (CIRCLE_RENDER_ORDERS is canonical):
|
|
14790
|
+
// when two buckets resolve to the same anchor, each addLayer/moveLayer
|
|
14791
|
+
// lands immediately before it, so a bucket processed later paints above
|
|
14792
|
+
// the ones processed earlier. Canonical order keeps
|
|
14793
|
+
// belowLabels < aboveBasemap < top regardless of circle insertion order.
|
|
14794
|
+
var _iterator = map_createForOfIteratorHelper(CIRCLE_RENDER_ORDERS),
|
|
14795
|
+
_step;
|
|
14796
|
+
try {
|
|
14797
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
14798
|
+
var order = _step.value;
|
|
14799
|
+
if (!ordersInUse.has(order)) continue;
|
|
14800
|
+
var ids = circleLayerIdsFor(order);
|
|
14801
|
+
var beforeId = this.circleBeforeIdFor(order);
|
|
14802
|
+
var orderFilter = ["==", ["get", "renderOrder"], order];
|
|
14803
|
+
if (!this.map.getLayer(ids.fill)) {
|
|
14804
|
+
var fillLayer = {
|
|
14805
|
+
id: ids.fill,
|
|
14806
|
+
type: "fill",
|
|
14807
|
+
source: CIRCLE_SOURCE_ID,
|
|
14808
|
+
filter: orderFilter,
|
|
14809
|
+
paint: {
|
|
14810
|
+
"fill-color": ["get", "fillColor"],
|
|
14811
|
+
"fill-opacity": ["get", "fillOpacity"]
|
|
14812
|
+
}
|
|
14813
|
+
};
|
|
14814
|
+
this.map.addLayer(fillLayer, beforeId);
|
|
14815
|
+
} else {
|
|
14816
|
+
this.map.moveLayer(ids.fill, beforeId);
|
|
14817
|
+
}
|
|
14818
|
+
if (!this.map.getLayer(ids.line)) {
|
|
14819
|
+
var lineLayer = {
|
|
14820
|
+
id: ids.line,
|
|
14821
|
+
type: "line",
|
|
14822
|
+
source: CIRCLE_SOURCE_ID,
|
|
14823
|
+
filter: orderFilter,
|
|
14824
|
+
paint: {
|
|
14825
|
+
"line-color": ["get", "strokeColor"],
|
|
14826
|
+
"line-width": ["get", "strokeWidth"],
|
|
14827
|
+
"line-opacity": ["get", "strokeOpacity"]
|
|
14828
|
+
}
|
|
14829
|
+
};
|
|
14830
|
+
this.map.addLayer(lineLayer, beforeId);
|
|
14831
|
+
} else {
|
|
14832
|
+
this.map.moveLayer(ids.line, beforeId);
|
|
14392
14833
|
}
|
|
14393
|
-
}
|
|
14394
|
-
|
|
14834
|
+
}
|
|
14835
|
+
} catch (err) {
|
|
14836
|
+
_iterator.e(err);
|
|
14837
|
+
} finally {
|
|
14838
|
+
_iterator.f();
|
|
14395
14839
|
}
|
|
14396
14840
|
} catch (error) {
|
|
14397
14841
|
// Style may not be loaded yet; the styledata listener re-adds the layers
|
|
@@ -14449,27 +14893,27 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14449
14893
|
value: function updateMarkersTo(floorId) {
|
|
14450
14894
|
var _this$innerFloors$fin8,
|
|
14451
14895
|
_this$innerFloors$fin9,
|
|
14452
|
-
|
|
14896
|
+
_this10 = this;
|
|
14453
14897
|
var isOutdoor = !this.parentPlace || ((_this$innerFloors$fin8 = (_this$innerFloors$fin9 = this.innerFloors.find(function (floor) {
|
|
14454
14898
|
return floor.key === floorId;
|
|
14455
14899
|
})) === null || _this$innerFloors$fin9 === void 0 ? void 0 : _this$innerFloors$fin9.reachableFromGPS) !== null && _this$innerFloors$fin8 !== void 0 ? _this$innerFloors$fin8 : false);
|
|
14456
14900
|
this.markers.forEach(function (e) {
|
|
14457
|
-
e.changeFloor(floorId,
|
|
14901
|
+
e.changeFloor(floorId, _this10.map, isOutdoor);
|
|
14458
14902
|
});
|
|
14459
14903
|
}
|
|
14460
14904
|
}, {
|
|
14461
14905
|
key: "updateFiltersTo",
|
|
14462
14906
|
value: function updateFiltersTo(floorId) {
|
|
14463
|
-
var _this$map$getStyle$
|
|
14907
|
+
var _this$map$getStyle$la3,
|
|
14464
14908
|
_this$map$getStyle3,
|
|
14465
|
-
|
|
14909
|
+
_this11 = this,
|
|
14466
14910
|
_this$innerFloors$fin0;
|
|
14467
14911
|
if (!this.map) return;
|
|
14468
|
-
var layers = (_this$map$getStyle$
|
|
14912
|
+
var layers = (_this$map$getStyle$la3 = (_this$map$getStyle3 = this.map.getStyle()) === null || _this$map$getStyle3 === void 0 ? void 0 : _this$map$getStyle3.layers) !== null && _this$map$getStyle$la3 !== void 0 ? _this$map$getStyle$la3 : [];
|
|
14469
14913
|
layers.filter(function (l) {
|
|
14470
14914
|
return l.id.startsWith("base-indoor-");
|
|
14471
14915
|
}).forEach(function (l) {
|
|
14472
|
-
|
|
14916
|
+
_this11.map.removeLayer(l.id);
|
|
14473
14917
|
});
|
|
14474
14918
|
var baseFloorId = (_this$innerFloors$fin0 = this.innerFloors.find(function (floor) {
|
|
14475
14919
|
return floor.key === floorId;
|
|
@@ -14485,13 +14929,13 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14485
14929
|
}).forEach(function (layer) {
|
|
14486
14930
|
var baseLayer = deepClone(layer);
|
|
14487
14931
|
baseLayer.id = "base-" + layer.id;
|
|
14488
|
-
|
|
14489
|
-
|
|
14490
|
-
|
|
14932
|
+
_this11.baseFilters[baseLayer.id] = _this11.baseFilters[layer.id];
|
|
14933
|
+
_this11.map.addLayer(baseLayer, firstLayerId);
|
|
14934
|
+
_this11.applyLayerFilters(baseLayer, baseFloorId);
|
|
14491
14935
|
});
|
|
14492
14936
|
}
|
|
14493
14937
|
indoorLayers.forEach(function (layer) {
|
|
14494
|
-
|
|
14938
|
+
_this11.applyLayerFilters(layer, floorId);
|
|
14495
14939
|
});
|
|
14496
14940
|
}
|
|
14497
14941
|
}, {
|
|
@@ -14551,6 +14995,57 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14551
14995
|
this.map.setMinZoom(zoomLvl);
|
|
14552
14996
|
options === null || options === void 0 || (_options$onComplete3 = options.onComplete) === null || _options$onComplete3 === void 0 || _options$onComplete3.call(options);
|
|
14553
14997
|
}
|
|
14998
|
+
}, {
|
|
14999
|
+
key: "setBearing",
|
|
15000
|
+
value: function setBearing(degrees, options) {
|
|
15001
|
+
var _options$onComplete4;
|
|
15002
|
+
if (!Number.isFinite(degrees)) return;
|
|
15003
|
+
if (options !== null && options !== void 0 && options.animate) {
|
|
15004
|
+
if (options.onComplete) void this.map.once("moveend", options.onComplete);
|
|
15005
|
+
this.map.rotateTo(degrees, {
|
|
15006
|
+
duration: 600
|
|
15007
|
+
});
|
|
15008
|
+
return;
|
|
15009
|
+
}
|
|
15010
|
+
this.map.setBearing(degrees);
|
|
15011
|
+
options === null || options === void 0 || (_options$onComplete4 = options.onComplete) === null || _options$onComplete4 === void 0 || _options$onComplete4.call(options);
|
|
15012
|
+
}
|
|
15013
|
+
}, {
|
|
15014
|
+
key: "setRotationEnabled",
|
|
15015
|
+
value: function setRotationEnabled(enabled) {
|
|
15016
|
+
if (enabled) {
|
|
15017
|
+
var _this$map$dragRotate, _this$map$dragRotate$, _this$map$touchZoomRo3, _this$map$touchZoomRo4, _this$map$keyboard, _this$map$keyboard$en;
|
|
15018
|
+
(_this$map$dragRotate = this.map.dragRotate) === null || _this$map$dragRotate === void 0 || (_this$map$dragRotate$ = _this$map$dragRotate.enable) === null || _this$map$dragRotate$ === void 0 || _this$map$dragRotate$.call(_this$map$dragRotate);
|
|
15019
|
+
(_this$map$touchZoomRo3 = this.map.touchZoomRotate) === null || _this$map$touchZoomRo3 === void 0 || (_this$map$touchZoomRo4 = _this$map$touchZoomRo3.enableRotation) === null || _this$map$touchZoomRo4 === void 0 || _this$map$touchZoomRo4.call(_this$map$touchZoomRo3);
|
|
15020
|
+
(_this$map$keyboard = this.map.keyboard) === null || _this$map$keyboard === void 0 || (_this$map$keyboard$en = _this$map$keyboard.enable) === null || _this$map$keyboard$en === void 0 || _this$map$keyboard$en.call(_this$map$keyboard);
|
|
15021
|
+
} else {
|
|
15022
|
+
var _this$map$dragRotate2, _this$map$dragRotate3, _this$map$touchZoomRo5, _this$map$touchZoomRo6;
|
|
15023
|
+
(_this$map$dragRotate2 = this.map.dragRotate) === null || _this$map$dragRotate2 === void 0 || (_this$map$dragRotate3 = _this$map$dragRotate2.disable) === null || _this$map$dragRotate3 === void 0 || _this$map$dragRotate3.call(_this$map$dragRotate2);
|
|
15024
|
+
(_this$map$touchZoomRo5 = this.map.touchZoomRotate) === null || _this$map$touchZoomRo5 === void 0 || (_this$map$touchZoomRo6 = _this$map$touchZoomRo5.disableRotation) === null || _this$map$touchZoomRo6 === void 0 || _this$map$touchZoomRo6.call(_this$map$touchZoomRo5);
|
|
15025
|
+
}
|
|
15026
|
+
}
|
|
15027
|
+
}, {
|
|
15028
|
+
key: "setPanEnabled",
|
|
15029
|
+
value: function setPanEnabled(enabled) {
|
|
15030
|
+
if (enabled) {
|
|
15031
|
+
var _this$map$dragPan, _this$map$dragPan$ena;
|
|
15032
|
+
(_this$map$dragPan = this.map.dragPan) === null || _this$map$dragPan === void 0 || (_this$map$dragPan$ena = _this$map$dragPan.enable) === null || _this$map$dragPan$ena === void 0 || _this$map$dragPan$ena.call(_this$map$dragPan);
|
|
15033
|
+
} else {
|
|
15034
|
+
var _this$map$dragPan2, _this$map$dragPan2$di;
|
|
15035
|
+
(_this$map$dragPan2 = this.map.dragPan) === null || _this$map$dragPan2 === void 0 || (_this$map$dragPan2$di = _this$map$dragPan2.disable) === null || _this$map$dragPan2$di === void 0 || _this$map$dragPan2$di.call(_this$map$dragPan2);
|
|
15036
|
+
}
|
|
15037
|
+
}
|
|
15038
|
+
}, {
|
|
15039
|
+
key: "setScrollZoomEnabled",
|
|
15040
|
+
value: function setScrollZoomEnabled(enabled) {
|
|
15041
|
+
if (enabled) {
|
|
15042
|
+
var _this$map$scrollZoom, _this$map$scrollZoom$;
|
|
15043
|
+
(_this$map$scrollZoom = this.map.scrollZoom) === null || _this$map$scrollZoom === void 0 || (_this$map$scrollZoom$ = _this$map$scrollZoom.enable) === null || _this$map$scrollZoom$ === void 0 || _this$map$scrollZoom$.call(_this$map$scrollZoom);
|
|
15044
|
+
} else {
|
|
15045
|
+
var _this$map$scrollZoom2, _this$map$scrollZoom3;
|
|
15046
|
+
(_this$map$scrollZoom2 = this.map.scrollZoom) === null || _this$map$scrollZoom2 === void 0 || (_this$map$scrollZoom3 = _this$map$scrollZoom2.disable) === null || _this$map$scrollZoom3 === void 0 || _this$map$scrollZoom3.call(_this$map$scrollZoom2);
|
|
15047
|
+
}
|
|
15048
|
+
}
|
|
14554
15049
|
}, {
|
|
14555
15050
|
key: "isInsideBounds",
|
|
14556
15051
|
value: function isInsideBounds(point) {
|
|
@@ -14563,12 +15058,12 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14563
15058
|
}, {
|
|
14564
15059
|
key: "setMaxBounds",
|
|
14565
15060
|
value: function setMaxBounds(coordinates, options) {
|
|
14566
|
-
var _options$
|
|
15061
|
+
var _options$onComplete5;
|
|
14567
15062
|
if (coordinates.length > 1) {
|
|
14568
15063
|
var boundingBox = getBoundingBox(coordinates);
|
|
14569
15064
|
this.map.setMaxBounds(new maplibre_gl.LngLatBounds([boundingBox[0].lng, boundingBox[0].lat], [boundingBox[1].lng, boundingBox[1].lat]));
|
|
14570
15065
|
}
|
|
14571
|
-
options === null || options === void 0 || (_options$
|
|
15066
|
+
options === null || options === void 0 || (_options$onComplete5 = options.onComplete) === null || _options$onComplete5 === void 0 || _options$onComplete5.call(options);
|
|
14572
15067
|
}
|
|
14573
15068
|
}, {
|
|
14574
15069
|
key: "fitCoordinates",
|
|
@@ -14592,11 +15087,11 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14592
15087
|
var minLng;
|
|
14593
15088
|
var maxLat;
|
|
14594
15089
|
var maxLng;
|
|
14595
|
-
var
|
|
14596
|
-
|
|
15090
|
+
var _iterator2 = map_createForOfIteratorHelper(coordinates),
|
|
15091
|
+
_step2;
|
|
14597
15092
|
try {
|
|
14598
|
-
for (
|
|
14599
|
-
var _coord =
|
|
15093
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
15094
|
+
var _coord = _step2.value;
|
|
14600
15095
|
var lat = _coord.lat,
|
|
14601
15096
|
lng = _coord.lng;
|
|
14602
15097
|
minLat = minLat === undefined ? lat : Math.min(minLat, lat);
|
|
@@ -14605,9 +15100,9 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14605
15100
|
maxLng = maxLng === undefined ? lng : Math.max(maxLng, lng);
|
|
14606
15101
|
}
|
|
14607
15102
|
} catch (err) {
|
|
14608
|
-
|
|
15103
|
+
_iterator2.e(err);
|
|
14609
15104
|
} finally {
|
|
14610
|
-
|
|
15105
|
+
_iterator2.f();
|
|
14611
15106
|
}
|
|
14612
15107
|
var bounds = [minLng !== null && minLng !== void 0 ? minLng : 0, minLat !== null && minLat !== void 0 ? minLat : 0, maxLng !== null && maxLng !== void 0 ? maxLng : 0, maxLat !== null && maxLat !== void 0 ? maxLat : 0];
|
|
14613
15108
|
|
|
@@ -14659,13 +15154,13 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14659
15154
|
key: "updateFloor",
|
|
14660
15155
|
value: function updateFloor(floorId, options) {
|
|
14661
15156
|
try {
|
|
14662
|
-
var _this$onFloorChange2, _options$
|
|
15157
|
+
var _this$onFloorChange2, _options$onComplete6;
|
|
14663
15158
|
this.filterByFloorKey(floorId);
|
|
14664
15159
|
(_this$onFloorChange2 = this.onFloorChange) === null || _this$onFloorChange2 === void 0 || _this$onFloorChange2.call(this, floorId);
|
|
14665
15160
|
this.logEvent("updateFloor", {
|
|
14666
15161
|
floorId: floorId
|
|
14667
15162
|
});
|
|
14668
|
-
options === null || options === void 0 || (_options$
|
|
15163
|
+
options === null || options === void 0 || (_options$onComplete6 = options.onComplete) === null || _options$onComplete6 === void 0 || _options$onComplete6.call(options);
|
|
14669
15164
|
} catch (error) {
|
|
14670
15165
|
// Floor update may fail
|
|
14671
15166
|
}
|
|
@@ -14784,7 +15279,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14784
15279
|
return subplace.clientId === placeId || subplace.mapvxId === placeId;
|
|
14785
15280
|
});
|
|
14786
15281
|
if (pointedPlace !== undefined) {
|
|
14787
|
-
new (maplibre_gl_default()).Popup().setLngLat(pointedPlace.position).
|
|
15282
|
+
new (maplibre_gl_default()).Popup().setLngLat(pointedPlace.position).setText(pointedPlace.title).addTo(this.map);
|
|
14788
15283
|
}
|
|
14789
15284
|
}
|
|
14790
15285
|
return "";
|
|
@@ -14809,17 +15304,17 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14809
15304
|
}, {
|
|
14810
15305
|
key: "defaultClickListener",
|
|
14811
15306
|
value: function defaultClickListener() {
|
|
14812
|
-
var
|
|
15307
|
+
var _this12 = this;
|
|
14813
15308
|
this.map.on("click", /*#__PURE__*/function () {
|
|
14814
15309
|
var _ref4 = map_asyncToGenerator(/*#__PURE__*/map_regenerator().m(function _callee2(e) {
|
|
14815
|
-
var features, roomFeatures, touchedFeature, ref, _clickedPlace, _ref5, _clickedPlace$mapvxId, _clickedPlace2, _clickedPlace3, clickedPlace,
|
|
15310
|
+
var features, roomFeatures, touchedFeature, ref, _clickedPlace, _ref5, _clickedPlace$mapvxId, _clickedPlace2, _clickedPlace3, clickedPlace, _iterator3, _step3, potentialParentPlace, cachedSubPlaces, cachedPlaces, clickedPlaceId, _t2;
|
|
14816
15311
|
return map_regenerator().w(function (_context2) {
|
|
14817
15312
|
while (1) switch (_context2.p = _context2.n) {
|
|
14818
15313
|
case 0:
|
|
14819
|
-
features =
|
|
15314
|
+
features = _this12.map.queryRenderedFeatures(e.point); // Filter room features by current floor
|
|
14820
15315
|
roomFeatures = features.filter(function (feature) {
|
|
14821
15316
|
var _feature$properties;
|
|
14822
|
-
return feature.properties["class"] === "room" && ((_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties.floor_key) ===
|
|
15317
|
+
return feature.properties["class"] === "room" && ((_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties.floor_key) === _this12.currentFloor;
|
|
14823
15318
|
});
|
|
14824
15319
|
touchedFeature = roomFeatures[0];
|
|
14825
15320
|
ref = touchedFeature === null || touchedFeature === void 0 ? void 0 : touchedFeature.properties.ref;
|
|
@@ -14830,23 +15325,23 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14830
15325
|
console.log("touchedFeature", ref);
|
|
14831
15326
|
|
|
14832
15327
|
// First, search in current subPlaces
|
|
14833
|
-
clickedPlace =
|
|
15328
|
+
clickedPlace = _this12.subPlaces.find(function (subPlace) {
|
|
14834
15329
|
return subPlace.mapvxId === ref;
|
|
14835
15330
|
}); // If not found, search in subplaces of potential parent places
|
|
14836
15331
|
if (!(clickedPlace === undefined)) {
|
|
14837
15332
|
_context2.n = 7;
|
|
14838
15333
|
break;
|
|
14839
15334
|
}
|
|
14840
|
-
|
|
15335
|
+
_iterator3 = map_createForOfIteratorHelper(_this12.potentialParentPlaces);
|
|
14841
15336
|
_context2.p = 1;
|
|
14842
|
-
|
|
15337
|
+
_iterator3.s();
|
|
14843
15338
|
case 2:
|
|
14844
|
-
if ((
|
|
15339
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
14845
15340
|
_context2.n = 4;
|
|
14846
15341
|
break;
|
|
14847
15342
|
}
|
|
14848
|
-
potentialParentPlace =
|
|
14849
|
-
cachedSubPlaces =
|
|
15343
|
+
potentialParentPlace = _step3.value;
|
|
15344
|
+
cachedSubPlaces = _this12.repository.getCachedSubPlaces(potentialParentPlace.mapvxId);
|
|
14850
15345
|
if (!cachedSubPlaces) {
|
|
14851
15346
|
_context2.n = 3;
|
|
14852
15347
|
break;
|
|
@@ -14868,24 +15363,24 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14868
15363
|
case 5:
|
|
14869
15364
|
_context2.p = 5;
|
|
14870
15365
|
_t2 = _context2.v;
|
|
14871
|
-
|
|
15366
|
+
_iterator3.e(_t2);
|
|
14872
15367
|
case 6:
|
|
14873
15368
|
_context2.p = 6;
|
|
14874
|
-
|
|
15369
|
+
_iterator3.f();
|
|
14875
15370
|
return _context2.f(6);
|
|
14876
15371
|
case 7:
|
|
14877
15372
|
if (!(clickedPlace === undefined)) {
|
|
14878
15373
|
_context2.n = 10;
|
|
14879
15374
|
break;
|
|
14880
15375
|
}
|
|
14881
|
-
cachedPlaces =
|
|
15376
|
+
cachedPlaces = _this12.repository.getCachedPlaces([ref]);
|
|
14882
15377
|
if (!(cachedPlaces.length === 0)) {
|
|
14883
15378
|
_context2.n = 9;
|
|
14884
15379
|
break;
|
|
14885
15380
|
}
|
|
14886
15381
|
console.log("fetching place detail from server", ref);
|
|
14887
15382
|
_context2.n = 8;
|
|
14888
|
-
return
|
|
15383
|
+
return _this12.repository.fetchAndParsePlaceDetail(ref);
|
|
14889
15384
|
case 8:
|
|
14890
15385
|
clickedPlace = _context2.v;
|
|
14891
15386
|
_context2.n = 10;
|
|
@@ -14896,8 +15391,8 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14896
15391
|
case 10:
|
|
14897
15392
|
console.log("clickedPlace", (_clickedPlace = clickedPlace) === null || _clickedPlace === void 0 ? void 0 : _clickedPlace.title);
|
|
14898
15393
|
clickedPlaceId = (_ref5 = (_clickedPlace$mapvxId = (_clickedPlace2 = clickedPlace) === null || _clickedPlace2 === void 0 ? void 0 : _clickedPlace2.mapvxId) !== null && _clickedPlace$mapvxId !== void 0 ? _clickedPlace$mapvxId : (_clickedPlace3 = clickedPlace) === null || _clickedPlace3 === void 0 ? void 0 : _clickedPlace3.clientId) !== null && _ref5 !== void 0 ? _ref5 : "";
|
|
14899
|
-
if (clickedPlace !== undefined &&
|
|
14900
|
-
|
|
15394
|
+
if (clickedPlace !== undefined && _this12.clickCallback) {
|
|
15395
|
+
_this12.clickCallback(clickedPlaceId);
|
|
14901
15396
|
}
|
|
14902
15397
|
case 11:
|
|
14903
15398
|
return _context2.a(2);
|
|
@@ -14912,29 +15407,29 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14912
15407
|
}, {
|
|
14913
15408
|
key: "onHover",
|
|
14914
15409
|
value: function onHover() {
|
|
14915
|
-
var
|
|
15410
|
+
var _this13 = this;
|
|
14916
15411
|
if (!this.enableHover) return;
|
|
14917
15412
|
this.map.on("mousemove", "hoverable", function (e) {
|
|
14918
15413
|
var _e$features;
|
|
14919
15414
|
var feature = (_e$features = e.features) === null || _e$features === void 0 ? void 0 : _e$features.find(function (feature) {
|
|
14920
15415
|
var _feature$properties$r, _feature$properties2;
|
|
14921
|
-
return ((_feature$properties$r = feature.properties.ref) === null || _feature$properties$r === void 0 ? void 0 : _feature$properties$r.length) > 0 && ((_feature$properties2 = feature.properties) === null || _feature$properties2 === void 0 ? void 0 : _feature$properties2.floor_key) ===
|
|
15416
|
+
return ((_feature$properties$r = feature.properties.ref) === null || _feature$properties$r === void 0 ? void 0 : _feature$properties$r.length) > 0 && ((_feature$properties2 = feature.properties) === null || _feature$properties2 === void 0 ? void 0 : _feature$properties2.floor_key) === _this13.currentFloor;
|
|
14922
15417
|
});
|
|
14923
15418
|
var ref = feature === null || feature === void 0 ? void 0 : feature.properties.ref;
|
|
14924
15419
|
if (ref != null && typeof ref === "string" && ref.length > 0) {
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
} else if (ref === undefined &&
|
|
14928
|
-
|
|
14929
|
-
|
|
15420
|
+
_this13.hoveredId = ref;
|
|
15421
|
+
_this13.updateFiltersTo(_this13.currentFloor);
|
|
15422
|
+
} else if (ref === undefined && _this13.hoveredId !== "unselected") {
|
|
15423
|
+
_this13.hoveredId = "unselected";
|
|
15424
|
+
_this13.updateFiltersTo(_this13.currentFloor);
|
|
14930
15425
|
}
|
|
14931
15426
|
});
|
|
14932
15427
|
|
|
14933
15428
|
// When the mouse leaves the state-fill layer, update the feature state of the
|
|
14934
15429
|
// previously hovered feature.
|
|
14935
15430
|
this.map.on("mouseleave", "hoverable", function () {
|
|
14936
|
-
|
|
14937
|
-
|
|
15431
|
+
_this13.hoveredId = "unselected";
|
|
15432
|
+
_this13.updateFiltersTo(_this13.currentFloor);
|
|
14938
15433
|
});
|
|
14939
15434
|
}
|
|
14940
15435
|
}, {
|
|
@@ -15416,7 +15911,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15416
15911
|
key: "onWebGLContextLost",
|
|
15417
15912
|
value: function onWebGLContextLost(e) {
|
|
15418
15913
|
var _this$map,
|
|
15419
|
-
|
|
15914
|
+
_this14 = this;
|
|
15420
15915
|
e.originalEvent.preventDefault();
|
|
15421
15916
|
console.warn("Contexto WebGL perdido 😢");
|
|
15422
15917
|
|
|
@@ -15427,8 +15922,8 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15427
15922
|
var _ext$restoreContext;
|
|
15428
15923
|
canvas.addEventListener("webglcontextrestored", function () {
|
|
15429
15924
|
console.debug("Contexto WebGL restaurado, forzando re-render");
|
|
15430
|
-
|
|
15431
|
-
|
|
15925
|
+
_this14.map.triggerRepaint(); // forzar repaint
|
|
15926
|
+
_this14.failedTiles.clear();
|
|
15432
15927
|
}, {
|
|
15433
15928
|
once: true
|
|
15434
15929
|
});
|
|
@@ -15468,7 +15963,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15468
15963
|
}, {
|
|
15469
15964
|
key: "subscribeToFailedTiles",
|
|
15470
15965
|
value: function subscribeToFailedTiles() {
|
|
15471
|
-
var
|
|
15966
|
+
var _this15 = this;
|
|
15472
15967
|
if (this.retryTimer) return;
|
|
15473
15968
|
|
|
15474
15969
|
// Store bound functions for proper cleanup
|
|
@@ -15477,20 +15972,20 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15477
15972
|
this.boundOnWebGLContextLost = this.onWebGLContextLost.bind(this);
|
|
15478
15973
|
this.boundOnWebGLContextRestored = this.onWebGLContextRestored.bind(this);
|
|
15479
15974
|
this.retryTimer = setInterval(function () {
|
|
15480
|
-
if (!
|
|
15481
|
-
|
|
15975
|
+
if (!_this15.map.getSource("indoorequal")) {
|
|
15976
|
+
_this15.failedTiles.clear();
|
|
15482
15977
|
return;
|
|
15483
15978
|
}
|
|
15484
|
-
var source =
|
|
15979
|
+
var source = _this15.map.getSource("indoorequal");
|
|
15485
15980
|
if (!source || source.type !== "vector") {
|
|
15486
|
-
|
|
15981
|
+
_this15.failedTiles.clear();
|
|
15487
15982
|
return;
|
|
15488
15983
|
}
|
|
15489
15984
|
|
|
15490
15985
|
// Process tiles and remove invalid ones
|
|
15491
15986
|
var tilesToRetry = [];
|
|
15492
15987
|
var tilesToRemove = [];
|
|
15493
|
-
|
|
15988
|
+
_this15.failedTiles.forEach(function (tile) {
|
|
15494
15989
|
// Check if tile is still valid before attempting reload
|
|
15495
15990
|
if (!tile || tile.state === "unloaded" || tile.state === "loading") {
|
|
15496
15991
|
tilesToRemove.push(tile);
|
|
@@ -15508,7 +16003,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15508
16003
|
|
|
15509
16004
|
// Remove invalid tiles from the set
|
|
15510
16005
|
tilesToRemove.forEach(function (tile) {
|
|
15511
|
-
return
|
|
16006
|
+
return _this15.failedTiles["delete"](tile);
|
|
15512
16007
|
});
|
|
15513
16008
|
|
|
15514
16009
|
// Attempt to reload valid failed tiles
|
|
@@ -15520,7 +16015,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15520
16015
|
}
|
|
15521
16016
|
} catch (error) {
|
|
15522
16017
|
// If reload fails, remove tile from retry queue - this is expected
|
|
15523
|
-
|
|
16018
|
+
_this15.failedTiles["delete"](tile);
|
|
15524
16019
|
}
|
|
15525
16020
|
});
|
|
15526
16021
|
}, 1000);
|
|
@@ -15669,6 +16164,7 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
15669
16164
|
var _this;
|
|
15670
16165
|
sdk_classCallCheck(this, InternalMapVXSDK);
|
|
15671
16166
|
_this = sdk_callSuper(this, InternalMapVXSDK);
|
|
16167
|
+
sdk_defineProperty(_this, "maps", []);
|
|
15672
16168
|
sdk_defineProperty(_this, "geoLocation", navigator.geolocation);
|
|
15673
16169
|
sdk_defineProperty(_this, "headingListeners", []);
|
|
15674
16170
|
_this.token = token;
|
|
@@ -15702,6 +16198,17 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
15702
16198
|
value: function setSdkLang(lang) {
|
|
15703
16199
|
this.config.lang = lang;
|
|
15704
16200
|
this.repository.setLang(lang);
|
|
16201
|
+
this.maps.forEach(function (map) {
|
|
16202
|
+
return map.setLang(lang);
|
|
16203
|
+
});
|
|
16204
|
+
}
|
|
16205
|
+
}, {
|
|
16206
|
+
key: "unregisterMap",
|
|
16207
|
+
value: function unregisterMap(map) {
|
|
16208
|
+
var mapIndex = this.maps.indexOf(map);
|
|
16209
|
+
if (mapIndex >= 0) {
|
|
16210
|
+
this.maps.splice(mapIndex, 1);
|
|
16211
|
+
}
|
|
15705
16212
|
}
|
|
15706
16213
|
}, {
|
|
15707
16214
|
key: "getPlaceDetail",
|
|
@@ -15775,11 +16282,21 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
15775
16282
|
}, {
|
|
15776
16283
|
key: "createMap",
|
|
15777
16284
|
value: function createMap(container, mapConfig) {
|
|
16285
|
+
var _this2 = this;
|
|
15778
16286
|
try {
|
|
15779
16287
|
mapConfig.lang = this.config.lang;
|
|
15780
16288
|
mapConfig.apiUrl = this.config.apiUrl;
|
|
15781
16289
|
mapConfig.mapvxRequestContext = this.config.mapvxRequestContext;
|
|
15782
16290
|
var map = new InternalMapVXMap(mapConfig, container, this.token);
|
|
16291
|
+
var originalDestroyMap = map.destroyMap.bind(map);
|
|
16292
|
+
map.destroyMap = function () {
|
|
16293
|
+
try {
|
|
16294
|
+
originalDestroyMap();
|
|
16295
|
+
} finally {
|
|
16296
|
+
_this2.unregisterMap(map);
|
|
16297
|
+
}
|
|
16298
|
+
};
|
|
16299
|
+
this.maps.push(map);
|
|
15783
16300
|
this.logEvent("createMap");
|
|
15784
16301
|
return map;
|
|
15785
16302
|
} catch (error) {
|
|
@@ -16212,14 +16729,14 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
16212
16729
|
}, {
|
|
16213
16730
|
key: "getUserLocation",
|
|
16214
16731
|
value: function getUserLocation() {
|
|
16215
|
-
var
|
|
16732
|
+
var _this3 = this;
|
|
16216
16733
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
16217
16734
|
enableHighAccuracy: true,
|
|
16218
16735
|
timeout: 60 * 1000,
|
|
16219
16736
|
maximumAge: 10 * 1000
|
|
16220
16737
|
};
|
|
16221
16738
|
return new Promise(function (resolve, reject) {
|
|
16222
|
-
|
|
16739
|
+
_this3.geoLocation.getCurrentPosition(function (position) {
|
|
16223
16740
|
resolve(position);
|
|
16224
16741
|
}, function (error) {
|
|
16225
16742
|
reject(error);
|