@mapvx/web-js 3.2.0 → 3.3.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +112 -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 +40 -1
- package/dist/es/utils/loadGlb.d.ts.map +1 -1
- package/dist/es/utils/loadGlb.js +111 -7
- package/dist/es/utils/loadGlb.js.map +1 -1
- package/dist/umd/index.js +355 -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-dev.2";
|
|
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,65 @@ 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
|
+
* Declarative GLB scenes can legitimately include very large assets — a client's ground-mesh
|
|
19120
|
+
* "Suelo" model measured at ~400 MB took ~26s to download alone on a solid connection, before any
|
|
19121
|
+
* Draco decode time, and totem hardware/networks in the field are often slower than that. The
|
|
19122
|
+
* timeout only needs to be long enough that no realistically-sized valid asset ever hits it; a
|
|
19123
|
+
* truly hung load (the actual failure this guards against) would still hang forever whether this
|
|
19124
|
+
* is 30 seconds or 5 minutes, so there is no tradeoff in keeping it generous.
|
|
19125
|
+
*
|
|
19126
|
+
* @group Configuration
|
|
19127
|
+
*/
|
|
19128
|
+
var DEFAULT_GLB_LOAD_TIMEOUT_MS = 300000;
|
|
19129
|
+
|
|
19130
|
+
/**
|
|
19131
|
+
* Magic number ("glTF" read little-endian) at byte offset 0 of every binary glTF (`.glb`)
|
|
19132
|
+
* container. Used only to tell a binary GLB apart from a plain JSON `.gltf` payload — the latter
|
|
19133
|
+
* has no such header and skips the completeness check in {@link assertGlbBufferComplete}.
|
|
19134
|
+
*/
|
|
19135
|
+
var GLB_MAGIC = 0x46546c67;
|
|
19136
|
+
|
|
19137
|
+
/**
|
|
19138
|
+
* Rejects a GLB download that was cut short before it reaches Three.js's `GLTFLoader`/`DRACOLoader`,
|
|
19139
|
+
* whose behavior on truncated input ranges from a cryptic decode error (e.g. "Unexpected geometry
|
|
19140
|
+
* type") to an outright hang, rather than a clear message pointing at the actual problem.
|
|
19141
|
+
*
|
|
19142
|
+
* The binary glTF container format requires the 12-byte header's declared total length to equal
|
|
19143
|
+
* the file's real byte length (see the {@link https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#binary-header | spec}).
|
|
19144
|
+
* A mismatch means the response body was truncated — a dropped connection, or the object stored at
|
|
19145
|
+
* `url` is itself incomplete — so every buffer-view offset past that point reads garbage. This is
|
|
19146
|
+
* exactly what was found in the field for one "Suelo" asset that both threw a decode error and (in
|
|
19147
|
+
* a larger sibling file) hung: the file's own header declared a ~383 MB binary chunk while only
|
|
19148
|
+
* ~8.7 MB had actually been received.
|
|
19149
|
+
*/
|
|
19150
|
+
function assertGlbBufferComplete(buffer, url) {
|
|
19151
|
+
if (buffer.byteLength < 12) return; // too short to have a GLB header; let parse() report it
|
|
19152
|
+
var header = new DataView(buffer, 0, 12);
|
|
19153
|
+
if (header.getUint32(0, true) !== GLB_MAGIC) return; // plain JSON .gltf, not a binary .glb
|
|
19154
|
+
var declaredLength = header.getUint32(8, true);
|
|
19155
|
+
if (declaredLength !== buffer.byteLength) {
|
|
19156
|
+
throw new Error("GLB download is truncated or corrupt: header declares ".concat(declaredLength, " bytes, received ").concat(buffer.byteLength, ": ").concat(url));
|
|
19157
|
+
}
|
|
19158
|
+
}
|
|
19159
|
+
|
|
19160
|
+
/** Options for {@link loadGlbRoot}. */
|
|
19161
|
+
|
|
19098
19162
|
/**
|
|
19099
19163
|
* Loads a GLB/GLTF from URL and returns the root scene group.
|
|
19100
19164
|
* Central entry point so the loader implementation can be swapped later (e.g. Draco, KTX2, custom fetch).
|
|
19101
19165
|
*
|
|
19166
|
+
* Fetches the raw bytes itself (rather than deferring to `GLTFLoader.load`) so a truncated download
|
|
19167
|
+
* can be caught and rejected clearly — see {@link assertGlbBufferComplete} — before it ever reaches
|
|
19168
|
+
* the Draco/KTX2 decoders.
|
|
19169
|
+
*
|
|
19102
19170
|
* @param url - GLB URL
|
|
19103
19171
|
* @returns Root `THREE.Group` from the loaded glTF scene
|
|
19104
19172
|
* @group Utils
|
|
@@ -19108,23 +19176,99 @@ function loadGlbRoot(_x) {
|
|
|
19108
19176
|
}
|
|
19109
19177
|
function _loadGlbRoot() {
|
|
19110
19178
|
_loadGlbRoot = loadGlb_asyncToGenerator(/*#__PURE__*/loadGlb_regenerator().m(function _callee(url) {
|
|
19111
|
-
var
|
|
19179
|
+
var options,
|
|
19180
|
+
_options$timeoutMs,
|
|
19181
|
+
timeoutMs,
|
|
19182
|
+
onProgress,
|
|
19183
|
+
_yield$Promise$all,
|
|
19184
|
+
_yield$Promise$all2,
|
|
19185
|
+
gltfLoader,
|
|
19186
|
+
three,
|
|
19187
|
+
settled,
|
|
19188
|
+
fileLoader,
|
|
19189
|
+
load,
|
|
19190
|
+
timer,
|
|
19191
|
+
timeout,
|
|
19192
|
+
_args = arguments;
|
|
19112
19193
|
return loadGlb_regenerator().w(function (_context) {
|
|
19113
|
-
while (1) switch (_context.n) {
|
|
19194
|
+
while (1) switch (_context.p = _context.n) {
|
|
19114
19195
|
case 0:
|
|
19196
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
19197
|
+
_options$timeoutMs = options.timeoutMs, timeoutMs = _options$timeoutMs === void 0 ? DEFAULT_GLB_LOAD_TIMEOUT_MS : _options$timeoutMs, onProgress = options.onProgress;
|
|
19115
19198
|
_context.n = 1;
|
|
19116
|
-
return getGltfLoader();
|
|
19199
|
+
return Promise.all([getGltfLoader(), loadThree()]);
|
|
19117
19200
|
case 1:
|
|
19118
|
-
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
|
|
19201
|
+
_yield$Promise$all = _context.v;
|
|
19202
|
+
_yield$Promise$all2 = loadGlb_slicedToArray(_yield$Promise$all, 2);
|
|
19203
|
+
gltfLoader = _yield$Promise$all2[0];
|
|
19204
|
+
three = _yield$Promise$all2[1].THREE;
|
|
19205
|
+
// Set once the caller has stopped waiting (success, failure, or timeout) so any callback three
|
|
19206
|
+
// fires afterwards — e.g. a timed-out fetch/decode that keeps running in the background — is a
|
|
19207
|
+
// no-op instead of resolving/rejecting an already-settled promise or emitting a stray progress
|
|
19208
|
+
// event after the batch this asset belongs to already reported `done: true`.
|
|
19209
|
+
settled = false;
|
|
19210
|
+
fileLoader = new three.FileLoader();
|
|
19211
|
+
fileLoader.setResponseType("arraybuffer");
|
|
19212
|
+
load = new Promise(function (resolve, reject) {
|
|
19213
|
+
var onError = function onError(error) {
|
|
19214
|
+
if (settled) return;
|
|
19123
19215
|
reject(error instanceof Error ? error : new Error(String(error)));
|
|
19124
|
-
}
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
|
|
19216
|
+
};
|
|
19217
|
+
fileLoader.load(url, function (data) {
|
|
19218
|
+
if (settled) return;
|
|
19219
|
+
var buffer = data;
|
|
19220
|
+
try {
|
|
19221
|
+
assertGlbBufferComplete(buffer, url);
|
|
19222
|
+
} catch (err) {
|
|
19223
|
+
onError(err);
|
|
19224
|
+
return;
|
|
19225
|
+
}
|
|
19226
|
+
gltfLoader.parse(buffer, three.LoaderUtils.extractUrlBase(url), function (gltf) {
|
|
19227
|
+
if (settled) return;
|
|
19228
|
+
resolve(gltf.scene);
|
|
19229
|
+
}, onError);
|
|
19230
|
+
}, function (event) {
|
|
19231
|
+
if (!settled) onProgress === null || onProgress === void 0 || onProgress(event);
|
|
19232
|
+
}, onError);
|
|
19233
|
+
});
|
|
19234
|
+
if (!(!Number.isFinite(timeoutMs) || timeoutMs <= 0)) {
|
|
19235
|
+
_context.n = 5;
|
|
19236
|
+
break;
|
|
19237
|
+
}
|
|
19238
|
+
_context.p = 2;
|
|
19239
|
+
_context.n = 3;
|
|
19240
|
+
return load;
|
|
19241
|
+
case 3:
|
|
19242
|
+
return _context.a(2, _context.v);
|
|
19243
|
+
case 4:
|
|
19244
|
+
_context.p = 4;
|
|
19245
|
+
settled = true;
|
|
19246
|
+
return _context.f(4);
|
|
19247
|
+
case 5:
|
|
19248
|
+
timeout = new Promise(function (_resolve, reject) {
|
|
19249
|
+
timer = setTimeout(function () {
|
|
19250
|
+
return reject(new Error("Timed out loading GLB after ".concat(timeoutMs, "ms: ").concat(url)));
|
|
19251
|
+
}, timeoutMs);
|
|
19252
|
+
});
|
|
19253
|
+
_context.p = 6;
|
|
19254
|
+
_context.n = 7;
|
|
19255
|
+
return Promise.race([load, timeout]);
|
|
19256
|
+
case 7:
|
|
19257
|
+
return _context.a(2, _context.v);
|
|
19258
|
+
case 8:
|
|
19259
|
+
_context.p = 8;
|
|
19260
|
+
settled = true;
|
|
19261
|
+
clearTimeout(timer);
|
|
19262
|
+
// Cancels the underlying fetch (and, by never delivering its buffer, the Draco/KTX2 decode)
|
|
19263
|
+
// so a timed-out asset actually frees its network/CPU usage instead of running to completion
|
|
19264
|
+
// unattended — otherwise GLB_LOAD_CONCURRENCY only bounds how many loads the caller awaits,
|
|
19265
|
+
// not how many are truly in flight. A no-op if `load` already won the race.
|
|
19266
|
+
fileLoader.abort();
|
|
19267
|
+
return _context.f(8);
|
|
19268
|
+
case 9:
|
|
19269
|
+
return _context.a(2);
|
|
19270
|
+
}
|
|
19271
|
+
}, _callee, null, [[6,, 8, 9], [2,, 4, 5]]);
|
|
19128
19272
|
}));
|
|
19129
19273
|
return _loadGlbRoot.apply(this, arguments);
|
|
19130
19274
|
}
|
|
@@ -19192,7 +19336,11 @@ function scene3DController_nonIterableRest() { throw new TypeError("Invalid atte
|
|
|
19192
19336
|
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
19337
|
function scene3DController_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
19194
19338
|
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; } } }; }
|
|
19339
|
+
function scene3DController_toConsumableArray(r) { return scene3DController_arrayWithoutHoles(r) || scene3DController_iterableToArray(r) || scene3DController_unsupportedIterableToArray(r) || scene3DController_nonIterableSpread(); }
|
|
19340
|
+
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
19341
|
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; } }
|
|
19342
|
+
function scene3DController_iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
19343
|
+
function scene3DController_arrayWithoutHoles(r) { if (Array.isArray(r)) return scene3DController_arrayLikeToArray(r); }
|
|
19196
19344
|
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
19345
|
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
19346
|
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 +19359,7 @@ function scene3DController_toPrimitive(t, r) { if ("object" != scene3DController
|
|
|
19211
19359
|
|
|
19212
19360
|
|
|
19213
19361
|
|
|
19362
|
+
|
|
19214
19363
|
/**
|
|
19215
19364
|
* Owns the experimental 3D scene for a MapLibre map: the deck.gl overlay layers (elevated room
|
|
19216
19365
|
* outlines, indoor labels, POI icons, store logos) and the declarative GLB custom layer rendered
|
|
@@ -19227,7 +19376,7 @@ function scene3DController_toPrimitive(t, r) { if ("object" != scene3DController
|
|
|
19227
19376
|
* @group Map
|
|
19228
19377
|
*/
|
|
19229
19378
|
var Scene3DController = /*#__PURE__*/function () {
|
|
19230
|
-
function Scene3DController(map, scene3DConfig, initialCenter) {
|
|
19379
|
+
function Scene3DController(map, scene3DConfig, initialCenter, onModelsProgress) {
|
|
19231
19380
|
scene3DController_classCallCheck(this, Scene3DController);
|
|
19232
19381
|
/** Latest known floor key; updated by the floor-change hooks and read when (re)building layers. */
|
|
19233
19382
|
scene3DController_defineProperty(this, "currentFloor", "");
|
|
@@ -19256,6 +19405,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19256
19405
|
this.map = map;
|
|
19257
19406
|
this.scene3DConfig = scene3DConfig;
|
|
19258
19407
|
this.initialCenter = initialCenter;
|
|
19408
|
+
this.onModelsProgress = onModelsProgress;
|
|
19259
19409
|
}
|
|
19260
19410
|
|
|
19261
19411
|
// Lifecycle entry points forwarded by the map ---------------------------------------------
|
|
@@ -19484,72 +19634,164 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19484
19634
|
}, {
|
|
19485
19635
|
key: "loadScene3DGlbTemplates",
|
|
19486
19636
|
value: function () {
|
|
19487
|
-
var _loadScene3DGlbTemplates = scene3DController_asyncToGenerator(/*#__PURE__*/scene3DController_regenerator().m(function
|
|
19488
|
-
var _this$threeMod2
|
|
19489
|
-
|
|
19490
|
-
|
|
19491
|
-
|
|
19637
|
+
var _loadScene3DGlbTemplates = scene3DController_asyncToGenerator(/*#__PURE__*/scene3DController_regenerator().m(function _callee4() {
|
|
19638
|
+
var _this$threeMod2,
|
|
19639
|
+
_this2 = this;
|
|
19640
|
+
var three, models, uniqueUrls, errorByUrl, semaphore, loadedBytesByUrl, totalBytesByUrl, settledAssets, totalAssets, reportProgress, _iterator2, _step2, asset, root, center, _t5;
|
|
19641
|
+
return scene3DController_regenerator().w(function (_context4) {
|
|
19642
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
19492
19643
|
case 0:
|
|
19493
19644
|
three = (_this$threeMod2 = this.threeMod) === null || _this$threeMod2 === void 0 ? void 0 : _this$threeMod2.THREE;
|
|
19494
19645
|
models = this.scene3DConfig.models;
|
|
19495
19646
|
if (!(!three || !models || models.enabled === false || models.assets.length === 0)) {
|
|
19496
|
-
|
|
19647
|
+
_context4.n = 1;
|
|
19497
19648
|
break;
|
|
19498
19649
|
}
|
|
19499
|
-
return
|
|
19650
|
+
return _context4.a(2);
|
|
19500
19651
|
case 1:
|
|
19501
19652
|
this.scene3DGlbRootByUrl.clear();
|
|
19502
19653
|
this.scene3DGlbTemplateById.clear();
|
|
19503
|
-
|
|
19504
|
-
|
|
19505
|
-
|
|
19506
|
-
|
|
19507
|
-
|
|
19508
|
-
|
|
19654
|
+
|
|
19655
|
+
// Load every distinct URL with bounded concurrency (see GLB_LOAD_CONCURRENCY) instead of one
|
|
19656
|
+
// at a time, and let each load time out (see loadGlbRoot) — a single hung or malformed/truncated
|
|
19657
|
+
// asset is skipped and logged instead of blocking every asset queued behind it. Deduplicating by
|
|
19658
|
+
// URL up front — not inside the concurrent task — means assets sharing a URL never trigger
|
|
19659
|
+
// duplicate loads and never tie up more than one concurrency slot waiting on the same result.
|
|
19660
|
+
uniqueUrls = scene3DController_toConsumableArray(new Set(models.assets.map(function (asset) {
|
|
19661
|
+
return asset.url;
|
|
19662
|
+
})));
|
|
19663
|
+
errorByUrl = new globalThis.Map();
|
|
19664
|
+
semaphore = new Semaphore(Scene3DController.GLB_LOAD_CONCURRENCY); // Progress bookkeeping for `onModelsProgress` (e.g. a totem's loading bar). Kept even when no
|
|
19665
|
+
// callback is registered — the cost is a handful of Map writes over at most a few dozen assets.
|
|
19666
|
+
loadedBytesByUrl = new globalThis.Map();
|
|
19667
|
+
totalBytesByUrl = new globalThis.Map();
|
|
19668
|
+
settledAssets = 0;
|
|
19669
|
+
totalAssets = uniqueUrls.length;
|
|
19670
|
+
reportProgress = function reportProgress(done) {
|
|
19671
|
+
if (!_this2.onModelsProgress) return;
|
|
19672
|
+
var loadedBytes = 0;
|
|
19673
|
+
var totalBytes = 0;
|
|
19674
|
+
var _iterator = scene3DController_createForOfIteratorHelper(uniqueUrls),
|
|
19675
|
+
_step;
|
|
19676
|
+
try {
|
|
19677
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
19678
|
+
var _loadedBytesByUrl$get;
|
|
19679
|
+
var url = _step.value;
|
|
19680
|
+
loadedBytes += (_loadedBytesByUrl$get = loadedBytesByUrl.get(url)) !== null && _loadedBytesByUrl$get !== void 0 ? _loadedBytesByUrl$get : 0;
|
|
19681
|
+
var total = totalBytesByUrl.get(url);
|
|
19682
|
+
totalBytes = total == null || totalBytes === null ? null : totalBytes + total;
|
|
19683
|
+
}
|
|
19684
|
+
} catch (err) {
|
|
19685
|
+
_iterator.e(err);
|
|
19686
|
+
} finally {
|
|
19687
|
+
_iterator.f();
|
|
19688
|
+
}
|
|
19689
|
+
try {
|
|
19690
|
+
_this2.onModelsProgress({
|
|
19691
|
+
loadedAssets: settledAssets,
|
|
19692
|
+
totalAssets: totalAssets,
|
|
19693
|
+
loadedBytes: loadedBytes,
|
|
19694
|
+
totalBytes: totalBytes,
|
|
19695
|
+
done: done
|
|
19696
|
+
});
|
|
19697
|
+
} catch (err) {
|
|
19698
|
+
// Isolate the SDK's own load bookkeeping from a throwing consumer callback — letting this
|
|
19699
|
+
// escape would reject the `Promise.all` below (or, from the `onProgress` path, break
|
|
19700
|
+
// three.js's internal stream-reading chain) and lose every already-loaded asset.
|
|
19701
|
+
console.error("onScene3DModelsProgress callback threw", err);
|
|
19702
|
+
}
|
|
19703
|
+
};
|
|
19704
|
+
_context4.n = 2;
|
|
19705
|
+
return Promise.all(uniqueUrls.map(/*#__PURE__*/function () {
|
|
19706
|
+
var _ref = scene3DController_asyncToGenerator(/*#__PURE__*/scene3DController_regenerator().m(function _callee3(url) {
|
|
19707
|
+
var _ref2, _totalBytesByUrl$get, _t2, _t3, _t4;
|
|
19708
|
+
return scene3DController_regenerator().w(function (_context3) {
|
|
19709
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
19710
|
+
case 0:
|
|
19711
|
+
_context3.n = 1;
|
|
19712
|
+
return semaphore.acquire();
|
|
19713
|
+
case 1:
|
|
19714
|
+
_context3.p = 1;
|
|
19715
|
+
_t2 = _this2.scene3DGlbRootByUrl;
|
|
19716
|
+
_t3 = url;
|
|
19717
|
+
_context3.n = 2;
|
|
19718
|
+
return loadGlbRoot(url, {
|
|
19719
|
+
onProgress: function onProgress(event) {
|
|
19720
|
+
loadedBytesByUrl.set(url, event.loaded);
|
|
19721
|
+
totalBytesByUrl.set(url, event.lengthComputable ? event.total : null);
|
|
19722
|
+
reportProgress(false);
|
|
19723
|
+
}
|
|
19724
|
+
});
|
|
19725
|
+
case 2:
|
|
19726
|
+
_t2.set.call(_t2, _t3, _context3.v);
|
|
19727
|
+
_context3.n = 4;
|
|
19728
|
+
break;
|
|
19729
|
+
case 3:
|
|
19730
|
+
_context3.p = 3;
|
|
19731
|
+
_t4 = _context3.v;
|
|
19732
|
+
errorByUrl.set(url, _t4);
|
|
19733
|
+
case 4:
|
|
19734
|
+
_context3.p = 4;
|
|
19735
|
+
settledAssets++;
|
|
19736
|
+
// Once a URL has settled, its total is knowable even if no progress event ever supplied
|
|
19737
|
+
// one (failed before the first byte, or the server omitted Content-Length): fall back to
|
|
19738
|
+
// however many bytes actually arrived. Otherwise a single such asset would force the
|
|
19739
|
+
// whole batch's `totalBytes` to stay `null` forever, even after `done: true`.
|
|
19740
|
+
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);
|
|
19741
|
+
semaphore.release();
|
|
19742
|
+
reportProgress(false);
|
|
19743
|
+
return _context3.f(4);
|
|
19744
|
+
case 5:
|
|
19745
|
+
return _context3.a(2);
|
|
19746
|
+
}
|
|
19747
|
+
}, _callee3, null, [[1, 3, 4, 5]]);
|
|
19748
|
+
}));
|
|
19749
|
+
return function (_x) {
|
|
19750
|
+
return _ref.apply(this, arguments);
|
|
19751
|
+
};
|
|
19752
|
+
}()));
|
|
19753
|
+
case 2:
|
|
19754
|
+
reportProgress(true);
|
|
19755
|
+
_iterator2 = scene3DController_createForOfIteratorHelper(models.assets);
|
|
19756
|
+
_context4.p = 3;
|
|
19757
|
+
_iterator2.s();
|
|
19758
|
+
case 4:
|
|
19759
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
19760
|
+
_context4.n = 7;
|
|
19509
19761
|
break;
|
|
19510
19762
|
}
|
|
19511
|
-
asset =
|
|
19512
|
-
_context3.p = 4;
|
|
19763
|
+
asset = _step2.value;
|
|
19513
19764
|
root = this.scene3DGlbRootByUrl.get(asset.url);
|
|
19514
19765
|
if (root) {
|
|
19515
|
-
|
|
19766
|
+
_context4.n = 5;
|
|
19516
19767
|
break;
|
|
19517
19768
|
}
|
|
19518
|
-
|
|
19519
|
-
return
|
|
19769
|
+
console.error("Failed to load GLB asset \"".concat(asset.id, "\" from ").concat(asset.url), errorByUrl.get(asset.url));
|
|
19770
|
+
return _context4.a(3, 6);
|
|
19520
19771
|
case 5:
|
|
19521
|
-
root = _context3.v;
|
|
19522
|
-
this.scene3DGlbRootByUrl.set(asset.url, root);
|
|
19523
|
-
case 6:
|
|
19524
19772
|
center = computeGlbBottomAnchor(three, root);
|
|
19525
19773
|
this.scene3DGlbTemplateById.set(asset.id, {
|
|
19526
19774
|
root: root,
|
|
19527
19775
|
center: center
|
|
19528
19776
|
});
|
|
19529
|
-
|
|
19777
|
+
case 6:
|
|
19778
|
+
_context4.n = 4;
|
|
19530
19779
|
break;
|
|
19531
19780
|
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;
|
|
19781
|
+
_context4.n = 9;
|
|
19537
19782
|
break;
|
|
19783
|
+
case 8:
|
|
19784
|
+
_context4.p = 8;
|
|
19785
|
+
_t5 = _context4.v;
|
|
19786
|
+
_iterator2.e(_t5);
|
|
19538
19787
|
case 9:
|
|
19539
|
-
|
|
19540
|
-
|
|
19788
|
+
_context4.p = 9;
|
|
19789
|
+
_iterator2.f();
|
|
19790
|
+
return _context4.f(9);
|
|
19541
19791
|
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);
|
|
19792
|
+
return _context4.a(2);
|
|
19551
19793
|
}
|
|
19552
|
-
},
|
|
19794
|
+
}, _callee4, this, [[3, 8, 9, 10]]);
|
|
19553
19795
|
}));
|
|
19554
19796
|
function loadScene3DGlbTemplates() {
|
|
19555
19797
|
return _loadScene3DGlbTemplates.apply(this, arguments);
|
|
@@ -19566,7 +19808,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19566
19808
|
_models$globalOffset2,
|
|
19567
19809
|
_models$globalOffset$3,
|
|
19568
19810
|
_models$globalOffset3,
|
|
19569
|
-
|
|
19811
|
+
_this3 = this;
|
|
19570
19812
|
var three = (_this$threeMod3 = this.threeMod) === null || _this$threeMod3 === void 0 ? void 0 : _this$threeMod3.THREE;
|
|
19571
19813
|
if (!three || !this.scene3DGlbScene) {
|
|
19572
19814
|
return;
|
|
@@ -19587,16 +19829,16 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19587
19829
|
var floorKey = this.currentFloor;
|
|
19588
19830
|
var modelsGroup = new three.Group();
|
|
19589
19831
|
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
|
-
|
|
19832
|
+
var _iterator3 = scene3DController_createForOfIteratorHelper(models.placements),
|
|
19833
|
+
_step3;
|
|
19592
19834
|
try {
|
|
19593
19835
|
var _loop = function _loop() {
|
|
19594
19836
|
var _placement$position$a;
|
|
19595
|
-
var placement =
|
|
19837
|
+
var placement = _step3.value;
|
|
19596
19838
|
if (!isPlacementVisibleOnFloor(placement, floorKey)) {
|
|
19597
19839
|
return 0; // continue
|
|
19598
19840
|
}
|
|
19599
|
-
var template =
|
|
19841
|
+
var template = _this3.scene3DGlbTemplateById.get(placement.assetId);
|
|
19600
19842
|
if (!template) {
|
|
19601
19843
|
return 0; // continue
|
|
19602
19844
|
}
|
|
@@ -19658,14 +19900,14 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19658
19900
|
modelsGroup.add(pivot);
|
|
19659
19901
|
},
|
|
19660
19902
|
_ret;
|
|
19661
|
-
for (
|
|
19903
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
19662
19904
|
_ret = _loop();
|
|
19663
19905
|
if (_ret === 0) continue;
|
|
19664
19906
|
}
|
|
19665
19907
|
} catch (err) {
|
|
19666
|
-
|
|
19908
|
+
_iterator3.e(err);
|
|
19667
19909
|
} finally {
|
|
19668
|
-
|
|
19910
|
+
_iterator3.f();
|
|
19669
19911
|
}
|
|
19670
19912
|
this.scene3DModelsGroup = modelsGroup;
|
|
19671
19913
|
this.scene3DGlbScene.add(modelsGroup);
|
|
@@ -19686,14 +19928,14 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19686
19928
|
key: "recomputeRouteAffectedModels",
|
|
19687
19929
|
value: function recomputeRouteAffectedModels() {
|
|
19688
19930
|
var _this$threeMod4,
|
|
19689
|
-
|
|
19931
|
+
_this4 = this;
|
|
19690
19932
|
var three = (_this$threeMod4 = this.threeMod) === null || _this$threeMod4 === void 0 ? void 0 : _this$threeMod4.THREE;
|
|
19691
19933
|
var modelsGroup = this.scene3DModelsGroup;
|
|
19692
19934
|
if (!three || !modelsGroup) {
|
|
19693
19935
|
return;
|
|
19694
19936
|
}
|
|
19695
19937
|
var points = this.scene3DRouteCollisionPoints.filter(function (p) {
|
|
19696
|
-
return p.floorKey ===
|
|
19938
|
+
return p.floorKey === _this4.currentFloor;
|
|
19697
19939
|
});
|
|
19698
19940
|
|
|
19699
19941
|
// Convert each route point into the models group's local frame (metres relative to
|
|
@@ -19710,11 +19952,11 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19710
19952
|
});
|
|
19711
19953
|
modelsGroup.updateMatrixWorld(true);
|
|
19712
19954
|
var local = new three.Vector3();
|
|
19713
|
-
var
|
|
19714
|
-
|
|
19955
|
+
var _iterator4 = scene3DController_createForOfIteratorHelper(modelsGroup.children),
|
|
19956
|
+
_step4;
|
|
19715
19957
|
try {
|
|
19716
19958
|
var _loop2 = function _loop2() {
|
|
19717
|
-
var pivot =
|
|
19959
|
+
var pivot = _step4.value;
|
|
19718
19960
|
var routeCfg = pivot.userData.routeTransparency;
|
|
19719
19961
|
var footprint = pivot.userData.footprint;
|
|
19720
19962
|
// Only models with a route-transparency config participate (feature activation gate).
|
|
@@ -19731,13 +19973,13 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19731
19973
|
return pointInFootprint(footprint, local.x, local.z);
|
|
19732
19974
|
});
|
|
19733
19975
|
};
|
|
19734
|
-
for (
|
|
19976
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
19735
19977
|
if (_loop2()) continue;
|
|
19736
19978
|
}
|
|
19737
19979
|
} catch (err) {
|
|
19738
|
-
|
|
19980
|
+
_iterator4.e(err);
|
|
19739
19981
|
} finally {
|
|
19740
|
-
|
|
19982
|
+
_iterator4.f();
|
|
19741
19983
|
}
|
|
19742
19984
|
}
|
|
19743
19985
|
|
|
@@ -19757,11 +19999,11 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19757
19999
|
}
|
|
19758
20000
|
var zoom = this.map.getZoom();
|
|
19759
20001
|
var changed = false;
|
|
19760
|
-
var
|
|
19761
|
-
|
|
20002
|
+
var _iterator5 = scene3DController_createForOfIteratorHelper(this.scene3DModelsGroup.children),
|
|
20003
|
+
_step5;
|
|
19762
20004
|
try {
|
|
19763
20005
|
var _loop3 = function _loop3() {
|
|
19764
|
-
var pivot =
|
|
20006
|
+
var pivot = _step5.value;
|
|
19765
20007
|
var zoomCfg = pivot.userData.zoomTransparency;
|
|
19766
20008
|
var routeCfg = pivot.userData.routeTransparency;
|
|
19767
20009
|
var routeAffected = pivot.userData.routeAffected === true;
|
|
@@ -19772,11 +20014,11 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19772
20014
|
return;
|
|
19773
20015
|
}
|
|
19774
20016
|
var materials = Array.isArray(mesh.material) ? mesh.material : [mesh.material];
|
|
19775
|
-
var
|
|
19776
|
-
|
|
20017
|
+
var _iterator6 = scene3DController_createForOfIteratorHelper(materials),
|
|
20018
|
+
_step6;
|
|
19777
20019
|
try {
|
|
19778
|
-
for (
|
|
19779
|
-
var material =
|
|
20020
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
20021
|
+
var material = _step6.value;
|
|
19780
20022
|
if (material.opacity !== opacity) {
|
|
19781
20023
|
material.transparent = opacity < 1;
|
|
19782
20024
|
material.opacity = opacity;
|
|
@@ -19786,19 +20028,19 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19786
20028
|
}
|
|
19787
20029
|
}
|
|
19788
20030
|
} catch (err) {
|
|
19789
|
-
|
|
20031
|
+
_iterator6.e(err);
|
|
19790
20032
|
} finally {
|
|
19791
|
-
|
|
20033
|
+
_iterator6.f();
|
|
19792
20034
|
}
|
|
19793
20035
|
});
|
|
19794
20036
|
};
|
|
19795
|
-
for (
|
|
20037
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
19796
20038
|
_loop3();
|
|
19797
20039
|
}
|
|
19798
20040
|
} catch (err) {
|
|
19799
|
-
|
|
20041
|
+
_iterator5.e(err);
|
|
19800
20042
|
} finally {
|
|
19801
|
-
|
|
20043
|
+
_iterator5.f();
|
|
19802
20044
|
}
|
|
19803
20045
|
if (changed) {
|
|
19804
20046
|
this.map.triggerRepaint();
|
|
@@ -19807,12 +20049,12 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19807
20049
|
}, {
|
|
19808
20050
|
key: "loadSpriteAtlas",
|
|
19809
20051
|
value: function () {
|
|
19810
|
-
var _loadSpriteAtlas = scene3DController_asyncToGenerator(/*#__PURE__*/scene3DController_regenerator().m(function
|
|
20052
|
+
var _loadSpriteAtlas = scene3DController_asyncToGenerator(/*#__PURE__*/scene3DController_regenerator().m(function _callee5(spriteUrl) {
|
|
19811
20053
|
var _yield$Promise$all, _yield$Promise$all2, json, img;
|
|
19812
|
-
return scene3DController_regenerator().w(function (
|
|
19813
|
-
while (1) switch (
|
|
20054
|
+
return scene3DController_regenerator().w(function (_context5) {
|
|
20055
|
+
while (1) switch (_context5.n) {
|
|
19814
20056
|
case 0:
|
|
19815
|
-
|
|
20057
|
+
_context5.n = 1;
|
|
19816
20058
|
return Promise.all([fetch("".concat(spriteUrl, ".json")).then(function (r) {
|
|
19817
20059
|
return r.json();
|
|
19818
20060
|
}), new Promise(function (resolve, reject) {
|
|
@@ -19825,18 +20067,18 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19825
20067
|
image.src = "".concat(spriteUrl, ".png");
|
|
19826
20068
|
})]);
|
|
19827
20069
|
case 1:
|
|
19828
|
-
_yield$Promise$all =
|
|
20070
|
+
_yield$Promise$all = _context5.v;
|
|
19829
20071
|
_yield$Promise$all2 = scene3DController_slicedToArray(_yield$Promise$all, 2);
|
|
19830
20072
|
json = _yield$Promise$all2[0];
|
|
19831
20073
|
img = _yield$Promise$all2[1];
|
|
19832
20074
|
this.spriteIconMapping = json;
|
|
19833
20075
|
this.spriteAtlasImage = img;
|
|
19834
20076
|
case 2:
|
|
19835
|
-
return
|
|
20077
|
+
return _context5.a(2);
|
|
19836
20078
|
}
|
|
19837
|
-
},
|
|
20079
|
+
}, _callee5, this);
|
|
19838
20080
|
}));
|
|
19839
|
-
function loadSpriteAtlas(
|
|
20081
|
+
function loadSpriteAtlas(_x2) {
|
|
19840
20082
|
return _loadSpriteAtlas.apply(this, arguments);
|
|
19841
20083
|
}
|
|
19842
20084
|
return loadSpriteAtlas;
|
|
@@ -19880,7 +20122,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19880
20122
|
var _layerConfig$binaryDa2,
|
|
19881
20123
|
_layerConfig$minZoom,
|
|
19882
20124
|
_layerConfig$maxZoom,
|
|
19883
|
-
|
|
20125
|
+
_this5 = this;
|
|
19884
20126
|
var useSdf = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
19885
20127
|
var deck = this.deckMod;
|
|
19886
20128
|
if (!deck) return null;
|
|
@@ -19895,7 +20137,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19895
20137
|
// Use area_name and poi Point features — unique per tile, no duplicates.
|
|
19896
20138
|
// If a logo-{name} image exists in the sprite, the icon takes priority over the text label.
|
|
19897
20139
|
var textData = buildLabelData(props.data || [], floorKey, function (imageId) {
|
|
19898
|
-
return
|
|
20140
|
+
return _this5.map.hasImage(imageId);
|
|
19899
20141
|
}, (_layerConfig$defaultH2 = layerConfig.defaultHeight) !== null && _layerConfig$defaultH2 !== void 0 ? _layerConfig$defaultH2 : 5);
|
|
19900
20142
|
if (!textData.length) return null;
|
|
19901
20143
|
return new deck.TextLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, props), {}, {
|
|
@@ -19934,7 +20176,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19934
20176
|
var _layerConfig$binaryDa3,
|
|
19935
20177
|
_layerConfig$minZoom2,
|
|
19936
20178
|
_layerConfig$maxZoom2,
|
|
19937
|
-
|
|
20179
|
+
_this6 = this;
|
|
19938
20180
|
var deck = this.deckMod;
|
|
19939
20181
|
if (!deck || !this.spriteIconMapping || !this.spriteAtlasImage) return null;
|
|
19940
20182
|
return new deck.MVTLayer({
|
|
@@ -19950,8 +20192,8 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19950
20192
|
return new deck.IconLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, props), {}, {
|
|
19951
20193
|
id: "".concat(props.id, "-poi-icons"),
|
|
19952
20194
|
data: iconData,
|
|
19953
|
-
iconAtlas:
|
|
19954
|
-
iconMapping:
|
|
20195
|
+
iconAtlas: _this6.spriteAtlasImage,
|
|
20196
|
+
iconMapping: _this6.spriteIconMapping,
|
|
19955
20197
|
getIcon: function getIcon(d) {
|
|
19956
20198
|
return d.icon;
|
|
19957
20199
|
},
|
|
@@ -19976,7 +20218,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19976
20218
|
var _layerConfig$binaryDa4,
|
|
19977
20219
|
_layerConfig$minZoom3,
|
|
19978
20220
|
_layerConfig$maxZoom3,
|
|
19979
|
-
|
|
20221
|
+
_this7 = this;
|
|
19980
20222
|
var deck = this.deckMod;
|
|
19981
20223
|
if (!deck || !this.spriteIconMapping || !this.spriteAtlasImage) return null;
|
|
19982
20224
|
return new deck.MVTLayer({
|
|
@@ -19987,13 +20229,13 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
19987
20229
|
maxZoom: (_layerConfig$maxZoom3 = layerConfig.maxZoom) !== null && _layerConfig$maxZoom3 !== void 0 ? _layerConfig$maxZoom3 : 24,
|
|
19988
20230
|
renderSubLayers: function renderSubLayers(props) {
|
|
19989
20231
|
var _layerConfig$defaultH4, _layerConfig$sizeUnit2, _layerConfig$sizeScal2, _layerConfig$billboar2;
|
|
19990
|
-
var logoData = buildStoreLogoData(props.data || [], floorKey,
|
|
20232
|
+
var logoData = buildStoreLogoData(props.data || [], floorKey, _this7.spriteIconMapping, (_layerConfig$defaultH4 = layerConfig.defaultHeight) !== null && _layerConfig$defaultH4 !== void 0 ? _layerConfig$defaultH4 : 5);
|
|
19991
20233
|
if (!logoData.length) return null;
|
|
19992
20234
|
return new deck.IconLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, props), {}, {
|
|
19993
20235
|
id: "".concat(props.id, "-store-logos"),
|
|
19994
20236
|
data: logoData,
|
|
19995
|
-
iconAtlas:
|
|
19996
|
-
iconMapping:
|
|
20237
|
+
iconAtlas: _this7.spriteAtlasImage,
|
|
20238
|
+
iconMapping: _this7.spriteIconMapping,
|
|
19997
20239
|
getIcon: function getIcon(d) {
|
|
19998
20240
|
return d.icon;
|
|
19999
20241
|
},
|
|
@@ -20005,7 +20247,7 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
20005
20247
|
},
|
|
20006
20248
|
getSize: function getSize(d) {
|
|
20007
20249
|
var _layerConfig$logoScal;
|
|
20008
|
-
return computeStoreLogoSize(
|
|
20250
|
+
return computeStoreLogoSize(_this7.spriteIconMapping, d.icon, (_layerConfig$logoScal = layerConfig.logoScale) !== null && _layerConfig$logoScal !== void 0 ? _layerConfig$logoScal : {});
|
|
20009
20251
|
},
|
|
20010
20252
|
sizeUnits: (_layerConfig$sizeUnit2 = layerConfig.sizeUnits) !== null && _layerConfig$sizeUnit2 !== void 0 ? _layerConfig$sizeUnit2 : "meters",
|
|
20011
20253
|
sizeScale: (_layerConfig$sizeScal2 = layerConfig.sizeScale) !== null && _layerConfig$sizeScal2 !== void 0 ? _layerConfig$sizeScal2 : 1,
|
|
@@ -20050,23 +20292,30 @@ var Scene3DController = /*#__PURE__*/function () {
|
|
|
20050
20292
|
key: "hideLayers",
|
|
20051
20293
|
value: function hideLayers(layersIds) {
|
|
20052
20294
|
if (!layersIds) return;
|
|
20053
|
-
var
|
|
20054
|
-
|
|
20295
|
+
var _iterator7 = scene3DController_createForOfIteratorHelper(layersIds),
|
|
20296
|
+
_step7;
|
|
20055
20297
|
try {
|
|
20056
|
-
for (
|
|
20057
|
-
var layerId =
|
|
20298
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
20299
|
+
var layerId = _step7.value;
|
|
20058
20300
|
var layer = this.map.getLayer(layerId);
|
|
20059
20301
|
if (!layer) continue;
|
|
20060
20302
|
this.map.setLayoutProperty(layer.id, "visibility", "none");
|
|
20061
20303
|
}
|
|
20062
20304
|
} catch (err) {
|
|
20063
|
-
|
|
20305
|
+
_iterator7.e(err);
|
|
20064
20306
|
} finally {
|
|
20065
|
-
|
|
20307
|
+
_iterator7.f();
|
|
20066
20308
|
}
|
|
20067
20309
|
}
|
|
20068
20310
|
}]);
|
|
20069
20311
|
}();
|
|
20312
|
+
/**
|
|
20313
|
+
* Bounded concurrency for loading declarative GLB assets in {@link loadScene3DGlbTemplates}.
|
|
20314
|
+
* High enough that one slow/broken asset (see {@link loadGlbRoot}'s timeout) does not stall the
|
|
20315
|
+
* rest of the batch, low enough to avoid saturating the browser with concurrent Draco/KTX2
|
|
20316
|
+
* decodes when a scene declares many assets.
|
|
20317
|
+
*/
|
|
20318
|
+
scene3DController_defineProperty(Scene3DController, "GLB_LOAD_CONCURRENCY", 4);
|
|
20070
20319
|
;// ./src/map/fitCamera.ts
|
|
20071
20320
|
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
20321
|
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 +21001,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
20752
21001
|
// Create the 3D controller only when the map opts into 3D. All heavy WebGL / deck.gl work is
|
|
20753
21002
|
// owned by it; in 2D mode `this.scene3D` stays undefined and every hook below is a no-op.
|
|
20754
21003
|
if (this.is3DSceneActive() && this.scene3DConfig) {
|
|
20755
|
-
this.scene3D = new Scene3DController(this.map, this.scene3DConfig, this.initialCenter);
|
|
21004
|
+
this.scene3D = new Scene3DController(this.map, this.scene3DConfig, this.initialCenter, mapConfig.onScene3DModelsProgress);
|
|
20756
21005
|
}
|
|
20757
21006
|
// When rotation is disabled we still want pinch-to-zoom to work, so the
|
|
20758
21007
|
// two-finger rotation is turned off here instead of via the constructor.
|