maplibre-gl-layers 0.16.0 → 0.17.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/README.md +2 -2
- package/dist/SpriteLayer.d.ts +3 -3
- package/dist/config.d.ts +2 -2
- package/dist/const.d.ts +26 -2
- package/dist/default.d.ts +2 -2
- package/dist/gl/atlas.d.ts +2 -2
- package/dist/gl/hitTest.d.ts +2 -2
- package/dist/gl/shader.d.ts +3 -4
- package/dist/gl/text.d.ts +2 -2
- package/dist/host/calculationHost.d.ts +2 -2
- package/dist/host/mapLibreProjectionHost.d.ts +2 -2
- package/dist/host/projectionHost.d.ts +2 -2
- package/dist/host/runtime.d.ts +2 -2
- package/dist/host/wasmCalculationHost.d.ts +2 -2
- package/dist/host/wasmHost.d.ts +3 -3
- package/dist/host/wasmProjectionHost.d.ts +2 -2
- package/dist/index.cjs +604 -499
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +604 -499
- package/dist/index.mjs.map +1 -1
- package/dist/internalTypes.d.ts +56 -83
- package/dist/interpolation/degreeInterpolation.d.ts +18 -19
- package/dist/interpolation/distanceInterpolation.d.ts +6 -7
- package/dist/interpolation/easing.d.ts +9 -7
- package/dist/interpolation/interpolation.d.ts +10 -12
- package/dist/interpolation/interpolationChannels.d.ts +4 -3
- package/dist/interpolation/rotationInterpolation.d.ts +10 -10
- package/dist/types.d.ts +137 -137
- package/dist/utils/color.d.ts +3 -8
- package/dist/utils/image.d.ts +2 -2
- package/dist/utils/looseQuadTree.d.ts +2 -2
- package/dist/utils/math.d.ts +68 -75
- package/dist/utils/utils.d.ts +2 -2
- package/dist/wasm/config.json.d.ts +2 -2
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -4,14 +4,13 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
/*!
|
|
6
6
|
* name: maplibre-gl-layers
|
|
7
|
-
* version: 0.
|
|
7
|
+
* version: 0.17.0
|
|
8
8
|
* description: MapLibre's layer extension library enabling the display, movement, and modification of large numbers of dynamic sprite images
|
|
9
9
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
10
10
|
* license: MIT
|
|
11
11
|
* repository.url: https://github.com/kekyo/maplibre-gl-layers.git
|
|
12
|
-
* git.commit.hash:
|
|
12
|
+
* git.commit.hash: 9fe9aa30db6602d13643e32c94af39ae2b26b082
|
|
13
13
|
*/
|
|
14
|
-
var _a;
|
|
15
14
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
16
15
|
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
17
16
|
const UNLIMITED_SPRITE_SCALING_OPTIONS = {
|
|
@@ -124,7 +123,7 @@ const parseSvgSize = (svgText) => {
|
|
|
124
123
|
}
|
|
125
124
|
};
|
|
126
125
|
const determineSvgRasterDimensions = (parsed, options) => {
|
|
127
|
-
var
|
|
126
|
+
var _a, _b;
|
|
128
127
|
const overrideWidth = options == null ? void 0 : options.width;
|
|
129
128
|
const overrideHeight = options == null ? void 0 : options.height;
|
|
130
129
|
if (overrideWidth !== void 0 && overrideHeight !== void 0 && overrideWidth > 0 && overrideHeight > 0) {
|
|
@@ -151,7 +150,7 @@ const determineSvgRasterDimensions = (parsed, options) => {
|
|
|
151
150
|
} else if (intrinsicHeight !== void 0 && intrinsicHeight > 0 && aspect !== void 0) {
|
|
152
151
|
baseHeight = intrinsicHeight;
|
|
153
152
|
baseWidth = intrinsicHeight * aspect;
|
|
154
|
-
} else if (hasValidViewBox && ((
|
|
153
|
+
} else if (hasValidViewBox && ((_a = options == null ? void 0 : options.svg) == null ? void 0 : _a.useViewBoxDimensions)) {
|
|
155
154
|
baseWidth = parsed.viewBoxWidth;
|
|
156
155
|
baseHeight = parsed.viewBoxHeight;
|
|
157
156
|
aspect = baseWidth / baseHeight;
|
|
@@ -298,14 +297,14 @@ const readImageBitmap = (blob, options) => {
|
|
|
298
297
|
return internalReadImageBitmap(blob, shouldTreatAsSvg, options);
|
|
299
298
|
};
|
|
300
299
|
const loadImageBitmap = async (url, options) => {
|
|
301
|
-
var
|
|
300
|
+
var _a;
|
|
302
301
|
const response = await fetch(url);
|
|
303
302
|
if (!response.ok) {
|
|
304
303
|
throw new Error(`Failed to fetch image from ${url}`);
|
|
305
304
|
}
|
|
306
305
|
const mimeType = response.headers.get("content-type");
|
|
307
306
|
const blob = await response.blob();
|
|
308
|
-
const shouldTreatAsSvg = ((
|
|
307
|
+
const shouldTreatAsSvg = ((_a = options == null ? void 0 : options.svg) == null ? void 0 : _a.assumeSvg) === true || isSvgMimeType(mimeType);
|
|
309
308
|
return await internalReadImageBitmap(blob, shouldTreatAsSvg, options);
|
|
310
309
|
};
|
|
311
310
|
/*!
|
|
@@ -400,12 +399,12 @@ const createMutex = (maxConsecutiveCalls = 20) => {
|
|
|
400
399
|
const queue = [];
|
|
401
400
|
let count = 0;
|
|
402
401
|
const processQueue = () => {
|
|
403
|
-
var
|
|
402
|
+
var _a;
|
|
404
403
|
if (isLocked || queue.length === 0) {
|
|
405
404
|
return;
|
|
406
405
|
}
|
|
407
406
|
const item = queue.shift();
|
|
408
|
-
if ((
|
|
407
|
+
if ((_a = item.signal) == null ? void 0 : _a.aborted) {
|
|
409
408
|
item.reject(ABORTED_ERROR$2());
|
|
410
409
|
scheduleNextProcess();
|
|
411
410
|
return;
|
|
@@ -591,9 +590,9 @@ const resolveBaseUrl = (base) => {
|
|
|
591
590
|
};
|
|
592
591
|
let wasmBaseUrlOverride;
|
|
593
592
|
const isNodeEnvironment = (() => {
|
|
594
|
-
var
|
|
593
|
+
var _a;
|
|
595
594
|
const globalProcess = globalThis.process;
|
|
596
|
-
return !!((
|
|
595
|
+
return !!((_a = globalProcess == null ? void 0 : globalProcess.versions) == null ? void 0 : _a.node);
|
|
597
596
|
})();
|
|
598
597
|
const canUseThreadedWasm = () => {
|
|
599
598
|
if (isNodeEnvironment) {
|
|
@@ -665,7 +664,7 @@ const resolveThreadPoolLimit = () => {
|
|
|
665
664
|
return hardware;
|
|
666
665
|
};
|
|
667
666
|
const instantiateThreadedProjectionWasm = async () => {
|
|
668
|
-
var
|
|
667
|
+
var _a, _b;
|
|
669
668
|
const scriptUrl = resolveVariantAssetUrl("simd-mt", "js");
|
|
670
669
|
const wasmUrl = resolveVariantAssetUrl("simd-mt", "wasm");
|
|
671
670
|
const workerUrl = resolveVariantAssetUrl("simd-mt", "worker");
|
|
@@ -673,7 +672,7 @@ const instantiateThreadedProjectionWasm = async () => {
|
|
|
673
672
|
/* @vite-ignore */
|
|
674
673
|
scriptUrl.href
|
|
675
674
|
);
|
|
676
|
-
const createModule = (_b = (
|
|
675
|
+
const createModule = (_b = (_a = moduleFactory == null ? void 0 : moduleFactory.default) != null ? _a : moduleFactory == null ? void 0 : moduleFactory.Module) != null ? _b : moduleFactory;
|
|
677
676
|
if (typeof createModule !== "function") {
|
|
678
677
|
throw new Error("maplibre-gl-layers: simd-mt module is unavailable.");
|
|
679
678
|
}
|
|
@@ -709,11 +708,11 @@ const instantiateProjectionWasm = async (variant) => {
|
|
|
709
708
|
return createWasmHostFromExports(exports2);
|
|
710
709
|
};
|
|
711
710
|
const createWasmHostFromExports = (exports2) => {
|
|
712
|
-
var
|
|
711
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
713
712
|
if (typeof exports2.__wasm_call_ctors === "function") {
|
|
714
713
|
exports2.__wasm_call_ctors();
|
|
715
714
|
}
|
|
716
|
-
const memory = (
|
|
715
|
+
const memory = (_a = exports2.memory) != null ? _a : exports2.wasmMemory;
|
|
717
716
|
if (!memory) {
|
|
718
717
|
throw new Error("maplibre-gl-layers: wasm memory is unavailable.");
|
|
719
718
|
}
|
|
@@ -944,14 +943,14 @@ const createWasmHostFromExports = (exports2) => {
|
|
|
944
943
|
};
|
|
945
944
|
};
|
|
946
945
|
const initializeWasmHostInternal = async (preferredVariant) => {
|
|
947
|
-
var
|
|
946
|
+
var _a;
|
|
948
947
|
if (preferredVariant === "disabled") {
|
|
949
948
|
console.log(
|
|
950
949
|
"maplibre-gl-layers: Wasm execution disabled by configuration."
|
|
951
950
|
);
|
|
952
951
|
return ["disabled", void 0];
|
|
953
952
|
}
|
|
954
|
-
const variantsToTry = (
|
|
953
|
+
const variantsToTry = (_a = VARIANT_FALLBACKS[preferredVariant]) != null ? _a : ["nosimd"];
|
|
955
954
|
for (const variant of variantsToTry) {
|
|
956
955
|
if (variant === "simd-mt" && !canUseThreadedWasm()) {
|
|
957
956
|
if (!threadedVariantWarningPrinted) {
|
|
@@ -982,7 +981,7 @@ const initializeWasmHostInternal = async (preferredVariant) => {
|
|
|
982
981
|
};
|
|
983
982
|
let currentVariant = "disabled";
|
|
984
983
|
let currentWasmHost;
|
|
985
|
-
const initializeWasmHost = async (preferredVariant
|
|
984
|
+
const initializeWasmHost = async (preferredVariant, options) => {
|
|
986
985
|
let nextBaseUrl = wasmBaseUrlOverride;
|
|
987
986
|
if ((options == null ? void 0 : options.wasmBaseUrl) !== void 0) {
|
|
988
987
|
nextBaseUrl = options.wasmBaseUrl === "" ? void 0 : options.wasmBaseUrl;
|
|
@@ -1036,7 +1035,7 @@ const reportWasmRuntimeFailure = (reason) => {
|
|
|
1036
1035
|
releaseRuntimeHost();
|
|
1037
1036
|
};
|
|
1038
1037
|
const initializeRuntimeHost = async (options) => {
|
|
1039
|
-
var
|
|
1038
|
+
var _a;
|
|
1040
1039
|
const locker = await spriteLayerHostInitializationMutex.lock();
|
|
1041
1040
|
try {
|
|
1042
1041
|
if (wasmHostFatalError !== null) {
|
|
@@ -1045,7 +1044,7 @@ const initializeRuntimeHost = async (options) => {
|
|
|
1045
1044
|
);
|
|
1046
1045
|
return "disabled";
|
|
1047
1046
|
}
|
|
1048
|
-
const requestedVariant = (
|
|
1047
|
+
const requestedVariant = (_a = options == null ? void 0 : options.variant) != null ? _a : "simd";
|
|
1049
1048
|
if (requestedVariant === "disabled") {
|
|
1050
1049
|
releaseRuntimeHost();
|
|
1051
1050
|
return "disabled";
|
|
@@ -5418,7 +5417,7 @@ Use an identity property function instead: \`{ "type": "identity", "property": $
|
|
|
5418
5417
|
}
|
|
5419
5418
|
}
|
|
5420
5419
|
wa.prototype.bytesPerElement = 8, ls("StructArrayLayout1ul2ui8", wa);
|
|
5421
|
-
class
|
|
5420
|
+
class _a extends Ws {
|
|
5422
5421
|
_refreshViews() {
|
|
5423
5422
|
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
|
|
5424
5423
|
}
|
|
@@ -5431,7 +5430,7 @@ Use an identity property function instead: \`{ "type": "identity", "property": $
|
|
|
5431
5430
|
return this.uint16[n2 + 0] = e2, this.uint16[n2 + 1] = r2, t2;
|
|
5432
5431
|
}
|
|
5433
5432
|
}
|
|
5434
|
-
|
|
5433
|
+
_a.prototype.bytesPerElement = 4, ls("StructArrayLayout2ui4", _a);
|
|
5435
5434
|
class Sa extends Ws {
|
|
5436
5435
|
_refreshViews() {
|
|
5437
5436
|
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
|
|
@@ -5745,7 +5744,7 @@ Use an identity property function instead: \`{ "type": "identity", "property": $
|
|
|
5745
5744
|
}
|
|
5746
5745
|
class Ka extends ma {
|
|
5747
5746
|
}
|
|
5748
|
-
class Ja extends
|
|
5747
|
+
class Ja extends _a {
|
|
5749
5748
|
}
|
|
5750
5749
|
const Wa = Qs([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: Qa } = Wa;
|
|
5751
5750
|
class to {
|
|
@@ -10773,8 +10772,8 @@ Use an identity property function instead: \`{ "type": "identity", "property": $
|
|
|
10773
10772
|
void 0 !== i2.id && t2.writeVarintField(1, i2.id), t2.writeMessage(2, p, e2), t2.writeVarintField(3, i2.type), t2.writeMessage(4, v, i2);
|
|
10774
10773
|
}
|
|
10775
10774
|
function p(e2, t2) {
|
|
10776
|
-
var
|
|
10777
|
-
for (const i2 in (
|
|
10775
|
+
var _a;
|
|
10776
|
+
for (const i2 in (_a = e2.feature) == null ? void 0 : _a.properties) {
|
|
10778
10777
|
let o2 = e2.feature.properties[i2], s2 = e2.keycache[i2];
|
|
10779
10778
|
if (null === o2) continue;
|
|
10780
10779
|
void 0 === s2 && (e2.keys.push(i2), s2 = e2.keys.length - 1, e2.keycache[i2] = s2), t2.writeVarint(s2), "string" != typeof o2 && "boolean" != typeof o2 && "number" != typeof o2 && (o2 = JSON.stringify(o2));
|
|
@@ -18372,7 +18371,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
18372
18371
|
function da(e2, i2) {
|
|
18373
18372
|
return i2.colorRampTexture || (i2.colorRampTexture = new t.T(e2, i2.colorRamp, e2.gl.RGBA)), i2.colorRampTexture;
|
|
18374
18373
|
}
|
|
18375
|
-
function
|
|
18374
|
+
function _a(e2, i2, o2, a2, r2, s2, n2, l2) {
|
|
18376
18375
|
let c2 = 256;
|
|
18377
18376
|
if (r2.stepInterpolant) {
|
|
18378
18377
|
const a3 = i2.getSource().maxzoom, r3 = n2.canonical.z === a3 ? Math.ceil(1 << e2.transform.maxZoom - n2.canonical.z) : 1;
|
|
@@ -18389,12 +18388,12 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
18389
18388
|
function fa(e2, t2, i2, o2, a2, r2, s2) {
|
|
18390
18389
|
const n2 = r2.gradients[a2.id];
|
|
18391
18390
|
let l2 = n2.texture;
|
|
18392
|
-
a2.gradientVersion !== n2.version && (l2 =
|
|
18391
|
+
a2.gradientVersion !== n2.version && (l2 = _a(e2, t2, i2, o2, a2, r2, s2, n2)), i2.activeTexture.set(o2.TEXTURE0), l2.bind(a2.stepInterpolant ? o2.NEAREST : o2.LINEAR, o2.CLAMP_TO_EDGE);
|
|
18393
18392
|
}
|
|
18394
18393
|
function ga(e2, t2, i2, o2, a2, r2, s2, n2, l2) {
|
|
18395
18394
|
const c2 = r2.gradients[a2.id];
|
|
18396
18395
|
let h2 = c2.texture;
|
|
18397
|
-
a2.gradientVersion !== c2.version && (h2 =
|
|
18396
|
+
a2.gradientVersion !== c2.version && (h2 = _a(e2, t2, i2, o2, a2, r2, s2, c2)), i2.activeTexture.set(o2.TEXTURE0), h2.bind(a2.stepInterpolant ? o2.NEAREST : o2.LINEAR, o2.CLAMP_TO_EDGE), i2.activeTexture.set(o2.TEXTURE1), e2.lineAtlas.bind(i2), n2.updatePaintBuffers(l2);
|
|
18398
18397
|
}
|
|
18399
18398
|
function va(e2, t2, i2, o2, a2) {
|
|
18400
18399
|
if (!i2 || !o2 || !o2.imageAtlas) return;
|
|
@@ -22134,17 +22133,17 @@ const clampProgress = (progress) => {
|
|
|
22134
22133
|
return progress;
|
|
22135
22134
|
};
|
|
22136
22135
|
const linearEasing = (progress) => clampProgress(progress);
|
|
22137
|
-
const normalizePower = (power,
|
|
22136
|
+
const normalizePower = (power, fallback2) => {
|
|
22138
22137
|
if (Number.isFinite(power) && power > 0) {
|
|
22139
22138
|
return power;
|
|
22140
22139
|
}
|
|
22141
|
-
return
|
|
22140
|
+
return fallback2;
|
|
22142
22141
|
};
|
|
22143
|
-
const normalizeMode = (mode,
|
|
22142
|
+
const normalizeMode = (mode, fallback2) => {
|
|
22144
22143
|
if (mode === "in" || mode === "out" || mode === "in-out") {
|
|
22145
22144
|
return mode;
|
|
22146
22145
|
}
|
|
22147
|
-
return
|
|
22146
|
+
return fallback2;
|
|
22148
22147
|
};
|
|
22149
22148
|
const toBounded = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
22150
22149
|
const createPowerEasing = (power, mode) => {
|
|
@@ -22245,65 +22244,65 @@ const createBackEasing = (overshoot) => {
|
|
|
22245
22244
|
return 1 + c3 * p * p * p + c1 * p * p;
|
|
22246
22245
|
};
|
|
22247
22246
|
};
|
|
22247
|
+
const fallback = {
|
|
22248
|
+
func: linearEasing,
|
|
22249
|
+
param: { type: "linear" }
|
|
22250
|
+
};
|
|
22248
22251
|
const resolveEasing = (easing) => {
|
|
22249
|
-
const fallback = {
|
|
22250
|
-
easing: linearEasing,
|
|
22251
|
-
preset: { type: "linear" }
|
|
22252
|
-
};
|
|
22253
22252
|
if (!easing) {
|
|
22254
22253
|
return fallback;
|
|
22255
22254
|
}
|
|
22256
22255
|
switch (easing.type) {
|
|
22257
22256
|
case "linear": {
|
|
22258
|
-
const
|
|
22259
|
-
return {
|
|
22257
|
+
const param = { type: "linear" };
|
|
22258
|
+
return { func: linearEasing, param };
|
|
22260
22259
|
}
|
|
22261
22260
|
case "ease": {
|
|
22262
22261
|
const power = normalizePower(easing.power, 3);
|
|
22263
22262
|
const mode = normalizeMode(easing.mode, "in-out");
|
|
22264
|
-
const
|
|
22265
|
-
return {
|
|
22263
|
+
const param = { type: "ease", power, mode };
|
|
22264
|
+
return { func: createPowerEasing(power, mode), param };
|
|
22266
22265
|
}
|
|
22267
22266
|
case "exponential": {
|
|
22268
22267
|
const exponent = normalizePower(easing.exponent, 5);
|
|
22269
22268
|
const mode = normalizeMode(easing.mode, "in-out");
|
|
22270
|
-
const
|
|
22269
|
+
const param = {
|
|
22271
22270
|
type: "exponential",
|
|
22272
22271
|
exponent,
|
|
22273
22272
|
mode
|
|
22274
22273
|
};
|
|
22275
|
-
return {
|
|
22274
|
+
return { func: createExponentialEasing(exponent, mode), param };
|
|
22276
22275
|
}
|
|
22277
22276
|
case "quadratic": {
|
|
22278
22277
|
const mode = normalizeMode(easing.mode, "in-out");
|
|
22279
|
-
const
|
|
22280
|
-
return {
|
|
22278
|
+
const param = { type: "quadratic", mode };
|
|
22279
|
+
return { func: createPowerEasing(2, mode), param };
|
|
22281
22280
|
}
|
|
22282
22281
|
case "cubic": {
|
|
22283
22282
|
const mode = normalizeMode(easing.mode, "in-out");
|
|
22284
|
-
const
|
|
22285
|
-
return {
|
|
22283
|
+
const param = { type: "cubic", mode };
|
|
22284
|
+
return { func: createPowerEasing(3, mode), param };
|
|
22286
22285
|
}
|
|
22287
22286
|
case "sine": {
|
|
22288
22287
|
const mode = normalizeMode(easing.mode, "in-out");
|
|
22289
22288
|
const amplitude = Number.isFinite(easing.amplitude) && easing.amplitude > 0 ? easing.amplitude : 1;
|
|
22290
|
-
const
|
|
22291
|
-
return {
|
|
22289
|
+
const param = { type: "sine", mode, amplitude };
|
|
22290
|
+
return { func: createSineEasing(mode, amplitude), param };
|
|
22292
22291
|
}
|
|
22293
22292
|
case "bounce": {
|
|
22294
22293
|
const bounces = Number.isFinite(easing.bounces) && easing.bounces > 0 ? easing.bounces : 3;
|
|
22295
22294
|
const decay = Number.isFinite(easing.decay) && easing.decay > 0 ? easing.decay : 0.5;
|
|
22296
|
-
const
|
|
22295
|
+
const param = {
|
|
22297
22296
|
type: "bounce",
|
|
22298
22297
|
bounces,
|
|
22299
22298
|
decay
|
|
22300
22299
|
};
|
|
22301
|
-
return {
|
|
22300
|
+
return { func: createBounceEasing(bounces, decay), param };
|
|
22302
22301
|
}
|
|
22303
22302
|
case "back": {
|
|
22304
22303
|
const overshoot = Number.isFinite(easing.overshoot) && easing.overshoot !== void 0 ? easing.overshoot : 1.70158;
|
|
22305
|
-
const
|
|
22306
|
-
return {
|
|
22304
|
+
const param = { type: "back", overshoot };
|
|
22305
|
+
return { func: createBackEasing(overshoot), param };
|
|
22307
22306
|
}
|
|
22308
22307
|
default:
|
|
22309
22308
|
return fallback;
|
|
@@ -22351,6 +22350,28 @@ const UV_CORNERS = [
|
|
|
22351
22350
|
[0, 1],
|
|
22352
22351
|
[1, 1]
|
|
22353
22352
|
];
|
|
22353
|
+
const __CSS_KEYWORD_COLORS = {
|
|
22354
|
+
black: [0, 0, 0, 1],
|
|
22355
|
+
silver: [192, 192, 192, 1],
|
|
22356
|
+
gray: [128, 128, 128, 1],
|
|
22357
|
+
white: [255, 255, 255, 1],
|
|
22358
|
+
maroon: [128, 0, 0, 1],
|
|
22359
|
+
red: [255, 0, 0, 1],
|
|
22360
|
+
purple: [128, 0, 128, 1],
|
|
22361
|
+
fuchsia: [255, 0, 255, 1],
|
|
22362
|
+
green: [0, 128, 0, 1],
|
|
22363
|
+
lime: [0, 255, 0, 1],
|
|
22364
|
+
olive: [128, 128, 0, 1],
|
|
22365
|
+
yellow: [255, 255, 0, 1],
|
|
22366
|
+
navy: [0, 0, 128, 1],
|
|
22367
|
+
blue: [0, 0, 255, 1],
|
|
22368
|
+
teal: [0, 128, 128, 1],
|
|
22369
|
+
aqua: [0, 255, 255, 1],
|
|
22370
|
+
transparent: [0, 0, 0, 0]
|
|
22371
|
+
};
|
|
22372
|
+
const CSS_KEYWORD_COLORS = __CSS_KEYWORD_COLORS;
|
|
22373
|
+
const DEFAULT_BORDER_COLOR = "red";
|
|
22374
|
+
const DEFAULT_BORDER_COLOR_RGBA = CSS_KEYWORD_COLORS.red;
|
|
22354
22375
|
const cloneSpriteLocation = (location2) => {
|
|
22355
22376
|
if (location2.z === void 0) {
|
|
22356
22377
|
return { lng: location2.lng, lat: location2.lat };
|
|
@@ -22358,8 +22379,8 @@ const cloneSpriteLocation = (location2) => {
|
|
|
22358
22379
|
return { lng: location2.lng, lat: location2.lat, z: location2.z };
|
|
22359
22380
|
};
|
|
22360
22381
|
const lerpSpriteLocation = (from, to, ratio) => {
|
|
22361
|
-
var
|
|
22362
|
-
const zFrom = (
|
|
22382
|
+
var _a, _b;
|
|
22383
|
+
const zFrom = (_a = from.z) != null ? _a : 0;
|
|
22363
22384
|
const zTo = (_b = to.z) != null ? _b : 0;
|
|
22364
22385
|
const hasZ = from.z !== void 0 || to.z !== void 0;
|
|
22365
22386
|
const result = {
|
|
@@ -22372,16 +22393,16 @@ const lerpSpriteLocation = (from, to, ratio) => {
|
|
|
22372
22393
|
return result;
|
|
22373
22394
|
};
|
|
22374
22395
|
const spriteLocationsEqual = (a, b) => {
|
|
22375
|
-
var
|
|
22376
|
-
const zA = (
|
|
22396
|
+
var _a, _b;
|
|
22397
|
+
const zA = (_a = a.z) != null ? _a : null;
|
|
22377
22398
|
const zB = (_b = b.z) != null ? _b : null;
|
|
22378
22399
|
return a.lng === b.lng && a.lat === b.lat && zA === zB;
|
|
22379
22400
|
};
|
|
22380
22401
|
const toCartesianMeters = (location2) => {
|
|
22381
|
-
var
|
|
22402
|
+
var _a;
|
|
22382
22403
|
const latitude = location2.lat;
|
|
22383
22404
|
const longitude = location2.lng;
|
|
22384
|
-
const altitude = (
|
|
22405
|
+
const altitude = (_a = location2.z) != null ? _a : 0;
|
|
22385
22406
|
const latRad = latitude * DEG2RAD;
|
|
22386
22407
|
const lonRad = longitude * DEG2RAD;
|
|
22387
22408
|
const cosLat = Math.cos(latRad);
|
|
@@ -22412,8 +22433,8 @@ const normalizeAngleDeg = (angle) => {
|
|
|
22412
22433
|
return Object.is(normalized, -0) ? 0 : normalized;
|
|
22413
22434
|
};
|
|
22414
22435
|
const multiplyMatrixAndVector = (matrix, x, y, z, w) => {
|
|
22415
|
-
var
|
|
22416
|
-
const m0 = (
|
|
22436
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
22437
|
+
const m0 = (_a = matrix[0]) != null ? _a : 0;
|
|
22417
22438
|
const m1 = (_b = matrix[1]) != null ? _b : 0;
|
|
22418
22439
|
const m2 = (_c = matrix[2]) != null ? _c : 0;
|
|
22419
22440
|
const m3 = (_d = matrix[3]) != null ? _d : 0;
|
|
@@ -22437,10 +22458,10 @@ const multiplyMatrixAndVector = (matrix, x, y, z, w) => {
|
|
|
22437
22458
|
];
|
|
22438
22459
|
};
|
|
22439
22460
|
const resolveScalingOptions = (options) => {
|
|
22440
|
-
var
|
|
22461
|
+
var _a, _b;
|
|
22441
22462
|
const base = UNLIMITED_SPRITE_SCALING_OPTIONS;
|
|
22442
22463
|
const warnings = [];
|
|
22443
|
-
const fallbackMetersPerPixel = Number.isFinite(base.metersPerPixel) && ((
|
|
22464
|
+
const fallbackMetersPerPixel = Number.isFinite(base.metersPerPixel) && ((_a = base.metersPerPixel) != null ? _a : 0) > 0 ? base.metersPerPixel : 1;
|
|
22444
22465
|
let metersPerPixel = (options == null ? void 0 : options.metersPerPixel) !== void 0 ? options.metersPerPixel : fallbackMetersPerPixel;
|
|
22445
22466
|
if (!Number.isFinite(metersPerPixel) || metersPerPixel <= 0) {
|
|
22446
22467
|
if ((options == null ? void 0 : options.metersPerPixel) !== void 0) {
|
|
@@ -22660,8 +22681,8 @@ const calculateBillboardPixelDimensions = (imageWidth, imageHeight, baseMetersPe
|
|
|
22660
22681
|
);
|
|
22661
22682
|
};
|
|
22662
22683
|
const calculateBillboardOffsetPixels = (offset, imageScale, zoomScaleFactor, effectivePixelsPerMeter, sizeScaleAdjustment = 1) => {
|
|
22663
|
-
var
|
|
22664
|
-
const offsetMeters = ((
|
|
22684
|
+
var _a, _b;
|
|
22685
|
+
const offsetMeters = ((_a = offset == null ? void 0 : offset.offsetMeters) != null ? _a : 0) * imageScale * zoomScaleFactor;
|
|
22665
22686
|
const offsetPixels = offsetMeters * effectivePixelsPerMeter * sizeScaleAdjustment;
|
|
22666
22687
|
const offsetRad = ((_b = offset == null ? void 0 : offset.offsetDeg) != null ? _b : 0) * DEG2RAD;
|
|
22667
22688
|
return {
|
|
@@ -22670,11 +22691,11 @@ const calculateBillboardOffsetPixels = (offset, imageScale, zoomScaleFactor, eff
|
|
|
22670
22691
|
};
|
|
22671
22692
|
};
|
|
22672
22693
|
const calculateBillboardAnchorShiftPixels = (halfWidth, halfHeight, anchor, totalRotateDeg) => {
|
|
22673
|
-
var
|
|
22694
|
+
var _a, _b;
|
|
22674
22695
|
if (halfWidth <= 0 || halfHeight <= 0) {
|
|
22675
22696
|
return { x: 0, y: 0 };
|
|
22676
22697
|
}
|
|
22677
|
-
const anchorX = ((
|
|
22698
|
+
const anchorX = ((_a = anchor == null ? void 0 : anchor.x) != null ? _a : 0) * halfWidth;
|
|
22678
22699
|
const anchorY = ((_b = anchor == null ? void 0 : anchor.y) != null ? _b : 0) * halfHeight;
|
|
22679
22700
|
if (anchorX === 0 && anchorY === 0) {
|
|
22680
22701
|
return { x: 0, y: 0 };
|
|
@@ -22687,7 +22708,7 @@ const calculateBillboardAnchorShiftPixels = (halfWidth, halfHeight, anchor, tota
|
|
|
22687
22708
|
return { x: shiftX, y: shiftY };
|
|
22688
22709
|
};
|
|
22689
22710
|
const calculateSurfaceWorldDimensions = (imageWidth, imageHeight, baseMetersPerPixel, imageScale, zoomScaleFactor, options) => {
|
|
22690
|
-
var
|
|
22711
|
+
var _a, _b;
|
|
22691
22712
|
if (!imageWidth || !imageHeight || imageWidth <= 0 || imageHeight <= 0 || baseMetersPerPixel <= 0) {
|
|
22692
22713
|
return { width: 0, height: 0, scaleAdjustment: 1 };
|
|
22693
22714
|
}
|
|
@@ -22696,7 +22717,7 @@ const calculateSurfaceWorldDimensions = (imageWidth, imageHeight, baseMetersPerP
|
|
|
22696
22717
|
let height = ensureFinite(imageHeight * scaleFactor);
|
|
22697
22718
|
let scaleAdjustment = 1;
|
|
22698
22719
|
const effectivePixelsPerMeter = (options == null ? void 0 : options.effectivePixelsPerMeter) !== void 0 ? options.effectivePixelsPerMeter : 0;
|
|
22699
|
-
const spriteMinPixel = (
|
|
22720
|
+
const spriteMinPixel = (_a = options == null ? void 0 : options.spriteMinPixel) != null ? _a : 0;
|
|
22700
22721
|
const spriteMaxPixel = (_b = options == null ? void 0 : options.spriteMaxPixel) != null ? _b : 0;
|
|
22701
22722
|
if (effectivePixelsPerMeter > 0 && Number.isFinite(effectivePixelsPerMeter) && (spriteMinPixel > 0 || spriteMaxPixel > 0)) {
|
|
22702
22723
|
const largestMeters = Math.max(width, height);
|
|
@@ -22722,11 +22743,11 @@ const calculateSurfaceWorldDimensions = (imageWidth, imageHeight, baseMetersPerP
|
|
|
22722
22743
|
return { width, height, scaleAdjustment };
|
|
22723
22744
|
};
|
|
22724
22745
|
const calculateSurfaceAnchorShiftMeters = (halfWidthMeters, halfHeightMeters, anchor, totalRotateDeg) => {
|
|
22725
|
-
var
|
|
22746
|
+
var _a, _b;
|
|
22726
22747
|
if (halfWidthMeters <= 0 || halfHeightMeters <= 0) {
|
|
22727
22748
|
return { east: 0, north: 0 };
|
|
22728
22749
|
}
|
|
22729
|
-
const anchorEast = ((
|
|
22750
|
+
const anchorEast = ((_a = anchor == null ? void 0 : anchor.x) != null ? _a : 0) * halfWidthMeters;
|
|
22730
22751
|
const anchorNorth = ((_b = anchor == null ? void 0 : anchor.y) != null ? _b : 0) * halfHeightMeters;
|
|
22731
22752
|
if (anchorEast === 0 && anchorNorth === 0) {
|
|
22732
22753
|
return { east: 0, north: 0 };
|
|
@@ -22739,8 +22760,8 @@ const calculateSurfaceAnchorShiftMeters = (halfWidthMeters, halfHeightMeters, an
|
|
|
22739
22760
|
return { east, north };
|
|
22740
22761
|
};
|
|
22741
22762
|
const calculateSurfaceOffsetMeters = (offset, imageScale, zoomScaleFactor, sizeScaleAdjustment = 1) => {
|
|
22742
|
-
var
|
|
22743
|
-
const offsetMeters = ((
|
|
22763
|
+
var _a, _b;
|
|
22764
|
+
const offsetMeters = ((_a = offset == null ? void 0 : offset.offsetMeters) != null ? _a : 0) * imageScale * zoomScaleFactor;
|
|
22744
22765
|
if (offsetMeters === 0) {
|
|
22745
22766
|
return { east: 0, north: 0 };
|
|
22746
22767
|
}
|
|
@@ -22804,8 +22825,8 @@ const calculateBillboardDepthKey = (center, unproject, projectToClipSpace) => {
|
|
|
22804
22825
|
return -ndcZ;
|
|
22805
22826
|
};
|
|
22806
22827
|
const calculateSurfaceDepthKey = (baseLngLat, displacements, projectToClipSpace, options) => {
|
|
22807
|
-
var
|
|
22808
|
-
const indices = (
|
|
22828
|
+
var _a;
|
|
22829
|
+
const indices = (_a = options == null ? void 0 : options.indices) != null ? _a : TRIANGLE_INDICES;
|
|
22809
22830
|
let maxDepth = Number.NEGATIVE_INFINITY;
|
|
22810
22831
|
for (const index of indices) {
|
|
22811
22832
|
const displacement = displacements[index];
|
|
@@ -22893,12 +22914,12 @@ const BILLBOARD_BASE_CORNERS$1 = [
|
|
|
22893
22914
|
[1, -1]
|
|
22894
22915
|
];
|
|
22895
22916
|
const calculateBillboardCornerScreenPositions = (params) => {
|
|
22896
|
-
var
|
|
22917
|
+
var _a, _b;
|
|
22897
22918
|
const { center, halfWidth, halfHeight, anchor, totalRotateDeg } = params;
|
|
22898
22919
|
if (halfWidth <= 0 || halfHeight <= 0) {
|
|
22899
22920
|
return UV_CORNERS.map(([u, v]) => ({ x: center.x, y: center.y, u, v }));
|
|
22900
22921
|
}
|
|
22901
|
-
const anchorOffsetX = ((
|
|
22922
|
+
const anchorOffsetX = ((_a = anchor == null ? void 0 : anchor.x) != null ? _a : 0) * halfWidth;
|
|
22902
22923
|
const anchorOffsetY = ((_b = anchor == null ? void 0 : anchor.y) != null ? _b : 0) * halfHeight;
|
|
22903
22924
|
const rad = -totalRotateDeg * DEG2RAD;
|
|
22904
22925
|
const cosR = Math.cos(rad);
|
|
@@ -22923,7 +22944,7 @@ const calculateBillboardCornerScreenPositions = (params) => {
|
|
|
22923
22944
|
return corners;
|
|
22924
22945
|
};
|
|
22925
22946
|
const computeSurfaceCornerShaderModel = (params) => {
|
|
22926
|
-
var
|
|
22947
|
+
var _a, _b;
|
|
22927
22948
|
const {
|
|
22928
22949
|
baseLngLat,
|
|
22929
22950
|
worldWidthMeters,
|
|
@@ -22946,7 +22967,7 @@ const computeSurfaceCornerShaderModel = (params) => {
|
|
|
22946
22967
|
lat: baseLngLat.lat + deltaLat
|
|
22947
22968
|
}));
|
|
22948
22969
|
}
|
|
22949
|
-
const anchorEast = ((
|
|
22970
|
+
const anchorEast = ((_a = anchor == null ? void 0 : anchor.x) != null ? _a : 0) * halfWidth;
|
|
22950
22971
|
const anchorNorth = ((_b = anchor == null ? void 0 : anchor.y) != null ? _b : 0) * halfHeight;
|
|
22951
22972
|
const rad = -totalRotateDeg * DEG2RAD;
|
|
22952
22973
|
const sinR = Math.sin(rad);
|
|
@@ -22973,7 +22994,7 @@ const computeSurfaceCornerShaderModel = (params) => {
|
|
|
22973
22994
|
});
|
|
22974
22995
|
};
|
|
22975
22996
|
const calculateSurfaceCenterPosition = (params) => {
|
|
22976
|
-
var
|
|
22997
|
+
var _a;
|
|
22977
22998
|
const {
|
|
22978
22999
|
baseLngLat,
|
|
22979
23000
|
imageWidth,
|
|
@@ -23053,7 +23074,7 @@ const calculateSurfaceCenterPosition = (params) => {
|
|
|
23053
23074
|
baseLngLat,
|
|
23054
23075
|
anchorlessDisplacement
|
|
23055
23076
|
);
|
|
23056
|
-
anchorlessCenter = (
|
|
23077
|
+
anchorlessCenter = (_a = projectPoint(anchorlessLngLat)) != null ? _a : null;
|
|
23057
23078
|
}
|
|
23058
23079
|
return {
|
|
23059
23080
|
center,
|
|
@@ -23073,7 +23094,7 @@ const SURFACE_BASE_CORNERS$1 = [
|
|
|
23073
23094
|
];
|
|
23074
23095
|
SURFACE_BASE_CORNERS$1.length;
|
|
23075
23096
|
const calculateSurfaceCornerDisplacements = (params) => {
|
|
23076
|
-
var
|
|
23097
|
+
var _a, _b;
|
|
23077
23098
|
const {
|
|
23078
23099
|
worldWidthMeters,
|
|
23079
23100
|
worldHeightMeters,
|
|
@@ -23086,7 +23107,7 @@ const calculateSurfaceCornerDisplacements = (params) => {
|
|
|
23086
23107
|
}
|
|
23087
23108
|
const halfWidth = worldWidthMeters / 2;
|
|
23088
23109
|
const halfHeight = worldHeightMeters / 2;
|
|
23089
|
-
const anchorEast = ((
|
|
23110
|
+
const anchorEast = ((_a = anchor == null ? void 0 : anchor.x) != null ? _a : 0) * halfWidth;
|
|
23090
23111
|
const anchorNorth = ((_b = anchor == null ? void 0 : anchor.y) != null ? _b : 0) * halfHeight;
|
|
23091
23112
|
const rad = -totalRotateDeg * DEG2RAD;
|
|
23092
23113
|
const cosR = Math.cos(rad);
|
|
@@ -23131,11 +23152,11 @@ const clampOpacity = (value) => {
|
|
|
23131
23152
|
return value;
|
|
23132
23153
|
};
|
|
23133
23154
|
const computeFeedforwardTarget = (previous, next) => {
|
|
23134
|
-
var
|
|
23155
|
+
var _a, _b;
|
|
23135
23156
|
if (!previous) {
|
|
23136
23157
|
return cloneSpriteLocation(next);
|
|
23137
23158
|
}
|
|
23138
|
-
const prevZ = (
|
|
23159
|
+
const prevZ = (_a = previous.z) != null ? _a : 0;
|
|
23139
23160
|
const nextZ = (_b = next.z) != null ? _b : 0;
|
|
23140
23161
|
const hasZ = previous.z !== void 0 || next.z !== void 0;
|
|
23141
23162
|
const target = {
|
|
@@ -23147,10 +23168,10 @@ const computeFeedforwardTarget = (previous, next) => {
|
|
|
23147
23168
|
return target;
|
|
23148
23169
|
};
|
|
23149
23170
|
const normalizeOptions$2 = (options) => {
|
|
23150
|
-
var
|
|
23171
|
+
var _a;
|
|
23151
23172
|
return {
|
|
23152
23173
|
durationMs: Math.max(0, options.durationMs),
|
|
23153
|
-
mode: (
|
|
23174
|
+
mode: (_a = options.mode) != null ? _a : "feedback",
|
|
23154
23175
|
easing: options.easing
|
|
23155
23176
|
};
|
|
23156
23177
|
};
|
|
@@ -23159,31 +23180,36 @@ const createInterpolationState = (params) => {
|
|
|
23159
23180
|
const options = normalizeOptions$2(params.options);
|
|
23160
23181
|
const from = cloneSpriteLocation(currentLocation);
|
|
23161
23182
|
const resolvedEasing = resolveEasing(options.easing);
|
|
23162
|
-
|
|
23183
|
+
const commandTarget = cloneSpriteLocation(nextCommandLocation);
|
|
23184
|
+
let pathTarget;
|
|
23163
23185
|
if (options.mode === "feedforward") {
|
|
23164
|
-
|
|
23165
|
-
|
|
23166
|
-
|
|
23186
|
+
pathTarget = computeFeedforwardTarget(
|
|
23187
|
+
lastCommandLocation,
|
|
23188
|
+
nextCommandLocation
|
|
23189
|
+
);
|
|
23167
23190
|
}
|
|
23168
|
-
const requiresInterpolation = options.durationMs > 0 && !spriteLocationsEqual(from,
|
|
23191
|
+
const requiresInterpolation = options.durationMs > 0 && !spriteLocationsEqual(from, pathTarget != null ? pathTarget : commandTarget);
|
|
23169
23192
|
const state = {
|
|
23170
23193
|
mode: options.mode,
|
|
23171
23194
|
durationMs: options.durationMs,
|
|
23172
|
-
|
|
23173
|
-
|
|
23195
|
+
easingFunc: resolvedEasing.func,
|
|
23196
|
+
easingParam: resolvedEasing.param,
|
|
23174
23197
|
startTimestamp: -1,
|
|
23175
23198
|
from,
|
|
23176
|
-
to
|
|
23199
|
+
to: commandTarget,
|
|
23200
|
+
pathTarget: pathTarget && !spriteLocationsEqual(pathTarget, commandTarget) ? pathTarget : void 0
|
|
23177
23201
|
};
|
|
23178
23202
|
return { state, requiresInterpolation };
|
|
23179
23203
|
};
|
|
23180
23204
|
const evaluateInterpolation = (params) => {
|
|
23205
|
+
var _a;
|
|
23181
23206
|
const { state } = params;
|
|
23182
|
-
const easingFn = state.
|
|
23207
|
+
const easingFn = state.easingFunc;
|
|
23183
23208
|
const timestamp = Number.isFinite(params.timestamp) ? params.timestamp : Date.now();
|
|
23184
23209
|
const duration = Math.max(0, state.durationMs);
|
|
23185
23210
|
const effectiveStart = state.startTimestamp >= 0 ? state.startTimestamp : timestamp;
|
|
23186
|
-
|
|
23211
|
+
const target = (_a = state.pathTarget) != null ? _a : state.to;
|
|
23212
|
+
if (duration === 0 || spriteLocationsEqual(state.from, target)) {
|
|
23187
23213
|
return {
|
|
23188
23214
|
location: cloneSpriteLocation(state.to),
|
|
23189
23215
|
completed: true,
|
|
@@ -23193,7 +23219,7 @@ const evaluateInterpolation = (params) => {
|
|
|
23193
23219
|
const elapsed = timestamp - effectiveStart;
|
|
23194
23220
|
const rawProgress = duration <= 0 ? 1 : elapsed / duration;
|
|
23195
23221
|
const eased = easingFn(rawProgress);
|
|
23196
|
-
const location2 = lerpSpriteLocation(state.from,
|
|
23222
|
+
const location2 = lerpSpriteLocation(state.from, target, eased);
|
|
23197
23223
|
const completed = rawProgress >= 1;
|
|
23198
23224
|
return {
|
|
23199
23225
|
location: location2,
|
|
@@ -23216,13 +23242,13 @@ const normalizeDelta = (delta) => {
|
|
|
23216
23242
|
return adjusted;
|
|
23217
23243
|
};
|
|
23218
23244
|
const normalizeOptions$1 = (options) => {
|
|
23219
|
-
var
|
|
23245
|
+
var _a;
|
|
23220
23246
|
const resolved = resolveEasing(options.easing);
|
|
23221
23247
|
return {
|
|
23222
23248
|
durationMs: normalizeDuration$1(options.durationMs),
|
|
23223
|
-
|
|
23224
|
-
|
|
23225
|
-
mode: (
|
|
23249
|
+
easingFunc: resolved.func,
|
|
23250
|
+
easingParam: resolved.param,
|
|
23251
|
+
mode: (_a = options.mode) != null ? _a : "feedback"
|
|
23226
23252
|
};
|
|
23227
23253
|
};
|
|
23228
23254
|
const createDegreeInterpolationState = (params) => {
|
|
@@ -23236,14 +23262,16 @@ const createDegreeInterpolationState = (params) => {
|
|
|
23236
23262
|
}
|
|
23237
23263
|
const delta = normalizeDelta(effectiveTarget - currentValue);
|
|
23238
23264
|
const pathTarget = currentValue + delta;
|
|
23265
|
+
const normalizedPathTarget = Math.abs(pathTarget - targetValue) <= NUMERIC_EPSILON ? void 0 : pathTarget;
|
|
23239
23266
|
const requiresInterpolation = options.durationMs > 0 && Math.abs(delta) > NUMERIC_EPSILON;
|
|
23240
23267
|
const state = {
|
|
23268
|
+
mode: options.mode,
|
|
23241
23269
|
durationMs: options.durationMs,
|
|
23242
|
-
|
|
23243
|
-
|
|
23270
|
+
easingFunc: options.easingFunc,
|
|
23271
|
+
easingParam: options.easingParam,
|
|
23244
23272
|
from: currentValue,
|
|
23245
|
-
to:
|
|
23246
|
-
|
|
23273
|
+
to: targetValue,
|
|
23274
|
+
pathTarget: normalizedPathTarget,
|
|
23247
23275
|
startTimestamp: -1
|
|
23248
23276
|
};
|
|
23249
23277
|
return {
|
|
@@ -23264,38 +23292,40 @@ const clamp01$2 = (value) => {
|
|
|
23264
23292
|
return value;
|
|
23265
23293
|
};
|
|
23266
23294
|
const evaluateDegreeInterpolation = (params) => {
|
|
23295
|
+
var _a;
|
|
23267
23296
|
const { state } = params;
|
|
23297
|
+
const targetValue = (_a = state.pathTarget) != null ? _a : state.to;
|
|
23268
23298
|
const timestamp = Number.isFinite(params.timestamp) ? params.timestamp : Date.now();
|
|
23269
23299
|
const duration = Math.max(0, state.durationMs);
|
|
23270
23300
|
const effectiveStart = state.startTimestamp >= 0 ? state.startTimestamp : timestamp;
|
|
23271
|
-
if (duration === 0 || Math.abs(
|
|
23301
|
+
if (duration === 0 || Math.abs(targetValue - state.from) <= NUMERIC_EPSILON) {
|
|
23272
23302
|
return {
|
|
23273
|
-
value: state.
|
|
23303
|
+
value: state.to,
|
|
23274
23304
|
completed: true,
|
|
23275
23305
|
effectiveStartTimestamp: effectiveStart
|
|
23276
23306
|
};
|
|
23277
23307
|
}
|
|
23278
23308
|
const elapsed = timestamp - effectiveStart;
|
|
23279
23309
|
const rawProgress = duration <= 0 ? 1 : elapsed / duration;
|
|
23280
|
-
const eased = clamp01$2(state.
|
|
23281
|
-
const interpolated = state.from + (
|
|
23310
|
+
const eased = clamp01$2(state.easingFunc(rawProgress));
|
|
23311
|
+
const interpolated = state.from + (targetValue - state.from) * eased;
|
|
23282
23312
|
const completed = rawProgress >= 1;
|
|
23283
23313
|
return {
|
|
23284
|
-
value: completed ? state.
|
|
23314
|
+
value: completed ? state.to : interpolated,
|
|
23285
23315
|
completed,
|
|
23286
23316
|
effectiveStartTimestamp: effectiveStart
|
|
23287
23317
|
};
|
|
23288
23318
|
};
|
|
23289
23319
|
const DEGREE_INTERPOLATION_CHANNELS = {
|
|
23290
23320
|
rotation: {
|
|
23291
|
-
|
|
23321
|
+
resolveInterpolation: (image) => image.rotateDeg.interpolation,
|
|
23292
23322
|
normalize: normalizeAngleDeg,
|
|
23293
23323
|
applyValue: (image, value) => {
|
|
23294
23324
|
image.displayedRotateDeg = value;
|
|
23295
23325
|
}
|
|
23296
23326
|
},
|
|
23297
23327
|
offsetDeg: {
|
|
23298
|
-
|
|
23328
|
+
resolveInterpolation: (image) => image.offset.offsetDeg.interpolation,
|
|
23299
23329
|
applyValue: (image, value) => {
|
|
23300
23330
|
image.offset.offsetDeg.current = value;
|
|
23301
23331
|
},
|
|
@@ -23307,14 +23337,10 @@ const DEGREE_INTERPOLATION_CHANNELS = {
|
|
|
23307
23337
|
}
|
|
23308
23338
|
};
|
|
23309
23339
|
const updateDegreeInterpolationState = (image, descriptor, nextState) => {
|
|
23310
|
-
|
|
23311
|
-
image.rotationInterpolationState = nextState;
|
|
23312
|
-
} else {
|
|
23313
|
-
image.offsetDegInterpolationState = nextState;
|
|
23314
|
-
}
|
|
23340
|
+
descriptor.resolveInterpolation(image).state = nextState;
|
|
23315
23341
|
};
|
|
23316
23342
|
const collectDegreeInterpolationWorkItems = (image, workItems) => {
|
|
23317
|
-
const rotationState = image.
|
|
23343
|
+
const rotationState = DEGREE_INTERPOLATION_CHANNELS.rotation.resolveInterpolation(image).state;
|
|
23318
23344
|
if (rotationState) {
|
|
23319
23345
|
workItems.push({
|
|
23320
23346
|
descriptor: DEGREE_INTERPOLATION_CHANNELS.rotation,
|
|
@@ -23322,7 +23348,7 @@ const collectDegreeInterpolationWorkItems = (image, workItems) => {
|
|
|
23322
23348
|
state: rotationState
|
|
23323
23349
|
});
|
|
23324
23350
|
}
|
|
23325
|
-
const offsetState = image.
|
|
23351
|
+
const offsetState = DEGREE_INTERPOLATION_CHANNELS.offsetDeg.resolveInterpolation(image).state;
|
|
23326
23352
|
if (offsetState) {
|
|
23327
23353
|
workItems.push({
|
|
23328
23354
|
descriptor: DEGREE_INTERPOLATION_CHANNELS.offsetDeg,
|
|
@@ -23332,11 +23358,11 @@ const collectDegreeInterpolationWorkItems = (image, workItems) => {
|
|
|
23332
23358
|
}
|
|
23333
23359
|
};
|
|
23334
23360
|
const applyDegreeInterpolationEvaluations = (workItems, evaluations, timestamp) => {
|
|
23335
|
-
var
|
|
23361
|
+
var _a, _b, _c;
|
|
23336
23362
|
let active = false;
|
|
23337
23363
|
for (let index = 0; index < workItems.length; index += 1) {
|
|
23338
23364
|
const item = workItems[index];
|
|
23339
|
-
const evaluation = (
|
|
23365
|
+
const evaluation = (_a = evaluations[index]) != null ? _a : evaluateDegreeInterpolation({
|
|
23340
23366
|
state: item.state,
|
|
23341
23367
|
timestamp
|
|
23342
23368
|
});
|
|
@@ -23348,7 +23374,7 @@ const applyDegreeInterpolationEvaluations = (workItems, evaluations, timestamp)
|
|
|
23348
23374
|
const interpolatedValue = normalize(evaluation.value);
|
|
23349
23375
|
item.descriptor.applyValue(item.image, interpolatedValue);
|
|
23350
23376
|
if (evaluation.completed) {
|
|
23351
|
-
const finalValue = normalize(item.state.
|
|
23377
|
+
const finalValue = normalize(item.state.to);
|
|
23352
23378
|
applyFinalValue(item.image, finalValue);
|
|
23353
23379
|
updateDegreeInterpolationState(item.image, item.descriptor, null);
|
|
23354
23380
|
} else {
|
|
@@ -23394,32 +23420,13 @@ const normalizeRgba = (r, g, b, a) => [
|
|
|
23394
23420
|
clamp255(b) / 255,
|
|
23395
23421
|
clamp01$1(a)
|
|
23396
23422
|
];
|
|
23397
|
-
const CSS_KEYWORD_COLORS = {
|
|
23398
|
-
black: normalizeRgba(0, 0, 0, 1),
|
|
23399
|
-
silver: normalizeRgba(192, 192, 192, 1),
|
|
23400
|
-
gray: normalizeRgba(128, 128, 128, 1),
|
|
23401
|
-
white: normalizeRgba(255, 255, 255, 1),
|
|
23402
|
-
maroon: normalizeRgba(128, 0, 0, 1),
|
|
23403
|
-
red: normalizeRgba(255, 0, 0, 1),
|
|
23404
|
-
purple: normalizeRgba(128, 0, 128, 1),
|
|
23405
|
-
fuchsia: normalizeRgba(255, 0, 255, 1),
|
|
23406
|
-
green: normalizeRgba(0, 128, 0, 1),
|
|
23407
|
-
lime: normalizeRgba(0, 255, 0, 1),
|
|
23408
|
-
olive: normalizeRgba(128, 128, 0, 1),
|
|
23409
|
-
yellow: normalizeRgba(255, 255, 0, 1),
|
|
23410
|
-
navy: normalizeRgba(0, 0, 128, 1),
|
|
23411
|
-
blue: normalizeRgba(0, 0, 255, 1),
|
|
23412
|
-
teal: normalizeRgba(0, 128, 128, 1),
|
|
23413
|
-
aqua: normalizeRgba(0, 255, 255, 1),
|
|
23414
|
-
transparent: normalizeRgba(0, 0, 0, 0)
|
|
23415
|
-
};
|
|
23416
23423
|
const tryParseHexColor = (value) => {
|
|
23417
|
-
var
|
|
23424
|
+
var _a;
|
|
23418
23425
|
const match = /^#([0-9a-f]{3,8})$/i.exec(value.trim());
|
|
23419
23426
|
if (!match) {
|
|
23420
23427
|
return null;
|
|
23421
23428
|
}
|
|
23422
|
-
const hex = (
|
|
23429
|
+
const hex = (_a = match[1]) != null ? _a : "";
|
|
23423
23430
|
if (hex.length === 3) {
|
|
23424
23431
|
const [r, g, b] = hex.split("").map((c) => parseInt(c + c, 16));
|
|
23425
23432
|
return normalizeRgba(r, g, b, 1);
|
|
@@ -23463,14 +23470,14 @@ const parseAlpha = (value) => {
|
|
|
23463
23470
|
return Number.isFinite(number) ? clamp01$1(number) : Number.NaN;
|
|
23464
23471
|
};
|
|
23465
23472
|
const tryParseRgbFunction = (value) => {
|
|
23466
|
-
var
|
|
23473
|
+
var _a, _b, _c;
|
|
23467
23474
|
const match = /^rgba?\(\s*([^,]+?)\s*,\s*([^,]+?)\s*,\s*([^,]+?)(?:\s*,\s*([^,]+?)\s*)?\)$/i.exec(
|
|
23468
23475
|
value.trim()
|
|
23469
23476
|
);
|
|
23470
23477
|
if (!match) {
|
|
23471
23478
|
return null;
|
|
23472
23479
|
}
|
|
23473
|
-
const r = parseChannel((
|
|
23480
|
+
const r = parseChannel((_a = match[1]) != null ? _a : "");
|
|
23474
23481
|
const g = parseChannel((_b = match[2]) != null ? _b : "");
|
|
23475
23482
|
const b = parseChannel((_c = match[3]) != null ? _c : "");
|
|
23476
23483
|
const a = parseAlpha(match[4]);
|
|
@@ -23480,7 +23487,7 @@ const tryParseRgbFunction = (value) => {
|
|
|
23480
23487
|
return normalizeRgba(r, g, b, a);
|
|
23481
23488
|
};
|
|
23482
23489
|
const parseColorUsingDom = (value) => {
|
|
23483
|
-
var
|
|
23490
|
+
var _a;
|
|
23484
23491
|
if (typeof document === "undefined") {
|
|
23485
23492
|
return null;
|
|
23486
23493
|
}
|
|
@@ -23490,35 +23497,33 @@ const parseColorUsingDom = (value) => {
|
|
|
23490
23497
|
if (!element.style.color) {
|
|
23491
23498
|
return null;
|
|
23492
23499
|
}
|
|
23493
|
-
return (
|
|
23500
|
+
return (_a = tryParseRgbFunction(element.style.color)) != null ? _a : tryParseHexColor(element.style.color.toLowerCase());
|
|
23494
23501
|
};
|
|
23495
|
-
const parseCssColorToRgba = (color,
|
|
23496
|
-
var
|
|
23502
|
+
const parseCssColorToRgba = (color, fallback2) => {
|
|
23503
|
+
var _a, _b, _c;
|
|
23497
23504
|
if (!color) {
|
|
23498
|
-
return
|
|
23505
|
+
return fallback2;
|
|
23499
23506
|
}
|
|
23500
23507
|
const trimmed = color.trim();
|
|
23501
23508
|
if (trimmed.length === 0) {
|
|
23502
|
-
return
|
|
23509
|
+
return fallback2;
|
|
23503
23510
|
}
|
|
23504
23511
|
const keyword = CSS_KEYWORD_COLORS[trimmed.toLowerCase()];
|
|
23505
23512
|
if (keyword) {
|
|
23506
23513
|
return keyword;
|
|
23507
23514
|
}
|
|
23508
|
-
return (_c = (_b = (
|
|
23515
|
+
return (_c = (_b = (_a = tryParseHexColor(trimmed)) != null ? _a : tryParseRgbFunction(trimmed)) != null ? _b : parseColorUsingDom(trimmed)) != null ? _c : fallback2;
|
|
23509
23516
|
};
|
|
23510
|
-
const DEFAULT_BORDER_COLOR = "red";
|
|
23511
|
-
const DEFAULT_BORDER_COLOR_RGBA = (_a = CSS_KEYWORD_COLORS.red) != null ? _a : normalizeRgba(255, 0, 0, 1);
|
|
23512
23517
|
const DISTANCE_EPSILON = 1e-6;
|
|
23513
23518
|
const normalizeDuration = (durationMs) => Number.isFinite(durationMs) && durationMs > 0 ? durationMs : 0;
|
|
23514
23519
|
const normalizeOptions = (options) => {
|
|
23515
|
-
var
|
|
23520
|
+
var _a;
|
|
23516
23521
|
const resolved = resolveEasing(options.easing);
|
|
23517
23522
|
return {
|
|
23518
23523
|
durationMs: normalizeDuration(options.durationMs),
|
|
23519
|
-
|
|
23520
|
-
|
|
23521
|
-
mode: (
|
|
23524
|
+
easingFunc: resolved.func,
|
|
23525
|
+
easingParam: resolved.param,
|
|
23526
|
+
mode: (_a = options.mode) != null ? _a : "feedback"
|
|
23522
23527
|
};
|
|
23523
23528
|
};
|
|
23524
23529
|
const createDistanceInterpolationState = (params) => {
|
|
@@ -23532,13 +23537,16 @@ const createDistanceInterpolationState = (params) => {
|
|
|
23532
23537
|
}
|
|
23533
23538
|
const delta = effectiveTarget - currentValue;
|
|
23534
23539
|
const requiresInterpolation = options.durationMs > 0 && Math.abs(delta) > DISTANCE_EPSILON;
|
|
23540
|
+
const pathTarget = currentValue + delta;
|
|
23541
|
+
const normalizedPathTarget = Math.abs(pathTarget - targetValue) <= DISTANCE_EPSILON ? void 0 : pathTarget;
|
|
23535
23542
|
const state = {
|
|
23543
|
+
mode: options.mode,
|
|
23536
23544
|
durationMs: options.durationMs,
|
|
23537
|
-
|
|
23538
|
-
|
|
23545
|
+
easingFunc: options.easingFunc,
|
|
23546
|
+
easingParam: options.easingParam,
|
|
23539
23547
|
from: currentValue,
|
|
23540
|
-
to:
|
|
23541
|
-
|
|
23548
|
+
to: targetValue,
|
|
23549
|
+
pathTarget: normalizedPathTarget,
|
|
23542
23550
|
startTimestamp: -1
|
|
23543
23551
|
};
|
|
23544
23552
|
return {
|
|
@@ -23559,31 +23567,33 @@ const clamp01 = (value) => {
|
|
|
23559
23567
|
return value;
|
|
23560
23568
|
};
|
|
23561
23569
|
const evaluateDistanceInterpolation = (params) => {
|
|
23570
|
+
var _a;
|
|
23562
23571
|
const { state } = params;
|
|
23572
|
+
const targetValue = (_a = state.pathTarget) != null ? _a : state.to;
|
|
23563
23573
|
const timestamp = Number.isFinite(params.timestamp) ? params.timestamp : Date.now();
|
|
23564
23574
|
const duration = Math.max(0, state.durationMs);
|
|
23565
23575
|
const effectiveStart = state.startTimestamp >= 0 ? state.startTimestamp : timestamp;
|
|
23566
|
-
if (duration === 0 || Math.abs(
|
|
23576
|
+
if (duration === 0 || Math.abs(targetValue - state.from) <= DISTANCE_EPSILON) {
|
|
23567
23577
|
return {
|
|
23568
|
-
value: state.
|
|
23578
|
+
value: state.to,
|
|
23569
23579
|
completed: true,
|
|
23570
23580
|
effectiveStartTimestamp: effectiveStart
|
|
23571
23581
|
};
|
|
23572
23582
|
}
|
|
23573
23583
|
const elapsed = timestamp - effectiveStart;
|
|
23574
23584
|
const rawProgress = duration <= 0 ? 1 : elapsed / duration;
|
|
23575
|
-
const eased = clamp01(state.
|
|
23576
|
-
const interpolated = state.from + (
|
|
23585
|
+
const eased = clamp01(state.easingFunc(rawProgress));
|
|
23586
|
+
const interpolated = state.from + (targetValue - state.from) * eased;
|
|
23577
23587
|
const completed = rawProgress >= 1;
|
|
23578
23588
|
return {
|
|
23579
|
-
value: completed ? state.
|
|
23589
|
+
value: completed ? state.to : interpolated,
|
|
23580
23590
|
completed,
|
|
23581
23591
|
effectiveStartTimestamp: effectiveStart
|
|
23582
23592
|
};
|
|
23583
23593
|
};
|
|
23584
23594
|
const DISTANCE_INTERPOLATION_CHANNELS = {
|
|
23585
23595
|
offsetMeters: {
|
|
23586
|
-
|
|
23596
|
+
resolveInterpolation: (image) => image.offset.offsetMeters.interpolation,
|
|
23587
23597
|
applyValue: (image, value) => {
|
|
23588
23598
|
image.offset.offsetMeters.current = value;
|
|
23589
23599
|
},
|
|
@@ -23594,7 +23604,7 @@ const DISTANCE_INTERPOLATION_CHANNELS = {
|
|
|
23594
23604
|
}
|
|
23595
23605
|
},
|
|
23596
23606
|
opacity: {
|
|
23597
|
-
|
|
23607
|
+
resolveInterpolation: (image) => image.opacity.interpolation,
|
|
23598
23608
|
normalize: clampOpacity,
|
|
23599
23609
|
applyValue: (image, value) => {
|
|
23600
23610
|
image.opacity.current = value;
|
|
@@ -23607,10 +23617,12 @@ const DISTANCE_INTERPOLATION_CHANNELS = {
|
|
|
23607
23617
|
}
|
|
23608
23618
|
};
|
|
23609
23619
|
const collectDistanceInterpolationWorkItems = (image, workItems, options) => {
|
|
23610
|
-
var
|
|
23611
|
-
const includeOffsetMeters = (
|
|
23620
|
+
var _a, _b;
|
|
23621
|
+
const includeOffsetMeters = (_a = options == null ? void 0 : options.includeOffsetMeters) != null ? _a : true;
|
|
23612
23622
|
const includeOpacity = (_b = options == null ? void 0 : options.includeOpacity) != null ? _b : true;
|
|
23613
|
-
const offsetMetersState =
|
|
23623
|
+
const offsetMetersState = DISTANCE_INTERPOLATION_CHANNELS.offsetMeters.resolveInterpolation(
|
|
23624
|
+
image
|
|
23625
|
+
).state;
|
|
23614
23626
|
if (includeOffsetMeters && offsetMetersState) {
|
|
23615
23627
|
workItems.push({
|
|
23616
23628
|
descriptor: DISTANCE_INTERPOLATION_CHANNELS.offsetMeters,
|
|
@@ -23618,7 +23630,7 @@ const collectDistanceInterpolationWorkItems = (image, workItems, options) => {
|
|
|
23618
23630
|
state: offsetMetersState
|
|
23619
23631
|
});
|
|
23620
23632
|
}
|
|
23621
|
-
const opacityState = image.
|
|
23633
|
+
const opacityState = DISTANCE_INTERPOLATION_CHANNELS.opacity.resolveInterpolation(image).state;
|
|
23622
23634
|
if (includeOpacity && opacityState) {
|
|
23623
23635
|
workItems.push({
|
|
23624
23636
|
descriptor: DISTANCE_INTERPOLATION_CHANNELS.opacity,
|
|
@@ -23628,18 +23640,14 @@ const collectDistanceInterpolationWorkItems = (image, workItems, options) => {
|
|
|
23628
23640
|
}
|
|
23629
23641
|
};
|
|
23630
23642
|
const updateDistanceInterpolationState = (image, descriptor, nextState) => {
|
|
23631
|
-
|
|
23632
|
-
image.offsetMetersInterpolationState = nextState;
|
|
23633
|
-
} else {
|
|
23634
|
-
image.opacityInterpolationState = nextState;
|
|
23635
|
-
}
|
|
23643
|
+
descriptor.resolveInterpolation(image).state = nextState;
|
|
23636
23644
|
};
|
|
23637
23645
|
const applyDistanceInterpolationEvaluations = (workItems, evaluations, timestamp) => {
|
|
23638
|
-
var
|
|
23646
|
+
var _a, _b, _c;
|
|
23639
23647
|
let active = false;
|
|
23640
23648
|
for (let index = 0; index < workItems.length; index += 1) {
|
|
23641
23649
|
const item = workItems[index];
|
|
23642
|
-
const evaluation = (
|
|
23650
|
+
const evaluation = (_a = evaluations[index]) != null ? _a : evaluateDistanceInterpolation({
|
|
23643
23651
|
state: item.state,
|
|
23644
23652
|
timestamp
|
|
23645
23653
|
});
|
|
@@ -23651,7 +23659,7 @@ const applyDistanceInterpolationEvaluations = (workItems, evaluations, timestamp
|
|
|
23651
23659
|
const interpolatedValue = normalize(evaluation.value);
|
|
23652
23660
|
item.descriptor.applyValue(item.image, interpolatedValue);
|
|
23653
23661
|
if (evaluation.completed) {
|
|
23654
|
-
const finalValue = normalize(item.state.
|
|
23662
|
+
const finalValue = normalize(item.state.to);
|
|
23655
23663
|
applyFinalValue(item.image, finalValue);
|
|
23656
23664
|
updateDistanceInterpolationState(item.image, item.descriptor, null);
|
|
23657
23665
|
} else {
|
|
@@ -23662,7 +23670,7 @@ const applyDistanceInterpolationEvaluations = (workItems, evaluations, timestamp
|
|
|
23662
23670
|
return active;
|
|
23663
23671
|
};
|
|
23664
23672
|
const stepDegreeInterpolationState = (interpolationState, timestamp, applyValue, options) => {
|
|
23665
|
-
var
|
|
23673
|
+
var _a, _b;
|
|
23666
23674
|
if (!interpolationState) {
|
|
23667
23675
|
return { state: null, active: false };
|
|
23668
23676
|
}
|
|
@@ -23673,20 +23681,20 @@ const stepDegreeInterpolationState = (interpolationState, timestamp, applyValue,
|
|
|
23673
23681
|
if (interpolationState.startTimestamp < 0) {
|
|
23674
23682
|
interpolationState.startTimestamp = evaluation.effectiveStartTimestamp;
|
|
23675
23683
|
}
|
|
23676
|
-
const normalizeValue = (
|
|
23684
|
+
const normalizeValue = (_a = options == null ? void 0 : options.normalize) != null ? _a : ((value) => value);
|
|
23677
23685
|
const applyFinalValue = (_b = options == null ? void 0 : options.applyFinalValue) != null ? _b : applyValue;
|
|
23678
23686
|
const interpolatedValue = normalizeValue(evaluation.value);
|
|
23679
23687
|
applyValue(interpolatedValue);
|
|
23680
23688
|
if (evaluation.completed) {
|
|
23681
|
-
const finalValue = normalizeValue(interpolationState.
|
|
23689
|
+
const finalValue = normalizeValue(interpolationState.to);
|
|
23682
23690
|
applyFinalValue(finalValue);
|
|
23683
23691
|
return { state: null, active: false };
|
|
23684
23692
|
}
|
|
23685
23693
|
return { state: interpolationState, active: true };
|
|
23686
23694
|
};
|
|
23687
23695
|
const resolveManualRotationFromDisplayed = (image) => {
|
|
23688
|
-
var
|
|
23689
|
-
const baseRotation = (
|
|
23696
|
+
var _a;
|
|
23697
|
+
const baseRotation = (_a = image.resolvedBaseRotateDeg) != null ? _a : 0;
|
|
23690
23698
|
const fallbackRotation = normalizeAngleDeg(
|
|
23691
23699
|
baseRotation + image.rotationCommandDeg
|
|
23692
23700
|
);
|
|
@@ -23695,7 +23703,7 @@ const resolveManualRotationFromDisplayed = (image) => {
|
|
|
23695
23703
|
};
|
|
23696
23704
|
const refreshRotateDegInterpolatedValues = (image) => {
|
|
23697
23705
|
image.rotateDeg.current = resolveManualRotationFromDisplayed(image);
|
|
23698
|
-
if (!image.
|
|
23706
|
+
if (!image.rotateDeg.interpolation.state) {
|
|
23699
23707
|
image.rotateDeg.from = void 0;
|
|
23700
23708
|
image.rotateDeg.to = void 0;
|
|
23701
23709
|
}
|
|
@@ -23705,8 +23713,8 @@ const updateImageDisplayedRotation = (image, optionsOverride) => {
|
|
|
23705
23713
|
image.resolvedBaseRotateDeg + image.rotationCommandDeg
|
|
23706
23714
|
);
|
|
23707
23715
|
const currentAngle = Number.isFinite(image.displayedRotateDeg) ? image.displayedRotateDeg : targetAngle;
|
|
23708
|
-
const previousCommandAngle = image.
|
|
23709
|
-
const options = optionsOverride === void 0 ? image.
|
|
23716
|
+
const previousCommandAngle = image.rotateDeg.interpolation.lastCommandValue;
|
|
23717
|
+
const options = optionsOverride === void 0 ? image.rotateDeg.interpolation.options : optionsOverride;
|
|
23710
23718
|
const { nextAngleDeg, interpolationState } = resolveRotationTarget({
|
|
23711
23719
|
currentAngleDeg: currentAngle,
|
|
23712
23720
|
targetAngleDeg: targetAngle,
|
|
@@ -23714,11 +23722,11 @@ const updateImageDisplayedRotation = (image, optionsOverride) => {
|
|
|
23714
23722
|
options: options != null ? options : void 0
|
|
23715
23723
|
});
|
|
23716
23724
|
image.displayedRotateDeg = nextAngleDeg;
|
|
23717
|
-
image.
|
|
23725
|
+
image.rotateDeg.interpolation.state = interpolationState;
|
|
23718
23726
|
if (!interpolationState) {
|
|
23719
23727
|
image.displayedRotateDeg = targetAngle;
|
|
23720
23728
|
}
|
|
23721
|
-
image.
|
|
23729
|
+
image.rotateDeg.interpolation.lastCommandValue = targetAngle;
|
|
23722
23730
|
};
|
|
23723
23731
|
const syncImageRotationChannel = (image, optionsOverride) => {
|
|
23724
23732
|
updateImageDisplayedRotation(image, optionsOverride);
|
|
@@ -23726,7 +23734,7 @@ const syncImageRotationChannel = (image, optionsOverride) => {
|
|
|
23726
23734
|
};
|
|
23727
23735
|
const stepRotationInterpolation = (image, timestamp) => {
|
|
23728
23736
|
const { state, active } = stepDegreeInterpolationState(
|
|
23729
|
-
image.
|
|
23737
|
+
image.rotateDeg.interpolation.state,
|
|
23730
23738
|
timestamp,
|
|
23731
23739
|
(value) => {
|
|
23732
23740
|
image.displayedRotateDeg = value;
|
|
@@ -23735,19 +23743,19 @@ const stepRotationInterpolation = (image, timestamp) => {
|
|
|
23735
23743
|
normalize: normalizeAngleDeg
|
|
23736
23744
|
}
|
|
23737
23745
|
);
|
|
23738
|
-
image.
|
|
23746
|
+
image.rotateDeg.interpolation.state = state;
|
|
23739
23747
|
refreshRotateDegInterpolatedValues(image);
|
|
23740
23748
|
return active;
|
|
23741
23749
|
};
|
|
23742
23750
|
const stepOffsetDegInterpolation = (image, timestamp) => {
|
|
23743
23751
|
const { state, active } = stepDegreeInterpolationState(
|
|
23744
|
-
image.
|
|
23752
|
+
image.offset.offsetDeg.interpolation.state,
|
|
23745
23753
|
timestamp,
|
|
23746
23754
|
(value) => {
|
|
23747
23755
|
image.offset.offsetDeg.current = value;
|
|
23748
23756
|
}
|
|
23749
23757
|
);
|
|
23750
|
-
image.
|
|
23758
|
+
image.offset.offsetDeg.interpolation.state = state;
|
|
23751
23759
|
if (!state) {
|
|
23752
23760
|
image.offset.offsetDeg.from = void 0;
|
|
23753
23761
|
image.offset.offsetDeg.to = void 0;
|
|
@@ -23755,12 +23763,12 @@ const stepOffsetDegInterpolation = (image, timestamp) => {
|
|
|
23755
23763
|
return active;
|
|
23756
23764
|
};
|
|
23757
23765
|
const clearOffsetDegInterpolation = (image) => {
|
|
23758
|
-
image.
|
|
23766
|
+
image.offset.offsetDeg.interpolation.state = null;
|
|
23759
23767
|
image.offset.offsetDeg.from = void 0;
|
|
23760
23768
|
image.offset.offsetDeg.to = void 0;
|
|
23761
23769
|
};
|
|
23762
23770
|
const stepDistanceInterpolationState = (interpolationState, timestamp, applyValue, options) => {
|
|
23763
|
-
var
|
|
23771
|
+
var _a, _b;
|
|
23764
23772
|
if (!interpolationState) {
|
|
23765
23773
|
return { state: null, active: false };
|
|
23766
23774
|
}
|
|
@@ -23771,24 +23779,24 @@ const stepDistanceInterpolationState = (interpolationState, timestamp, applyValu
|
|
|
23771
23779
|
if (interpolationState.startTimestamp < 0) {
|
|
23772
23780
|
interpolationState.startTimestamp = evaluation.effectiveStartTimestamp;
|
|
23773
23781
|
}
|
|
23774
|
-
const normalizeValue = (
|
|
23782
|
+
const normalizeValue = (_a = options == null ? void 0 : options.normalize) != null ? _a : ((value) => value);
|
|
23775
23783
|
const applyFinalValue = (_b = options == null ? void 0 : options.applyFinalValue) != null ? _b : applyValue;
|
|
23776
23784
|
const interpolatedValue = normalizeValue(evaluation.value);
|
|
23777
23785
|
applyValue(interpolatedValue);
|
|
23778
23786
|
if (evaluation.completed) {
|
|
23779
|
-
const finalValue = normalizeValue(interpolationState.
|
|
23787
|
+
const finalValue = normalizeValue(interpolationState.to);
|
|
23780
23788
|
applyFinalValue(finalValue);
|
|
23781
23789
|
return { state: null, active: false };
|
|
23782
23790
|
}
|
|
23783
23791
|
return { state: interpolationState, active: true };
|
|
23784
23792
|
};
|
|
23785
23793
|
const clearOffsetMetersInterpolation = (image) => {
|
|
23786
|
-
image.
|
|
23794
|
+
image.offset.offsetMeters.interpolation.state = null;
|
|
23787
23795
|
image.offset.offsetMeters.from = void 0;
|
|
23788
23796
|
image.offset.offsetMeters.to = void 0;
|
|
23789
23797
|
};
|
|
23790
23798
|
const clearOpacityInterpolation = (image) => {
|
|
23791
|
-
image.
|
|
23799
|
+
image.opacity.interpolation.state = null;
|
|
23792
23800
|
};
|
|
23793
23801
|
const applyOffsetDegUpdate = (image, nextOffset, interpolationOptions) => {
|
|
23794
23802
|
const options = interpolationOptions;
|
|
@@ -23796,26 +23804,26 @@ const applyOffsetDegUpdate = (image, nextOffset, interpolationOptions) => {
|
|
|
23796
23804
|
image.offset.offsetDeg.current = nextOffset.offsetDeg;
|
|
23797
23805
|
image.offset.offsetDeg.from = void 0;
|
|
23798
23806
|
image.offset.offsetDeg.to = void 0;
|
|
23799
|
-
image.
|
|
23800
|
-
image.
|
|
23807
|
+
image.offset.offsetDeg.interpolation.state = null;
|
|
23808
|
+
image.offset.offsetDeg.interpolation.lastCommandValue = nextOffset.offsetDeg;
|
|
23801
23809
|
return;
|
|
23802
23810
|
}
|
|
23803
23811
|
const { state, requiresInterpolation } = createDegreeInterpolationState({
|
|
23804
23812
|
currentValue: image.offset.offsetDeg.current,
|
|
23805
23813
|
targetValue: nextOffset.offsetDeg,
|
|
23806
|
-
previousCommandValue: image.
|
|
23814
|
+
previousCommandValue: image.offset.offsetDeg.interpolation.lastCommandValue,
|
|
23807
23815
|
options
|
|
23808
23816
|
});
|
|
23809
|
-
image.
|
|
23817
|
+
image.offset.offsetDeg.interpolation.lastCommandValue = nextOffset.offsetDeg;
|
|
23810
23818
|
if (requiresInterpolation) {
|
|
23811
|
-
image.
|
|
23819
|
+
image.offset.offsetDeg.interpolation.state = state;
|
|
23812
23820
|
image.offset.offsetDeg.from = image.offset.offsetDeg.current;
|
|
23813
23821
|
image.offset.offsetDeg.to = nextOffset.offsetDeg;
|
|
23814
23822
|
} else {
|
|
23815
23823
|
image.offset.offsetDeg.current = nextOffset.offsetDeg;
|
|
23816
23824
|
image.offset.offsetDeg.from = void 0;
|
|
23817
23825
|
image.offset.offsetDeg.to = void 0;
|
|
23818
|
-
image.
|
|
23826
|
+
image.offset.offsetDeg.interpolation.state = null;
|
|
23819
23827
|
}
|
|
23820
23828
|
};
|
|
23821
23829
|
const applyOffsetMetersUpdate = (image, nextOffset, interpolationOptions) => {
|
|
@@ -23824,79 +23832,92 @@ const applyOffsetMetersUpdate = (image, nextOffset, interpolationOptions) => {
|
|
|
23824
23832
|
image.offset.offsetMeters.current = nextOffset.offsetMeters;
|
|
23825
23833
|
image.offset.offsetMeters.from = void 0;
|
|
23826
23834
|
image.offset.offsetMeters.to = void 0;
|
|
23827
|
-
image.
|
|
23828
|
-
image.
|
|
23835
|
+
image.offset.offsetMeters.interpolation.state = null;
|
|
23836
|
+
image.offset.offsetMeters.interpolation.lastCommandValue = nextOffset.offsetMeters;
|
|
23829
23837
|
return;
|
|
23830
23838
|
}
|
|
23831
23839
|
const { state, requiresInterpolation } = createDistanceInterpolationState({
|
|
23832
23840
|
currentValue: image.offset.offsetMeters.current,
|
|
23833
23841
|
targetValue: nextOffset.offsetMeters,
|
|
23834
|
-
previousCommandValue: image.
|
|
23842
|
+
previousCommandValue: image.offset.offsetMeters.interpolation.lastCommandValue,
|
|
23835
23843
|
options
|
|
23836
23844
|
});
|
|
23837
|
-
image.
|
|
23845
|
+
image.offset.offsetMeters.interpolation.lastCommandValue = nextOffset.offsetMeters;
|
|
23838
23846
|
if (requiresInterpolation) {
|
|
23839
|
-
image.
|
|
23847
|
+
image.offset.offsetMeters.interpolation.state = state;
|
|
23840
23848
|
image.offset.offsetMeters.from = image.offset.offsetMeters.current;
|
|
23841
23849
|
image.offset.offsetMeters.to = nextOffset.offsetMeters;
|
|
23842
23850
|
} else {
|
|
23843
23851
|
image.offset.offsetMeters.current = nextOffset.offsetMeters;
|
|
23844
23852
|
image.offset.offsetMeters.from = void 0;
|
|
23845
23853
|
image.offset.offsetMeters.to = void 0;
|
|
23846
|
-
image.
|
|
23854
|
+
image.offset.offsetMeters.interpolation.state = null;
|
|
23847
23855
|
}
|
|
23848
23856
|
};
|
|
23849
23857
|
const stepOffsetMetersInterpolation = (image, timestamp) => {
|
|
23850
23858
|
const { state, active } = stepDistanceInterpolationState(
|
|
23851
|
-
image.
|
|
23859
|
+
image.offset.offsetMeters.interpolation.state,
|
|
23852
23860
|
timestamp,
|
|
23853
23861
|
(value) => {
|
|
23854
23862
|
image.offset.offsetMeters.current = value;
|
|
23855
23863
|
}
|
|
23856
23864
|
);
|
|
23857
|
-
image.
|
|
23865
|
+
image.offset.offsetMeters.interpolation.state = state;
|
|
23858
23866
|
if (!state) {
|
|
23859
23867
|
image.offset.offsetMeters.from = void 0;
|
|
23860
23868
|
image.offset.offsetMeters.to = void 0;
|
|
23861
23869
|
}
|
|
23862
23870
|
return active;
|
|
23863
23871
|
};
|
|
23864
|
-
const
|
|
23865
|
-
const clampedTarget = clampOpacity(
|
|
23872
|
+
const runOpacityTargetTransition = (image, targetOpacity, interpolationOptions) => {
|
|
23873
|
+
const clampedTarget = clampOpacity(targetOpacity);
|
|
23866
23874
|
const options = interpolationOptions;
|
|
23867
23875
|
if (!options || options.durationMs <= 0) {
|
|
23868
23876
|
image.opacity.current = clampedTarget;
|
|
23869
23877
|
image.opacity.from = void 0;
|
|
23870
23878
|
image.opacity.to = void 0;
|
|
23871
|
-
image.
|
|
23872
|
-
image.lastCommandOpacity = clampedTarget;
|
|
23873
|
-
image.opacityTargetValue = clampedTarget;
|
|
23874
|
-
image.lodLastCommandOpacity = clampedTarget;
|
|
23875
|
-
return;
|
|
23876
|
-
}
|
|
23877
|
-
const { state, requiresInterpolation } = createDistanceInterpolationState({
|
|
23878
|
-
currentValue: clampOpacity(image.opacity.current),
|
|
23879
|
-
targetValue: clampedTarget,
|
|
23880
|
-
previousCommandValue: image.lastCommandOpacity,
|
|
23881
|
-
options
|
|
23882
|
-
});
|
|
23883
|
-
image.lastCommandOpacity = clampedTarget;
|
|
23884
|
-
image.opacityTargetValue = clampedTarget;
|
|
23885
|
-
image.lodLastCommandOpacity = clampedTarget;
|
|
23886
|
-
if (requiresInterpolation) {
|
|
23887
|
-
image.opacityInterpolationState = state;
|
|
23888
|
-
image.opacity.from = image.opacity.current;
|
|
23889
|
-
image.opacity.to = clampedTarget;
|
|
23879
|
+
image.opacity.interpolation.state = null;
|
|
23890
23880
|
} else {
|
|
23891
|
-
|
|
23892
|
-
|
|
23893
|
-
|
|
23894
|
-
|
|
23881
|
+
const { state, requiresInterpolation } = createDistanceInterpolationState({
|
|
23882
|
+
currentValue: clampOpacity(image.opacity.current),
|
|
23883
|
+
targetValue: clampedTarget,
|
|
23884
|
+
previousCommandValue: image.opacity.interpolation.lastCommandValue,
|
|
23885
|
+
options
|
|
23886
|
+
});
|
|
23887
|
+
if (requiresInterpolation) {
|
|
23888
|
+
image.opacity.interpolation.state = state;
|
|
23889
|
+
image.opacity.from = image.opacity.current;
|
|
23890
|
+
image.opacity.to = clampedTarget;
|
|
23891
|
+
} else {
|
|
23892
|
+
image.opacity.current = clampedTarget;
|
|
23893
|
+
image.opacity.from = void 0;
|
|
23894
|
+
image.opacity.to = void 0;
|
|
23895
|
+
image.opacity.interpolation.state = null;
|
|
23896
|
+
}
|
|
23895
23897
|
}
|
|
23898
|
+
image.opacity.interpolation.lastCommandValue = clampedTarget;
|
|
23899
|
+
image.opacity.interpolation.targetValue = clampedTarget;
|
|
23900
|
+
};
|
|
23901
|
+
const applyOpacityUpdate = (image, nextOpacity, interpolationOptions, spriteOpacityMultiplier = 1) => {
|
|
23902
|
+
const clampedBase = clampOpacity(nextOpacity);
|
|
23903
|
+
const lodMultiplier = typeof image.lodOpacity === "number" ? image.lodOpacity : 1;
|
|
23904
|
+
image.opacity.interpolation.baseValue = clampedBase;
|
|
23905
|
+
runOpacityTargetTransition(
|
|
23906
|
+
image,
|
|
23907
|
+
clampedBase * spriteOpacityMultiplier * lodMultiplier,
|
|
23908
|
+
interpolationOptions != null ? interpolationOptions : null
|
|
23909
|
+
);
|
|
23910
|
+
};
|
|
23911
|
+
const applyResolvedOpacityTarget = (image, resolvedTarget, interpolationOptions) => {
|
|
23912
|
+
runOpacityTargetTransition(
|
|
23913
|
+
image,
|
|
23914
|
+
resolvedTarget,
|
|
23915
|
+
interpolationOptions != null ? interpolationOptions : null
|
|
23916
|
+
);
|
|
23896
23917
|
};
|
|
23897
23918
|
const stepOpacityInterpolation = (image, timestamp) => {
|
|
23898
23919
|
const { state, active } = stepDistanceInterpolationState(
|
|
23899
|
-
image.
|
|
23920
|
+
image.opacity.interpolation.state,
|
|
23900
23921
|
timestamp,
|
|
23901
23922
|
(value) => {
|
|
23902
23923
|
image.opacity.current = value;
|
|
@@ -23905,7 +23926,7 @@ const stepOpacityInterpolation = (image, timestamp) => {
|
|
|
23905
23926
|
normalize: clampOpacity
|
|
23906
23927
|
}
|
|
23907
23928
|
);
|
|
23908
|
-
image.
|
|
23929
|
+
image.opacity.interpolation.state = state;
|
|
23909
23930
|
if (!state) {
|
|
23910
23931
|
image.opacity.from = void 0;
|
|
23911
23932
|
image.opacity.to = void 0;
|
|
@@ -23919,9 +23940,9 @@ const IMAGE_INTERPOLATION_STEPPERS = [
|
|
|
23919
23940
|
{ id: "opacity", step: stepOpacityInterpolation }
|
|
23920
23941
|
];
|
|
23921
23942
|
const stepSpriteImageInterpolations = (image, timestamp, options) => {
|
|
23922
|
-
var
|
|
23943
|
+
var _a;
|
|
23923
23944
|
let active = false;
|
|
23924
|
-
const skipChannels = (
|
|
23945
|
+
const skipChannels = (_a = options == null ? void 0 : options.skipChannels) != null ? _a : null;
|
|
23925
23946
|
for (const { id, step } of IMAGE_INTERPOLATION_STEPPERS) {
|
|
23926
23947
|
if (skipChannels && skipChannels[id]) {
|
|
23927
23948
|
continue;
|
|
@@ -23933,7 +23954,7 @@ const stepSpriteImageInterpolations = (image, timestamp, options) => {
|
|
|
23933
23954
|
return active;
|
|
23934
23955
|
};
|
|
23935
23956
|
const hasActiveImageInterpolations = (image) => {
|
|
23936
|
-
return image.
|
|
23957
|
+
return image.rotateDeg.interpolation.state !== null || image.offset.offsetDeg.interpolation.state !== null || image.offset.offsetMeters.interpolation.state !== null || image.opacity.interpolation.state !== null;
|
|
23937
23958
|
};
|
|
23938
23959
|
const applyOffsetUpdate = (image, nextOffset, options = {}) => {
|
|
23939
23960
|
applyOffsetDegUpdate(image, nextOffset, options.deg);
|
|
@@ -24064,8 +24085,8 @@ const computeBillboardCornersShaderModel = ({
|
|
|
24064
24085
|
anchor,
|
|
24065
24086
|
rotationDeg
|
|
24066
24087
|
}) => {
|
|
24067
|
-
var
|
|
24068
|
-
const anchorX = (
|
|
24088
|
+
var _a, _b;
|
|
24089
|
+
const anchorX = (_a = anchor == null ? void 0 : anchor.x) != null ? _a : 0;
|
|
24069
24090
|
const anchorY = (_b = anchor == null ? void 0 : anchor.y) != null ? _b : 0;
|
|
24070
24091
|
const rad = -rotationDeg * DEG2RAD;
|
|
24071
24092
|
const cosR = Math.cos(rad);
|
|
@@ -24087,7 +24108,7 @@ const computeBillboardCornersShaderModel = ({
|
|
|
24087
24108
|
});
|
|
24088
24109
|
};
|
|
24089
24110
|
const compileShader = (glContext, type, source) => {
|
|
24090
|
-
var
|
|
24111
|
+
var _a;
|
|
24091
24112
|
const shader = glContext.createShader(type);
|
|
24092
24113
|
if (!shader) {
|
|
24093
24114
|
throw new Error("Failed to create shader.");
|
|
@@ -24095,14 +24116,14 @@ const compileShader = (glContext, type, source) => {
|
|
|
24095
24116
|
glContext.shaderSource(shader, source);
|
|
24096
24117
|
glContext.compileShader(shader);
|
|
24097
24118
|
if (!glContext.getShaderParameter(shader, glContext.COMPILE_STATUS)) {
|
|
24098
|
-
const info = (
|
|
24119
|
+
const info = (_a = glContext.getShaderInfoLog(shader)) != null ? _a : "unknown error";
|
|
24099
24120
|
glContext.deleteShader(shader);
|
|
24100
24121
|
throw new Error(`Shader compile failed: ${info}`);
|
|
24101
24122
|
}
|
|
24102
24123
|
return shader;
|
|
24103
24124
|
};
|
|
24104
24125
|
const createShaderProgram = (glContext, vertexSource, fragmentSource) => {
|
|
24105
|
-
var
|
|
24126
|
+
var _a;
|
|
24106
24127
|
const vertexShader = compileShader(
|
|
24107
24128
|
glContext,
|
|
24108
24129
|
glContext.VERTEX_SHADER,
|
|
@@ -24125,7 +24146,7 @@ const createShaderProgram = (glContext, vertexSource, fragmentSource) => {
|
|
|
24125
24146
|
glContext.deleteShader(vertexShader);
|
|
24126
24147
|
glContext.deleteShader(fragmentShader);
|
|
24127
24148
|
if (!glContext.getProgramParameter(program, glContext.LINK_STATUS)) {
|
|
24128
|
-
const info = (
|
|
24149
|
+
const info = (_a = glContext.getProgramInfoLog(program)) != null ? _a : "unknown error";
|
|
24129
24150
|
glContext.deleteProgram(program);
|
|
24130
24151
|
throw new Error(`Program link failed: ${info}`);
|
|
24131
24152
|
}
|
|
@@ -24865,7 +24886,7 @@ const MIPMAP_MIN_FILTERS = /* @__PURE__ */ new Set([
|
|
|
24865
24886
|
]);
|
|
24866
24887
|
const filterRequiresMipmaps = (filter) => MIPMAP_MIN_FILTERS.has(filter);
|
|
24867
24888
|
const resolveTextureFilteringOptions = (options) => {
|
|
24868
|
-
var
|
|
24889
|
+
var _a, _b;
|
|
24869
24890
|
const minCandidate = options == null ? void 0 : options.minFilter;
|
|
24870
24891
|
const minFilter = MIN_FILTER_VALUES.includes(
|
|
24871
24892
|
minCandidate
|
|
@@ -24874,7 +24895,7 @@ const resolveTextureFilteringOptions = (options) => {
|
|
|
24874
24895
|
const magFilter = MAG_FILTER_VALUES.includes(
|
|
24875
24896
|
magCandidate
|
|
24876
24897
|
) ? magCandidate : DEFAULT_TEXTURE_FILTERING_OPTIONS.magFilter;
|
|
24877
|
-
let generateMipmaps = (
|
|
24898
|
+
let generateMipmaps = (_a = options == null ? void 0 : options.generateMipmaps) != null ? _a : DEFAULT_TEXTURE_FILTERING_OPTIONS.generateMipmaps;
|
|
24878
24899
|
if (filterRequiresMipmaps(minFilter)) {
|
|
24879
24900
|
generateMipmaps = true;
|
|
24880
24901
|
}
|
|
@@ -25326,7 +25347,7 @@ const MAX_MERCATOR_HORIZON_ANGLE = 89.25;
|
|
|
25326
25347
|
const MIN_RENDER_DISTANCE_BELOW_CAMERA = 100;
|
|
25327
25348
|
const NEAR_CLIP_DIVISOR = 50;
|
|
25328
25349
|
const SIN_DENOMINATOR_EPSILON = 0.01;
|
|
25329
|
-
const toFiniteOr$1 = (value,
|
|
25350
|
+
const toFiniteOr$1 = (value, fallback2) => Number.isFinite(value) ? value : fallback2;
|
|
25330
25351
|
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
25331
25352
|
const circumferenceAtLatitude = (latitudeDeg) => 2 * Math.PI * EARTH_RADIUS_METERS * Math.cos(latitudeDeg * DEG2RAD);
|
|
25332
25353
|
const mercatorXfromLng = (lng) => (180 + lng) / 360;
|
|
@@ -25416,7 +25437,7 @@ const calculateNearFarZ = (params, cameraToCenterDistance, cameraToSeaLevelDista
|
|
|
25416
25437
|
};
|
|
25417
25438
|
};
|
|
25418
25439
|
const prepareProjectionState = (params) => {
|
|
25419
|
-
var
|
|
25440
|
+
var _a;
|
|
25420
25441
|
const width = Math.max(0, params.width);
|
|
25421
25442
|
const height = Math.max(0, params.height);
|
|
25422
25443
|
const zoom = toFiniteOr$1(params.zoom, 0);
|
|
@@ -25517,7 +25538,7 @@ const prepareProjectionState = (params) => {
|
|
|
25517
25538
|
clipSpaceToPixelsMatrix,
|
|
25518
25539
|
worldMatrix
|
|
25519
25540
|
);
|
|
25520
|
-
const pixelMatrixInverse = (
|
|
25541
|
+
const pixelMatrixInverse = (_a = invert(createMat4f64(), pixelMatrix)) != null ? _a : void 0;
|
|
25521
25542
|
const clipContext = mercatorMatrix ? { mercatorMatrix } : void 0;
|
|
25522
25543
|
return {
|
|
25523
25544
|
zoom,
|
|
@@ -25623,7 +25644,7 @@ const createProjectionHost = (params) => {
|
|
|
25623
25644
|
};
|
|
25624
25645
|
};
|
|
25625
25646
|
const calculatePerspectiveRatio = (location2, cachedMercator) => {
|
|
25626
|
-
var
|
|
25647
|
+
var _a;
|
|
25627
25648
|
if (!state.mercatorMatrix || state.cameraToCenterDistance <= 0) {
|
|
25628
25649
|
return 1;
|
|
25629
25650
|
}
|
|
@@ -25633,7 +25654,7 @@ const createProjectionHost = (params) => {
|
|
|
25633
25654
|
state.mercatorMatrix,
|
|
25634
25655
|
mercator.x,
|
|
25635
25656
|
mercator.y,
|
|
25636
|
-
(
|
|
25657
|
+
(_a = mercator.z) != null ? _a : 0,
|
|
25637
25658
|
1
|
|
25638
25659
|
);
|
|
25639
25660
|
if (!Number.isFinite(w) || w <= 0) {
|
|
@@ -25660,11 +25681,11 @@ const createProjectionHost = (params) => {
|
|
|
25660
25681
|
};
|
|
25661
25682
|
};
|
|
25662
25683
|
const createProjectionHostParamsFromMapLibre = (map) => {
|
|
25663
|
-
var
|
|
25684
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
25664
25685
|
const ensureFinite2 = (value) => typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
25665
25686
|
const centerLngLat = map.getCenter();
|
|
25666
25687
|
const transform = map.transform;
|
|
25667
|
-
const canvas = typeof map.getCanvas === "function" ? (
|
|
25688
|
+
const canvas = typeof map.getCanvas === "function" ? (_a = map.getCanvas()) != null ? _a : null : null;
|
|
25668
25689
|
if (!transform) {
|
|
25669
25690
|
return {
|
|
25670
25691
|
zoom: (_b = ensureFinite2(map.getZoom())) != null ? _b : 0,
|
|
@@ -25732,9 +25753,9 @@ const createFromLngLat = (wasm) => {
|
|
|
25732
25753
|
WASM_FromLngLat_RESULT_ELEMENT_COUNT
|
|
25733
25754
|
);
|
|
25734
25755
|
const fromLngLat = (location2) => {
|
|
25735
|
-
var
|
|
25756
|
+
var _a;
|
|
25736
25757
|
const { ptr, buffer } = resultHolder.prepare();
|
|
25737
|
-
wasm.fromLngLat(location2.lng, location2.lat, (
|
|
25758
|
+
wasm.fromLngLat(location2.lng, location2.lat, (_a = location2.z) != null ? _a : 0, ptr);
|
|
25738
25759
|
const x = buffer[0];
|
|
25739
25760
|
const y = buffer[1];
|
|
25740
25761
|
const z = buffer[2];
|
|
@@ -25761,13 +25782,13 @@ const createProject = (wasm, preparedState) => {
|
|
|
25761
25782
|
WASM_Project_RESULT_ELEMENT_COUNT
|
|
25762
25783
|
);
|
|
25763
25784
|
const project = (location2) => {
|
|
25764
|
-
var
|
|
25785
|
+
var _a;
|
|
25765
25786
|
const { ptr: matrixPtr } = matrixHolder.prepare();
|
|
25766
25787
|
const { ptr: resultPtr, buffer: result } = resultHolder.prepare();
|
|
25767
25788
|
if (wasm.project(
|
|
25768
25789
|
location2.lng,
|
|
25769
25790
|
location2.lat,
|
|
25770
|
-
(
|
|
25791
|
+
(_a = location2.z) != null ? _a : 0,
|
|
25771
25792
|
preparedState.worldSize,
|
|
25772
25793
|
matrixPtr,
|
|
25773
25794
|
resultPtr
|
|
@@ -25848,7 +25869,7 @@ const createCalculatePerspectiveRatio = (wasm, preparedState) => {
|
|
|
25848
25869
|
WASM_CalculatePerspectiveRatio_RESULT_ELEMENT_COUNT
|
|
25849
25870
|
);
|
|
25850
25871
|
const calculatePerspectiveRatio = (location2, cachedMercator) => {
|
|
25851
|
-
var
|
|
25872
|
+
var _a, _b;
|
|
25852
25873
|
if (cachedMercator) {
|
|
25853
25874
|
const { ptr: matrixPtr } = matrixHolder.prepare();
|
|
25854
25875
|
const { ptr: cachedMercatorPtr, buffer: cachedMercatorBuffer } = cachedMercatorHolder.prepare();
|
|
@@ -25859,7 +25880,7 @@ const createCalculatePerspectiveRatio = (wasm, preparedState) => {
|
|
|
25859
25880
|
if (wasm.calculatePerspectiveRatio(
|
|
25860
25881
|
location2.lng,
|
|
25861
25882
|
location2.lat,
|
|
25862
|
-
(
|
|
25883
|
+
(_a = location2.z) != null ? _a : 0,
|
|
25863
25884
|
cachedMercatorPtr,
|
|
25864
25885
|
preparedState.cameraToCenterDistance,
|
|
25865
25886
|
matrixPtr,
|
|
@@ -26057,7 +26078,7 @@ const collectDepthSortedItemsInternal = (projectionHost, zoom, zoomScaleFactor,
|
|
|
26057
26078
|
drawingBufferHeight,
|
|
26058
26079
|
pixelRatio
|
|
26059
26080
|
}) => {
|
|
26060
|
-
var
|
|
26081
|
+
var _a, _b, _c;
|
|
26061
26082
|
const itemsWithDepth = [];
|
|
26062
26083
|
const projectToClipSpace = (location2) => projectLngLatToClipSpace(projectionHost, location2, clipContext);
|
|
26063
26084
|
const unprojectPoint = (point) => {
|
|
@@ -26111,7 +26132,7 @@ const collectDepthSortedItemsInternal = (projectionHost, zoom, zoomScaleFactor,
|
|
|
26111
26132
|
clipContext,
|
|
26112
26133
|
resolveOrigin
|
|
26113
26134
|
};
|
|
26114
|
-
const anchorResolved = (
|
|
26135
|
+
const anchorResolved = (_a = imageEntry.anchor) != null ? _a : DEFAULT_ANCHOR;
|
|
26115
26136
|
const offsetResolved = resolveImageOffset$2(imageEntry);
|
|
26116
26137
|
const depthCenter = computeImageCenterXY(
|
|
26117
26138
|
spriteEntry,
|
|
@@ -26151,7 +26172,7 @@ const collectDepthSortedItemsInternal = (projectionHost, zoom, zoomScaleFactor,
|
|
|
26151
26172
|
offsetMeters
|
|
26152
26173
|
});
|
|
26153
26174
|
const baseLngLat = (() => {
|
|
26154
|
-
var
|
|
26175
|
+
var _a2;
|
|
26155
26176
|
if (imageEntry.originLocation !== void 0) {
|
|
26156
26177
|
const refImg = resolveOrigin(spriteEntry, imageEntry);
|
|
26157
26178
|
if (refImg) {
|
|
@@ -26159,7 +26180,7 @@ const collectDepthSortedItemsInternal = (projectionHost, zoom, zoomScaleFactor,
|
|
|
26159
26180
|
spriteEntry,
|
|
26160
26181
|
refImg,
|
|
26161
26182
|
centerParams,
|
|
26162
|
-
(
|
|
26183
|
+
(_a2 = imageEntry.originLocation.useResolvedAnchor) != null ? _a2 : false
|
|
26163
26184
|
);
|
|
26164
26185
|
const baseLngLatLike = projectionHost.unproject(baseCenter);
|
|
26165
26186
|
if (baseLngLatLike) {
|
|
@@ -26244,7 +26265,7 @@ const projectLngLatToClipSpace = (projectionHost, location2, context) => {
|
|
|
26244
26265
|
return [clipX, clipY, clipZ, clipW];
|
|
26245
26266
|
};
|
|
26246
26267
|
const computeImageCenterXY = (sprite, image, params, useResolvedAnchor) => {
|
|
26247
|
-
var
|
|
26268
|
+
var _a, _b, _c, _d, _e;
|
|
26248
26269
|
const {
|
|
26249
26270
|
originCenterCache,
|
|
26250
26271
|
projected,
|
|
@@ -26288,7 +26309,7 @@ const computeImageCenterXY = (sprite, image, params, useResolvedAnchor) => {
|
|
|
26288
26309
|
}
|
|
26289
26310
|
}
|
|
26290
26311
|
const totalRotDeg = Number.isFinite(image.displayedRotateDeg) ? image.displayedRotateDeg : normalizeAngleDeg(
|
|
26291
|
-
((
|
|
26312
|
+
((_a = image.resolvedBaseRotateDeg) != null ? _a : 0) + image.rotationCommandDeg
|
|
26292
26313
|
);
|
|
26293
26314
|
const imageScaleLocal = (_b = image.scale) != null ? _b : 1;
|
|
26294
26315
|
const imageResourceRef = imageResources[image.imageHandle];
|
|
@@ -26367,7 +26388,7 @@ const calculateWorldToMercatorScale = (projectionHost, base) => {
|
|
|
26367
26388
|
};
|
|
26368
26389
|
};
|
|
26369
26390
|
const prepareSurfaceShaderInputs = (projectionHost, params) => {
|
|
26370
|
-
var
|
|
26391
|
+
var _a;
|
|
26371
26392
|
const {
|
|
26372
26393
|
baseLngLat,
|
|
26373
26394
|
worldWidthMeters,
|
|
@@ -26404,7 +26425,7 @@ const prepareSurfaceShaderInputs = (projectionHost, params) => {
|
|
|
26404
26425
|
mercatorCenter: {
|
|
26405
26426
|
x: mercatorCenter.x,
|
|
26406
26427
|
y: mercatorCenter.y,
|
|
26407
|
-
z: (
|
|
26428
|
+
z: (_a = mercatorCenter.z) != null ? _a : 0
|
|
26408
26429
|
},
|
|
26409
26430
|
worldToMercatorScale,
|
|
26410
26431
|
halfSizeMeters,
|
|
@@ -26455,7 +26476,7 @@ const prepareDrawSpriteImageInternal = (projectionHost, item, zoom, zoomScaleFac
|
|
|
26455
26476
|
screenToClipOffsetX,
|
|
26456
26477
|
screenToClipOffsetY
|
|
26457
26478
|
}) => {
|
|
26458
|
-
var
|
|
26479
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
26459
26480
|
const spriteEntry = item.sprite;
|
|
26460
26481
|
const imageEntry = item.image;
|
|
26461
26482
|
const imageResource = item.resource;
|
|
@@ -26482,7 +26503,7 @@ const prepareDrawSpriteImageInternal = (projectionHost, item, zoom, zoomScaleFac
|
|
|
26482
26503
|
offsetY: identityOffsetY
|
|
26483
26504
|
};
|
|
26484
26505
|
let borderSizeScaleAdjustment = 1;
|
|
26485
|
-
const anchor = (
|
|
26506
|
+
const anchor = (_a = imageEntry.anchor) != null ? _a : DEFAULT_ANCHOR;
|
|
26486
26507
|
const offsetDef = resolveImageOffset$2(imageEntry);
|
|
26487
26508
|
const totalRotateDeg = Number.isFinite(imageEntry.displayedRotateDeg) ? imageEntry.displayedRotateDeg : normalizeAngleDeg(
|
|
26488
26509
|
((_b = imageEntry.resolvedBaseRotateDeg) != null ? _b : 0) + imageEntry.rotationCommandDeg
|
|
@@ -26539,22 +26560,22 @@ const prepareDrawSpriteImageInternal = (projectionHost, item, zoom, zoomScaleFac
|
|
|
26539
26560
|
}
|
|
26540
26561
|
}
|
|
26541
26562
|
const resolveBaseLocation = () => {
|
|
26542
|
-
var
|
|
26543
|
-
const
|
|
26563
|
+
var _a2, _b2, _c2;
|
|
26564
|
+
const fallback2 = spriteEntry.location.current;
|
|
26544
26565
|
if (imageEntry.originLocation !== void 0) {
|
|
26545
26566
|
const unprojected = projectionHost.unproject(baseProjected);
|
|
26546
26567
|
if (unprojected) {
|
|
26547
26568
|
return {
|
|
26548
26569
|
lng: unprojected.lng,
|
|
26549
26570
|
lat: unprojected.lat,
|
|
26550
|
-
z: (_b2 = (
|
|
26571
|
+
z: (_b2 = (_a2 = fallback2.z) != null ? _a2 : unprojected.z) != null ? _b2 : 0
|
|
26551
26572
|
};
|
|
26552
26573
|
}
|
|
26553
26574
|
}
|
|
26554
26575
|
return {
|
|
26555
|
-
lng:
|
|
26556
|
-
lat:
|
|
26557
|
-
z: (_c2 =
|
|
26576
|
+
lng: fallback2.lng,
|
|
26577
|
+
lat: fallback2.lat,
|
|
26578
|
+
z: (_c2 = fallback2.z) != null ? _c2 : 0
|
|
26558
26579
|
};
|
|
26559
26580
|
};
|
|
26560
26581
|
const baseLocation = resolveBaseLocation();
|
|
@@ -26903,10 +26924,10 @@ const prepareDrawSpriteImageInternal = (projectionHost, item, zoom, zoomScaleFac
|
|
|
26903
26924
|
};
|
|
26904
26925
|
};
|
|
26905
26926
|
const prepareDrawSpriteImages = (projectionHost, params) => {
|
|
26906
|
-
var
|
|
26927
|
+
var _a;
|
|
26907
26928
|
const originCenterCache = /* @__PURE__ */ new Map();
|
|
26908
26929
|
const zoom = projectionHost.getZoom();
|
|
26909
|
-
const resolvedScaling = (
|
|
26930
|
+
const resolvedScaling = (_a = params.resolvedScaling) != null ? _a : resolveScalingOptions({
|
|
26910
26931
|
metersPerPixel: params.baseMetersPerPixel,
|
|
26911
26932
|
spriteMinPixel: params.spriteMinPixel,
|
|
26912
26933
|
spriteMaxPixel: params.spriteMaxPixel,
|
|
@@ -26939,29 +26960,39 @@ const prepareDrawSpriteImages = (projectionHost, params) => {
|
|
|
26939
26960
|
}
|
|
26940
26961
|
return preparedItems;
|
|
26941
26962
|
};
|
|
26942
|
-
const
|
|
26943
|
-
const baseOpacity = clampOpacity(image.lastCommandOpacity);
|
|
26963
|
+
const resolveVisibilityLodMultiplier = (sprite, cameraDistanceMeters) => {
|
|
26944
26964
|
const threshold = sprite.visibilityDistanceMeters;
|
|
26945
26965
|
if (threshold === void 0 || !Number.isFinite(threshold) || threshold <= 0 || !Number.isFinite(cameraDistanceMeters)) {
|
|
26946
|
-
return
|
|
26966
|
+
return 1;
|
|
26947
26967
|
}
|
|
26948
|
-
return cameraDistanceMeters >= threshold ? 0 :
|
|
26968
|
+
return cameraDistanceMeters >= threshold ? 0 : 1;
|
|
26949
26969
|
};
|
|
26950
26970
|
const applyVisibilityDistanceLod = (preparedItems) => {
|
|
26971
|
+
var _a, _b, _c;
|
|
26951
26972
|
if (!preparedItems.length) {
|
|
26952
26973
|
return;
|
|
26953
26974
|
}
|
|
26954
26975
|
for (const prepared of preparedItems) {
|
|
26955
26976
|
const image = prepared.imageEntry;
|
|
26956
26977
|
const sprite = prepared.spriteEntry;
|
|
26957
|
-
const
|
|
26978
|
+
const lodMultiplier = resolveVisibilityLodMultiplier(
|
|
26958
26979
|
sprite,
|
|
26959
|
-
image,
|
|
26960
26980
|
prepared.cameraDistanceMeters
|
|
26961
26981
|
);
|
|
26962
|
-
|
|
26963
|
-
|
|
26982
|
+
const previousLod = (_a = image.lodOpacity) != null ? _a : 1;
|
|
26983
|
+
if (Math.abs(previousLod - lodMultiplier) <= OPACITY_TARGET_EPSILON) {
|
|
26984
|
+
continue;
|
|
26964
26985
|
}
|
|
26986
|
+
image.lodOpacity = lodMultiplier;
|
|
26987
|
+
const baseOpacity = (_b = image.opacity.interpolation.baseValue) != null ? _b : image.opacity.current;
|
|
26988
|
+
const combinedTarget = clampOpacity(
|
|
26989
|
+
baseOpacity * (sprite.opacityMultiplier || 1) * lodMultiplier
|
|
26990
|
+
);
|
|
26991
|
+
applyResolvedOpacityTarget(
|
|
26992
|
+
image,
|
|
26993
|
+
combinedTarget,
|
|
26994
|
+
(_c = image.opacity.interpolation.options) != null ? _c : null
|
|
26995
|
+
);
|
|
26965
26996
|
}
|
|
26966
26997
|
};
|
|
26967
26998
|
const syncPreparedOpacities = (preparedItems) => {
|
|
@@ -27008,12 +27039,12 @@ const defaultInterpolationEvaluationHandlers = {
|
|
|
27008
27039
|
evaluateSprite: (requests) => evaluateSpriteInterpolationsBatch(requests)
|
|
27009
27040
|
};
|
|
27010
27041
|
const applySpriteInterpolationEvaluations$1 = (workItems, evaluations, timestamp) => {
|
|
27011
|
-
var
|
|
27042
|
+
var _a;
|
|
27012
27043
|
let active = false;
|
|
27013
27044
|
for (let index = 0; index < workItems.length; index += 1) {
|
|
27014
27045
|
const item = workItems[index];
|
|
27015
27046
|
const { sprite, state } = item;
|
|
27016
|
-
const evaluation = (
|
|
27047
|
+
const evaluation = (_a = evaluations[index]) != null ? _a : evaluateInterpolation({
|
|
27017
27048
|
state,
|
|
27018
27049
|
timestamp
|
|
27019
27050
|
});
|
|
@@ -27025,39 +27056,37 @@ const applySpriteInterpolationEvaluations$1 = (workItems, evaluations, timestamp
|
|
|
27025
27056
|
sprite.location.current = cloneSpriteLocation(state.to);
|
|
27026
27057
|
sprite.location.from = void 0;
|
|
27027
27058
|
sprite.location.to = void 0;
|
|
27028
|
-
sprite.
|
|
27059
|
+
sprite.location.interpolation.state = null;
|
|
27029
27060
|
} else {
|
|
27030
27061
|
active = true;
|
|
27031
27062
|
}
|
|
27032
27063
|
}
|
|
27033
27064
|
return active;
|
|
27034
27065
|
};
|
|
27035
|
-
const ensureOpacityInterpolationTarget = (image) => {
|
|
27036
|
-
var
|
|
27066
|
+
const ensureOpacityInterpolationTarget = (sprite, image) => {
|
|
27067
|
+
var _a, _b, _c;
|
|
27037
27068
|
const target = clampOpacity(
|
|
27038
|
-
(
|
|
27069
|
+
((_a = image.opacity.interpolation.baseValue) != null ? _a : image.opacity.current) * (sprite.opacityMultiplier || 1) * ((_b = image.lodOpacity) != null ? _b : 1)
|
|
27039
27070
|
);
|
|
27040
|
-
const interpolationState = image.
|
|
27041
|
-
const currentStateTarget = interpolationState ? clampOpacity(interpolationState.
|
|
27071
|
+
const interpolationState = image.opacity.interpolation.state;
|
|
27072
|
+
const currentStateTarget = interpolationState ? clampOpacity((_c = interpolationState.pathTarget) != null ? _c : interpolationState.to) : image.opacity.current;
|
|
27042
27073
|
if (interpolationState) {
|
|
27043
27074
|
if (Math.abs(currentStateTarget - target) <= OPACITY_TARGET_EPSILON) {
|
|
27044
27075
|
return;
|
|
27045
27076
|
}
|
|
27046
27077
|
} else if (Math.abs(image.opacity.current - target) <= OPACITY_TARGET_EPSILON) {
|
|
27047
|
-
image.lodLastCommandOpacity = target;
|
|
27048
27078
|
return;
|
|
27049
27079
|
}
|
|
27050
|
-
const options = image.
|
|
27080
|
+
const options = image.opacity.interpolation.options;
|
|
27051
27081
|
if (options && options.durationMs > 0) {
|
|
27052
27082
|
const { state, requiresInterpolation } = createDistanceInterpolationState({
|
|
27053
27083
|
currentValue: clampOpacity(image.opacity.current),
|
|
27054
27084
|
targetValue: target,
|
|
27055
|
-
previousCommandValue: image.
|
|
27085
|
+
previousCommandValue: image.opacity.interpolation.lastCommandValue,
|
|
27056
27086
|
options
|
|
27057
27087
|
});
|
|
27058
|
-
image.lodLastCommandOpacity = target;
|
|
27059
27088
|
if (requiresInterpolation) {
|
|
27060
|
-
image.
|
|
27089
|
+
image.opacity.interpolation.state = state;
|
|
27061
27090
|
image.opacity.from = image.opacity.current;
|
|
27062
27091
|
image.opacity.to = target;
|
|
27063
27092
|
return;
|
|
@@ -27066,11 +27095,12 @@ const ensureOpacityInterpolationTarget = (image) => {
|
|
|
27066
27095
|
image.opacity.current = target;
|
|
27067
27096
|
image.opacity.from = void 0;
|
|
27068
27097
|
image.opacity.to = void 0;
|
|
27069
|
-
image.
|
|
27070
|
-
image.
|
|
27098
|
+
image.opacity.interpolation.state = null;
|
|
27099
|
+
image.opacity.interpolation.lastCommandValue = target;
|
|
27100
|
+
image.opacity.interpolation.targetValue = target;
|
|
27071
27101
|
};
|
|
27072
27102
|
const processInterpolationsInternal = (params, handlers = defaultInterpolationEvaluationHandlers) => {
|
|
27073
|
-
var
|
|
27103
|
+
var _a;
|
|
27074
27104
|
const evaluationHandlers = handlers != null ? handlers : defaultInterpolationEvaluationHandlers;
|
|
27075
27105
|
const { sprites, timestamp } = params;
|
|
27076
27106
|
if (!sprites.length) {
|
|
@@ -27084,13 +27114,14 @@ const processInterpolationsInternal = (params, handlers = defaultInterpolationEv
|
|
|
27084
27114
|
const spriteInterpolationWorkItems = [];
|
|
27085
27115
|
let hasActiveInterpolation = false;
|
|
27086
27116
|
for (const sprite of sprites) {
|
|
27087
|
-
const
|
|
27117
|
+
const locationInterpolation = sprite.location.interpolation;
|
|
27118
|
+
const state = locationInterpolation.state;
|
|
27088
27119
|
if (state) {
|
|
27089
27120
|
spriteInterpolationWorkItems.push({ sprite, state });
|
|
27090
27121
|
}
|
|
27091
27122
|
sprite.images.forEach((orderMap) => {
|
|
27092
27123
|
orderMap.forEach((image) => {
|
|
27093
|
-
const hasOffsetMetersInterpolation = image.
|
|
27124
|
+
const hasOffsetMetersInterpolation = image.offset.offsetMeters.interpolation.state !== null;
|
|
27094
27125
|
if (hasOffsetMetersInterpolation) {
|
|
27095
27126
|
collectDistanceInterpolationWorkItems(
|
|
27096
27127
|
image,
|
|
@@ -27100,9 +27131,9 @@ const processInterpolationsInternal = (params, handlers = defaultInterpolationEv
|
|
|
27100
27131
|
}
|
|
27101
27132
|
);
|
|
27102
27133
|
}
|
|
27103
|
-
ensureOpacityInterpolationTarget(image);
|
|
27104
|
-
const hasOpacityInterpolation = image.
|
|
27105
|
-
const hasDegreeInterpolation = image.
|
|
27134
|
+
ensureOpacityInterpolationTarget(sprite, image);
|
|
27135
|
+
const hasOpacityInterpolation = image.opacity.interpolation.state !== null;
|
|
27136
|
+
const hasDegreeInterpolation = image.rotateDeg.interpolation.state !== null || image.offset.offsetDeg.interpolation.state !== null;
|
|
27106
27137
|
if (hasDegreeInterpolation) {
|
|
27107
27138
|
collectDegreeInterpolationWorkItems(
|
|
27108
27139
|
image,
|
|
@@ -27148,7 +27179,7 @@ const processInterpolationsInternal = (params, handlers = defaultInterpolationEv
|
|
|
27148
27179
|
})) : [];
|
|
27149
27180
|
const hasRequests = distanceRequests.length > 0 || degreeRequests.length > 0 || spriteRequests.length > 0;
|
|
27150
27181
|
if (hasRequests) {
|
|
27151
|
-
(
|
|
27182
|
+
(_a = evaluationHandlers.prepare) == null ? void 0 : _a.call(evaluationHandlers, {
|
|
27152
27183
|
distance: distanceRequests,
|
|
27153
27184
|
degree: degreeRequests,
|
|
27154
27185
|
sprite: spriteRequests
|
|
@@ -27190,7 +27221,7 @@ const processInterpolationsInternal = (params, handlers = defaultInterpolationEv
|
|
|
27190
27221
|
};
|
|
27191
27222
|
};
|
|
27192
27223
|
const processOpacityInterpolationsAfterPreparation = (params, preparedItems, handlers = defaultInterpolationEvaluationHandlers) => {
|
|
27193
|
-
var
|
|
27224
|
+
var _a;
|
|
27194
27225
|
const evaluationHandlers = handlers != null ? handlers : defaultInterpolationEvaluationHandlers;
|
|
27195
27226
|
const { sprites, timestamp } = params;
|
|
27196
27227
|
if (!sprites.length) {
|
|
@@ -27203,8 +27234,8 @@ const processOpacityInterpolationsAfterPreparation = (params, preparedItems, han
|
|
|
27203
27234
|
for (const sprite of sprites) {
|
|
27204
27235
|
sprite.images.forEach((orderMap) => {
|
|
27205
27236
|
orderMap.forEach((image) => {
|
|
27206
|
-
ensureOpacityInterpolationTarget(image);
|
|
27207
|
-
if (image.
|
|
27237
|
+
ensureOpacityInterpolationTarget(sprite, image);
|
|
27238
|
+
if (image.opacity.interpolation.state !== null) {
|
|
27208
27239
|
collectDistanceInterpolationWorkItems(image, opacityWorkItems, {
|
|
27209
27240
|
includeOffsetMeters: false
|
|
27210
27241
|
});
|
|
@@ -27223,7 +27254,7 @@ const processOpacityInterpolationsAfterPreparation = (params, preparedItems, han
|
|
|
27223
27254
|
timestamp
|
|
27224
27255
|
})) : [];
|
|
27225
27256
|
if (opacityRequests.length > 0) {
|
|
27226
|
-
(
|
|
27257
|
+
(_a = evaluationHandlers.prepare) == null ? void 0 : _a.call(evaluationHandlers, {
|
|
27227
27258
|
distance: opacityRequests,
|
|
27228
27259
|
degree: [],
|
|
27229
27260
|
sprite: []
|
|
@@ -27295,8 +27326,8 @@ const EASING_PRESET_IDS = {
|
|
|
27295
27326
|
back: 9
|
|
27296
27327
|
};
|
|
27297
27328
|
const encodeEasingPreset = (preset) => {
|
|
27298
|
-
var
|
|
27299
|
-
const id = (
|
|
27329
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
27330
|
+
const id = (_a = EASING_PRESET_IDS[preset.type]) != null ? _a : -1;
|
|
27300
27331
|
switch (preset.type) {
|
|
27301
27332
|
case "ease": {
|
|
27302
27333
|
const mode = preset.mode === "in" ? 1 : preset.mode === "out" ? 2 : (
|
|
@@ -27369,8 +27400,9 @@ const resolveImageOffset$1 = (image) => {
|
|
|
27369
27400
|
};
|
|
27370
27401
|
};
|
|
27371
27402
|
const encodeDistanceInterpolationRequest = (buffer, cursor, request) => {
|
|
27403
|
+
var _a;
|
|
27372
27404
|
const { state, timestamp } = request;
|
|
27373
|
-
const preset = encodeEasingPreset(state.
|
|
27405
|
+
const preset = encodeEasingPreset(state.easingParam);
|
|
27374
27406
|
if (preset.id < 0) {
|
|
27375
27407
|
throw new Error(
|
|
27376
27408
|
"Distance interpolation request missing preset easing function."
|
|
@@ -27378,8 +27410,8 @@ const encodeDistanceInterpolationRequest = (buffer, cursor, request) => {
|
|
|
27378
27410
|
}
|
|
27379
27411
|
buffer[cursor++] = state.durationMs;
|
|
27380
27412
|
buffer[cursor++] = state.from;
|
|
27413
|
+
buffer[cursor++] = (_a = state.pathTarget) != null ? _a : state.to;
|
|
27381
27414
|
buffer[cursor++] = state.to;
|
|
27382
|
-
buffer[cursor++] = state.finalValue;
|
|
27383
27415
|
buffer[cursor++] = state.startTimestamp;
|
|
27384
27416
|
buffer[cursor++] = timestamp;
|
|
27385
27417
|
buffer[cursor++] = preset.id;
|
|
@@ -27389,8 +27421,9 @@ const encodeDistanceInterpolationRequest = (buffer, cursor, request) => {
|
|
|
27389
27421
|
return cursor;
|
|
27390
27422
|
};
|
|
27391
27423
|
const encodeDegreeInterpolationRequest = (buffer, cursor, request) => {
|
|
27424
|
+
var _a;
|
|
27392
27425
|
const { state, timestamp } = request;
|
|
27393
|
-
const preset = encodeEasingPreset(state.
|
|
27426
|
+
const preset = encodeEasingPreset(state.easingParam);
|
|
27394
27427
|
if (preset.id < 0) {
|
|
27395
27428
|
throw new Error(
|
|
27396
27429
|
"Degree interpolation request missing preset easing function."
|
|
@@ -27398,8 +27431,8 @@ const encodeDegreeInterpolationRequest = (buffer, cursor, request) => {
|
|
|
27398
27431
|
}
|
|
27399
27432
|
buffer[cursor++] = state.durationMs;
|
|
27400
27433
|
buffer[cursor++] = state.from;
|
|
27434
|
+
buffer[cursor++] = (_a = state.pathTarget) != null ? _a : state.to;
|
|
27401
27435
|
buffer[cursor++] = state.to;
|
|
27402
|
-
buffer[cursor++] = state.finalValue;
|
|
27403
27436
|
buffer[cursor++] = state.startTimestamp;
|
|
27404
27437
|
buffer[cursor++] = timestamp;
|
|
27405
27438
|
buffer[cursor++] = preset.id;
|
|
@@ -27409,9 +27442,9 @@ const encodeDegreeInterpolationRequest = (buffer, cursor, request) => {
|
|
|
27409
27442
|
return cursor;
|
|
27410
27443
|
};
|
|
27411
27444
|
const encodeSpriteInterpolationRequest = (buffer, cursor, request) => {
|
|
27412
|
-
var
|
|
27445
|
+
var _a, _b;
|
|
27413
27446
|
const { state, timestamp } = request;
|
|
27414
|
-
const preset = encodeEasingPreset(state.
|
|
27447
|
+
const preset = encodeEasingPreset(state.easingParam);
|
|
27415
27448
|
if (preset.id < 0) {
|
|
27416
27449
|
throw new Error(
|
|
27417
27450
|
"Sprite interpolation request missing preset easing function."
|
|
@@ -27421,7 +27454,7 @@ const encodeSpriteInterpolationRequest = (buffer, cursor, request) => {
|
|
|
27421
27454
|
buffer[cursor++] = state.durationMs;
|
|
27422
27455
|
buffer[cursor++] = state.from.lng;
|
|
27423
27456
|
buffer[cursor++] = state.from.lat;
|
|
27424
|
-
buffer[cursor++] = (
|
|
27457
|
+
buffer[cursor++] = (_a = state.from.z) != null ? _a : 0;
|
|
27425
27458
|
buffer[cursor++] = state.to.lng;
|
|
27426
27459
|
buffer[cursor++] = state.to.lat;
|
|
27427
27460
|
buffer[cursor++] = (_b = state.to.z) != null ? _b : 0;
|
|
@@ -27544,12 +27577,12 @@ const processInterpolationsViaWasm = (wasm, requests) => {
|
|
|
27544
27577
|
}
|
|
27545
27578
|
};
|
|
27546
27579
|
const applySpriteInterpolationEvaluations = (workItems, evaluations, timestamp) => {
|
|
27547
|
-
var
|
|
27580
|
+
var _a;
|
|
27548
27581
|
let active = false;
|
|
27549
27582
|
for (let index = 0; index < workItems.length; index += 1) {
|
|
27550
27583
|
const item = workItems[index];
|
|
27551
27584
|
const { sprite, state } = item;
|
|
27552
|
-
const evaluation = (
|
|
27585
|
+
const evaluation = (_a = evaluations[index]) != null ? _a : evaluateInterpolation({
|
|
27553
27586
|
state,
|
|
27554
27587
|
timestamp
|
|
27555
27588
|
});
|
|
@@ -27561,7 +27594,7 @@ const applySpriteInterpolationEvaluations = (workItems, evaluations, timestamp)
|
|
|
27561
27594
|
sprite.location.current = cloneSpriteLocation(state.to);
|
|
27562
27595
|
sprite.location.from = void 0;
|
|
27563
27596
|
sprite.location.to = void 0;
|
|
27564
|
-
sprite.
|
|
27597
|
+
sprite.location.interpolation.state = null;
|
|
27565
27598
|
} else {
|
|
27566
27599
|
active = true;
|
|
27567
27600
|
}
|
|
@@ -27582,7 +27615,8 @@ const processInterpolationsWithWasm = (wasm, params) => {
|
|
|
27582
27615
|
const processedSprites = [];
|
|
27583
27616
|
let hasActiveInterpolation = false;
|
|
27584
27617
|
for (const sprite of sprites) {
|
|
27585
|
-
const
|
|
27618
|
+
const locationInterpolation = sprite.location.interpolation;
|
|
27619
|
+
const state = locationInterpolation.state;
|
|
27586
27620
|
const hasSpriteInterpolation = state !== null;
|
|
27587
27621
|
if (!hasSpriteInterpolation && !sprite.interpolationDirty) {
|
|
27588
27622
|
continue;
|
|
@@ -27601,7 +27635,7 @@ const processInterpolationsWithWasm = (wasm, params) => {
|
|
|
27601
27635
|
if (!imageHasInterpolations) {
|
|
27602
27636
|
return;
|
|
27603
27637
|
}
|
|
27604
|
-
const hasOffsetMetersInterpolation = image.
|
|
27638
|
+
const hasOffsetMetersInterpolation = image.offset.offsetMeters.interpolation.state !== null;
|
|
27605
27639
|
if (hasOffsetMetersInterpolation) {
|
|
27606
27640
|
collectDistanceInterpolationWorkItems(
|
|
27607
27641
|
image,
|
|
@@ -27611,8 +27645,8 @@ const processInterpolationsWithWasm = (wasm, params) => {
|
|
|
27611
27645
|
}
|
|
27612
27646
|
);
|
|
27613
27647
|
}
|
|
27614
|
-
const hasOpacityInterpolation = image.
|
|
27615
|
-
const hasDegreeInterpolation = image.
|
|
27648
|
+
const hasOpacityInterpolation = image.opacity.interpolation.state !== null;
|
|
27649
|
+
const hasDegreeInterpolation = image.rotateDeg.interpolation.state !== null || image.offset.offsetDeg.interpolation.state !== null;
|
|
27616
27650
|
if (hasDegreeInterpolation) {
|
|
27617
27651
|
collectDegreeInterpolationWorkItems(
|
|
27618
27652
|
image,
|
|
@@ -27749,7 +27783,7 @@ const RESULT_COMMON_ITEM_LENGTH = 4 + // spriteIndex,imageIndex,resourceIndex,op
|
|
|
27749
27783
|
3 + // useShaderSurface, surfaceClipEnabled, useShaderBillboard
|
|
27750
27784
|
RESULT_BILLBOARD_UNIFORM_LENGTH + 1;
|
|
27751
27785
|
const RESULT_ITEM_STRIDE = RESULT_COMMON_ITEM_LENGTH + RESULT_VERTEX_COMPONENT_LENGTH + RESULT_HIT_TEST_COMPONENT_LENGTH + RESULT_SURFACE_BLOCK_LENGTH;
|
|
27752
|
-
const toFiniteOr = (value,
|
|
27786
|
+
const toFiniteOr = (value, fallback2) => Number.isFinite(value) ? value : fallback2;
|
|
27753
27787
|
const boolToNumber = (value) => value ? 1 : 0;
|
|
27754
27788
|
const modeToNumber = (mode) => mode === "surface" ? 0 : 1;
|
|
27755
27789
|
const computeInputElementCount = (resourceCount, spriteCount, resultItemCount) => {
|
|
@@ -27771,17 +27805,17 @@ const ensureHitTestCorners = (imageEntry) => {
|
|
|
27771
27805
|
return imageEntry.hitTestCorners;
|
|
27772
27806
|
};
|
|
27773
27807
|
const converToPreparedDrawImageParams = (state, deps, resultBuffer) => {
|
|
27774
|
-
var
|
|
27808
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa;
|
|
27775
27809
|
const { buffer } = resultBuffer.prepare();
|
|
27776
27810
|
if (buffer.length < RESULT_HEADER_LENGTH) {
|
|
27777
27811
|
return [];
|
|
27778
27812
|
}
|
|
27779
27813
|
const preparedCount = Math.max(
|
|
27780
27814
|
0,
|
|
27781
|
-
Math.trunc((
|
|
27815
|
+
Math.trunc((_a = buffer[
|
|
27782
27816
|
0
|
|
27783
27817
|
/* PREPARED_COUNT */
|
|
27784
|
-
]) != null ?
|
|
27818
|
+
]) != null ? _a : 0)
|
|
27785
27819
|
);
|
|
27786
27820
|
const itemStride = Math.trunc((_b = buffer[
|
|
27787
27821
|
1
|
|
@@ -27811,12 +27845,12 @@ const converToPreparedDrawImageParams = (state, deps, resultBuffer) => {
|
|
|
27811
27845
|
return altitude / circumferenceAtLatitude2;
|
|
27812
27846
|
};
|
|
27813
27847
|
const calculatePerspectiveRatio = (location2) => {
|
|
27814
|
-
var
|
|
27848
|
+
var _a2, _b2, _c2;
|
|
27815
27849
|
const { mercatorMatrix, cameraToCenterDistance } = state.preparedProjection;
|
|
27816
27850
|
if (!mercatorMatrix || !Number.isFinite(cameraToCenterDistance)) {
|
|
27817
27851
|
return 1;
|
|
27818
27852
|
}
|
|
27819
|
-
const lng = (
|
|
27853
|
+
const lng = (_a2 = location2.lng) != null ? _a2 : 0;
|
|
27820
27854
|
const lat = clampLatitude((_b2 = location2.lat) != null ? _b2 : 0);
|
|
27821
27855
|
const altitude = (_c2 = location2.z) != null ? _c2 : 0;
|
|
27822
27856
|
const mercatorX = (180 + lng) / 360;
|
|
@@ -27840,10 +27874,10 @@ const converToPreparedDrawImageParams = (state, deps, resultBuffer) => {
|
|
|
27840
27874
|
}
|
|
27841
27875
|
};
|
|
27842
27876
|
const resolveEffectivePixelsPerMeter = (location2) => {
|
|
27843
|
-
var
|
|
27877
|
+
var _a2;
|
|
27844
27878
|
const metersPerPixelAtLat = calculateMetersPerPixelAtLatitude(
|
|
27845
27879
|
state.preparedProjection.zoom,
|
|
27846
|
-
(
|
|
27880
|
+
(_a2 = location2.lat) != null ? _a2 : 0
|
|
27847
27881
|
);
|
|
27848
27882
|
const perspectiveRatio = calculatePerspectiveRatio(location2);
|
|
27849
27883
|
const effective = calculateEffectivePixelsPerMeter(
|
|
@@ -28119,13 +28153,13 @@ const convertToWasmProjectionState = (wasm, params, deps) => {
|
|
|
28119
28153
|
let resourceRefs = [];
|
|
28120
28154
|
let state;
|
|
28121
28155
|
const writeMatrix = (buffer, start, matrix) => {
|
|
28122
|
-
var
|
|
28156
|
+
var _a;
|
|
28123
28157
|
for (let i = 0; i < 16; i++) {
|
|
28124
|
-
buffer[start + i] = matrix ? (
|
|
28158
|
+
buffer[start + i] = matrix ? (_a = matrix[i]) != null ? _a : 0 : 0;
|
|
28125
28159
|
}
|
|
28126
28160
|
};
|
|
28127
28161
|
const prepareInputBuffer = (callParams) => {
|
|
28128
|
-
var
|
|
28162
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
28129
28163
|
const { bucket } = callParams;
|
|
28130
28164
|
const resultItemCount = bucket.length;
|
|
28131
28165
|
const spriteHandleSet = /* @__PURE__ */ new Set();
|
|
@@ -28250,7 +28284,7 @@ const convertToWasmProjectionState = (wasm, params, deps) => {
|
|
|
28250
28284
|
frameConstView[fcCursor++] = EPS_NDC;
|
|
28251
28285
|
frameConstView[fcCursor++] = boolToNumber(ENABLE_NDC_BIAS_SURFACE);
|
|
28252
28286
|
const cameraLocation = preparedProjection.cameraLocation;
|
|
28253
|
-
frameConstView[fcCursor++] = (
|
|
28287
|
+
frameConstView[fcCursor++] = (_a = cameraLocation == null ? void 0 : cameraLocation.lng) != null ? _a : 0;
|
|
28254
28288
|
frameConstView[fcCursor++] = (_b = cameraLocation == null ? void 0 : cameraLocation.lat) != null ? _b : 0;
|
|
28255
28289
|
frameConstView[fcCursor++] = (_c = cameraLocation == null ? void 0 : cameraLocation.z) != null ? _c : 0;
|
|
28256
28290
|
state.lastFrameParams = {
|
|
@@ -28298,7 +28332,7 @@ const convertToWasmProjectionState = (wasm, params, deps) => {
|
|
|
28298
28332
|
}
|
|
28299
28333
|
cursor = spriteOffset;
|
|
28300
28334
|
spriteHandles.forEach((handle) => {
|
|
28301
|
-
var
|
|
28335
|
+
var _a2, _b2;
|
|
28302
28336
|
const sprite = spriteByHandle.get(handle);
|
|
28303
28337
|
if (!sprite) {
|
|
28304
28338
|
return;
|
|
@@ -28307,7 +28341,7 @@ const convertToWasmProjectionState = (wasm, params, deps) => {
|
|
|
28307
28341
|
const mercator = sprite.cachedMercator;
|
|
28308
28342
|
parameterBuffer[cursor++] = location2.lng;
|
|
28309
28343
|
parameterBuffer[cursor++] = location2.lat;
|
|
28310
|
-
parameterBuffer[cursor++] = (
|
|
28344
|
+
parameterBuffer[cursor++] = (_a2 = location2.z) != null ? _a2 : 0;
|
|
28311
28345
|
parameterBuffer[cursor++] = mercator.x;
|
|
28312
28346
|
parameterBuffer[cursor++] = mercator.y;
|
|
28313
28347
|
parameterBuffer[cursor++] = (_b2 = mercator.z) != null ? _b2 : 0;
|
|
@@ -28316,10 +28350,10 @@ const convertToWasmProjectionState = (wasm, params, deps) => {
|
|
|
28316
28350
|
const originTargetIndices = (_g = (_f = callParams.bucketBuffers) == null ? void 0 : _f.originTargetIndices) != null ? _g : null;
|
|
28317
28351
|
cursor = itemOffset;
|
|
28318
28352
|
bucket.forEach(([sprite, image], index) => {
|
|
28319
|
-
var
|
|
28353
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k;
|
|
28320
28354
|
const imageHandle = image.imageHandle;
|
|
28321
28355
|
const spriteHandle = sprite.handle;
|
|
28322
|
-
const originKeyCandidate = (
|
|
28356
|
+
const originKeyCandidate = (_a2 = originReferenceKeys == null ? void 0 : originReferenceKeys[index]) != null ? _a2 : image.originReferenceKey;
|
|
28323
28357
|
const originKey = originKeyCandidate !== void 0 && originKeyCandidate !== SPRITE_ORIGIN_REFERENCE_KEY_NONE ? originKeyCandidate : originReference.encodeKey(image.subLayer, image.order);
|
|
28324
28358
|
const originIndex = (_b2 = originTargetIndices == null ? void 0 : originTargetIndices[index]) != null ? _b2 : image.originRenderTargetIndex;
|
|
28325
28359
|
const originLocation = image.originLocation;
|
|
@@ -28862,9 +28896,9 @@ const createAtlasManager = (options) => {
|
|
|
28862
28896
|
return removed;
|
|
28863
28897
|
},
|
|
28864
28898
|
getImagePlacement: (id) => {
|
|
28865
|
-
var
|
|
28899
|
+
var _a;
|
|
28866
28900
|
const entry = images.get(id);
|
|
28867
|
-
return (
|
|
28901
|
+
return (_a = entry == null ? void 0 : entry.placement) != null ? _a : null;
|
|
28868
28902
|
},
|
|
28869
28903
|
getPages: () => {
|
|
28870
28904
|
return pages.slice();
|
|
@@ -29016,8 +29050,8 @@ const rectContainsRectInclusive = (container, target) => container.x0 <= target.
|
|
|
29016
29050
|
const rectsOverlapInclusive = (a, b) => !(a.x1 < b.x0 || a.x0 > b.x1 || a.y1 < b.y0 || a.y0 > b.y1);
|
|
29017
29051
|
const rectEquals = (a, b) => a.x0 === b.x0 && a.y0 === b.y0 && a.x1 === b.x1 && a.y1 === b.y1;
|
|
29018
29052
|
const createLooseQuadTree = (options) => {
|
|
29019
|
-
var
|
|
29020
|
-
const maxItemsPerNode = (
|
|
29053
|
+
var _a, _b, _c;
|
|
29054
|
+
const maxItemsPerNode = (_a = options.maxItemsPerNode) != null ? _a : DEFAULT_MAX_ITEMS_PER_NODE;
|
|
29021
29055
|
const maxDepth = (_b = options.maxDepth) != null ? _b : DEFAULT_MAX_DEPTH;
|
|
29022
29056
|
const looseness = (_c = options.looseness) != null ? _c : DEFAULT_LOOSENESS;
|
|
29023
29057
|
if (maxItemsPerNode <= 0) {
|
|
@@ -29299,7 +29333,7 @@ const createHitTestController = ({
|
|
|
29299
29333
|
return rectFromLngLatPoints([cornerNE, cornerSW]);
|
|
29300
29334
|
};
|
|
29301
29335
|
const estimateSurfaceImageBounds = (projectionHost, sprite, image) => {
|
|
29302
|
-
var
|
|
29336
|
+
var _a, _b, _c;
|
|
29303
29337
|
const imageResource = images.get(image.imageId);
|
|
29304
29338
|
if (!imageResource) {
|
|
29305
29339
|
return null;
|
|
@@ -29327,7 +29361,7 @@ const createHitTestController = ({
|
|
|
29327
29361
|
if (!Number.isFinite(effectivePixelsPerMeter) || effectivePixelsPerMeter <= 0) {
|
|
29328
29362
|
return null;
|
|
29329
29363
|
}
|
|
29330
|
-
const imageScale = (
|
|
29364
|
+
const imageScale = (_a = image.scale) != null ? _a : 1;
|
|
29331
29365
|
const baseMetersPerPixel = scaling.metersPerPixel;
|
|
29332
29366
|
const spriteMinPixel = scaling.spriteMinPixel;
|
|
29333
29367
|
const spriteMaxPixel = scaling.spriteMaxPixel;
|
|
@@ -29370,7 +29404,7 @@ const createHitTestController = ({
|
|
|
29370
29404
|
return rectFromLngLatPoints(corners);
|
|
29371
29405
|
};
|
|
29372
29406
|
const estimateBillboardImageBounds = (projectionHost, sprite, image) => {
|
|
29373
|
-
var
|
|
29407
|
+
var _a, _b;
|
|
29374
29408
|
const imageResource = images.get(image.imageId);
|
|
29375
29409
|
if (!imageResource) {
|
|
29376
29410
|
return null;
|
|
@@ -29401,7 +29435,7 @@ const createHitTestController = ({
|
|
|
29401
29435
|
const baseMetersPerPixel = scaling.metersPerPixel;
|
|
29402
29436
|
const spriteMinPixel = scaling.spriteMinPixel;
|
|
29403
29437
|
const spriteMaxPixel = scaling.spriteMaxPixel;
|
|
29404
|
-
const imageScale = (
|
|
29438
|
+
const imageScale = (_a = image.scale) != null ? _a : 1;
|
|
29405
29439
|
const totalRotateDeg = Number.isFinite(image.displayedRotateDeg) ? image.displayedRotateDeg : normalizeAngleDeg(
|
|
29406
29440
|
((_b = image.resolvedBaseRotateDeg) != null ? _b : 0) + image.rotationCommandDeg
|
|
29407
29441
|
);
|
|
@@ -29678,7 +29712,7 @@ const createHitTestController = ({
|
|
|
29678
29712
|
return findTopmostHitEntryLinear(point);
|
|
29679
29713
|
};
|
|
29680
29714
|
const resolveScreenPointFromEvent = (nativeEvent, canvasElement) => {
|
|
29681
|
-
var
|
|
29715
|
+
var _a, _b, _c;
|
|
29682
29716
|
if (!canvasElement) {
|
|
29683
29717
|
return void 0;
|
|
29684
29718
|
}
|
|
@@ -29689,7 +29723,7 @@ const createHitTestController = ({
|
|
|
29689
29723
|
});
|
|
29690
29724
|
if ("changedTouches" in nativeEvent) {
|
|
29691
29725
|
const touchEvent = nativeEvent;
|
|
29692
|
-
const touch = (_c = (
|
|
29726
|
+
const touch = (_c = (_a = touchEvent.changedTouches) == null ? void 0 : _a[0]) != null ? _c : (_b = touchEvent.touches) == null ? void 0 : _b[0];
|
|
29693
29727
|
if (!touch) {
|
|
29694
29728
|
return void 0;
|
|
29695
29729
|
}
|
|
@@ -29799,19 +29833,19 @@ const resolveTextAlign = (align) => {
|
|
|
29799
29833
|
}
|
|
29800
29834
|
};
|
|
29801
29835
|
const resolveFontStyle = (style) => style === "italic" ? "italic" : DEFAULT_TEXT_GLYPH_FONT_STYLE;
|
|
29802
|
-
const resolvePositiveFinite = (value,
|
|
29836
|
+
const resolvePositiveFinite = (value, fallback2) => {
|
|
29803
29837
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
29804
|
-
return
|
|
29838
|
+
return fallback2;
|
|
29805
29839
|
}
|
|
29806
|
-
return value > 0 ? value :
|
|
29840
|
+
return value > 0 ? value : fallback2;
|
|
29807
29841
|
};
|
|
29808
|
-
const resolveNonNegativeFinite = (value,
|
|
29842
|
+
const resolveNonNegativeFinite = (value, fallback2 = 0) => {
|
|
29809
29843
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
29810
|
-
return
|
|
29844
|
+
return fallback2;
|
|
29811
29845
|
}
|
|
29812
|
-
return value >= 0 ? value :
|
|
29846
|
+
return value >= 0 ? value : fallback2;
|
|
29813
29847
|
};
|
|
29814
|
-
const resolveFiniteOrDefault = (value,
|
|
29848
|
+
const resolveFiniteOrDefault = (value, fallback2) => typeof value === "number" && Number.isFinite(value) ? value : fallback2;
|
|
29815
29849
|
const resolveRenderPixelRatio = (value) => {
|
|
29816
29850
|
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
29817
29851
|
return DEFAULT_TEXT_GLYPH_RENDER_PIXEL_RATIO;
|
|
@@ -29946,7 +29980,7 @@ const drawTextWithLetterSpacing = (ctx, text, startX, y, letterSpacing) => {
|
|
|
29946
29980
|
}
|
|
29947
29981
|
};
|
|
29948
29982
|
const resolveTextGlyphOptions = (options, preferredLineHeight) => {
|
|
29949
|
-
var
|
|
29983
|
+
var _a, _b, _c;
|
|
29950
29984
|
const fallbackFontSize = typeof preferredLineHeight === "number" && preferredLineHeight > 0 ? (
|
|
29951
29985
|
// When a preferred line height is provided, use it as the baseline font size.
|
|
29952
29986
|
preferredLineHeight
|
|
@@ -29959,7 +29993,7 @@ const resolveTextGlyphOptions = (options, preferredLineHeight) => {
|
|
|
29959
29993
|
fallbackFontSize
|
|
29960
29994
|
);
|
|
29961
29995
|
return {
|
|
29962
|
-
fontFamily: (
|
|
29996
|
+
fontFamily: (_a = options == null ? void 0 : options.fontFamily) != null ? _a : DEFAULT_TEXT_GLYPH_FONT_FAMILY,
|
|
29963
29997
|
fontStyle: resolveFontStyle(options == null ? void 0 : options.fontStyle),
|
|
29964
29998
|
fontWeight: (_b = options == null ? void 0 : options.fontWeight) != null ? _b : DEFAULT_TEXT_GLYPH_FONT_WEIGHT,
|
|
29965
29999
|
fontSizePixel: resolvedFontSize,
|
|
@@ -30221,6 +30255,7 @@ const renderTextGlyphBitmap = async (text, dimensions, options) => {
|
|
|
30221
30255
|
);
|
|
30222
30256
|
return { bitmap, width: totalWidth, height: totalHeight };
|
|
30223
30257
|
};
|
|
30258
|
+
const OPACITY_VISIBILITY_EPSILON = 1e-4;
|
|
30224
30259
|
const ATLAS_PAGE_INDEX_NONE = -1;
|
|
30225
30260
|
const updateImageInterpolationDirtyState = (sprite, image) => {
|
|
30226
30261
|
const dirty = hasActiveImageInterpolations(image);
|
|
@@ -30229,22 +30264,36 @@ const updateImageInterpolationDirtyState = (sprite, image) => {
|
|
|
30229
30264
|
sprite.interpolationDirty = true;
|
|
30230
30265
|
}
|
|
30231
30266
|
};
|
|
30232
|
-
const
|
|
30267
|
+
const reapplySpriteOpacityMultiplier = (sprite) => {
|
|
30268
|
+
const multiplier = sprite.opacityMultiplier || 1;
|
|
30269
|
+
sprite.images.forEach((orderMap) => {
|
|
30270
|
+
orderMap.forEach((image) => {
|
|
30271
|
+
var _a, _b;
|
|
30272
|
+
const baseOpacity = (_a = image.opacity.interpolation.baseValue) != null ? _a : image.opacity.current;
|
|
30273
|
+
const interpolationOption = (_b = image.opacity.interpolation.options) != null ? _b : null;
|
|
30274
|
+
applyOpacityUpdate(image, baseOpacity, interpolationOption, multiplier);
|
|
30275
|
+
});
|
|
30276
|
+
});
|
|
30277
|
+
};
|
|
30278
|
+
const applyAutoRotation = (sprite, nextLocation, forceAutoRotation) => {
|
|
30233
30279
|
let hasAutoRotation = false;
|
|
30234
30280
|
let requiredDistance = 0;
|
|
30235
30281
|
sprite.images.forEach((orderMap) => {
|
|
30236
30282
|
orderMap.forEach((image) => {
|
|
30237
|
-
var
|
|
30283
|
+
var _a;
|
|
30238
30284
|
if (!image.autoRotation) {
|
|
30239
30285
|
return;
|
|
30240
30286
|
}
|
|
30241
30287
|
hasAutoRotation = true;
|
|
30242
|
-
const minDistance = Math.max(0, (
|
|
30288
|
+
const minDistance = Math.max(0, (_a = image.autoRotationMinDistanceMeters) != null ? _a : 0);
|
|
30243
30289
|
if (minDistance > requiredDistance) {
|
|
30244
30290
|
requiredDistance = minDistance;
|
|
30245
30291
|
}
|
|
30246
30292
|
});
|
|
30247
30293
|
});
|
|
30294
|
+
if (forceAutoRotation) {
|
|
30295
|
+
requiredDistance = 0;
|
|
30296
|
+
}
|
|
30248
30297
|
if (!hasAutoRotation) {
|
|
30249
30298
|
return false;
|
|
30250
30299
|
}
|
|
@@ -30309,13 +30358,27 @@ const createInterpolatedOffsetState = (offset, invalidated) => {
|
|
|
30309
30358
|
current: base.offsetMeters,
|
|
30310
30359
|
from: void 0,
|
|
30311
30360
|
to: void 0,
|
|
30312
|
-
invalidated
|
|
30361
|
+
invalidated,
|
|
30362
|
+
interpolation: {
|
|
30363
|
+
state: null,
|
|
30364
|
+
options: null,
|
|
30365
|
+
lastCommandValue: base.offsetMeters,
|
|
30366
|
+
baseValue: void 0,
|
|
30367
|
+
targetValue: void 0
|
|
30368
|
+
}
|
|
30313
30369
|
},
|
|
30314
30370
|
offsetDeg: {
|
|
30315
30371
|
current: base.offsetDeg,
|
|
30316
30372
|
from: void 0,
|
|
30317
30373
|
to: void 0,
|
|
30318
|
-
invalidated
|
|
30374
|
+
invalidated,
|
|
30375
|
+
interpolation: {
|
|
30376
|
+
state: null,
|
|
30377
|
+
options: null,
|
|
30378
|
+
lastCommandValue: base.offsetDeg,
|
|
30379
|
+
baseValue: void 0,
|
|
30380
|
+
targetValue: void 0
|
|
30381
|
+
}
|
|
30319
30382
|
}
|
|
30320
30383
|
};
|
|
30321
30384
|
};
|
|
@@ -30354,9 +30417,18 @@ const sanitizeVisibilityDistanceMeters = (value) => {
|
|
|
30354
30417
|
}
|
|
30355
30418
|
return value;
|
|
30356
30419
|
};
|
|
30420
|
+
const sanitizeOpacityMultiplier = (value) => {
|
|
30421
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
30422
|
+
return 1;
|
|
30423
|
+
}
|
|
30424
|
+
if (value <= 0) {
|
|
30425
|
+
return 0;
|
|
30426
|
+
}
|
|
30427
|
+
return value;
|
|
30428
|
+
};
|
|
30357
30429
|
const createImageStateFromInit = (imageInit, subLayer, order, originReference, invalidated) => {
|
|
30358
|
-
var
|
|
30359
|
-
const mode = (
|
|
30430
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
30431
|
+
const mode = (_a = imageInit.mode) != null ? _a : "surface";
|
|
30360
30432
|
const autoRotationDefault = mode === "surface";
|
|
30361
30433
|
const initialOffset = cloneOffset(imageInit.offset);
|
|
30362
30434
|
const initialOpacity = clampOpacity((_b = imageInit.opacity) != null ? _b : 1);
|
|
@@ -30373,8 +30445,16 @@ const createImageStateFromInit = (imageInit, subLayer, order, originReference, i
|
|
|
30373
30445
|
current: initialOpacity,
|
|
30374
30446
|
from: void 0,
|
|
30375
30447
|
to: void 0,
|
|
30376
|
-
invalidated
|
|
30448
|
+
invalidated,
|
|
30449
|
+
interpolation: {
|
|
30450
|
+
state: null,
|
|
30451
|
+
options: null,
|
|
30452
|
+
targetValue: initialOpacity,
|
|
30453
|
+
baseValue: initialOpacity,
|
|
30454
|
+
lastCommandValue: initialOpacity
|
|
30455
|
+
}
|
|
30377
30456
|
},
|
|
30457
|
+
lodOpacity: 1,
|
|
30378
30458
|
scale: (_d = imageInit.scale) != null ? _d : 1,
|
|
30379
30459
|
anchor: cloneAnchor(imageInit.anchor),
|
|
30380
30460
|
border: resolveSpriteImageLineAttribute(imageInit.border),
|
|
@@ -30386,7 +30466,14 @@ const createImageStateFromInit = (imageInit, subLayer, order, originReference, i
|
|
|
30386
30466
|
current: initialRotateDeg,
|
|
30387
30467
|
from: void 0,
|
|
30388
30468
|
to: void 0,
|
|
30389
|
-
invalidated
|
|
30469
|
+
invalidated,
|
|
30470
|
+
interpolation: {
|
|
30471
|
+
state: null,
|
|
30472
|
+
options: null,
|
|
30473
|
+
lastCommandValue: initialRotateDeg,
|
|
30474
|
+
baseValue: void 0,
|
|
30475
|
+
targetValue: void 0
|
|
30476
|
+
}
|
|
30390
30477
|
},
|
|
30391
30478
|
rotationCommandDeg: initialRotateDeg,
|
|
30392
30479
|
displayedRotateDeg: initialRotateDeg,
|
|
@@ -30396,34 +30483,22 @@ const createImageStateFromInit = (imageInit, subLayer, order, originReference, i
|
|
|
30396
30483
|
originLocation,
|
|
30397
30484
|
originReferenceKey,
|
|
30398
30485
|
originRenderTargetIndex: SPRITE_ORIGIN_REFERENCE_INDEX_NONE,
|
|
30399
|
-
rotationInterpolationState: null,
|
|
30400
|
-
rotationInterpolationOptions: null,
|
|
30401
|
-
offsetDegInterpolationState: null,
|
|
30402
|
-
offsetMetersInterpolationState: null,
|
|
30403
|
-
opacityInterpolationState: null,
|
|
30404
|
-
opacityInterpolationOptions: null,
|
|
30405
|
-
opacityTargetValue: initialOpacity,
|
|
30406
|
-
lodLastCommandOpacity: initialOpacity,
|
|
30407
|
-
lastCommandRotateDeg: initialRotateDeg,
|
|
30408
|
-
lastCommandOffsetDeg: initialOffset.offsetDeg,
|
|
30409
|
-
lastCommandOffsetMeters: initialOffset.offsetMeters,
|
|
30410
|
-
lastCommandOpacity: initialOpacity,
|
|
30411
30486
|
interpolationDirty: false
|
|
30412
30487
|
};
|
|
30413
30488
|
const rotateInitOption = (_h = (_g = imageInit.interpolation) == null ? void 0 : _g.rotateDeg) != null ? _h : null;
|
|
30414
30489
|
if (rotateInitOption) {
|
|
30415
|
-
state.
|
|
30490
|
+
state.rotateDeg.interpolation.options = cloneInterpolationOptions(rotateInitOption);
|
|
30416
30491
|
}
|
|
30417
30492
|
const opacityInitOption = (_j = (_i = imageInit.interpolation) == null ? void 0 : _i.opacity) != null ? _j : null;
|
|
30418
30493
|
if (opacityInitOption) {
|
|
30419
|
-
state.
|
|
30494
|
+
state.opacity.interpolation.options = cloneInterpolationOptions(opacityInitOption);
|
|
30420
30495
|
}
|
|
30421
30496
|
syncImageRotationChannel(state);
|
|
30422
30497
|
return state;
|
|
30423
30498
|
};
|
|
30424
30499
|
const createSpriteLayer = (options) => {
|
|
30425
|
-
var
|
|
30426
|
-
const id = (
|
|
30500
|
+
var _a;
|
|
30501
|
+
const id = (_a = options == null ? void 0 : options.id) != null ? _a : "sprite-layer";
|
|
30427
30502
|
let resolvedScaling = resolveScalingOptions(options == null ? void 0 : options.spriteScaling);
|
|
30428
30503
|
const resolvedTextureFiltering = resolveTextureFilteringOptions(
|
|
30429
30504
|
options == null ? void 0 : options.textureFiltering
|
|
@@ -30514,13 +30589,13 @@ const createSpriteLayer = (options) => {
|
|
|
30514
30589
|
scheduleTextGlyphQueueProcessing();
|
|
30515
30590
|
};
|
|
30516
30591
|
const cancelPendingTextGlyphJob = (imageId, reason) => {
|
|
30517
|
-
var
|
|
30592
|
+
var _a2;
|
|
30518
30593
|
for (let idx = textGlyphQueue.length - 1; idx >= 0; idx -= 1) {
|
|
30519
30594
|
const entry = textGlyphQueue[idx];
|
|
30520
30595
|
if (entry && entry.glyphId === imageId) {
|
|
30521
30596
|
textGlyphQueue.splice(idx, 1);
|
|
30522
30597
|
pendingTextGlyphIds.delete(imageId);
|
|
30523
|
-
(
|
|
30598
|
+
(_a2 = entry.abortHandle) == null ? void 0 : _a2.release();
|
|
30524
30599
|
entry.deferred.reject(
|
|
30525
30600
|
reason != null ? reason : new Error(
|
|
30526
30601
|
`[SpriteLayer][GlyphQueue] Image "${imageId}" was cancelled before generation.`
|
|
@@ -30530,19 +30605,19 @@ const createSpriteLayer = (options) => {
|
|
|
30530
30605
|
}
|
|
30531
30606
|
};
|
|
30532
30607
|
const rejectAllPendingTextGlyphJobs = (reason) => {
|
|
30533
|
-
var
|
|
30608
|
+
var _a2;
|
|
30534
30609
|
while (textGlyphQueue.length > 0) {
|
|
30535
30610
|
const entry = textGlyphQueue.shift();
|
|
30536
30611
|
if (entry) {
|
|
30537
30612
|
pendingTextGlyphIds.delete(entry.glyphId);
|
|
30538
|
-
(
|
|
30613
|
+
(_a2 = entry.abortHandle) == null ? void 0 : _a2.release();
|
|
30539
30614
|
entry.deferred.reject(reason);
|
|
30540
30615
|
}
|
|
30541
30616
|
}
|
|
30542
30617
|
};
|
|
30543
30618
|
const executeTextGlyphJob = async (entry) => {
|
|
30544
|
-
var
|
|
30545
|
-
if ((
|
|
30619
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
|
30620
|
+
if ((_a2 = entry.signal) == null ? void 0 : _a2.aborted) {
|
|
30546
30621
|
(_b = entry.abortHandle) == null ? void 0 : _b.release();
|
|
30547
30622
|
entry.deferred.reject(entry.signal.reason);
|
|
30548
30623
|
pendingTextGlyphIds.delete(entry.glyphId);
|
|
@@ -30694,51 +30769,51 @@ const createSpriteLayer = (options) => {
|
|
|
30694
30769
|
};
|
|
30695
30770
|
const sprites = /* @__PURE__ */ new Map();
|
|
30696
30771
|
const invalidateImageInterpolationState = (sprite, image) => {
|
|
30697
|
-
|
|
30698
|
-
|
|
30699
|
-
|
|
30700
|
-
|
|
30701
|
-
image.rotationInterpolationState = null;
|
|
30702
|
-
image.offsetDegInterpolationState = null;
|
|
30703
|
-
image.offsetMetersInterpolationState = null;
|
|
30704
|
-
image.opacityInterpolationState = null;
|
|
30705
|
-
image.rotateDeg.current = manualRotation;
|
|
30772
|
+
image.rotateDeg.interpolation.state = null;
|
|
30773
|
+
image.offset.offsetDeg.interpolation.state = null;
|
|
30774
|
+
image.offset.offsetMeters.interpolation.state = null;
|
|
30775
|
+
image.opacity.interpolation.state = null;
|
|
30706
30776
|
image.rotateDeg.from = void 0;
|
|
30707
30777
|
image.rotateDeg.to = void 0;
|
|
30708
30778
|
image.rotateDeg.invalidated = true;
|
|
30709
|
-
image.
|
|
30710
|
-
image.displayedRotateDeg = displayedRotation;
|
|
30711
|
-
image.lastCommandRotateDeg = normalizeAngleDeg(displayedRotation);
|
|
30779
|
+
image.rotateDeg.interpolation.lastCommandValue = image.rotateDeg.current;
|
|
30712
30780
|
image.offset.offsetDeg.from = void 0;
|
|
30713
30781
|
image.offset.offsetDeg.to = void 0;
|
|
30714
30782
|
image.offset.offsetDeg.invalidated = true;
|
|
30715
|
-
image.
|
|
30783
|
+
image.offset.offsetDeg.interpolation.lastCommandValue = image.offset.offsetDeg.current;
|
|
30716
30784
|
image.offset.offsetMeters.from = void 0;
|
|
30717
30785
|
image.offset.offsetMeters.to = void 0;
|
|
30718
30786
|
image.offset.offsetMeters.invalidated = true;
|
|
30719
|
-
image.
|
|
30787
|
+
image.offset.offsetMeters.interpolation.lastCommandValue = image.offset.offsetMeters.current;
|
|
30720
30788
|
image.opacity.from = void 0;
|
|
30721
30789
|
image.opacity.to = void 0;
|
|
30722
30790
|
image.opacity.invalidated = true;
|
|
30723
|
-
image.
|
|
30724
|
-
image.
|
|
30725
|
-
|
|
30791
|
+
image.opacity.interpolation.targetValue = image.opacity.current;
|
|
30792
|
+
image.opacity.interpolation.lastCommandValue = image.opacity.current;
|
|
30793
|
+
const spriteOpacityMultiplier = sprite.opacityMultiplier || 1;
|
|
30794
|
+
const lodMultiplier = image.lodOpacity || 1;
|
|
30795
|
+
if (spriteOpacityMultiplier > 0 && lodMultiplier > 0) {
|
|
30796
|
+
image.opacity.interpolation.baseValue = clampOpacity(
|
|
30797
|
+
image.opacity.current / (spriteOpacityMultiplier * lodMultiplier)
|
|
30798
|
+
);
|
|
30799
|
+
}
|
|
30726
30800
|
updateImageInterpolationDirtyState(sprite, image);
|
|
30727
30801
|
};
|
|
30728
30802
|
const invalidateSpriteInterpolationState = (sprite) => {
|
|
30803
|
+
const currentSnapshot = cloneSpriteLocation(sprite.location.current);
|
|
30729
30804
|
sprite.location.from = void 0;
|
|
30730
30805
|
sprite.location.to = void 0;
|
|
30731
30806
|
sprite.location.invalidated = true;
|
|
30732
|
-
sprite.
|
|
30733
|
-
sprite.
|
|
30734
|
-
sprite.
|
|
30735
|
-
sprite.lastAutoRotationLocation = cloneSpriteLocation(
|
|
30736
|
-
|
|
30737
|
-
);
|
|
30807
|
+
sprite.location.interpolation.state = null;
|
|
30808
|
+
sprite.location.interpolation.options = null;
|
|
30809
|
+
sprite.location.interpolation.lastCommandValue = cloneSpriteLocation(currentSnapshot);
|
|
30810
|
+
sprite.lastAutoRotationLocation = cloneSpriteLocation(currentSnapshot);
|
|
30811
|
+
sprite.autoRotationInvalidated = true;
|
|
30738
30812
|
sprite.interpolationDirty = false;
|
|
30739
30813
|
sprite.images.forEach((orderMap) => {
|
|
30740
30814
|
orderMap.forEach((image) => {
|
|
30741
30815
|
invalidateImageInterpolationState(sprite, image);
|
|
30816
|
+
image.displayedRotateDeg = image.resolvedBaseRotateDeg + image.rotationCommandDeg;
|
|
30742
30817
|
});
|
|
30743
30818
|
});
|
|
30744
30819
|
};
|
|
@@ -30767,10 +30842,10 @@ const createSpriteLayer = (options) => {
|
|
|
30767
30842
|
});
|
|
30768
30843
|
};
|
|
30769
30844
|
const getImageState = (sprite, subLayer, order) => {
|
|
30770
|
-
var
|
|
30845
|
+
var _a2;
|
|
30771
30846
|
return (
|
|
30772
30847
|
// Use optional chaining to safely traverse the nested map hierarchy.
|
|
30773
|
-
(
|
|
30848
|
+
(_a2 = sprite.images.get(subLayer)) == null ? void 0 : _a2.get(order)
|
|
30774
30849
|
);
|
|
30775
30850
|
};
|
|
30776
30851
|
const setImageState = (sprite, state) => {
|
|
@@ -30782,10 +30857,10 @@ const createSpriteLayer = (options) => {
|
|
|
30782
30857
|
inner.set(state.order, state);
|
|
30783
30858
|
};
|
|
30784
30859
|
const hasImageState = (sprite, subLayer, order) => {
|
|
30785
|
-
var
|
|
30860
|
+
var _a2, _b;
|
|
30786
30861
|
return (
|
|
30787
30862
|
// Return true only when the nested map exists and contains the desired order entry.
|
|
30788
|
-
(_b = (
|
|
30863
|
+
(_b = (_a2 = sprite.images.get(subLayer)) == null ? void 0 : _a2.has(order)) != null ? _b : false
|
|
30789
30864
|
);
|
|
30790
30865
|
};
|
|
30791
30866
|
const deleteImageState = (sprite, subLayer, order) => {
|
|
@@ -30837,22 +30912,22 @@ const createSpriteLayer = (options) => {
|
|
|
30837
30912
|
const inputListenerDisposers = [];
|
|
30838
30913
|
let mapVisible = typeof document !== "undefined" ? document.visibilityState !== "hidden" : true;
|
|
30839
30914
|
const resolveDocumentVisibility = () => {
|
|
30840
|
-
var
|
|
30841
|
-
const doc = (
|
|
30915
|
+
var _a2;
|
|
30916
|
+
const doc = (_a2 = canvasElement == null ? void 0 : canvasElement.ownerDocument) != null ? _a2 : typeof document !== "undefined" ? document : void 0;
|
|
30842
30917
|
return doc ? doc.visibilityState !== "hidden" : true;
|
|
30843
30918
|
};
|
|
30844
30919
|
const isLayerVisible = () => mapVisible;
|
|
30845
30920
|
const hasSpriteListeners = (type) => {
|
|
30846
|
-
var
|
|
30921
|
+
var _a2, _b;
|
|
30847
30922
|
return (
|
|
30848
30923
|
// Treat missing listener sets as zero, otherwise check the registered count.
|
|
30849
|
-
((_b = (
|
|
30924
|
+
((_b = (_a2 = eventListeners.get(type)) == null ? void 0 : _a2.size) != null ? _b : 0) > 0
|
|
30850
30925
|
);
|
|
30851
30926
|
};
|
|
30852
30927
|
const hasSpriteClickListeners = () => hasSpriteListeners("spriteclick");
|
|
30853
30928
|
const hasSpriteHoverListeners = () => hasSpriteListeners("spritehover");
|
|
30854
30929
|
const resolveSpriteEventPayload = (hitEntry) => {
|
|
30855
|
-
var
|
|
30930
|
+
var _a2, _b;
|
|
30856
30931
|
if (!hitEntry) {
|
|
30857
30932
|
return {
|
|
30858
30933
|
sprite: void 0,
|
|
@@ -30860,7 +30935,7 @@ const createSpriteLayer = (options) => {
|
|
|
30860
30935
|
};
|
|
30861
30936
|
}
|
|
30862
30937
|
const spriteState = getSpriteState(hitEntry.sprite.spriteId);
|
|
30863
|
-
const imageState = (_b = (
|
|
30938
|
+
const imageState = (_b = (_a2 = spriteState == null ? void 0 : spriteState.images.get(hitEntry.image.subLayer)) == null ? void 0 : _a2.get(hitEntry.image.order)) != null ? _b : void 0;
|
|
30864
30939
|
return {
|
|
30865
30940
|
sprite: spriteState,
|
|
30866
30941
|
image: imageState
|
|
@@ -30940,7 +31015,7 @@ const createSpriteLayer = (options) => {
|
|
|
30940
31015
|
scheduleRender();
|
|
30941
31016
|
};
|
|
30942
31017
|
const ensureRenderTargetEntries = () => {
|
|
30943
|
-
var
|
|
31018
|
+
var _a2;
|
|
30944
31019
|
renderTargetEntries.length = 0;
|
|
30945
31020
|
sprites.forEach((sprite) => {
|
|
30946
31021
|
if (!sprite.isEnabled) {
|
|
@@ -30951,7 +31026,9 @@ const createSpriteLayer = (options) => {
|
|
|
30951
31026
|
}
|
|
30952
31027
|
sprite.images.forEach((orderMap) => {
|
|
30953
31028
|
orderMap.forEach((image) => {
|
|
30954
|
-
|
|
31029
|
+
var _a3;
|
|
31030
|
+
const baseOpacity = (_a3 = image.opacity.interpolation.baseValue) != null ? _a3 : image.opacity.interpolation.lastCommandValue;
|
|
31031
|
+
const shouldForceVisibilityCheck = sprite.visibilityDistanceMeters !== void 0 && (baseOpacity != null ? baseOpacity : 0) > OPACITY_VISIBILITY_EPSILON;
|
|
30955
31032
|
if (image.opacity.current <= 0 && !shouldForceVisibilityCheck) {
|
|
30956
31033
|
image.originRenderTargetIndex = SPRITE_ORIGIN_REFERENCE_INDEX_NONE;
|
|
30957
31034
|
image.originReferenceKey = SPRITE_ORIGIN_REFERENCE_KEY_NONE;
|
|
@@ -31006,12 +31083,12 @@ const createSpriteLayer = (options) => {
|
|
|
31006
31083
|
continue;
|
|
31007
31084
|
}
|
|
31008
31085
|
const indexMap = originIndexBySprite.get(sprite.spriteId);
|
|
31009
|
-
const targetIndex = (
|
|
31086
|
+
const targetIndex = (_a2 = indexMap == null ? void 0 : indexMap.get(image.originReferenceKey)) != null ? _a2 : SPRITE_ORIGIN_REFERENCE_INDEX_NONE;
|
|
31010
31087
|
image.originRenderTargetIndex = targetIndex;
|
|
31011
31088
|
}
|
|
31012
31089
|
};
|
|
31013
31090
|
const onAdd = (mapInstance, glContext) => {
|
|
31014
|
-
var
|
|
31091
|
+
var _a2;
|
|
31015
31092
|
map = mapInstance;
|
|
31016
31093
|
gl = glContext;
|
|
31017
31094
|
anisotropyExtension = resolveAnisotropyExtension(glContext);
|
|
@@ -31097,7 +31174,7 @@ const createSpriteLayer = (options) => {
|
|
|
31097
31174
|
canvasElement == null ? void 0 : canvasElement.removeEventListener("mousemove", mouseMoveListener);
|
|
31098
31175
|
});
|
|
31099
31176
|
}
|
|
31100
|
-
const visibilityTarget = (
|
|
31177
|
+
const visibilityTarget = (_a2 = canvasElement.ownerDocument) != null ? _a2 : typeof document !== "undefined" ? document : void 0;
|
|
31101
31178
|
if (visibilityTarget) {
|
|
31102
31179
|
const visibilityListener = () => updateVisibilityState();
|
|
31103
31180
|
visibilityTarget.addEventListener(
|
|
@@ -31240,12 +31317,12 @@ const createSpriteLayer = (options) => {
|
|
|
31240
31317
|
const drawProgram = spriteDrawProgram;
|
|
31241
31318
|
let drawOrderCounter = 0;
|
|
31242
31319
|
const drawPreparedSprite = (prepared) => {
|
|
31243
|
-
var
|
|
31320
|
+
var _a2;
|
|
31244
31321
|
const didDraw = drawProgram.draw(prepared);
|
|
31245
31322
|
if (!didDraw) {
|
|
31246
31323
|
return;
|
|
31247
31324
|
}
|
|
31248
|
-
prepared.imageEntry.surfaceShaderInputs = (
|
|
31325
|
+
prepared.imageEntry.surfaceShaderInputs = (_a2 = prepared.surfaceShaderInputs) != null ? _a2 : void 0;
|
|
31249
31326
|
if (prepared.hitTestCorners && prepared.hitTestCorners.length === 4) {
|
|
31250
31327
|
hitTestController.registerHitTestEntry(
|
|
31251
31328
|
prepared.spriteEntry,
|
|
@@ -31468,7 +31545,7 @@ const createSpriteLayer = (options) => {
|
|
|
31468
31545
|
glContext.disable(glContext.BLEND);
|
|
31469
31546
|
};
|
|
31470
31547
|
const registerImage = async (imageId, imageSource, options2, signal) => {
|
|
31471
|
-
var
|
|
31548
|
+
var _a2;
|
|
31472
31549
|
let bitmap;
|
|
31473
31550
|
try {
|
|
31474
31551
|
bitmap = typeof imageSource === "string" ? await loadImageBitmap(imageSource, options2) : imageSource;
|
|
@@ -31516,7 +31593,7 @@ const createSpriteLayer = (options) => {
|
|
|
31516
31593
|
updateSpriteImageHandles(imageId, 0);
|
|
31517
31594
|
imageHandleBuffersController.markDirty(images);
|
|
31518
31595
|
atlasManager.removeImage(imageId);
|
|
31519
|
-
(
|
|
31596
|
+
(_a2 = bitmap.close) == null ? void 0 : _a2.call(bitmap);
|
|
31520
31597
|
throw e;
|
|
31521
31598
|
} finally {
|
|
31522
31599
|
abortHandle == null ? void 0 : abortHandle.release();
|
|
@@ -31550,7 +31627,7 @@ const createSpriteLayer = (options) => {
|
|
|
31550
31627
|
}
|
|
31551
31628
|
};
|
|
31552
31629
|
const unregisterImage = (imageId) => {
|
|
31553
|
-
var
|
|
31630
|
+
var _a2, _b;
|
|
31554
31631
|
const image = images.get(imageId);
|
|
31555
31632
|
if (!image) {
|
|
31556
31633
|
if (pendingTextGlyphIds.has(imageId)) {
|
|
@@ -31580,7 +31657,7 @@ const createSpriteLayer = (options) => {
|
|
|
31580
31657
|
});
|
|
31581
31658
|
});
|
|
31582
31659
|
if (image.bitmap) {
|
|
31583
|
-
(_b = (
|
|
31660
|
+
(_b = (_a2 = image.bitmap).close) == null ? void 0 : _b.call(_a2);
|
|
31584
31661
|
}
|
|
31585
31662
|
images.delete(imageId);
|
|
31586
31663
|
imageIdHandler.release(imageId);
|
|
@@ -31610,9 +31687,9 @@ const createSpriteLayer = (options) => {
|
|
|
31610
31687
|
});
|
|
31611
31688
|
atlasPageTextures.clear();
|
|
31612
31689
|
images.forEach((image) => {
|
|
31613
|
-
var
|
|
31690
|
+
var _a2, _b;
|
|
31614
31691
|
if (image.bitmap) {
|
|
31615
|
-
(_b = (
|
|
31692
|
+
(_b = (_a2 = image.bitmap).close) == null ? void 0 : _b.call(_a2);
|
|
31616
31693
|
}
|
|
31617
31694
|
});
|
|
31618
31695
|
images.clear();
|
|
@@ -31633,11 +31710,11 @@ const createSpriteLayer = (options) => {
|
|
|
31633
31710
|
};
|
|
31634
31711
|
const getAllImageIds = () => Array.from(images.keys());
|
|
31635
31712
|
const addSpriteInternal = (projectionHost, spriteId, init) => {
|
|
31636
|
-
var
|
|
31713
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
31637
31714
|
if (sprites.get(spriteId)) {
|
|
31638
31715
|
return false;
|
|
31639
31716
|
}
|
|
31640
|
-
const initialInvalidated = ((
|
|
31717
|
+
const initialInvalidated = ((_a2 = init.invalidate) != null ? _a2 : false) || !isLayerVisible();
|
|
31641
31718
|
const imagesInit = (_b = init.images) != null ? _b : [];
|
|
31642
31719
|
const images2 = /* @__PURE__ */ new Map();
|
|
31643
31720
|
for (const imageInit of imagesInit) {
|
|
@@ -31661,8 +31738,8 @@ const createSpriteLayer = (options) => {
|
|
|
31661
31738
|
}
|
|
31662
31739
|
const keyToStr = (k) => `${k.subLayer}:${k.order}`;
|
|
31663
31740
|
const getRef = (k) => {
|
|
31664
|
-
var
|
|
31665
|
-
const ref = (_b2 = (
|
|
31741
|
+
var _a3, _b2;
|
|
31742
|
+
const ref = (_b2 = (_a3 = images2.get(k.subLayer)) == null ? void 0 : _a3.get(k.order)) == null ? void 0 : _b2.originLocation;
|
|
31666
31743
|
if (!ref) return void 0;
|
|
31667
31744
|
return { subLayer: ref.subLayer, order: ref.order };
|
|
31668
31745
|
};
|
|
@@ -31711,20 +31788,26 @@ const createSpriteLayer = (options) => {
|
|
|
31711
31788
|
// Sprites default to enabled unless explicitly disabled in the init payload.
|
|
31712
31789
|
isEnabled: (_e = init.isEnabled) != null ? _e : true,
|
|
31713
31790
|
visibilityDistanceMeters: spriteVisibilityDistanceMeters != null ? spriteVisibilityDistanceMeters : void 0,
|
|
31791
|
+
opacityMultiplier: sanitizeOpacityMultiplier(init.opacityMultiplier),
|
|
31714
31792
|
location: {
|
|
31715
31793
|
current: currentLocation,
|
|
31716
31794
|
from: void 0,
|
|
31717
31795
|
to: void 0,
|
|
31718
|
-
invalidated: initialInvalidated
|
|
31796
|
+
invalidated: initialInvalidated,
|
|
31797
|
+
interpolation: {
|
|
31798
|
+
state: null,
|
|
31799
|
+
options: initialInterpolationOptions,
|
|
31800
|
+
lastCommandValue: cloneSpriteLocation(currentLocation),
|
|
31801
|
+
baseValue: void 0,
|
|
31802
|
+
targetValue: void 0
|
|
31803
|
+
}
|
|
31719
31804
|
},
|
|
31720
31805
|
images: images2,
|
|
31721
31806
|
// Tags default to null to simplify downstream comparisons.
|
|
31722
31807
|
tag: (_f = init.tag) != null ? _f : null,
|
|
31723
|
-
interpolationState: null,
|
|
31724
|
-
pendingInterpolationOptions: initialInterpolationOptions,
|
|
31725
|
-
lastCommandLocation: cloneSpriteLocation(currentLocation),
|
|
31726
31808
|
lastAutoRotationLocation: cloneSpriteLocation(currentLocation),
|
|
31727
31809
|
lastAutoRotationAngleDeg: 0,
|
|
31810
|
+
autoRotationInvalidated: false,
|
|
31728
31811
|
interpolationDirty: false,
|
|
31729
31812
|
cachedMercator: initialMercator,
|
|
31730
31813
|
cachedMercatorLng: currentLocation.lng,
|
|
@@ -31876,8 +31959,8 @@ const createSpriteLayer = (options) => {
|
|
|
31876
31959
|
}
|
|
31877
31960
|
const keyToStr = (k) => `${k.subLayer}:${k.order}`;
|
|
31878
31961
|
const getRef = (k) => {
|
|
31879
|
-
var
|
|
31880
|
-
return (
|
|
31962
|
+
var _a2;
|
|
31963
|
+
return (_a2 = getImageState(sprite, k.subLayer, k.order)) == null ? void 0 : _a2.originLocation;
|
|
31881
31964
|
};
|
|
31882
31965
|
const visited = /* @__PURE__ */ new Set();
|
|
31883
31966
|
let curMaybe = state.originLocation;
|
|
@@ -31938,7 +32021,7 @@ const createSpriteLayer = (options) => {
|
|
|
31938
32021
|
}
|
|
31939
32022
|
};
|
|
31940
32023
|
const updateSpriteImageInternal = (projectionHost, sprite, subLayer, order, imageUpdate, resultOut) => {
|
|
31941
|
-
var
|
|
32024
|
+
var _a2;
|
|
31942
32025
|
const state = getImageState(sprite, subLayer, order);
|
|
31943
32026
|
if (!state) return false;
|
|
31944
32027
|
const mapCurrentlyVisible = isLayerVisible();
|
|
@@ -31953,18 +32036,17 @@ const createSpriteLayer = (options) => {
|
|
|
31953
32036
|
const interpolationOptions = imageUpdate.interpolation;
|
|
31954
32037
|
const opacityInterpolationOption = interpolationOptions == null ? void 0 : interpolationOptions.opacity;
|
|
31955
32038
|
if (opacityInterpolationOption !== void 0) {
|
|
31956
|
-
state.
|
|
32039
|
+
state.opacity.interpolation.options = opacityInterpolationOption === null ? null : cloneInterpolationOptions(opacityInterpolationOption);
|
|
31957
32040
|
}
|
|
31958
32041
|
const allowOpacityInterpolation = interpolationAllowed && !state.opacity.invalidated;
|
|
31959
|
-
const resolvedOpacityInterpolationOption = allowOpacityInterpolation ? opacityInterpolationOption === void 0 ? (
|
|
32042
|
+
const resolvedOpacityInterpolationOption = allowOpacityInterpolation ? opacityInterpolationOption === void 0 ? (_a2 = state.opacity.interpolation.options) != null ? _a2 : null : opacityInterpolationOption : null;
|
|
31960
32043
|
if (imageUpdate.opacity !== void 0) {
|
|
31961
32044
|
applyOpacityUpdate(
|
|
31962
32045
|
state,
|
|
31963
32046
|
imageUpdate.opacity,
|
|
31964
|
-
resolvedOpacityInterpolationOption
|
|
32047
|
+
resolvedOpacityInterpolationOption,
|
|
32048
|
+
sprite.opacityMultiplier
|
|
31965
32049
|
);
|
|
31966
|
-
state.opacityTargetValue = state.lastCommandOpacity;
|
|
31967
|
-
state.lodLastCommandOpacity = state.lastCommandOpacity;
|
|
31968
32050
|
if (mapCurrentlyVisible && state.opacity.invalidated) {
|
|
31969
32051
|
state.opacity.invalidated = false;
|
|
31970
32052
|
}
|
|
@@ -32023,11 +32105,11 @@ const createSpriteLayer = (options) => {
|
|
|
32023
32105
|
}
|
|
32024
32106
|
if (rotateInterpolationOption !== void 0) {
|
|
32025
32107
|
if (rotateInterpolationOption === null) {
|
|
32026
|
-
state.
|
|
32108
|
+
state.rotateDeg.interpolation.options = null;
|
|
32027
32109
|
rotationOverride = null;
|
|
32028
32110
|
} else {
|
|
32029
32111
|
const cloned = cloneInterpolationOptions(rotateInterpolationOption);
|
|
32030
|
-
state.
|
|
32112
|
+
state.rotateDeg.interpolation.options = cloned;
|
|
32031
32113
|
rotationOverride = cloned;
|
|
32032
32114
|
}
|
|
32033
32115
|
hasRotationOverride = true;
|
|
@@ -32064,7 +32146,7 @@ const createSpriteLayer = (options) => {
|
|
|
32064
32146
|
requireRotationSync = true;
|
|
32065
32147
|
}
|
|
32066
32148
|
if (shouldReapplyAutoRotation) {
|
|
32067
|
-
const applied = applyAutoRotation(sprite, sprite.location.current);
|
|
32149
|
+
const applied = applyAutoRotation(sprite, sprite.location.current, true);
|
|
32068
32150
|
if (!applied && state.autoRotation) {
|
|
32069
32151
|
state.resolvedBaseRotateDeg = sprite.lastAutoRotationAngleDeg;
|
|
32070
32152
|
requireRotationSync = true;
|
|
@@ -32141,7 +32223,7 @@ const createSpriteLayer = (options) => {
|
|
|
32141
32223
|
return true;
|
|
32142
32224
|
};
|
|
32143
32225
|
const updateSpriteInternal = (projectionHost, spriteId, update) => {
|
|
32144
|
-
var
|
|
32226
|
+
var _a2;
|
|
32145
32227
|
const sprite = sprites.get(spriteId);
|
|
32146
32228
|
if (!sprite) {
|
|
32147
32229
|
return "notfound";
|
|
@@ -32169,33 +32251,49 @@ const createSpriteLayer = (options) => {
|
|
|
32169
32251
|
if (previousVisibilityDistance !== void 0 && (resolved === void 0 || resolved === null)) {
|
|
32170
32252
|
sprite.images.forEach((orderMap) => {
|
|
32171
32253
|
orderMap.forEach((image) => {
|
|
32172
|
-
|
|
32254
|
+
var _a3;
|
|
32255
|
+
const baseOpacity = (_a3 = image.opacity.interpolation.baseValue) != null ? _a3 : image.opacity.current;
|
|
32256
|
+
if (!(Number.isFinite(baseOpacity) && baseOpacity > 0)) {
|
|
32173
32257
|
return;
|
|
32174
32258
|
}
|
|
32175
32259
|
if (image.opacity.current > 0) {
|
|
32176
32260
|
return;
|
|
32177
32261
|
}
|
|
32262
|
+
image.lodOpacity = 1;
|
|
32178
32263
|
applyOpacityUpdate(
|
|
32179
32264
|
image,
|
|
32180
|
-
|
|
32181
|
-
image.
|
|
32265
|
+
baseOpacity,
|
|
32266
|
+
image.opacity.interpolation.options,
|
|
32267
|
+
sprite.opacityMultiplier
|
|
32182
32268
|
);
|
|
32183
32269
|
});
|
|
32184
32270
|
});
|
|
32185
32271
|
}
|
|
32186
32272
|
}
|
|
32187
32273
|
}
|
|
32274
|
+
if (update.opacityMultiplier !== void 0) {
|
|
32275
|
+
const nextMultiplier = sanitizeOpacityMultiplier(
|
|
32276
|
+
update.opacityMultiplier
|
|
32277
|
+
);
|
|
32278
|
+
if (nextMultiplier !== sprite.opacityMultiplier) {
|
|
32279
|
+
sprite.opacityMultiplier = nextMultiplier;
|
|
32280
|
+
reapplySpriteOpacityMultiplier(sprite);
|
|
32281
|
+
updated = true;
|
|
32282
|
+
isRequiredRender = true;
|
|
32283
|
+
}
|
|
32284
|
+
}
|
|
32285
|
+
const locationState = sprite.location;
|
|
32286
|
+
const locationInterpolation = locationState.interpolation;
|
|
32188
32287
|
let interpolationOptionsForLocation = void 0;
|
|
32189
32288
|
let interpolationExplicitlySpecified = false;
|
|
32190
32289
|
const mapCurrentlyVisible = isLayerVisible();
|
|
32191
|
-
const interpolationAllowed = interpolationCalculationEnabled && mapCurrentlyVisible && !
|
|
32290
|
+
const interpolationAllowed = interpolationCalculationEnabled && mapCurrentlyVisible && !locationState.invalidated;
|
|
32192
32291
|
if (update.interpolation !== void 0) {
|
|
32193
32292
|
interpolationExplicitlySpecified = true;
|
|
32194
32293
|
if (update.interpolation === null) {
|
|
32195
|
-
|
|
32196
|
-
|
|
32197
|
-
|
|
32198
|
-
sprite.interpolationState = null;
|
|
32294
|
+
if (locationInterpolation.state !== null || locationState.from !== void 0 || locationState.to !== void 0) {
|
|
32295
|
+
locationInterpolation.state = null;
|
|
32296
|
+
locationInterpolation.options = null;
|
|
32199
32297
|
locationState.from = void 0;
|
|
32200
32298
|
locationState.to = void 0;
|
|
32201
32299
|
updated = true;
|
|
@@ -32203,8 +32301,8 @@ const createSpriteLayer = (options) => {
|
|
|
32203
32301
|
interpolationOptionsForLocation = null;
|
|
32204
32302
|
} else {
|
|
32205
32303
|
const nextOptions = cloneInterpolationOptions(update.interpolation);
|
|
32206
|
-
if (!
|
|
32207
|
-
|
|
32304
|
+
if (!locationInterpolation.options || locationInterpolation.options.durationMs !== nextOptions.durationMs || locationInterpolation.options.mode !== nextOptions.mode || locationInterpolation.options.easing !== nextOptions.easing) {
|
|
32305
|
+
locationInterpolation.options = nextOptions;
|
|
32208
32306
|
updated = true;
|
|
32209
32307
|
}
|
|
32210
32308
|
interpolationOptionsForLocation = nextOptions;
|
|
@@ -32213,15 +32311,15 @@ const createSpriteLayer = (options) => {
|
|
|
32213
32311
|
if (update.location !== void 0) {
|
|
32214
32312
|
const newCommandLocation = cloneSpriteLocation(update.location);
|
|
32215
32313
|
const locationChanged = !spriteLocationsEqual(
|
|
32216
|
-
|
|
32314
|
+
locationInterpolation.lastCommandValue,
|
|
32217
32315
|
newCommandLocation
|
|
32218
32316
|
);
|
|
32219
32317
|
const optionsForLocation = interpolationExplicitlySpecified ? (
|
|
32220
32318
|
// When new interpolation parameters accompanied the update, prefer them (or null to disable).
|
|
32221
32319
|
interpolationOptionsForLocation != null ? interpolationOptionsForLocation : null
|
|
32222
32320
|
) : (
|
|
32223
|
-
// Otherwise reuse any previously
|
|
32224
|
-
|
|
32321
|
+
// Otherwise reuse any previously interpolation request.
|
|
32322
|
+
locationInterpolation.options
|
|
32225
32323
|
);
|
|
32226
32324
|
const effectiveOptions = (
|
|
32227
32325
|
// Treat `undefined` as "no interpolation change" whereas explicit `null` disables interpolation.
|
|
@@ -32230,45 +32328,52 @@ const createSpriteLayer = (options) => {
|
|
|
32230
32328
|
let handledByInterpolation = false;
|
|
32231
32329
|
if (effectiveOptions && effectiveOptions.durationMs > 0) {
|
|
32232
32330
|
const { state, requiresInterpolation } = createInterpolationState({
|
|
32233
|
-
currentLocation:
|
|
32234
|
-
lastCommandLocation:
|
|
32331
|
+
currentLocation: locationState.current,
|
|
32332
|
+
lastCommandLocation: locationInterpolation.lastCommandValue,
|
|
32235
32333
|
nextCommandLocation: newCommandLocation,
|
|
32236
32334
|
options: effectiveOptions
|
|
32237
32335
|
});
|
|
32238
|
-
|
|
32336
|
+
locationInterpolation.state = null;
|
|
32239
32337
|
if (requiresInterpolation) {
|
|
32240
|
-
|
|
32241
|
-
|
|
32242
|
-
|
|
32243
|
-
|
|
32338
|
+
locationInterpolation.state = state;
|
|
32339
|
+
locationInterpolation.options = effectiveOptions;
|
|
32340
|
+
locationState.from = cloneSpriteLocation(state.from);
|
|
32341
|
+
locationState.to = cloneSpriteLocation(state.to);
|
|
32342
|
+
locationState.current = cloneSpriteLocation(state.from);
|
|
32244
32343
|
handledByInterpolation = true;
|
|
32245
32344
|
updated = true;
|
|
32246
32345
|
isRequiredRender = true;
|
|
32247
32346
|
}
|
|
32248
32347
|
}
|
|
32249
|
-
|
|
32348
|
+
locationInterpolation.lastCommandValue = cloneSpriteLocation(newCommandLocation);
|
|
32250
32349
|
if (handledByInterpolation) ;
|
|
32251
32350
|
else if (locationChanged) {
|
|
32252
|
-
|
|
32253
|
-
|
|
32254
|
-
|
|
32255
|
-
|
|
32351
|
+
locationState.current = cloneSpriteLocation(newCommandLocation);
|
|
32352
|
+
locationState.from = void 0;
|
|
32353
|
+
locationState.to = void 0;
|
|
32354
|
+
locationInterpolation.state = null;
|
|
32256
32355
|
updated = true;
|
|
32257
32356
|
isRequiredRender = true;
|
|
32258
32357
|
} else {
|
|
32259
|
-
|
|
32260
|
-
|
|
32261
|
-
|
|
32358
|
+
locationInterpolation.state = null;
|
|
32359
|
+
locationState.from = void 0;
|
|
32360
|
+
locationState.to = void 0;
|
|
32361
|
+
}
|
|
32362
|
+
if (mapCurrentlyVisible && locationState.invalidated) {
|
|
32363
|
+
locationState.invalidated = false;
|
|
32262
32364
|
}
|
|
32263
|
-
if (mapCurrentlyVisible
|
|
32264
|
-
sprite.
|
|
32365
|
+
if (!mapCurrentlyVisible) {
|
|
32366
|
+
sprite.autoRotationInvalidated = true;
|
|
32367
|
+
sprite.lastAutoRotationLocation = cloneSpriteLocation(newCommandLocation);
|
|
32368
|
+
} else {
|
|
32369
|
+
const forceAutoRotation = sprite.autoRotationInvalidated;
|
|
32370
|
+
sprite.autoRotationInvalidated = false;
|
|
32371
|
+
applyAutoRotation(sprite, newCommandLocation, forceAutoRotation);
|
|
32265
32372
|
}
|
|
32266
|
-
sprite.pendingInterpolationOptions = null;
|
|
32267
|
-
applyAutoRotation(sprite, newCommandLocation);
|
|
32268
32373
|
needsHitTestRefresh = true;
|
|
32269
32374
|
}
|
|
32270
32375
|
if (update.tag !== void 0) {
|
|
32271
|
-
const nextTag = (
|
|
32376
|
+
const nextTag = (_a2 = update.tag) != null ? _a2 : null;
|
|
32272
32377
|
if (sprite.tag !== nextTag) {
|
|
32273
32378
|
sprite.tag = nextTag;
|
|
32274
32379
|
updated = true;
|