@mapvx/web-js 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/logger/sentry.js +1 -1
- package/dist/cjs/map/map.js +1 -1
- package/dist/cjs/map/map.js.map +1 -1
- package/dist/cjs/map/scene3DController.js +82 -10
- package/dist/cjs/map/scene3DController.js.map +1 -1
- package/dist/cjs/utils/loadGlb.js +105 -7
- package/dist/cjs/utils/loadGlb.js.map +1 -1
- package/dist/es/domain/models/mapConfig.d.ts +44 -0
- package/dist/es/domain/models/mapConfig.d.ts.map +1 -1
- package/dist/es/index.d.ts +1 -1
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js.map +1 -1
- package/dist/es/logger/sentry.js +1 -1
- package/dist/es/map/map.d.ts.map +1 -1
- package/dist/es/map/map.js +1 -1
- package/dist/es/map/map.js.map +1 -1
- package/dist/es/map/scene3DController.d.ts +10 -1
- package/dist/es/map/scene3DController.d.ts.map +1 -1
- package/dist/es/map/scene3DController.js +82 -10
- package/dist/es/map/scene3DController.js.map +1 -1
- package/dist/es/utils/loadGlb.d.ts +33 -1
- package/dist/es/utils/loadGlb.d.ts.map +1 -1
- package/dist/es/utils/loadGlb.js +104 -7
- package/dist/es/utils/loadGlb.js.map +1 -1
- package/dist/umd/index.js +348 -106
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/umd/index.js
CHANGED
|
@@ -11240,7 +11240,7 @@ const extractSafariExtensionDetails = (func, filename) => {
|
|
|
11240
11240
|
// exists only for the type-checker, so in the ES/CJS builds the identifier is
|
|
11241
11241
|
// genuinely absent and a direct comparison throws ReferenceError at module load.
|
|
11242
11242
|
// `typeof` is the only safe way to probe a possibly-undeclared global.
|
|
11243
|
-
var sentry_SDK_VERSION = false ? 0 : "3.
|
|
11243
|
+
var sentry_SDK_VERSION = false ? 0 : "3.3.0";
|
|
11244
11244
|
var DSN = false ? 0 : "https://872f598f020e3cd73a0933b562d24c81@sentry.mapvx.app/5";
|
|
11245
11245
|
|
|
11246
11246
|
/**
|
|
@@ -15282,6 +15282,13 @@ var DEFAULT_MARKER_LAYOUT_CONFIG = {
|
|
|
15282
15282
|
maxLabelWidthPx: DEFAULT_MAX_LABEL_WIDTH_PX
|
|
15283
15283
|
};
|
|
15284
15284
|
|
|
15285
|
+
/**
|
|
15286
|
+
* Aggregate load progress for the declarative GLB models in {@link MapConfig.scene3D}, reported via
|
|
15287
|
+
* {@link MapConfig.onScene3DModelsProgress}.
|
|
15288
|
+
*
|
|
15289
|
+
* @group Configuration
|
|
15290
|
+
*/
|
|
15291
|
+
|
|
15285
15292
|
/**
|
|
15286
15293
|
* Basic configuration for the map.
|
|
15287
15294
|
* Provides essential settings for initializing and customizing map behavior.
|
|
@@ -19066,6 +19073,12 @@ function loadDeck() {
|
|
|
19066
19073
|
;// ./src/utils/loadGlb.ts
|
|
19067
19074
|
function loadGlb_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 loadGlb_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]())) : (loadGlb_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, loadGlb_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, loadGlb_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), loadGlb_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", loadGlb_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), loadGlb_regeneratorDefine2(u), loadGlb_regeneratorDefine2(u, o, "Generator"), loadGlb_regeneratorDefine2(u, n, function () { return this; }), loadGlb_regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (loadGlb_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
19068
19075
|
function loadGlb_regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } loadGlb_regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { loadGlb_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)); }, loadGlb_regeneratorDefine2(e, r, n, t); }
|
|
19076
|
+
function loadGlb_slicedToArray(r, e) { return loadGlb_arrayWithHoles(r) || loadGlb_iterableToArrayLimit(r, e) || loadGlb_unsupportedIterableToArray(r, e) || loadGlb_nonIterableRest(); }
|
|
19077
|
+
function loadGlb_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."); }
|
|
19078
|
+
function loadGlb_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return loadGlb_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) ? loadGlb_arrayLikeToArray(r, a) : void 0; } }
|
|
19079
|
+
function loadGlb_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
19080
|
+
function loadGlb_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; } }
|
|
19081
|
+
function loadGlb_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
19069
19082
|
function loadGlb_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); }
|
|
19070
19083
|
function loadGlb_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { loadGlb_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { loadGlb_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
19071
19084
|
|
|
@@ -19095,10 +19108,58 @@ function getGltfLoader() {
|
|
|
19095
19108
|
return gltfLoaderPromise;
|
|
19096
19109
|
}
|
|
19097
19110
|
|
|
19111
|
+
/**
|
|
19112
|
+
* Default per-asset timeout for {@link loadGlbRoot}.
|
|
19113
|
+
*
|
|
19114
|
+
* Guards against loaders that hang instead of throwing — a GLB whose binary chunk is truncated
|
|
19115
|
+
* (see {@link loadGlbRoot}'s completeness check) or otherwise malformed can put Three.js's
|
|
19116
|
+
* `DRACOLoader` into an undefined state: sometimes a decode error, sometimes no callback at all.
|
|
19117
|
+
* Without a timeout, one such asset never settles and blocks every other load queued behind it.
|
|
19118
|
+
*
|
|
19119
|
+
* @group Configuration
|
|
19120
|
+
*/
|
|
19121
|
+
var DEFAULT_GLB_LOAD_TIMEOUT_MS = 30000;
|
|
19122
|
+
|
|
19123
|
+
/**
|
|
19124
|
+
* Magic number ("glTF" read little-endian) at byte offset 0 of every binary glTF (`.glb`)
|
|
19125
|
+
* container. Used only to tell a binary GLB apart from a plain JSON `.gltf` payload — the latter
|
|
19126
|
+
* has no such header and skips the completeness check in {@link assertGlbBufferComplete}.
|
|
19127
|
+
*/
|
|
19128
|
+
var GLB_MAGIC = 0x46546c67;
|
|
19129
|
+
|
|
19130
|
+
/**
|
|
19131
|
+
* Rejects a GLB download that was cut short before it reaches Three.js's `GLTFLoader`/`DRACOLoader`,
|
|
19132
|
+
* whose behavior on truncated input ranges from a cryptic decode error (e.g. "Unexpected geometry
|
|
19133
|
+
* type") to an outright hang, rather than a clear message pointing at the actual problem.
|
|
19134
|
+
*
|
|
19135
|
+
* The binary glTF container format requires the 12-byte header's declared total length to equal
|
|
19136
|
+
* the file's real byte length (see the {@link https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#binary-header | spec}).
|
|
19137
|
+
* A mismatch means the response body was truncated — a dropped connection, or the object stored at
|
|
19138
|
+
* `url` is itself incomplete — so every buffer-view offset past that point reads garbage. This is
|
|
19139
|
+
* exactly what was found in the field for one "Suelo" asset that both threw a decode error and (in
|
|
19140
|
+
* a larger sibling file) hung: the file's own header declared a ~383 MB binary chunk while only
|
|
19141
|
+
* ~8.7 MB had actually been received.
|
|
19142
|
+
*/
|
|
19143
|
+
function assertGlbBufferComplete(buffer, url) {
|
|
19144
|
+
if (buffer.byteLength < 12) return; // too short to have a GLB header; let parse() report it
|
|
19145
|
+
var header = new DataView(buffer, 0, 12);
|
|
19146
|
+
if (header.getUint32(0, true) !== GLB_MAGIC) return; // plain JSON .gltf, not a binary .glb
|
|
19147
|
+
var declaredLength = header.getUint32(8, true);
|
|
19148
|
+
if (declaredLength !== buffer.byteLength) {
|
|
19149
|
+
throw new Error("GLB download is truncated or corrupt: header declares ".concat(declaredLength, " bytes, received ").concat(buffer.byteLength, ": ").concat(url));
|
|
19150
|
+
}
|
|
19151
|
+
}
|
|
19152
|
+
|
|
19153
|
+
/** Options for {@link loadGlbRoot}. */
|
|
19154
|
+
|
|
19098
19155
|
/**
|
|
19099
19156
|
* Loads a GLB/GLTF from URL and returns the root scene group.
|
|
19100
19157
|
* Central entry point so the loader implementation can be swapped later (e.g. Draco, KTX2, custom fetch).
|
|
19101
19158
|
*
|
|
19159
|
+
* Fetches the raw bytes itself (rather than deferring to `GLTFLoader.load`) so a truncated download
|
|
19160
|
+
* can be caught and rejected clearly — see {@link assertGlbBufferComplete} — before it ever reaches
|
|
19161
|
+
* the Draco/KTX2 decoders.
|
|
19162
|
+
*
|
|
19102
19163
|
* @param url - GLB URL
|
|
19103
19164
|
* @returns Root `THREE.Group` from the loaded glTF scene
|
|
19104
19165
|
* @group Utils
|
|
@@ -19108,23 +19169,99 @@ function loadGlbRoot(_x) {
|
|
|
19108
19169
|
}
|
|
19109
19170
|
function _loadGlbRoot() {
|
|
19110
19171
|
_loadGlbRoot = loadGlb_asyncToGenerator(/*#__PURE__*/loadGlb_regenerator().m(function _callee(url) {
|
|
19111
|
-
var
|
|
19172
|
+
var options,
|
|
19173
|
+
_options$timeoutMs,
|
|
19174
|
+
timeoutMs,
|
|
19175
|
+
onProgress,
|
|
19176
|
+
_yield$Promise$all,
|
|
19177
|
+
_yield$Promise$all2,
|
|
19178
|
+
gltfLoader,
|
|
19179
|
+
three,
|
|
19180
|
+
settled,
|
|
19181
|
+
fileLoader,
|
|
19182
|
+
load,
|
|
19183
|
+
timer,
|
|
19184
|
+
timeout,
|
|
19185
|
+
_args = arguments;
|
|
19112
19186
|
return loadGlb_regenerator().w(function (_context) {
|
|
19113
|
-
while (1) switch (_context.n) {
|
|
19187
|
+
while (1) switch (_context.p = _context.n) {
|
|
19114
19188
|
case 0:
|
|
19189
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
19190
|
+
_options$timeoutMs = options.timeoutMs, timeoutMs = _options$timeoutMs === void 0 ? DEFAULT_GLB_LOAD_TIMEOUT_MS : _options$timeoutMs, onProgress = options.onProgress;
|
|
19115
19191
|
_context.n = 1;
|
|
19116
|
-
return getGltfLoader();
|
|
19192
|
+
return Promise.all([getGltfLoader(), loadThree()]);
|
|
19117
19193
|
case 1:
|
|
19118
|
-
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
|
|
19194
|
+
_yield$Promise$all = _context.v;
|
|
19195
|
+
_yield$Promise$all2 = loadGlb_slicedToArray(_yield$Promise$all, 2);
|
|
19196
|
+
gltfLoader = _yield$Promise$all2[0];
|
|
19197
|
+
three = _yield$Promise$all2[1].THREE;
|
|
19198
|
+
// Set once the caller has stopped waiting (success, failure, or timeout) so any callback three
|
|
19199
|
+
// fires afterwards — e.g. a timed-out fetch/decode that keeps running in the background — is a
|
|
19200
|
+
// no-op instead of resolving/rejecting an already-settled promise or emitting a stray progress
|
|
19201
|
+
// event after the batch this asset belongs to already reported `done: true`.
|
|
19202
|
+
settled = false;
|
|
19203
|
+
fileLoader = new three.FileLoader();
|
|
19204
|
+
fileLoader.setResponseType("arraybuffer");
|
|
19205
|
+
load = new Promise(function (resolve, reject) {
|
|
19206
|
+
var onError = function onError(error) {
|
|
19207
|
+
if (settled) return;
|
|
19123
19208
|
reject(error instanceof Error ? error : new Error(String(error)));
|
|
19124
|
-
}
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
|
|
19209
|
+
};
|
|
19210
|
+
fileLoader.load(url, function (data) {
|
|
19211
|
+
if (settled) return;
|
|
19212
|
+
var buffer = data;
|
|
19213
|
+
try {
|
|
19214
|
+
assertGlbBufferComplete(buffer, url);
|
|
19215
|
+
} catch (err) {
|
|
19216
|
+
onError(err);
|
|
19217
|
+
return;
|
|
19218
|
+
}
|
|
19219
|
+
gltfLoader.parse(buffer, three.LoaderUtils.extractUrlBase(url), function (gltf) {
|
|
19220
|
+
if (settled) return;
|
|
19221
|
+
resolve(gltf.scene);
|
|
19222
|
+
}, onError);
|
|
19223
|
+
}, function (event) {
|
|
19224
|
+
if (!settled) onProgress === null || onProgress === void 0 || onProgress(event);
|
|
19225
|
+
}, onError);
|
|
19226
|
+
});
|
|
19227
|
+
if (!(!Number.isFinite(timeoutMs) || timeoutMs <= 0)) {
|
|
19228
|
+
_context.n = 5;
|
|
19229
|
+
break;
|
|
19230
|
+
}
|
|
19231
|
+
_context.p = 2;
|
|
19232
|
+
_context.n = 3;
|
|
19233
|
+
return load;
|
|
19234
|
+
case 3:
|
|
19235
|
+
return _context.a(2, _context.v);
|
|
19236
|
+
case 4:
|
|
19237
|
+
_context.p = 4;
|
|
19238
|
+
settled = true;
|
|
19239
|
+
return _context.f(4);
|
|
19240
|
+
case 5:
|
|
19241
|
+
timeout = new Promise(function (_resolve, reject) {
|
|
19242
|
+
timer = setTimeout(function () {
|
|
19243
|
+
return reject(new Error("Timed out loading GLB after ".concat(timeoutMs, "ms: ").concat(url)));
|
|
19244
|
+
}, timeoutMs);
|
|
19245
|
+
});
|
|
19246
|
+
_context.p = 6;
|
|
19247
|
+
_context.n = 7;
|
|
19248
|
+
return Promise.race([load, timeout]);
|
|
19249
|
+
case 7:
|
|
19250
|
+
return _context.a(2, _context.v);
|
|
19251
|
+
case 8:
|
|
19252
|
+
_context.p = 8;
|
|
19253
|
+
settled = true;
|
|
19254
|
+
clearTimeout(timer);
|
|
19255
|
+
// Cancels the underlying fetch (and, by never delivering its buffer, the Draco/KTX2 decode)
|
|
19256
|
+
// so a timed-out asset actually frees its network/CPU usage instead of running to completion
|
|
19257
|
+
// unattended — otherwise GLB_LOAD_CONCURRENCY only bounds how many loads the caller awaits,
|
|
19258
|
+
// not how many are truly in flight. A no-op if `load` already won the race.
|
|
19259
|
+
fileLoader.abort();
|
|
19260
|
+
return _context.f(8);
|
|
19261
|
+
case 9:
|
|
19262
|
+
return _context.a(2);
|
|
19263
|
+
}
|
|
19264
|
+
}, _callee, null, [[6,, 8, 9], [2,, 4, 5]]);
|
|
19128
19265
|
}));
|
|
19129
19266
|
return _loadGlbRoot.apply(this, arguments);
|
|
19130
19267
|
}
|
|
@@ -19192,7 +19329,11 @@ function scene3DController_nonIterableRest() { throw new TypeError("Invalid atte
|
|
|
19192
19329
|
function scene3DController_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; } }
|
|
19193
19330
|
function scene3DController_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
19194
19331
|
function scene3DController_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = scene3DController_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; } } }; }
|
|
19332
|
+
function scene3DController_toConsumableArray(r) { return scene3DController_arrayWithoutHoles(r) || scene3DController_iterableToArray(r) || scene3DController_unsupportedIterableToArray(r) || scene3DController_nonIterableSpread(); }
|
|
19333
|
+
function scene3DController_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."); }
|
|
19195
19334
|
function scene3DController_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return scene3DController_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) ? scene3DController_arrayLikeToArray(r, a) : void 0; } }
|
|
19335
|
+
function scene3DController_iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
19336
|
+
function scene3DController_arrayWithoutHoles(r) { if (Array.isArray(r)) return scene3DController_arrayLikeToArray(r); }
|
|
19196
19337
|
function scene3DController_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
19197
19338
|
function scene3DController_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 scene3DController_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]())) : (scene3DController_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, scene3DController_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, scene3DController_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), scene3DController_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", scene3DController_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), scene3DController_regeneratorDefine2(u), scene3DController_regeneratorDefine2(u, o, "Generator"), scene3DController_regeneratorDefine2(u, n, function () { return this; }), scene3DController_regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (scene3DController_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
19198
19339
|
function scene3DController_regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } scene3DController_regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { scene3DController_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)); }, scene3DController_regeneratorDefine2(e, r, n, t); }
|
|
@@ -19211,6 +19352,7 @@ function scene3DController_toPrimitive(t, r) { if ("object" != scene3DController
|
|
|
19211
19352
|
|
|
19212
19353
|
|
|
19213
19354
|
|
|
19355
|
+
|
|
19214
19356
|
/**
|
|
19215
19357
|
* Owns the experimental 3D scene for a MapLibre map: the deck.gl overlay layers (elevated room
|
|
19216
19358
|
* outlines, indoor labels, POI icons, store logos) and the declarative GLB custom layer rendered
|
|
@@ -19227,7 +19369,7 @@ function scene3DController_toPrimitive(t, r) { if ("object" != scene3DController
|
|
|
19227
19369
|
* @group Map
|
|
19228
19370
|
*/
|
|
19229
19371
|
var Scene3DController = /*#__PURE__*/function () {
|
|
19230
|
-
function Scene3DController(map, scene3DConfig, initialCenter) {
|
|
19372
|
+
function Scene3DController(map, scene3DConfig, initialCenter, onModelsProgress) {
|
|
19231
19373
|
scene3DController_classCallCheck(this, Scene3DController);
|
|
19232
19374
|
/** Latest known floor key; updated by the floor-change hooks and read when (re)building layers. */
|
|
19233
19375
|
scene3DController_defineProperty(this, "currentFloor", "");
|
|
@@ -19256,6 +19398,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19256
19398
|
this.map = map;
|
|
19257
19399
|
this.scene3DConfig = scene3DConfig;
|
|
19258
19400
|
this.initialCenter = initialCenter;
|
|
19401
|
+
this.onModelsProgress = onModelsProgress;
|
|
19259
19402
|
}
|
|
19260
19403
|
|
|
19261
19404
|
// Lifecycle entry points forwarded by the map ---------------------------------------------
|
|
@@ -19484,72 +19627,164 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19484
19627
|
}, {
|
|
19485
19628
|
key: "loadScene3DGlbTemplates",
|
|
19486
19629
|
value: function () {
|
|
19487
|
-
var _loadScene3DGlbTemplates = scene3DController_asyncToGenerator(/*#__PURE__*/scene3DController_regenerator().m(function
|
|
19488
|
-
var _this$threeMod2
|
|
19489
|
-
|
|
19490
|
-
|
|
19491
|
-
|
|
19630
|
+
var _loadScene3DGlbTemplates = scene3DController_asyncToGenerator(/*#__PURE__*/scene3DController_regenerator().m(function _callee4() {
|
|
19631
|
+
var _this$threeMod2,
|
|
19632
|
+
_this2 = this;
|
|
19633
|
+
var three, models, uniqueUrls, errorByUrl, semaphore, loadedBytesByUrl, totalBytesByUrl, settledAssets, totalAssets, reportProgress, _iterator2, _step2, asset, root, center, _t5;
|
|
19634
|
+
return scene3DController_regenerator().w(function (_context4) {
|
|
19635
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
19492
19636
|
case 0:
|
|
19493
19637
|
three = (_this$threeMod2 = this.threeMod) === null || _this$threeMod2 === void 0 ? void 0 : _this$threeMod2.THREE;
|
|
19494
19638
|
models = this.scene3DConfig.models;
|
|
19495
19639
|
if (!(!three || !models || models.enabled === false || models.assets.length === 0)) {
|
|
19496
|
-
|
|
19640
|
+
_context4.n = 1;
|
|
19497
19641
|
break;
|
|
19498
19642
|
}
|
|
19499
|
-
return
|
|
19643
|
+
return _context4.a(2);
|
|
19500
19644
|
case 1:
|
|
19501
19645
|
this.scene3DGlbRootByUrl.clear();
|
|
19502
19646
|
this.scene3DGlbTemplateById.clear();
|
|
19503
|
-
|
|
19504
|
-
|
|
19505
|
-
|
|
19506
|
-
|
|
19507
|
-
|
|
19508
|
-
|
|
19647
|
+
|
|
19648
|
+
// Load every distinct URL with bounded concurrency (see GLB_LOAD_CONCURRENCY) instead of one
|
|
19649
|
+
// at a time, and let each load time out (see loadGlbRoot) — a single hung or malformed/truncated
|
|
19650
|
+
// asset is skipped and logged instead of blocking every asset queued behind it. Deduplicating by
|
|
19651
|
+
// URL up front — not inside the concurrent task — means assets sharing a URL never trigger
|
|
19652
|
+
// duplicate loads and never tie up more than one concurrency slot waiting on the same result.
|
|
19653
|
+
uniqueUrls = scene3DController_toConsumableArray(new Set(models.assets.map(function (asset) {
|
|
19654
|
+
return asset.url;
|
|
19655
|
+
})));
|
|
19656
|
+
errorByUrl = new globalThis.Map();
|
|
19657
|
+
semaphore = new Semaphore(Scene3DController.GLB_LOAD_CONCURRENCY); // Progress bookkeeping for `onModelsProgress` (e.g. a totem's loading bar). Kept even when no
|
|
19658
|
+
// callback is registered — the cost is a handful of Map writes over at most a few dozen assets.
|
|
19659
|
+
loadedBytesByUrl = new globalThis.Map();
|
|
19660
|
+
totalBytesByUrl = new globalThis.Map();
|
|
19661
|
+
settledAssets = 0;
|
|
19662
|
+
totalAssets = uniqueUrls.length;
|
|
19663
|
+
reportProgress = function reportProgress(done) {
|
|
19664
|
+
if (!_this2.onModelsProgress) return;
|
|
19665
|
+
var loadedBytes = 0;
|
|
19666
|
+
var totalBytes = 0;
|
|
19667
|
+
var _iterator = scene3DController_createForOfIteratorHelper(uniqueUrls),
|
|
19668
|
+
_step;
|
|
19669
|
+
try {
|
|
19670
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
19671
|
+
var _loadedBytesByUrl$get;
|
|
19672
|
+
var url = _step.value;
|
|
19673
|
+
loadedBytes += (_loadedBytesByUrl$get = loadedBytesByUrl.get(url)) !== null && _loadedBytesByUrl$get !== void 0 ? _loadedBytesByUrl$get : 0;
|
|
19674
|
+
var total = totalBytesByUrl.get(url);
|
|
19675
|
+
totalBytes = total == null || totalBytes === null ? null : totalBytes + total;
|
|
19676
|
+
}
|
|
19677
|
+
} catch (err) {
|
|
19678
|
+
_iterator.e(err);
|
|
19679
|
+
} finally {
|
|
19680
|
+
_iterator.f();
|
|
19681
|
+
}
|
|
19682
|
+
try {
|
|
19683
|
+
_this2.onModelsProgress({
|
|
19684
|
+
loadedAssets: settledAssets,
|
|
19685
|
+
totalAssets: totalAssets,
|
|
19686
|
+
loadedBytes: loadedBytes,
|
|
19687
|
+
totalBytes: totalBytes,
|
|
19688
|
+
done: done
|
|
19689
|
+
});
|
|
19690
|
+
} catch (err) {
|
|
19691
|
+
// Isolate the SDK's own load bookkeeping from a throwing consumer callback — letting this
|
|
19692
|
+
// escape would reject the `Promise.all` below (or, from the `onProgress` path, break
|
|
19693
|
+
// three.js's internal stream-reading chain) and lose every already-loaded asset.
|
|
19694
|
+
console.error("onScene3DModelsProgress callback threw", err);
|
|
19695
|
+
}
|
|
19696
|
+
};
|
|
19697
|
+
_context4.n = 2;
|
|
19698
|
+
return Promise.all(uniqueUrls.map(/*#__PURE__*/function () {
|
|
19699
|
+
var _ref = scene3DController_asyncToGenerator(/*#__PURE__*/scene3DController_regenerator().m(function _callee3(url) {
|
|
19700
|
+
var _ref2, _totalBytesByUrl$get, _t2, _t3, _t4;
|
|
19701
|
+
return scene3DController_regenerator().w(function (_context3) {
|
|
19702
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
19703
|
+
case 0:
|
|
19704
|
+
_context3.n = 1;
|
|
19705
|
+
return semaphore.acquire();
|
|
19706
|
+
case 1:
|
|
19707
|
+
_context3.p = 1;
|
|
19708
|
+
_t2 = _this2.scene3DGlbRootByUrl;
|
|
19709
|
+
_t3 = url;
|
|
19710
|
+
_context3.n = 2;
|
|
19711
|
+
return loadGlbRoot(url, {
|
|
19712
|
+
onProgress: function onProgress(event) {
|
|
19713
|
+
loadedBytesByUrl.set(url, event.loaded);
|
|
19714
|
+
totalBytesByUrl.set(url, event.lengthComputable ? event.total : null);
|
|
19715
|
+
reportProgress(false);
|
|
19716
|
+
}
|
|
19717
|
+
});
|
|
19718
|
+
case 2:
|
|
19719
|
+
_t2.set.call(_t2, _t3, _context3.v);
|
|
19720
|
+
_context3.n = 4;
|
|
19721
|
+
break;
|
|
19722
|
+
case 3:
|
|
19723
|
+
_context3.p = 3;
|
|
19724
|
+
_t4 = _context3.v;
|
|
19725
|
+
errorByUrl.set(url, _t4);
|
|
19726
|
+
case 4:
|
|
19727
|
+
_context3.p = 4;
|
|
19728
|
+
settledAssets++;
|
|
19729
|
+
// Once a URL has settled, its total is knowable even if no progress event ever supplied
|
|
19730
|
+
// one (failed before the first byte, or the server omitted Content-Length): fall back to
|
|
19731
|
+
// however many bytes actually arrived. Otherwise a single such asset would force the
|
|
19732
|
+
// whole batch's `totalBytes` to stay `null` forever, even after `done: true`.
|
|
19733
|
+
totalBytesByUrl.set(url, (_ref2 = (_totalBytesByUrl$get = totalBytesByUrl.get(url)) !== null && _totalBytesByUrl$get !== void 0 ? _totalBytesByUrl$get : loadedBytesByUrl.get(url)) !== null && _ref2 !== void 0 ? _ref2 : 0);
|
|
19734
|
+
semaphore.release();
|
|
19735
|
+
reportProgress(false);
|
|
19736
|
+
return _context3.f(4);
|
|
19737
|
+
case 5:
|
|
19738
|
+
return _context3.a(2);
|
|
19739
|
+
}
|
|
19740
|
+
}, _callee3, null, [[1, 3, 4, 5]]);
|
|
19741
|
+
}));
|
|
19742
|
+
return function (_x) {
|
|
19743
|
+
return _ref.apply(this, arguments);
|
|
19744
|
+
};
|
|
19745
|
+
}()));
|
|
19746
|
+
case 2:
|
|
19747
|
+
reportProgress(true);
|
|
19748
|
+
_iterator2 = scene3DController_createForOfIteratorHelper(models.assets);
|
|
19749
|
+
_context4.p = 3;
|
|
19750
|
+
_iterator2.s();
|
|
19751
|
+
case 4:
|
|
19752
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
19753
|
+
_context4.n = 7;
|
|
19509
19754
|
break;
|
|
19510
19755
|
}
|
|
19511
|
-
asset =
|
|
19512
|
-
_context3.p = 4;
|
|
19756
|
+
asset = _step2.value;
|
|
19513
19757
|
root = this.scene3DGlbRootByUrl.get(asset.url);
|
|
19514
19758
|
if (root) {
|
|
19515
|
-
|
|
19759
|
+
_context4.n = 5;
|
|
19516
19760
|
break;
|
|
19517
19761
|
}
|
|
19518
|
-
|
|
19519
|
-
return
|
|
19762
|
+
console.error("Failed to load GLB asset \"".concat(asset.id, "\" from ").concat(asset.url), errorByUrl.get(asset.url));
|
|
19763
|
+
return _context4.a(3, 6);
|
|
19520
19764
|
case 5:
|
|
19521
|
-
root = _context3.v;
|
|
19522
|
-
this.scene3DGlbRootByUrl.set(asset.url, root);
|
|
19523
|
-
case 6:
|
|
19524
19765
|
center = computeGlbBottomAnchor(three, root);
|
|
19525
19766
|
this.scene3DGlbTemplateById.set(asset.id, {
|
|
19526
19767
|
root: root,
|
|
19527
19768
|
center: center
|
|
19528
19769
|
});
|
|
19529
|
-
|
|
19770
|
+
case 6:
|
|
19771
|
+
_context4.n = 4;
|
|
19530
19772
|
break;
|
|
19531
19773
|
case 7:
|
|
19532
|
-
|
|
19533
|
-
_t2 = _context3.v;
|
|
19534
|
-
console.error("Failed to load GLB asset \"".concat(asset.id, "\" from ").concat(asset.url), _t2);
|
|
19535
|
-
case 8:
|
|
19536
|
-
_context3.n = 3;
|
|
19774
|
+
_context4.n = 9;
|
|
19537
19775
|
break;
|
|
19776
|
+
case 8:
|
|
19777
|
+
_context4.p = 8;
|
|
19778
|
+
_t5 = _context4.v;
|
|
19779
|
+
_iterator2.e(_t5);
|
|
19538
19780
|
case 9:
|
|
19539
|
-
|
|
19540
|
-
|
|
19781
|
+
_context4.p = 9;
|
|
19782
|
+
_iterator2.f();
|
|
19783
|
+
return _context4.f(9);
|
|
19541
19784
|
case 10:
|
|
19542
|
-
|
|
19543
|
-
_t3 = _context3.v;
|
|
19544
|
-
_iterator.e(_t3);
|
|
19545
|
-
case 11:
|
|
19546
|
-
_context3.p = 11;
|
|
19547
|
-
_iterator.f();
|
|
19548
|
-
return _context3.f(11);
|
|
19549
|
-
case 12:
|
|
19550
|
-
return _context3.a(2);
|
|
19785
|
+
return _context4.a(2);
|
|
19551
19786
|
}
|
|
19552
|
-
},
|
|
19787
|
+
}, _callee4, this, [[3, 8, 9, 10]]);
|
|
19553
19788
|
}));
|
|
19554
19789
|
function loadScene3DGlbTemplates() {
|
|
19555
19790
|
return _loadScene3DGlbTemplates.apply(this, arguments);
|
|
@@ -19566,7 +19801,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19566
19801
|
_models$globalOffset2,
|
|
19567
19802
|
_models$globalOffset$3,
|
|
19568
19803
|
_models$globalOffset3,
|
|
19569
|
-
|
|
19804
|
+
_this3 = this;
|
|
19570
19805
|
var three = (_this$threeMod3 = this.threeMod) === null || _this$threeMod3 === void 0 ? void 0 : _this$threeMod3.THREE;
|
|
19571
19806
|
if (!three || !this.scene3DGlbScene) {
|
|
19572
19807
|
return;
|
|
@@ -19587,16 +19822,16 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19587
19822
|
var floorKey = this.currentFloor;
|
|
19588
19823
|
var modelsGroup = new three.Group();
|
|
19589
19824
|
modelsGroup.position.set((_models$globalOffset$ = (_models$globalOffset = models.globalOffset) === null || _models$globalOffset === void 0 ? void 0 : _models$globalOffset.x) !== null && _models$globalOffset$ !== void 0 ? _models$globalOffset$ : 0, (_models$globalOffset$2 = (_models$globalOffset2 = models.globalOffset) === null || _models$globalOffset2 === void 0 ? void 0 : _models$globalOffset2.y) !== null && _models$globalOffset$2 !== void 0 ? _models$globalOffset$2 : 0, (_models$globalOffset$3 = (_models$globalOffset3 = models.globalOffset) === null || _models$globalOffset3 === void 0 ? void 0 : _models$globalOffset3.z) !== null && _models$globalOffset$3 !== void 0 ? _models$globalOffset$3 : 0);
|
|
19590
|
-
var
|
|
19591
|
-
|
|
19825
|
+
var _iterator3 = scene3DController_createForOfIteratorHelper(models.placements),
|
|
19826
|
+
_step3;
|
|
19592
19827
|
try {
|
|
19593
19828
|
var _loop = function _loop() {
|
|
19594
19829
|
var _placement$position$a;
|
|
19595
|
-
var placement =
|
|
19830
|
+
var placement = _step3.value;
|
|
19596
19831
|
if (!isPlacementVisibleOnFloor(placement, floorKey)) {
|
|
19597
19832
|
return 0; // continue
|
|
19598
19833
|
}
|
|
19599
|
-
var template =
|
|
19834
|
+
var template = _this3.scene3DGlbTemplateById.get(placement.assetId);
|
|
19600
19835
|
if (!template) {
|
|
19601
19836
|
return 0; // continue
|
|
19602
19837
|
}
|
|
@@ -19658,14 +19893,14 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19658
19893
|
modelsGroup.add(pivot);
|
|
19659
19894
|
},
|
|
19660
19895
|
_ret;
|
|
19661
|
-
for (
|
|
19896
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
19662
19897
|
_ret = _loop();
|
|
19663
19898
|
if (_ret === 0) continue;
|
|
19664
19899
|
}
|
|
19665
19900
|
} catch (err) {
|
|
19666
|
-
|
|
19901
|
+
_iterator3.e(err);
|
|
19667
19902
|
} finally {
|
|
19668
|
-
|
|
19903
|
+
_iterator3.f();
|
|
19669
19904
|
}
|
|
19670
19905
|
this.scene3DModelsGroup = modelsGroup;
|
|
19671
19906
|
this.scene3DGlbScene.add(modelsGroup);
|
|
@@ -19686,14 +19921,14 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19686
19921
|
key: "recomputeRouteAffectedModels",
|
|
19687
19922
|
value: function recomputeRouteAffectedModels() {
|
|
19688
19923
|
var _this$threeMod4,
|
|
19689
|
-
|
|
19924
|
+
_this4 = this;
|
|
19690
19925
|
var three = (_this$threeMod4 = this.threeMod) === null || _this$threeMod4 === void 0 ? void 0 : _this$threeMod4.THREE;
|
|
19691
19926
|
var modelsGroup = this.scene3DModelsGroup;
|
|
19692
19927
|
if (!three || !modelsGroup) {
|
|
19693
19928
|
return;
|
|
19694
19929
|
}
|
|
19695
19930
|
var points = this.scene3DRouteCollisionPoints.filter(function (p) {
|
|
19696
|
-
return p.floorKey ===
|
|
19931
|
+
return p.floorKey === _this4.currentFloor;
|
|
19697
19932
|
});
|
|
19698
19933
|
|
|
19699
19934
|
// Convert each route point into the models group's local frame (metres relative to
|
|
@@ -19710,11 +19945,11 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19710
19945
|
});
|
|
19711
19946
|
modelsGroup.updateMatrixWorld(true);
|
|
19712
19947
|
var local = new three.Vector3();
|
|
19713
|
-
var
|
|
19714
|
-
|
|
19948
|
+
var _iterator4 = scene3DController_createForOfIteratorHelper(modelsGroup.children),
|
|
19949
|
+
_step4;
|
|
19715
19950
|
try {
|
|
19716
19951
|
var _loop2 = function _loop2() {
|
|
19717
|
-
var pivot =
|
|
19952
|
+
var pivot = _step4.value;
|
|
19718
19953
|
var routeCfg = pivot.userData.routeTransparency;
|
|
19719
19954
|
var footprint = pivot.userData.footprint;
|
|
19720
19955
|
// Only models with a route-transparency config participate (feature activation gate).
|
|
@@ -19731,13 +19966,13 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19731
19966
|
return pointInFootprint(footprint, local.x, local.z);
|
|
19732
19967
|
});
|
|
19733
19968
|
};
|
|
19734
|
-
for (
|
|
19969
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
19735
19970
|
if (_loop2()) continue;
|
|
19736
19971
|
}
|
|
19737
19972
|
} catch (err) {
|
|
19738
|
-
|
|
19973
|
+
_iterator4.e(err);
|
|
19739
19974
|
} finally {
|
|
19740
|
-
|
|
19975
|
+
_iterator4.f();
|
|
19741
19976
|
}
|
|
19742
19977
|
}
|
|
19743
19978
|
|
|
@@ -19757,11 +19992,11 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19757
19992
|
}
|
|
19758
19993
|
var zoom = this.map.getZoom();
|
|
19759
19994
|
var changed = false;
|
|
19760
|
-
var
|
|
19761
|
-
|
|
19995
|
+
var _iterator5 = scene3DController_createForOfIteratorHelper(this.scene3DModelsGroup.children),
|
|
19996
|
+
_step5;
|
|
19762
19997
|
try {
|
|
19763
19998
|
var _loop3 = function _loop3() {
|
|
19764
|
-
var pivot =
|
|
19999
|
+
var pivot = _step5.value;
|
|
19765
20000
|
var zoomCfg = pivot.userData.zoomTransparency;
|
|
19766
20001
|
var routeCfg = pivot.userData.routeTransparency;
|
|
19767
20002
|
var routeAffected = pivot.userData.routeAffected === true;
|
|
@@ -19772,11 +20007,11 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19772
20007
|
return;
|
|
19773
20008
|
}
|
|
19774
20009
|
var materials = Array.isArray(mesh.material) ? mesh.material : [mesh.material];
|
|
19775
|
-
var
|
|
19776
|
-
|
|
20010
|
+
var _iterator6 = scene3DController_createForOfIteratorHelper(materials),
|
|
20011
|
+
_step6;
|
|
19777
20012
|
try {
|
|
19778
|
-
for (
|
|
19779
|
-
var material =
|
|
20013
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
20014
|
+
var material = _step6.value;
|
|
19780
20015
|
if (material.opacity !== opacity) {
|
|
19781
20016
|
material.transparent = opacity < 1;
|
|
19782
20017
|
material.opacity = opacity;
|
|
@@ -19786,19 +20021,19 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19786
20021
|
}
|
|
19787
20022
|
}
|
|
19788
20023
|
} catch (err) {
|
|
19789
|
-
|
|
20024
|
+
_iterator6.e(err);
|
|
19790
20025
|
} finally {
|
|
19791
|
-
|
|
20026
|
+
_iterator6.f();
|
|
19792
20027
|
}
|
|
19793
20028
|
});
|
|
19794
20029
|
};
|
|
19795
|
-
for (
|
|
20030
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
19796
20031
|
_loop3();
|
|
19797
20032
|
}
|
|
19798
20033
|
} catch (err) {
|
|
19799
|
-
|
|
20034
|
+
_iterator5.e(err);
|
|
19800
20035
|
} finally {
|
|
19801
|
-
|
|
20036
|
+
_iterator5.f();
|
|
19802
20037
|
}
|
|
19803
20038
|
if (changed) {
|
|
19804
20039
|
this.map.triggerRepaint();
|
|
@@ -19807,12 +20042,12 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19807
20042
|
}, {
|
|
19808
20043
|
key: "loadSpriteAtlas",
|
|
19809
20044
|
value: function () {
|
|
19810
|
-
var _loadSpriteAtlas = scene3DController_asyncToGenerator(/*#__PURE__*/scene3DController_regenerator().m(function
|
|
20045
|
+
var _loadSpriteAtlas = scene3DController_asyncToGenerator(/*#__PURE__*/scene3DController_regenerator().m(function _callee5(spriteUrl) {
|
|
19811
20046
|
var _yield$Promise$all, _yield$Promise$all2, json, img;
|
|
19812
|
-
return scene3DController_regenerator().w(function (
|
|
19813
|
-
while (1) switch (
|
|
20047
|
+
return scene3DController_regenerator().w(function (_context5) {
|
|
20048
|
+
while (1) switch (_context5.n) {
|
|
19814
20049
|
case 0:
|
|
19815
|
-
|
|
20050
|
+
_context5.n = 1;
|
|
19816
20051
|
return Promise.all([fetch("".concat(spriteUrl, ".json")).then(function (r) {
|
|
19817
20052
|
return r.json();
|
|
19818
20053
|
}), new Promise(function (resolve, reject) {
|
|
@@ -19825,18 +20060,18 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19825
20060
|
image.src = "".concat(spriteUrl, ".png");
|
|
19826
20061
|
})]);
|
|
19827
20062
|
case 1:
|
|
19828
|
-
_yield$Promise$all =
|
|
20063
|
+
_yield$Promise$all = _context5.v;
|
|
19829
20064
|
_yield$Promise$all2 = scene3DController_slicedToArray(_yield$Promise$all, 2);
|
|
19830
20065
|
json = _yield$Promise$all2[0];
|
|
19831
20066
|
img = _yield$Promise$all2[1];
|
|
19832
20067
|
this.spriteIconMapping = json;
|
|
19833
20068
|
this.spriteAtlasImage = img;
|
|
19834
20069
|
case 2:
|
|
19835
|
-
return
|
|
20070
|
+
return _context5.a(2);
|
|
19836
20071
|
}
|
|
19837
|
-
},
|
|
20072
|
+
}, _callee5, this);
|
|
19838
20073
|
}));
|
|
19839
|
-
function loadSpriteAtlas(
|
|
20074
|
+
function loadSpriteAtlas(_x2) {
|
|
19840
20075
|
return _loadSpriteAtlas.apply(this, arguments);
|
|
19841
20076
|
}
|
|
19842
20077
|
return loadSpriteAtlas;
|
|
@@ -19880,7 +20115,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19880
20115
|
var _layerConfig$binaryDa2,
|
|
19881
20116
|
_layerConfig$minZoom,
|
|
19882
20117
|
_layerConfig$maxZoom,
|
|
19883
|
-
|
|
20118
|
+
_this5 = this;
|
|
19884
20119
|
var useSdf = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
19885
20120
|
var deck = this.deckMod;
|
|
19886
20121
|
if (!deck) return null;
|
|
@@ -19895,7 +20130,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19895
20130
|
// Use area_name and poi Point features — unique per tile, no duplicates.
|
|
19896
20131
|
// If a logo-{name} image exists in the sprite, the icon takes priority over the text label.
|
|
19897
20132
|
var textData = buildLabelData(props.data || [], floorKey, function (imageId) {
|
|
19898
|
-
return
|
|
20133
|
+
return _this5.map.hasImage(imageId);
|
|
19899
20134
|
}, (_layerConfig$defaultH2 = layerConfig.defaultHeight) !== null && _layerConfig$defaultH2 !== void 0 ? _layerConfig$defaultH2 : 5);
|
|
19900
20135
|
if (!textData.length) return null;
|
|
19901
20136
|
return new deck.TextLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, props), {}, {
|
|
@@ -19934,7 +20169,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19934
20169
|
var _layerConfig$binaryDa3,
|
|
19935
20170
|
_layerConfig$minZoom2,
|
|
19936
20171
|
_layerConfig$maxZoom2,
|
|
19937
|
-
|
|
20172
|
+
_this6 = this;
|
|
19938
20173
|
var deck = this.deckMod;
|
|
19939
20174
|
if (!deck || !this.spriteIconMapping || !this.spriteAtlasImage) return null;
|
|
19940
20175
|
return new deck.MVTLayer({
|
|
@@ -19950,8 +20185,8 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19950
20185
|
return new deck.IconLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, props), {}, {
|
|
19951
20186
|
id: "".concat(props.id, "-poi-icons"),
|
|
19952
20187
|
data: iconData,
|
|
19953
|
-
iconAtlas:
|
|
19954
|
-
iconMapping:
|
|
20188
|
+
iconAtlas: _this6.spriteAtlasImage,
|
|
20189
|
+
iconMapping: _this6.spriteIconMapping,
|
|
19955
20190
|
getIcon: function getIcon(d) {
|
|
19956
20191
|
return d.icon;
|
|
19957
20192
|
},
|
|
@@ -19976,7 +20211,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19976
20211
|
var _layerConfig$binaryDa4,
|
|
19977
20212
|
_layerConfig$minZoom3,
|
|
19978
20213
|
_layerConfig$maxZoom3,
|
|
19979
|
-
|
|
20214
|
+
_this7 = this;
|
|
19980
20215
|
var deck = this.deckMod;
|
|
19981
20216
|
if (!deck || !this.spriteIconMapping || !this.spriteAtlasImage) return null;
|
|
19982
20217
|
return new deck.MVTLayer({
|
|
@@ -19987,13 +20222,13 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19987
20222
|
maxZoom: (_layerConfig$maxZoom3 = layerConfig.maxZoom) !== null && _layerConfig$maxZoom3 !== void 0 ? _layerConfig$maxZoom3 : 24,
|
|
19988
20223
|
renderSubLayers: function renderSubLayers(props) {
|
|
19989
20224
|
var _layerConfig$defaultH4, _layerConfig$sizeUnit2, _layerConfig$sizeScal2, _layerConfig$billboar2;
|
|
19990
|
-
var logoData = buildStoreLogoData(props.data || [], floorKey,
|
|
20225
|
+
var logoData = buildStoreLogoData(props.data || [], floorKey, _this7.spriteIconMapping, (_layerConfig$defaultH4 = layerConfig.defaultHeight) !== null && _layerConfig$defaultH4 !== void 0 ? _layerConfig$defaultH4 : 5);
|
|
19991
20226
|
if (!logoData.length) return null;
|
|
19992
20227
|
return new deck.IconLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, props), {}, {
|
|
19993
20228
|
id: "".concat(props.id, "-store-logos"),
|
|
19994
20229
|
data: logoData,
|
|
19995
|
-
iconAtlas:
|
|
19996
|
-
iconMapping:
|
|
20230
|
+
iconAtlas: _this7.spriteAtlasImage,
|
|
20231
|
+
iconMapping: _this7.spriteIconMapping,
|
|
19997
20232
|
getIcon: function getIcon(d) {
|
|
19998
20233
|
return d.icon;
|
|
19999
20234
|
},
|
|
@@ -20005,7 +20240,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
20005
20240
|
},
|
|
20006
20241
|
getSize: function getSize(d) {
|
|
20007
20242
|
var _layerConfig$logoScal;
|
|
20008
|
-
return computeStoreLogoSize(
|
|
20243
|
+
return computeStoreLogoSize(_this7.spriteIconMapping, d.icon, (_layerConfig$logoScal = layerConfig.logoScale) !== null && _layerConfig$logoScal !== void 0 ? _layerConfig$logoScal : {});
|
|
20009
20244
|
},
|
|
20010
20245
|
sizeUnits: (_layerConfig$sizeUnit2 = layerConfig.sizeUnits) !== null && _layerConfig$sizeUnit2 !== void 0 ? _layerConfig$sizeUnit2 : "meters",
|
|
20011
20246
|
sizeScale: (_layerConfig$sizeScal2 = layerConfig.sizeScale) !== null && _layerConfig$sizeScal2 !== void 0 ? _layerConfig$sizeScal2 : 1,
|
|
@@ -20050,23 +20285,30 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
20050
20285
|
key: "hideLayers",
|
|
20051
20286
|
value: function hideLayers(layersIds) {
|
|
20052
20287
|
if (!layersIds) return;
|
|
20053
|
-
var
|
|
20054
|
-
|
|
20288
|
+
var _iterator7 = scene3DController_createForOfIteratorHelper(layersIds),
|
|
20289
|
+
_step7;
|
|
20055
20290
|
try {
|
|
20056
|
-
for (
|
|
20057
|
-
var layerId =
|
|
20291
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
20292
|
+
var layerId = _step7.value;
|
|
20058
20293
|
var layer = this.map.getLayer(layerId);
|
|
20059
20294
|
if (!layer) continue;
|
|
20060
20295
|
this.map.setLayoutProperty(layer.id, "visibility", "none");
|
|
20061
20296
|
}
|
|
20062
20297
|
} catch (err) {
|
|
20063
|
-
|
|
20298
|
+
_iterator7.e(err);
|
|
20064
20299
|
} finally {
|
|
20065
|
-
|
|
20300
|
+
_iterator7.f();
|
|
20066
20301
|
}
|
|
20067
20302
|
}
|
|
20068
20303
|
}]);
|
|
20069
20304
|
}();
|
|
20305
|
+
/**
|
|
20306
|
+
* Bounded concurrency for loading declarative GLB assets in {@link loadScene3DGlbTemplates}.
|
|
20307
|
+
* High enough that one slow/broken asset (see {@link loadGlbRoot}'s timeout) does not stall the
|
|
20308
|
+
* rest of the batch, low enough to avoid saturating the browser with concurrent Draco/KTX2
|
|
20309
|
+
* decodes when a scene declares many assets.
|
|
20310
|
+
*/
|
|
20311
|
+
scene3DController_defineProperty(Scene3DController, "GLB_LOAD_CONCURRENCY", 4);
|
|
20070
20312
|
;// ./src/map/fitCamera.ts
|
|
20071
20313
|
function fitCamera_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = fitCamera_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; } } }; }
|
|
20072
20314
|
function fitCamera_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return fitCamera_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) ? fitCamera_arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -20752,7 +20994,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
20752
20994
|
// Create the 3D controller only when the map opts into 3D. All heavy WebGL / deck.gl work is
|
|
20753
20995
|
// owned by it; in 2D mode `this.scene3D` stays undefined and every hook below is a no-op.
|
|
20754
20996
|
if (this.is3DSceneActive() && this.scene3DConfig) {
|
|
20755
|
-
this.scene3D = new Scene3DController(this.map, this.scene3DConfig, this.initialCenter);
|
|
20997
|
+
this.scene3D = new Scene3DController(this.map, this.scene3DConfig, this.initialCenter, mapConfig.onScene3DModelsProgress);
|
|
20756
20998
|
}
|
|
20757
20999
|
// When rotation is disabled we still want pinch-to-zoom to work, so the
|
|
20758
21000
|
// two-finger rotation is turned off here instead of via the constructor.
|