maplibre-gl-layers 0.16.0 → 0.18.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 +606 -499
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +606 -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.mjs
CHANGED
|
@@ -3,14 +3,13 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
/*!
|
|
5
5
|
* name: maplibre-gl-layers
|
|
6
|
-
* version: 0.
|
|
6
|
+
* version: 0.18.0
|
|
7
7
|
* description: MapLibre's layer extension library enabling the display, movement, and modification of large numbers of dynamic sprite images
|
|
8
8
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
9
9
|
* license: MIT
|
|
10
10
|
* repository.url: https://github.com/kekyo/maplibre-gl-layers.git
|
|
11
|
-
* git.commit.hash:
|
|
11
|
+
* git.commit.hash: ca8392c8aa3aae7e0e4e3c871e195d49b125e481
|
|
12
12
|
*/
|
|
13
|
-
var _a;
|
|
14
13
|
const UNLIMITED_SPRITE_SCALING_OPTIONS = {
|
|
15
14
|
metersPerPixel: 1,
|
|
16
15
|
zoomMin: 0,
|
|
@@ -121,7 +120,7 @@ const parseSvgSize = (svgText) => {
|
|
|
121
120
|
}
|
|
122
121
|
};
|
|
123
122
|
const determineSvgRasterDimensions = (parsed, options) => {
|
|
124
|
-
var
|
|
123
|
+
var _a, _b;
|
|
125
124
|
const overrideWidth = options == null ? void 0 : options.width;
|
|
126
125
|
const overrideHeight = options == null ? void 0 : options.height;
|
|
127
126
|
if (overrideWidth !== void 0 && overrideHeight !== void 0 && overrideWidth > 0 && overrideHeight > 0) {
|
|
@@ -148,7 +147,7 @@ const determineSvgRasterDimensions = (parsed, options) => {
|
|
|
148
147
|
} else if (intrinsicHeight !== void 0 && intrinsicHeight > 0 && aspect !== void 0) {
|
|
149
148
|
baseHeight = intrinsicHeight;
|
|
150
149
|
baseWidth = intrinsicHeight * aspect;
|
|
151
|
-
} else if (hasValidViewBox && ((
|
|
150
|
+
} else if (hasValidViewBox && ((_a = options == null ? void 0 : options.svg) == null ? void 0 : _a.useViewBoxDimensions)) {
|
|
152
151
|
baseWidth = parsed.viewBoxWidth;
|
|
153
152
|
baseHeight = parsed.viewBoxHeight;
|
|
154
153
|
aspect = baseWidth / baseHeight;
|
|
@@ -295,14 +294,14 @@ const readImageBitmap = (blob, options) => {
|
|
|
295
294
|
return internalReadImageBitmap(blob, shouldTreatAsSvg, options);
|
|
296
295
|
};
|
|
297
296
|
const loadImageBitmap = async (url, options) => {
|
|
298
|
-
var
|
|
297
|
+
var _a;
|
|
299
298
|
const response = await fetch(url);
|
|
300
299
|
if (!response.ok) {
|
|
301
300
|
throw new Error(`Failed to fetch image from ${url}`);
|
|
302
301
|
}
|
|
303
302
|
const mimeType = response.headers.get("content-type");
|
|
304
303
|
const blob = await response.blob();
|
|
305
|
-
const shouldTreatAsSvg = ((
|
|
304
|
+
const shouldTreatAsSvg = ((_a = options == null ? void 0 : options.svg) == null ? void 0 : _a.assumeSvg) === true || isSvgMimeType(mimeType);
|
|
306
305
|
return await internalReadImageBitmap(blob, shouldTreatAsSvg, options);
|
|
307
306
|
};
|
|
308
307
|
/*!
|
|
@@ -397,12 +396,12 @@ const createMutex = (maxConsecutiveCalls = 20) => {
|
|
|
397
396
|
const queue = [];
|
|
398
397
|
let count = 0;
|
|
399
398
|
const processQueue = () => {
|
|
400
|
-
var
|
|
399
|
+
var _a;
|
|
401
400
|
if (isLocked || queue.length === 0) {
|
|
402
401
|
return;
|
|
403
402
|
}
|
|
404
403
|
const item = queue.shift();
|
|
405
|
-
if ((
|
|
404
|
+
if ((_a = item.signal) == null ? void 0 : _a.aborted) {
|
|
406
405
|
item.reject(ABORTED_ERROR$2());
|
|
407
406
|
scheduleNextProcess();
|
|
408
407
|
return;
|
|
@@ -588,9 +587,9 @@ const resolveBaseUrl = (base) => {
|
|
|
588
587
|
};
|
|
589
588
|
let wasmBaseUrlOverride;
|
|
590
589
|
const isNodeEnvironment = (() => {
|
|
591
|
-
var
|
|
590
|
+
var _a;
|
|
592
591
|
const globalProcess = globalThis.process;
|
|
593
|
-
return !!((
|
|
592
|
+
return !!((_a = globalProcess == null ? void 0 : globalProcess.versions) == null ? void 0 : _a.node);
|
|
594
593
|
})();
|
|
595
594
|
const canUseThreadedWasm = () => {
|
|
596
595
|
if (isNodeEnvironment) {
|
|
@@ -662,7 +661,7 @@ const resolveThreadPoolLimit = () => {
|
|
|
662
661
|
return hardware;
|
|
663
662
|
};
|
|
664
663
|
const instantiateThreadedProjectionWasm = async () => {
|
|
665
|
-
var
|
|
664
|
+
var _a, _b;
|
|
666
665
|
const scriptUrl = resolveVariantAssetUrl("simd-mt", "js");
|
|
667
666
|
const wasmUrl = resolveVariantAssetUrl("simd-mt", "wasm");
|
|
668
667
|
const workerUrl = resolveVariantAssetUrl("simd-mt", "worker");
|
|
@@ -670,7 +669,7 @@ const instantiateThreadedProjectionWasm = async () => {
|
|
|
670
669
|
/* @vite-ignore */
|
|
671
670
|
scriptUrl.href
|
|
672
671
|
);
|
|
673
|
-
const createModule = (_b = (
|
|
672
|
+
const createModule = (_b = (_a = moduleFactory == null ? void 0 : moduleFactory.default) != null ? _a : moduleFactory == null ? void 0 : moduleFactory.Module) != null ? _b : moduleFactory;
|
|
674
673
|
if (typeof createModule !== "function") {
|
|
675
674
|
throw new Error("maplibre-gl-layers: simd-mt module is unavailable.");
|
|
676
675
|
}
|
|
@@ -706,11 +705,11 @@ const instantiateProjectionWasm = async (variant) => {
|
|
|
706
705
|
return createWasmHostFromExports(exports);
|
|
707
706
|
};
|
|
708
707
|
const createWasmHostFromExports = (exports) => {
|
|
709
|
-
var
|
|
708
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
710
709
|
if (typeof exports.__wasm_call_ctors === "function") {
|
|
711
710
|
exports.__wasm_call_ctors();
|
|
712
711
|
}
|
|
713
|
-
const memory = (
|
|
712
|
+
const memory = (_a = exports.memory) != null ? _a : exports.wasmMemory;
|
|
714
713
|
if (!memory) {
|
|
715
714
|
throw new Error("maplibre-gl-layers: wasm memory is unavailable.");
|
|
716
715
|
}
|
|
@@ -941,14 +940,14 @@ const createWasmHostFromExports = (exports) => {
|
|
|
941
940
|
};
|
|
942
941
|
};
|
|
943
942
|
const initializeWasmHostInternal = async (preferredVariant) => {
|
|
944
|
-
var
|
|
943
|
+
var _a;
|
|
945
944
|
if (preferredVariant === "disabled") {
|
|
946
945
|
console.log(
|
|
947
946
|
"maplibre-gl-layers: Wasm execution disabled by configuration."
|
|
948
947
|
);
|
|
949
948
|
return ["disabled", void 0];
|
|
950
949
|
}
|
|
951
|
-
const variantsToTry = (
|
|
950
|
+
const variantsToTry = (_a = VARIANT_FALLBACKS[preferredVariant]) != null ? _a : ["nosimd"];
|
|
952
951
|
for (const variant of variantsToTry) {
|
|
953
952
|
if (variant === "simd-mt" && !canUseThreadedWasm()) {
|
|
954
953
|
if (!threadedVariantWarningPrinted) {
|
|
@@ -979,7 +978,7 @@ const initializeWasmHostInternal = async (preferredVariant) => {
|
|
|
979
978
|
};
|
|
980
979
|
let currentVariant = "disabled";
|
|
981
980
|
let currentWasmHost;
|
|
982
|
-
const initializeWasmHost = async (preferredVariant
|
|
981
|
+
const initializeWasmHost = async (preferredVariant, options) => {
|
|
983
982
|
let nextBaseUrl = wasmBaseUrlOverride;
|
|
984
983
|
if ((options == null ? void 0 : options.wasmBaseUrl) !== void 0) {
|
|
985
984
|
nextBaseUrl = options.wasmBaseUrl === "" ? void 0 : options.wasmBaseUrl;
|
|
@@ -1033,7 +1032,7 @@ const reportWasmRuntimeFailure = (reason) => {
|
|
|
1033
1032
|
releaseRuntimeHost();
|
|
1034
1033
|
};
|
|
1035
1034
|
const initializeRuntimeHost = async (options) => {
|
|
1036
|
-
var
|
|
1035
|
+
var _a;
|
|
1037
1036
|
const locker = await spriteLayerHostInitializationMutex.lock();
|
|
1038
1037
|
try {
|
|
1039
1038
|
if (wasmHostFatalError !== null) {
|
|
@@ -1042,7 +1041,7 @@ const initializeRuntimeHost = async (options) => {
|
|
|
1042
1041
|
);
|
|
1043
1042
|
return "disabled";
|
|
1044
1043
|
}
|
|
1045
|
-
const requestedVariant = (
|
|
1044
|
+
const requestedVariant = (_a = options == null ? void 0 : options.variant) != null ? _a : "simd";
|
|
1046
1045
|
if (requestedVariant === "disabled") {
|
|
1047
1046
|
releaseRuntimeHost();
|
|
1048
1047
|
return "disabled";
|
|
@@ -5415,7 +5414,7 @@ Use an identity property function instead: \`{ "type": "identity", "property": $
|
|
|
5415
5414
|
}
|
|
5416
5415
|
}
|
|
5417
5416
|
wa.prototype.bytesPerElement = 8, ls("StructArrayLayout1ul2ui8", wa);
|
|
5418
|
-
class
|
|
5417
|
+
class _a extends Ws {
|
|
5419
5418
|
_refreshViews() {
|
|
5420
5419
|
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
|
|
5421
5420
|
}
|
|
@@ -5428,7 +5427,7 @@ Use an identity property function instead: \`{ "type": "identity", "property": $
|
|
|
5428
5427
|
return this.uint16[n2 + 0] = e2, this.uint16[n2 + 1] = r2, t2;
|
|
5429
5428
|
}
|
|
5430
5429
|
}
|
|
5431
|
-
|
|
5430
|
+
_a.prototype.bytesPerElement = 4, ls("StructArrayLayout2ui4", _a);
|
|
5432
5431
|
class Sa extends Ws {
|
|
5433
5432
|
_refreshViews() {
|
|
5434
5433
|
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
|
|
@@ -5742,7 +5741,7 @@ Use an identity property function instead: \`{ "type": "identity", "property": $
|
|
|
5742
5741
|
}
|
|
5743
5742
|
class Ka extends ma {
|
|
5744
5743
|
}
|
|
5745
|
-
class Ja extends
|
|
5744
|
+
class Ja extends _a {
|
|
5746
5745
|
}
|
|
5747
5746
|
const Wa = Qs([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: Qa } = Wa;
|
|
5748
5747
|
class to {
|
|
@@ -10770,8 +10769,8 @@ Use an identity property function instead: \`{ "type": "identity", "property": $
|
|
|
10770
10769
|
void 0 !== i2.id && t2.writeVarintField(1, i2.id), t2.writeMessage(2, p, e2), t2.writeVarintField(3, i2.type), t2.writeMessage(4, v, i2);
|
|
10771
10770
|
}
|
|
10772
10771
|
function p(e2, t2) {
|
|
10773
|
-
var
|
|
10774
|
-
for (const i2 in (
|
|
10772
|
+
var _a;
|
|
10773
|
+
for (const i2 in (_a = e2.feature) == null ? void 0 : _a.properties) {
|
|
10775
10774
|
let o2 = e2.feature.properties[i2], s2 = e2.keycache[i2];
|
|
10776
10775
|
if (null === o2) continue;
|
|
10777
10776
|
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));
|
|
@@ -18369,7 +18368,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
18369
18368
|
function da(e2, i2) {
|
|
18370
18369
|
return i2.colorRampTexture || (i2.colorRampTexture = new t.T(e2, i2.colorRamp, e2.gl.RGBA)), i2.colorRampTexture;
|
|
18371
18370
|
}
|
|
18372
|
-
function
|
|
18371
|
+
function _a(e2, i2, o2, a2, r2, s2, n2, l2) {
|
|
18373
18372
|
let c2 = 256;
|
|
18374
18373
|
if (r2.stepInterpolant) {
|
|
18375
18374
|
const a3 = i2.getSource().maxzoom, r3 = n2.canonical.z === a3 ? Math.ceil(1 << e2.transform.maxZoom - n2.canonical.z) : 1;
|
|
@@ -18386,12 +18385,12 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
18386
18385
|
function fa(e2, t2, i2, o2, a2, r2, s2) {
|
|
18387
18386
|
const n2 = r2.gradients[a2.id];
|
|
18388
18387
|
let l2 = n2.texture;
|
|
18389
|
-
a2.gradientVersion !== n2.version && (l2 =
|
|
18388
|
+
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);
|
|
18390
18389
|
}
|
|
18391
18390
|
function ga(e2, t2, i2, o2, a2, r2, s2, n2, l2) {
|
|
18392
18391
|
const c2 = r2.gradients[a2.id];
|
|
18393
18392
|
let h2 = c2.texture;
|
|
18394
|
-
a2.gradientVersion !== c2.version && (h2 =
|
|
18393
|
+
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);
|
|
18395
18394
|
}
|
|
18396
18395
|
function va(e2, t2, i2, o2, a2) {
|
|
18397
18396
|
if (!i2 || !o2 || !o2.imageAtlas) return;
|
|
@@ -22131,17 +22130,17 @@ const clampProgress = (progress) => {
|
|
|
22131
22130
|
return progress;
|
|
22132
22131
|
};
|
|
22133
22132
|
const linearEasing = (progress) => clampProgress(progress);
|
|
22134
|
-
const normalizePower = (power,
|
|
22133
|
+
const normalizePower = (power, fallback2) => {
|
|
22135
22134
|
if (Number.isFinite(power) && power > 0) {
|
|
22136
22135
|
return power;
|
|
22137
22136
|
}
|
|
22138
|
-
return
|
|
22137
|
+
return fallback2;
|
|
22139
22138
|
};
|
|
22140
|
-
const normalizeMode = (mode,
|
|
22139
|
+
const normalizeMode = (mode, fallback2) => {
|
|
22141
22140
|
if (mode === "in" || mode === "out" || mode === "in-out") {
|
|
22142
22141
|
return mode;
|
|
22143
22142
|
}
|
|
22144
|
-
return
|
|
22143
|
+
return fallback2;
|
|
22145
22144
|
};
|
|
22146
22145
|
const toBounded = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
22147
22146
|
const createPowerEasing = (power, mode) => {
|
|
@@ -22242,65 +22241,65 @@ const createBackEasing = (overshoot) => {
|
|
|
22242
22241
|
return 1 + c3 * p * p * p + c1 * p * p;
|
|
22243
22242
|
};
|
|
22244
22243
|
};
|
|
22244
|
+
const fallback = {
|
|
22245
|
+
func: linearEasing,
|
|
22246
|
+
param: { type: "linear" }
|
|
22247
|
+
};
|
|
22245
22248
|
const resolveEasing = (easing) => {
|
|
22246
|
-
const fallback = {
|
|
22247
|
-
easing: linearEasing,
|
|
22248
|
-
preset: { type: "linear" }
|
|
22249
|
-
};
|
|
22250
22249
|
if (!easing) {
|
|
22251
22250
|
return fallback;
|
|
22252
22251
|
}
|
|
22253
22252
|
switch (easing.type) {
|
|
22254
22253
|
case "linear": {
|
|
22255
|
-
const
|
|
22256
|
-
return {
|
|
22254
|
+
const param = { type: "linear" };
|
|
22255
|
+
return { func: linearEasing, param };
|
|
22257
22256
|
}
|
|
22258
22257
|
case "ease": {
|
|
22259
22258
|
const power = normalizePower(easing.power, 3);
|
|
22260
22259
|
const mode = normalizeMode(easing.mode, "in-out");
|
|
22261
|
-
const
|
|
22262
|
-
return {
|
|
22260
|
+
const param = { type: "ease", power, mode };
|
|
22261
|
+
return { func: createPowerEasing(power, mode), param };
|
|
22263
22262
|
}
|
|
22264
22263
|
case "exponential": {
|
|
22265
22264
|
const exponent = normalizePower(easing.exponent, 5);
|
|
22266
22265
|
const mode = normalizeMode(easing.mode, "in-out");
|
|
22267
|
-
const
|
|
22266
|
+
const param = {
|
|
22268
22267
|
type: "exponential",
|
|
22269
22268
|
exponent,
|
|
22270
22269
|
mode
|
|
22271
22270
|
};
|
|
22272
|
-
return {
|
|
22271
|
+
return { func: createExponentialEasing(exponent, mode), param };
|
|
22273
22272
|
}
|
|
22274
22273
|
case "quadratic": {
|
|
22275
22274
|
const mode = normalizeMode(easing.mode, "in-out");
|
|
22276
|
-
const
|
|
22277
|
-
return {
|
|
22275
|
+
const param = { type: "quadratic", mode };
|
|
22276
|
+
return { func: createPowerEasing(2, mode), param };
|
|
22278
22277
|
}
|
|
22279
22278
|
case "cubic": {
|
|
22280
22279
|
const mode = normalizeMode(easing.mode, "in-out");
|
|
22281
|
-
const
|
|
22282
|
-
return {
|
|
22280
|
+
const param = { type: "cubic", mode };
|
|
22281
|
+
return { func: createPowerEasing(3, mode), param };
|
|
22283
22282
|
}
|
|
22284
22283
|
case "sine": {
|
|
22285
22284
|
const mode = normalizeMode(easing.mode, "in-out");
|
|
22286
22285
|
const amplitude = Number.isFinite(easing.amplitude) && easing.amplitude > 0 ? easing.amplitude : 1;
|
|
22287
|
-
const
|
|
22288
|
-
return {
|
|
22286
|
+
const param = { type: "sine", mode, amplitude };
|
|
22287
|
+
return { func: createSineEasing(mode, amplitude), param };
|
|
22289
22288
|
}
|
|
22290
22289
|
case "bounce": {
|
|
22291
22290
|
const bounces = Number.isFinite(easing.bounces) && easing.bounces > 0 ? easing.bounces : 3;
|
|
22292
22291
|
const decay = Number.isFinite(easing.decay) && easing.decay > 0 ? easing.decay : 0.5;
|
|
22293
|
-
const
|
|
22292
|
+
const param = {
|
|
22294
22293
|
type: "bounce",
|
|
22295
22294
|
bounces,
|
|
22296
22295
|
decay
|
|
22297
22296
|
};
|
|
22298
|
-
return {
|
|
22297
|
+
return { func: createBounceEasing(bounces, decay), param };
|
|
22299
22298
|
}
|
|
22300
22299
|
case "back": {
|
|
22301
22300
|
const overshoot = Number.isFinite(easing.overshoot) && easing.overshoot !== void 0 ? easing.overshoot : 1.70158;
|
|
22302
|
-
const
|
|
22303
|
-
return {
|
|
22301
|
+
const param = { type: "back", overshoot };
|
|
22302
|
+
return { func: createBackEasing(overshoot), param };
|
|
22304
22303
|
}
|
|
22305
22304
|
default:
|
|
22306
22305
|
return fallback;
|
|
@@ -22348,6 +22347,28 @@ const UV_CORNERS = [
|
|
|
22348
22347
|
[0, 1],
|
|
22349
22348
|
[1, 1]
|
|
22350
22349
|
];
|
|
22350
|
+
const __CSS_KEYWORD_COLORS = {
|
|
22351
|
+
black: [0, 0, 0, 1],
|
|
22352
|
+
silver: [192, 192, 192, 1],
|
|
22353
|
+
gray: [128, 128, 128, 1],
|
|
22354
|
+
white: [255, 255, 255, 1],
|
|
22355
|
+
maroon: [128, 0, 0, 1],
|
|
22356
|
+
red: [255, 0, 0, 1],
|
|
22357
|
+
purple: [128, 0, 128, 1],
|
|
22358
|
+
fuchsia: [255, 0, 255, 1],
|
|
22359
|
+
green: [0, 128, 0, 1],
|
|
22360
|
+
lime: [0, 255, 0, 1],
|
|
22361
|
+
olive: [128, 128, 0, 1],
|
|
22362
|
+
yellow: [255, 255, 0, 1],
|
|
22363
|
+
navy: [0, 0, 128, 1],
|
|
22364
|
+
blue: [0, 0, 255, 1],
|
|
22365
|
+
teal: [0, 128, 128, 1],
|
|
22366
|
+
aqua: [0, 255, 255, 1],
|
|
22367
|
+
transparent: [0, 0, 0, 0]
|
|
22368
|
+
};
|
|
22369
|
+
const CSS_KEYWORD_COLORS = __CSS_KEYWORD_COLORS;
|
|
22370
|
+
const DEFAULT_BORDER_COLOR = "red";
|
|
22371
|
+
const DEFAULT_BORDER_COLOR_RGBA = CSS_KEYWORD_COLORS.red;
|
|
22351
22372
|
const cloneSpriteLocation = (location2) => {
|
|
22352
22373
|
if (location2.z === void 0) {
|
|
22353
22374
|
return { lng: location2.lng, lat: location2.lat };
|
|
@@ -22355,8 +22376,8 @@ const cloneSpriteLocation = (location2) => {
|
|
|
22355
22376
|
return { lng: location2.lng, lat: location2.lat, z: location2.z };
|
|
22356
22377
|
};
|
|
22357
22378
|
const lerpSpriteLocation = (from, to, ratio) => {
|
|
22358
|
-
var
|
|
22359
|
-
const zFrom = (
|
|
22379
|
+
var _a, _b;
|
|
22380
|
+
const zFrom = (_a = from.z) != null ? _a : 0;
|
|
22360
22381
|
const zTo = (_b = to.z) != null ? _b : 0;
|
|
22361
22382
|
const hasZ = from.z !== void 0 || to.z !== void 0;
|
|
22362
22383
|
const result = {
|
|
@@ -22369,16 +22390,16 @@ const lerpSpriteLocation = (from, to, ratio) => {
|
|
|
22369
22390
|
return result;
|
|
22370
22391
|
};
|
|
22371
22392
|
const spriteLocationsEqual = (a, b) => {
|
|
22372
|
-
var
|
|
22373
|
-
const zA = (
|
|
22393
|
+
var _a, _b;
|
|
22394
|
+
const zA = (_a = a.z) != null ? _a : null;
|
|
22374
22395
|
const zB = (_b = b.z) != null ? _b : null;
|
|
22375
22396
|
return a.lng === b.lng && a.lat === b.lat && zA === zB;
|
|
22376
22397
|
};
|
|
22377
22398
|
const toCartesianMeters = (location2) => {
|
|
22378
|
-
var
|
|
22399
|
+
var _a;
|
|
22379
22400
|
const latitude = location2.lat;
|
|
22380
22401
|
const longitude = location2.lng;
|
|
22381
|
-
const altitude = (
|
|
22402
|
+
const altitude = (_a = location2.z) != null ? _a : 0;
|
|
22382
22403
|
const latRad = latitude * DEG2RAD;
|
|
22383
22404
|
const lonRad = longitude * DEG2RAD;
|
|
22384
22405
|
const cosLat = Math.cos(latRad);
|
|
@@ -22409,8 +22430,8 @@ const normalizeAngleDeg = (angle) => {
|
|
|
22409
22430
|
return Object.is(normalized, -0) ? 0 : normalized;
|
|
22410
22431
|
};
|
|
22411
22432
|
const multiplyMatrixAndVector = (matrix, x, y, z, w) => {
|
|
22412
|
-
var
|
|
22413
|
-
const m0 = (
|
|
22433
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
22434
|
+
const m0 = (_a = matrix[0]) != null ? _a : 0;
|
|
22414
22435
|
const m1 = (_b = matrix[1]) != null ? _b : 0;
|
|
22415
22436
|
const m2 = (_c = matrix[2]) != null ? _c : 0;
|
|
22416
22437
|
const m3 = (_d = matrix[3]) != null ? _d : 0;
|
|
@@ -22434,10 +22455,10 @@ const multiplyMatrixAndVector = (matrix, x, y, z, w) => {
|
|
|
22434
22455
|
];
|
|
22435
22456
|
};
|
|
22436
22457
|
const resolveScalingOptions = (options) => {
|
|
22437
|
-
var
|
|
22458
|
+
var _a, _b;
|
|
22438
22459
|
const base = UNLIMITED_SPRITE_SCALING_OPTIONS;
|
|
22439
22460
|
const warnings = [];
|
|
22440
|
-
const fallbackMetersPerPixel = Number.isFinite(base.metersPerPixel) && ((
|
|
22461
|
+
const fallbackMetersPerPixel = Number.isFinite(base.metersPerPixel) && ((_a = base.metersPerPixel) != null ? _a : 0) > 0 ? base.metersPerPixel : 1;
|
|
22441
22462
|
let metersPerPixel = (options == null ? void 0 : options.metersPerPixel) !== void 0 ? options.metersPerPixel : fallbackMetersPerPixel;
|
|
22442
22463
|
if (!Number.isFinite(metersPerPixel) || metersPerPixel <= 0) {
|
|
22443
22464
|
if ((options == null ? void 0 : options.metersPerPixel) !== void 0) {
|
|
@@ -22657,8 +22678,8 @@ const calculateBillboardPixelDimensions = (imageWidth, imageHeight, baseMetersPe
|
|
|
22657
22678
|
);
|
|
22658
22679
|
};
|
|
22659
22680
|
const calculateBillboardOffsetPixels = (offset, imageScale, zoomScaleFactor, effectivePixelsPerMeter, sizeScaleAdjustment = 1) => {
|
|
22660
|
-
var
|
|
22661
|
-
const offsetMeters = ((
|
|
22681
|
+
var _a, _b;
|
|
22682
|
+
const offsetMeters = ((_a = offset == null ? void 0 : offset.offsetMeters) != null ? _a : 0) * imageScale * zoomScaleFactor;
|
|
22662
22683
|
const offsetPixels = offsetMeters * effectivePixelsPerMeter * sizeScaleAdjustment;
|
|
22663
22684
|
const offsetRad = ((_b = offset == null ? void 0 : offset.offsetDeg) != null ? _b : 0) * DEG2RAD;
|
|
22664
22685
|
return {
|
|
@@ -22667,11 +22688,11 @@ const calculateBillboardOffsetPixels = (offset, imageScale, zoomScaleFactor, eff
|
|
|
22667
22688
|
};
|
|
22668
22689
|
};
|
|
22669
22690
|
const calculateBillboardAnchorShiftPixels = (halfWidth, halfHeight, anchor, totalRotateDeg) => {
|
|
22670
|
-
var
|
|
22691
|
+
var _a, _b;
|
|
22671
22692
|
if (halfWidth <= 0 || halfHeight <= 0) {
|
|
22672
22693
|
return { x: 0, y: 0 };
|
|
22673
22694
|
}
|
|
22674
|
-
const anchorX = ((
|
|
22695
|
+
const anchorX = ((_a = anchor == null ? void 0 : anchor.x) != null ? _a : 0) * halfWidth;
|
|
22675
22696
|
const anchorY = ((_b = anchor == null ? void 0 : anchor.y) != null ? _b : 0) * halfHeight;
|
|
22676
22697
|
if (anchorX === 0 && anchorY === 0) {
|
|
22677
22698
|
return { x: 0, y: 0 };
|
|
@@ -22684,7 +22705,7 @@ const calculateBillboardAnchorShiftPixels = (halfWidth, halfHeight, anchor, tota
|
|
|
22684
22705
|
return { x: shiftX, y: shiftY };
|
|
22685
22706
|
};
|
|
22686
22707
|
const calculateSurfaceWorldDimensions = (imageWidth, imageHeight, baseMetersPerPixel, imageScale, zoomScaleFactor, options) => {
|
|
22687
|
-
var
|
|
22708
|
+
var _a, _b;
|
|
22688
22709
|
if (!imageWidth || !imageHeight || imageWidth <= 0 || imageHeight <= 0 || baseMetersPerPixel <= 0) {
|
|
22689
22710
|
return { width: 0, height: 0, scaleAdjustment: 1 };
|
|
22690
22711
|
}
|
|
@@ -22693,7 +22714,7 @@ const calculateSurfaceWorldDimensions = (imageWidth, imageHeight, baseMetersPerP
|
|
|
22693
22714
|
let height = ensureFinite(imageHeight * scaleFactor);
|
|
22694
22715
|
let scaleAdjustment = 1;
|
|
22695
22716
|
const effectivePixelsPerMeter = (options == null ? void 0 : options.effectivePixelsPerMeter) !== void 0 ? options.effectivePixelsPerMeter : 0;
|
|
22696
|
-
const spriteMinPixel = (
|
|
22717
|
+
const spriteMinPixel = (_a = options == null ? void 0 : options.spriteMinPixel) != null ? _a : 0;
|
|
22697
22718
|
const spriteMaxPixel = (_b = options == null ? void 0 : options.spriteMaxPixel) != null ? _b : 0;
|
|
22698
22719
|
if (effectivePixelsPerMeter > 0 && Number.isFinite(effectivePixelsPerMeter) && (spriteMinPixel > 0 || spriteMaxPixel > 0)) {
|
|
22699
22720
|
const largestMeters = Math.max(width, height);
|
|
@@ -22719,11 +22740,11 @@ const calculateSurfaceWorldDimensions = (imageWidth, imageHeight, baseMetersPerP
|
|
|
22719
22740
|
return { width, height, scaleAdjustment };
|
|
22720
22741
|
};
|
|
22721
22742
|
const calculateSurfaceAnchorShiftMeters = (halfWidthMeters, halfHeightMeters, anchor, totalRotateDeg) => {
|
|
22722
|
-
var
|
|
22743
|
+
var _a, _b;
|
|
22723
22744
|
if (halfWidthMeters <= 0 || halfHeightMeters <= 0) {
|
|
22724
22745
|
return { east: 0, north: 0 };
|
|
22725
22746
|
}
|
|
22726
|
-
const anchorEast = ((
|
|
22747
|
+
const anchorEast = ((_a = anchor == null ? void 0 : anchor.x) != null ? _a : 0) * halfWidthMeters;
|
|
22727
22748
|
const anchorNorth = ((_b = anchor == null ? void 0 : anchor.y) != null ? _b : 0) * halfHeightMeters;
|
|
22728
22749
|
if (anchorEast === 0 && anchorNorth === 0) {
|
|
22729
22750
|
return { east: 0, north: 0 };
|
|
@@ -22736,8 +22757,8 @@ const calculateSurfaceAnchorShiftMeters = (halfWidthMeters, halfHeightMeters, an
|
|
|
22736
22757
|
return { east, north };
|
|
22737
22758
|
};
|
|
22738
22759
|
const calculateSurfaceOffsetMeters = (offset, imageScale, zoomScaleFactor, sizeScaleAdjustment = 1) => {
|
|
22739
|
-
var
|
|
22740
|
-
const offsetMeters = ((
|
|
22760
|
+
var _a, _b;
|
|
22761
|
+
const offsetMeters = ((_a = offset == null ? void 0 : offset.offsetMeters) != null ? _a : 0) * imageScale * zoomScaleFactor;
|
|
22741
22762
|
if (offsetMeters === 0) {
|
|
22742
22763
|
return { east: 0, north: 0 };
|
|
22743
22764
|
}
|
|
@@ -22801,8 +22822,8 @@ const calculateBillboardDepthKey = (center, unproject, projectToClipSpace) => {
|
|
|
22801
22822
|
return -ndcZ;
|
|
22802
22823
|
};
|
|
22803
22824
|
const calculateSurfaceDepthKey = (baseLngLat, displacements, projectToClipSpace, options) => {
|
|
22804
|
-
var
|
|
22805
|
-
const indices = (
|
|
22825
|
+
var _a;
|
|
22826
|
+
const indices = (_a = options == null ? void 0 : options.indices) != null ? _a : TRIANGLE_INDICES;
|
|
22806
22827
|
let maxDepth = Number.NEGATIVE_INFINITY;
|
|
22807
22828
|
for (const index of indices) {
|
|
22808
22829
|
const displacement = displacements[index];
|
|
@@ -22890,12 +22911,12 @@ const BILLBOARD_BASE_CORNERS$1 = [
|
|
|
22890
22911
|
[1, -1]
|
|
22891
22912
|
];
|
|
22892
22913
|
const calculateBillboardCornerScreenPositions = (params) => {
|
|
22893
|
-
var
|
|
22914
|
+
var _a, _b;
|
|
22894
22915
|
const { center, halfWidth, halfHeight, anchor, totalRotateDeg } = params;
|
|
22895
22916
|
if (halfWidth <= 0 || halfHeight <= 0) {
|
|
22896
22917
|
return UV_CORNERS.map(([u, v]) => ({ x: center.x, y: center.y, u, v }));
|
|
22897
22918
|
}
|
|
22898
|
-
const anchorOffsetX = ((
|
|
22919
|
+
const anchorOffsetX = ((_a = anchor == null ? void 0 : anchor.x) != null ? _a : 0) * halfWidth;
|
|
22899
22920
|
const anchorOffsetY = ((_b = anchor == null ? void 0 : anchor.y) != null ? _b : 0) * halfHeight;
|
|
22900
22921
|
const rad = -totalRotateDeg * DEG2RAD;
|
|
22901
22922
|
const cosR = Math.cos(rad);
|
|
@@ -22920,7 +22941,7 @@ const calculateBillboardCornerScreenPositions = (params) => {
|
|
|
22920
22941
|
return corners;
|
|
22921
22942
|
};
|
|
22922
22943
|
const computeSurfaceCornerShaderModel = (params) => {
|
|
22923
|
-
var
|
|
22944
|
+
var _a, _b;
|
|
22924
22945
|
const {
|
|
22925
22946
|
baseLngLat,
|
|
22926
22947
|
worldWidthMeters,
|
|
@@ -22943,7 +22964,7 @@ const computeSurfaceCornerShaderModel = (params) => {
|
|
|
22943
22964
|
lat: baseLngLat.lat + deltaLat
|
|
22944
22965
|
}));
|
|
22945
22966
|
}
|
|
22946
|
-
const anchorEast = ((
|
|
22967
|
+
const anchorEast = ((_a = anchor == null ? void 0 : anchor.x) != null ? _a : 0) * halfWidth;
|
|
22947
22968
|
const anchorNorth = ((_b = anchor == null ? void 0 : anchor.y) != null ? _b : 0) * halfHeight;
|
|
22948
22969
|
const rad = -totalRotateDeg * DEG2RAD;
|
|
22949
22970
|
const sinR = Math.sin(rad);
|
|
@@ -22970,7 +22991,7 @@ const computeSurfaceCornerShaderModel = (params) => {
|
|
|
22970
22991
|
});
|
|
22971
22992
|
};
|
|
22972
22993
|
const calculateSurfaceCenterPosition = (params) => {
|
|
22973
|
-
var
|
|
22994
|
+
var _a;
|
|
22974
22995
|
const {
|
|
22975
22996
|
baseLngLat,
|
|
22976
22997
|
imageWidth,
|
|
@@ -23050,7 +23071,7 @@ const calculateSurfaceCenterPosition = (params) => {
|
|
|
23050
23071
|
baseLngLat,
|
|
23051
23072
|
anchorlessDisplacement
|
|
23052
23073
|
);
|
|
23053
|
-
anchorlessCenter = (
|
|
23074
|
+
anchorlessCenter = (_a = projectPoint(anchorlessLngLat)) != null ? _a : null;
|
|
23054
23075
|
}
|
|
23055
23076
|
return {
|
|
23056
23077
|
center,
|
|
@@ -23070,7 +23091,7 @@ const SURFACE_BASE_CORNERS$1 = [
|
|
|
23070
23091
|
];
|
|
23071
23092
|
SURFACE_BASE_CORNERS$1.length;
|
|
23072
23093
|
const calculateSurfaceCornerDisplacements = (params) => {
|
|
23073
|
-
var
|
|
23094
|
+
var _a, _b;
|
|
23074
23095
|
const {
|
|
23075
23096
|
worldWidthMeters,
|
|
23076
23097
|
worldHeightMeters,
|
|
@@ -23083,7 +23104,7 @@ const calculateSurfaceCornerDisplacements = (params) => {
|
|
|
23083
23104
|
}
|
|
23084
23105
|
const halfWidth = worldWidthMeters / 2;
|
|
23085
23106
|
const halfHeight = worldHeightMeters / 2;
|
|
23086
|
-
const anchorEast = ((
|
|
23107
|
+
const anchorEast = ((_a = anchor == null ? void 0 : anchor.x) != null ? _a : 0) * halfWidth;
|
|
23087
23108
|
const anchorNorth = ((_b = anchor == null ? void 0 : anchor.y) != null ? _b : 0) * halfHeight;
|
|
23088
23109
|
const rad = -totalRotateDeg * DEG2RAD;
|
|
23089
23110
|
const cosR = Math.cos(rad);
|
|
@@ -23128,11 +23149,11 @@ const clampOpacity = (value) => {
|
|
|
23128
23149
|
return value;
|
|
23129
23150
|
};
|
|
23130
23151
|
const computeFeedforwardTarget = (previous, next) => {
|
|
23131
|
-
var
|
|
23152
|
+
var _a, _b;
|
|
23132
23153
|
if (!previous) {
|
|
23133
23154
|
return cloneSpriteLocation(next);
|
|
23134
23155
|
}
|
|
23135
|
-
const prevZ = (
|
|
23156
|
+
const prevZ = (_a = previous.z) != null ? _a : 0;
|
|
23136
23157
|
const nextZ = (_b = next.z) != null ? _b : 0;
|
|
23137
23158
|
const hasZ = previous.z !== void 0 || next.z !== void 0;
|
|
23138
23159
|
const target = {
|
|
@@ -23144,10 +23165,10 @@ const computeFeedforwardTarget = (previous, next) => {
|
|
|
23144
23165
|
return target;
|
|
23145
23166
|
};
|
|
23146
23167
|
const normalizeOptions$2 = (options) => {
|
|
23147
|
-
var
|
|
23168
|
+
var _a;
|
|
23148
23169
|
return {
|
|
23149
23170
|
durationMs: Math.max(0, options.durationMs),
|
|
23150
|
-
mode: (
|
|
23171
|
+
mode: (_a = options.mode) != null ? _a : "feedback",
|
|
23151
23172
|
easing: options.easing
|
|
23152
23173
|
};
|
|
23153
23174
|
};
|
|
@@ -23156,31 +23177,36 @@ const createInterpolationState = (params) => {
|
|
|
23156
23177
|
const options = normalizeOptions$2(params.options);
|
|
23157
23178
|
const from = cloneSpriteLocation(currentLocation);
|
|
23158
23179
|
const resolvedEasing = resolveEasing(options.easing);
|
|
23159
|
-
|
|
23180
|
+
const commandTarget = cloneSpriteLocation(nextCommandLocation);
|
|
23181
|
+
let pathTarget;
|
|
23160
23182
|
if (options.mode === "feedforward") {
|
|
23161
|
-
|
|
23162
|
-
|
|
23163
|
-
|
|
23183
|
+
pathTarget = computeFeedforwardTarget(
|
|
23184
|
+
lastCommandLocation,
|
|
23185
|
+
nextCommandLocation
|
|
23186
|
+
);
|
|
23164
23187
|
}
|
|
23165
|
-
const requiresInterpolation = options.durationMs > 0 && !spriteLocationsEqual(from,
|
|
23188
|
+
const requiresInterpolation = options.durationMs > 0 && !spriteLocationsEqual(from, pathTarget != null ? pathTarget : commandTarget);
|
|
23166
23189
|
const state = {
|
|
23167
23190
|
mode: options.mode,
|
|
23168
23191
|
durationMs: options.durationMs,
|
|
23169
|
-
|
|
23170
|
-
|
|
23192
|
+
easingFunc: resolvedEasing.func,
|
|
23193
|
+
easingParam: resolvedEasing.param,
|
|
23171
23194
|
startTimestamp: -1,
|
|
23172
23195
|
from,
|
|
23173
|
-
to
|
|
23196
|
+
to: commandTarget,
|
|
23197
|
+
pathTarget: pathTarget && !spriteLocationsEqual(pathTarget, commandTarget) ? pathTarget : void 0
|
|
23174
23198
|
};
|
|
23175
23199
|
return { state, requiresInterpolation };
|
|
23176
23200
|
};
|
|
23177
23201
|
const evaluateInterpolation = (params) => {
|
|
23202
|
+
var _a;
|
|
23178
23203
|
const { state } = params;
|
|
23179
|
-
const easingFn = state.
|
|
23204
|
+
const easingFn = state.easingFunc;
|
|
23180
23205
|
const timestamp = Number.isFinite(params.timestamp) ? params.timestamp : Date.now();
|
|
23181
23206
|
const duration = Math.max(0, state.durationMs);
|
|
23182
23207
|
const effectiveStart = state.startTimestamp >= 0 ? state.startTimestamp : timestamp;
|
|
23183
|
-
|
|
23208
|
+
const target = (_a = state.pathTarget) != null ? _a : state.to;
|
|
23209
|
+
if (duration === 0 || spriteLocationsEqual(state.from, target)) {
|
|
23184
23210
|
return {
|
|
23185
23211
|
location: cloneSpriteLocation(state.to),
|
|
23186
23212
|
completed: true,
|
|
@@ -23190,7 +23216,7 @@ const evaluateInterpolation = (params) => {
|
|
|
23190
23216
|
const elapsed = timestamp - effectiveStart;
|
|
23191
23217
|
const rawProgress = duration <= 0 ? 1 : elapsed / duration;
|
|
23192
23218
|
const eased = easingFn(rawProgress);
|
|
23193
|
-
const location2 = lerpSpriteLocation(state.from,
|
|
23219
|
+
const location2 = lerpSpriteLocation(state.from, target, eased);
|
|
23194
23220
|
const completed = rawProgress >= 1;
|
|
23195
23221
|
return {
|
|
23196
23222
|
location: location2,
|
|
@@ -23213,13 +23239,13 @@ const normalizeDelta = (delta) => {
|
|
|
23213
23239
|
return adjusted;
|
|
23214
23240
|
};
|
|
23215
23241
|
const normalizeOptions$1 = (options) => {
|
|
23216
|
-
var
|
|
23242
|
+
var _a;
|
|
23217
23243
|
const resolved = resolveEasing(options.easing);
|
|
23218
23244
|
return {
|
|
23219
23245
|
durationMs: normalizeDuration$1(options.durationMs),
|
|
23220
|
-
|
|
23221
|
-
|
|
23222
|
-
mode: (
|
|
23246
|
+
easingFunc: resolved.func,
|
|
23247
|
+
easingParam: resolved.param,
|
|
23248
|
+
mode: (_a = options.mode) != null ? _a : "feedback"
|
|
23223
23249
|
};
|
|
23224
23250
|
};
|
|
23225
23251
|
const createDegreeInterpolationState = (params) => {
|
|
@@ -23233,14 +23259,16 @@ const createDegreeInterpolationState = (params) => {
|
|
|
23233
23259
|
}
|
|
23234
23260
|
const delta = normalizeDelta(effectiveTarget - currentValue);
|
|
23235
23261
|
const pathTarget = currentValue + delta;
|
|
23262
|
+
const normalizedPathTarget = Math.abs(pathTarget - targetValue) <= NUMERIC_EPSILON ? void 0 : pathTarget;
|
|
23236
23263
|
const requiresInterpolation = options.durationMs > 0 && Math.abs(delta) > NUMERIC_EPSILON;
|
|
23237
23264
|
const state = {
|
|
23265
|
+
mode: options.mode,
|
|
23238
23266
|
durationMs: options.durationMs,
|
|
23239
|
-
|
|
23240
|
-
|
|
23267
|
+
easingFunc: options.easingFunc,
|
|
23268
|
+
easingParam: options.easingParam,
|
|
23241
23269
|
from: currentValue,
|
|
23242
|
-
to:
|
|
23243
|
-
|
|
23270
|
+
to: targetValue,
|
|
23271
|
+
pathTarget: normalizedPathTarget,
|
|
23244
23272
|
startTimestamp: -1
|
|
23245
23273
|
};
|
|
23246
23274
|
return {
|
|
@@ -23261,38 +23289,40 @@ const clamp01$2 = (value) => {
|
|
|
23261
23289
|
return value;
|
|
23262
23290
|
};
|
|
23263
23291
|
const evaluateDegreeInterpolation = (params) => {
|
|
23292
|
+
var _a;
|
|
23264
23293
|
const { state } = params;
|
|
23294
|
+
const targetValue = (_a = state.pathTarget) != null ? _a : state.to;
|
|
23265
23295
|
const timestamp = Number.isFinite(params.timestamp) ? params.timestamp : Date.now();
|
|
23266
23296
|
const duration = Math.max(0, state.durationMs);
|
|
23267
23297
|
const effectiveStart = state.startTimestamp >= 0 ? state.startTimestamp : timestamp;
|
|
23268
|
-
if (duration === 0 || Math.abs(
|
|
23298
|
+
if (duration === 0 || Math.abs(targetValue - state.from) <= NUMERIC_EPSILON) {
|
|
23269
23299
|
return {
|
|
23270
|
-
value: state.
|
|
23300
|
+
value: state.to,
|
|
23271
23301
|
completed: true,
|
|
23272
23302
|
effectiveStartTimestamp: effectiveStart
|
|
23273
23303
|
};
|
|
23274
23304
|
}
|
|
23275
23305
|
const elapsed = timestamp - effectiveStart;
|
|
23276
23306
|
const rawProgress = duration <= 0 ? 1 : elapsed / duration;
|
|
23277
|
-
const eased = clamp01$2(state.
|
|
23278
|
-
const interpolated = state.from + (
|
|
23307
|
+
const eased = clamp01$2(state.easingFunc(rawProgress));
|
|
23308
|
+
const interpolated = state.from + (targetValue - state.from) * eased;
|
|
23279
23309
|
const completed = rawProgress >= 1;
|
|
23280
23310
|
return {
|
|
23281
|
-
value: completed ? state.
|
|
23311
|
+
value: completed ? state.to : interpolated,
|
|
23282
23312
|
completed,
|
|
23283
23313
|
effectiveStartTimestamp: effectiveStart
|
|
23284
23314
|
};
|
|
23285
23315
|
};
|
|
23286
23316
|
const DEGREE_INTERPOLATION_CHANNELS = {
|
|
23287
23317
|
rotation: {
|
|
23288
|
-
|
|
23318
|
+
resolveInterpolation: (image) => image.rotateDeg.interpolation,
|
|
23289
23319
|
normalize: normalizeAngleDeg,
|
|
23290
23320
|
applyValue: (image, value) => {
|
|
23291
23321
|
image.displayedRotateDeg = value;
|
|
23292
23322
|
}
|
|
23293
23323
|
},
|
|
23294
23324
|
offsetDeg: {
|
|
23295
|
-
|
|
23325
|
+
resolveInterpolation: (image) => image.offset.offsetDeg.interpolation,
|
|
23296
23326
|
applyValue: (image, value) => {
|
|
23297
23327
|
image.offset.offsetDeg.current = value;
|
|
23298
23328
|
},
|
|
@@ -23304,14 +23334,10 @@ const DEGREE_INTERPOLATION_CHANNELS = {
|
|
|
23304
23334
|
}
|
|
23305
23335
|
};
|
|
23306
23336
|
const updateDegreeInterpolationState = (image, descriptor, nextState) => {
|
|
23307
|
-
|
|
23308
|
-
image.rotationInterpolationState = nextState;
|
|
23309
|
-
} else {
|
|
23310
|
-
image.offsetDegInterpolationState = nextState;
|
|
23311
|
-
}
|
|
23337
|
+
descriptor.resolveInterpolation(image).state = nextState;
|
|
23312
23338
|
};
|
|
23313
23339
|
const collectDegreeInterpolationWorkItems = (image, workItems) => {
|
|
23314
|
-
const rotationState = image.
|
|
23340
|
+
const rotationState = DEGREE_INTERPOLATION_CHANNELS.rotation.resolveInterpolation(image).state;
|
|
23315
23341
|
if (rotationState) {
|
|
23316
23342
|
workItems.push({
|
|
23317
23343
|
descriptor: DEGREE_INTERPOLATION_CHANNELS.rotation,
|
|
@@ -23319,7 +23345,7 @@ const collectDegreeInterpolationWorkItems = (image, workItems) => {
|
|
|
23319
23345
|
state: rotationState
|
|
23320
23346
|
});
|
|
23321
23347
|
}
|
|
23322
|
-
const offsetState = image.
|
|
23348
|
+
const offsetState = DEGREE_INTERPOLATION_CHANNELS.offsetDeg.resolveInterpolation(image).state;
|
|
23323
23349
|
if (offsetState) {
|
|
23324
23350
|
workItems.push({
|
|
23325
23351
|
descriptor: DEGREE_INTERPOLATION_CHANNELS.offsetDeg,
|
|
@@ -23329,11 +23355,11 @@ const collectDegreeInterpolationWorkItems = (image, workItems) => {
|
|
|
23329
23355
|
}
|
|
23330
23356
|
};
|
|
23331
23357
|
const applyDegreeInterpolationEvaluations = (workItems, evaluations, timestamp) => {
|
|
23332
|
-
var
|
|
23358
|
+
var _a, _b, _c;
|
|
23333
23359
|
let active = false;
|
|
23334
23360
|
for (let index = 0; index < workItems.length; index += 1) {
|
|
23335
23361
|
const item = workItems[index];
|
|
23336
|
-
const evaluation = (
|
|
23362
|
+
const evaluation = (_a = evaluations[index]) != null ? _a : evaluateDegreeInterpolation({
|
|
23337
23363
|
state: item.state,
|
|
23338
23364
|
timestamp
|
|
23339
23365
|
});
|
|
@@ -23345,7 +23371,7 @@ const applyDegreeInterpolationEvaluations = (workItems, evaluations, timestamp)
|
|
|
23345
23371
|
const interpolatedValue = normalize(evaluation.value);
|
|
23346
23372
|
item.descriptor.applyValue(item.image, interpolatedValue);
|
|
23347
23373
|
if (evaluation.completed) {
|
|
23348
|
-
const finalValue = normalize(item.state.
|
|
23374
|
+
const finalValue = normalize(item.state.to);
|
|
23349
23375
|
applyFinalValue(item.image, finalValue);
|
|
23350
23376
|
updateDegreeInterpolationState(item.image, item.descriptor, null);
|
|
23351
23377
|
} else {
|
|
@@ -23391,32 +23417,13 @@ const normalizeRgba = (r, g, b, a) => [
|
|
|
23391
23417
|
clamp255(b) / 255,
|
|
23392
23418
|
clamp01$1(a)
|
|
23393
23419
|
];
|
|
23394
|
-
const CSS_KEYWORD_COLORS = {
|
|
23395
|
-
black: normalizeRgba(0, 0, 0, 1),
|
|
23396
|
-
silver: normalizeRgba(192, 192, 192, 1),
|
|
23397
|
-
gray: normalizeRgba(128, 128, 128, 1),
|
|
23398
|
-
white: normalizeRgba(255, 255, 255, 1),
|
|
23399
|
-
maroon: normalizeRgba(128, 0, 0, 1),
|
|
23400
|
-
red: normalizeRgba(255, 0, 0, 1),
|
|
23401
|
-
purple: normalizeRgba(128, 0, 128, 1),
|
|
23402
|
-
fuchsia: normalizeRgba(255, 0, 255, 1),
|
|
23403
|
-
green: normalizeRgba(0, 128, 0, 1),
|
|
23404
|
-
lime: normalizeRgba(0, 255, 0, 1),
|
|
23405
|
-
olive: normalizeRgba(128, 128, 0, 1),
|
|
23406
|
-
yellow: normalizeRgba(255, 255, 0, 1),
|
|
23407
|
-
navy: normalizeRgba(0, 0, 128, 1),
|
|
23408
|
-
blue: normalizeRgba(0, 0, 255, 1),
|
|
23409
|
-
teal: normalizeRgba(0, 128, 128, 1),
|
|
23410
|
-
aqua: normalizeRgba(0, 255, 255, 1),
|
|
23411
|
-
transparent: normalizeRgba(0, 0, 0, 0)
|
|
23412
|
-
};
|
|
23413
23420
|
const tryParseHexColor = (value) => {
|
|
23414
|
-
var
|
|
23421
|
+
var _a;
|
|
23415
23422
|
const match = /^#([0-9a-f]{3,8})$/i.exec(value.trim());
|
|
23416
23423
|
if (!match) {
|
|
23417
23424
|
return null;
|
|
23418
23425
|
}
|
|
23419
|
-
const hex = (
|
|
23426
|
+
const hex = (_a = match[1]) != null ? _a : "";
|
|
23420
23427
|
if (hex.length === 3) {
|
|
23421
23428
|
const [r, g, b] = hex.split("").map((c) => parseInt(c + c, 16));
|
|
23422
23429
|
return normalizeRgba(r, g, b, 1);
|
|
@@ -23460,14 +23467,14 @@ const parseAlpha = (value) => {
|
|
|
23460
23467
|
return Number.isFinite(number) ? clamp01$1(number) : Number.NaN;
|
|
23461
23468
|
};
|
|
23462
23469
|
const tryParseRgbFunction = (value) => {
|
|
23463
|
-
var
|
|
23470
|
+
var _a, _b, _c;
|
|
23464
23471
|
const match = /^rgba?\(\s*([^,]+?)\s*,\s*([^,]+?)\s*,\s*([^,]+?)(?:\s*,\s*([^,]+?)\s*)?\)$/i.exec(
|
|
23465
23472
|
value.trim()
|
|
23466
23473
|
);
|
|
23467
23474
|
if (!match) {
|
|
23468
23475
|
return null;
|
|
23469
23476
|
}
|
|
23470
|
-
const r = parseChannel((
|
|
23477
|
+
const r = parseChannel((_a = match[1]) != null ? _a : "");
|
|
23471
23478
|
const g = parseChannel((_b = match[2]) != null ? _b : "");
|
|
23472
23479
|
const b = parseChannel((_c = match[3]) != null ? _c : "");
|
|
23473
23480
|
const a = parseAlpha(match[4]);
|
|
@@ -23477,7 +23484,7 @@ const tryParseRgbFunction = (value) => {
|
|
|
23477
23484
|
return normalizeRgba(r, g, b, a);
|
|
23478
23485
|
};
|
|
23479
23486
|
const parseColorUsingDom = (value) => {
|
|
23480
|
-
var
|
|
23487
|
+
var _a;
|
|
23481
23488
|
if (typeof document === "undefined") {
|
|
23482
23489
|
return null;
|
|
23483
23490
|
}
|
|
@@ -23487,35 +23494,33 @@ const parseColorUsingDom = (value) => {
|
|
|
23487
23494
|
if (!element.style.color) {
|
|
23488
23495
|
return null;
|
|
23489
23496
|
}
|
|
23490
|
-
return (
|
|
23497
|
+
return (_a = tryParseRgbFunction(element.style.color)) != null ? _a : tryParseHexColor(element.style.color.toLowerCase());
|
|
23491
23498
|
};
|
|
23492
|
-
const parseCssColorToRgba = (color,
|
|
23493
|
-
var
|
|
23499
|
+
const parseCssColorToRgba = (color, fallback2) => {
|
|
23500
|
+
var _a, _b, _c;
|
|
23494
23501
|
if (!color) {
|
|
23495
|
-
return
|
|
23502
|
+
return fallback2;
|
|
23496
23503
|
}
|
|
23497
23504
|
const trimmed = color.trim();
|
|
23498
23505
|
if (trimmed.length === 0) {
|
|
23499
|
-
return
|
|
23506
|
+
return fallback2;
|
|
23500
23507
|
}
|
|
23501
23508
|
const keyword = CSS_KEYWORD_COLORS[trimmed.toLowerCase()];
|
|
23502
23509
|
if (keyword) {
|
|
23503
23510
|
return keyword;
|
|
23504
23511
|
}
|
|
23505
|
-
return (_c = (_b = (
|
|
23512
|
+
return (_c = (_b = (_a = tryParseHexColor(trimmed)) != null ? _a : tryParseRgbFunction(trimmed)) != null ? _b : parseColorUsingDom(trimmed)) != null ? _c : fallback2;
|
|
23506
23513
|
};
|
|
23507
|
-
const DEFAULT_BORDER_COLOR = "red";
|
|
23508
|
-
const DEFAULT_BORDER_COLOR_RGBA = (_a = CSS_KEYWORD_COLORS.red) != null ? _a : normalizeRgba(255, 0, 0, 1);
|
|
23509
23514
|
const DISTANCE_EPSILON = 1e-6;
|
|
23510
23515
|
const normalizeDuration = (durationMs) => Number.isFinite(durationMs) && durationMs > 0 ? durationMs : 0;
|
|
23511
23516
|
const normalizeOptions = (options) => {
|
|
23512
|
-
var
|
|
23517
|
+
var _a;
|
|
23513
23518
|
const resolved = resolveEasing(options.easing);
|
|
23514
23519
|
return {
|
|
23515
23520
|
durationMs: normalizeDuration(options.durationMs),
|
|
23516
|
-
|
|
23517
|
-
|
|
23518
|
-
mode: (
|
|
23521
|
+
easingFunc: resolved.func,
|
|
23522
|
+
easingParam: resolved.param,
|
|
23523
|
+
mode: (_a = options.mode) != null ? _a : "feedback"
|
|
23519
23524
|
};
|
|
23520
23525
|
};
|
|
23521
23526
|
const createDistanceInterpolationState = (params) => {
|
|
@@ -23529,13 +23534,16 @@ const createDistanceInterpolationState = (params) => {
|
|
|
23529
23534
|
}
|
|
23530
23535
|
const delta = effectiveTarget - currentValue;
|
|
23531
23536
|
const requiresInterpolation = options.durationMs > 0 && Math.abs(delta) > DISTANCE_EPSILON;
|
|
23537
|
+
const pathTarget = currentValue + delta;
|
|
23538
|
+
const normalizedPathTarget = Math.abs(pathTarget - targetValue) <= DISTANCE_EPSILON ? void 0 : pathTarget;
|
|
23532
23539
|
const state = {
|
|
23540
|
+
mode: options.mode,
|
|
23533
23541
|
durationMs: options.durationMs,
|
|
23534
|
-
|
|
23535
|
-
|
|
23542
|
+
easingFunc: options.easingFunc,
|
|
23543
|
+
easingParam: options.easingParam,
|
|
23536
23544
|
from: currentValue,
|
|
23537
|
-
to:
|
|
23538
|
-
|
|
23545
|
+
to: targetValue,
|
|
23546
|
+
pathTarget: normalizedPathTarget,
|
|
23539
23547
|
startTimestamp: -1
|
|
23540
23548
|
};
|
|
23541
23549
|
return {
|
|
@@ -23556,31 +23564,33 @@ const clamp01 = (value) => {
|
|
|
23556
23564
|
return value;
|
|
23557
23565
|
};
|
|
23558
23566
|
const evaluateDistanceInterpolation = (params) => {
|
|
23567
|
+
var _a;
|
|
23559
23568
|
const { state } = params;
|
|
23569
|
+
const targetValue = (_a = state.pathTarget) != null ? _a : state.to;
|
|
23560
23570
|
const timestamp = Number.isFinite(params.timestamp) ? params.timestamp : Date.now();
|
|
23561
23571
|
const duration = Math.max(0, state.durationMs);
|
|
23562
23572
|
const effectiveStart = state.startTimestamp >= 0 ? state.startTimestamp : timestamp;
|
|
23563
|
-
if (duration === 0 || Math.abs(
|
|
23573
|
+
if (duration === 0 || Math.abs(targetValue - state.from) <= DISTANCE_EPSILON) {
|
|
23564
23574
|
return {
|
|
23565
|
-
value: state.
|
|
23575
|
+
value: state.to,
|
|
23566
23576
|
completed: true,
|
|
23567
23577
|
effectiveStartTimestamp: effectiveStart
|
|
23568
23578
|
};
|
|
23569
23579
|
}
|
|
23570
23580
|
const elapsed = timestamp - effectiveStart;
|
|
23571
23581
|
const rawProgress = duration <= 0 ? 1 : elapsed / duration;
|
|
23572
|
-
const eased = clamp01(state.
|
|
23573
|
-
const interpolated = state.from + (
|
|
23582
|
+
const eased = clamp01(state.easingFunc(rawProgress));
|
|
23583
|
+
const interpolated = state.from + (targetValue - state.from) * eased;
|
|
23574
23584
|
const completed = rawProgress >= 1;
|
|
23575
23585
|
return {
|
|
23576
|
-
value: completed ? state.
|
|
23586
|
+
value: completed ? state.to : interpolated,
|
|
23577
23587
|
completed,
|
|
23578
23588
|
effectiveStartTimestamp: effectiveStart
|
|
23579
23589
|
};
|
|
23580
23590
|
};
|
|
23581
23591
|
const DISTANCE_INTERPOLATION_CHANNELS = {
|
|
23582
23592
|
offsetMeters: {
|
|
23583
|
-
|
|
23593
|
+
resolveInterpolation: (image) => image.offset.offsetMeters.interpolation,
|
|
23584
23594
|
applyValue: (image, value) => {
|
|
23585
23595
|
image.offset.offsetMeters.current = value;
|
|
23586
23596
|
},
|
|
@@ -23591,7 +23601,7 @@ const DISTANCE_INTERPOLATION_CHANNELS = {
|
|
|
23591
23601
|
}
|
|
23592
23602
|
},
|
|
23593
23603
|
opacity: {
|
|
23594
|
-
|
|
23604
|
+
resolveInterpolation: (image) => image.opacity.interpolation,
|
|
23595
23605
|
normalize: clampOpacity,
|
|
23596
23606
|
applyValue: (image, value) => {
|
|
23597
23607
|
image.opacity.current = value;
|
|
@@ -23604,10 +23614,12 @@ const DISTANCE_INTERPOLATION_CHANNELS = {
|
|
|
23604
23614
|
}
|
|
23605
23615
|
};
|
|
23606
23616
|
const collectDistanceInterpolationWorkItems = (image, workItems, options) => {
|
|
23607
|
-
var
|
|
23608
|
-
const includeOffsetMeters = (
|
|
23617
|
+
var _a, _b;
|
|
23618
|
+
const includeOffsetMeters = (_a = options == null ? void 0 : options.includeOffsetMeters) != null ? _a : true;
|
|
23609
23619
|
const includeOpacity = (_b = options == null ? void 0 : options.includeOpacity) != null ? _b : true;
|
|
23610
|
-
const offsetMetersState =
|
|
23620
|
+
const offsetMetersState = DISTANCE_INTERPOLATION_CHANNELS.offsetMeters.resolveInterpolation(
|
|
23621
|
+
image
|
|
23622
|
+
).state;
|
|
23611
23623
|
if (includeOffsetMeters && offsetMetersState) {
|
|
23612
23624
|
workItems.push({
|
|
23613
23625
|
descriptor: DISTANCE_INTERPOLATION_CHANNELS.offsetMeters,
|
|
@@ -23615,7 +23627,7 @@ const collectDistanceInterpolationWorkItems = (image, workItems, options) => {
|
|
|
23615
23627
|
state: offsetMetersState
|
|
23616
23628
|
});
|
|
23617
23629
|
}
|
|
23618
|
-
const opacityState = image.
|
|
23630
|
+
const opacityState = DISTANCE_INTERPOLATION_CHANNELS.opacity.resolveInterpolation(image).state;
|
|
23619
23631
|
if (includeOpacity && opacityState) {
|
|
23620
23632
|
workItems.push({
|
|
23621
23633
|
descriptor: DISTANCE_INTERPOLATION_CHANNELS.opacity,
|
|
@@ -23625,18 +23637,14 @@ const collectDistanceInterpolationWorkItems = (image, workItems, options) => {
|
|
|
23625
23637
|
}
|
|
23626
23638
|
};
|
|
23627
23639
|
const updateDistanceInterpolationState = (image, descriptor, nextState) => {
|
|
23628
|
-
|
|
23629
|
-
image.offsetMetersInterpolationState = nextState;
|
|
23630
|
-
} else {
|
|
23631
|
-
image.opacityInterpolationState = nextState;
|
|
23632
|
-
}
|
|
23640
|
+
descriptor.resolveInterpolation(image).state = nextState;
|
|
23633
23641
|
};
|
|
23634
23642
|
const applyDistanceInterpolationEvaluations = (workItems, evaluations, timestamp) => {
|
|
23635
|
-
var
|
|
23643
|
+
var _a, _b, _c;
|
|
23636
23644
|
let active = false;
|
|
23637
23645
|
for (let index = 0; index < workItems.length; index += 1) {
|
|
23638
23646
|
const item = workItems[index];
|
|
23639
|
-
const evaluation = (
|
|
23647
|
+
const evaluation = (_a = evaluations[index]) != null ? _a : evaluateDistanceInterpolation({
|
|
23640
23648
|
state: item.state,
|
|
23641
23649
|
timestamp
|
|
23642
23650
|
});
|
|
@@ -23648,7 +23656,7 @@ const applyDistanceInterpolationEvaluations = (workItems, evaluations, timestamp
|
|
|
23648
23656
|
const interpolatedValue = normalize(evaluation.value);
|
|
23649
23657
|
item.descriptor.applyValue(item.image, interpolatedValue);
|
|
23650
23658
|
if (evaluation.completed) {
|
|
23651
|
-
const finalValue = normalize(item.state.
|
|
23659
|
+
const finalValue = normalize(item.state.to);
|
|
23652
23660
|
applyFinalValue(item.image, finalValue);
|
|
23653
23661
|
updateDistanceInterpolationState(item.image, item.descriptor, null);
|
|
23654
23662
|
} else {
|
|
@@ -23659,7 +23667,7 @@ const applyDistanceInterpolationEvaluations = (workItems, evaluations, timestamp
|
|
|
23659
23667
|
return active;
|
|
23660
23668
|
};
|
|
23661
23669
|
const stepDegreeInterpolationState = (interpolationState, timestamp, applyValue, options) => {
|
|
23662
|
-
var
|
|
23670
|
+
var _a, _b;
|
|
23663
23671
|
if (!interpolationState) {
|
|
23664
23672
|
return { state: null, active: false };
|
|
23665
23673
|
}
|
|
@@ -23670,20 +23678,20 @@ const stepDegreeInterpolationState = (interpolationState, timestamp, applyValue,
|
|
|
23670
23678
|
if (interpolationState.startTimestamp < 0) {
|
|
23671
23679
|
interpolationState.startTimestamp = evaluation.effectiveStartTimestamp;
|
|
23672
23680
|
}
|
|
23673
|
-
const normalizeValue = (
|
|
23681
|
+
const normalizeValue = (_a = options == null ? void 0 : options.normalize) != null ? _a : ((value) => value);
|
|
23674
23682
|
const applyFinalValue = (_b = options == null ? void 0 : options.applyFinalValue) != null ? _b : applyValue;
|
|
23675
23683
|
const interpolatedValue = normalizeValue(evaluation.value);
|
|
23676
23684
|
applyValue(interpolatedValue);
|
|
23677
23685
|
if (evaluation.completed) {
|
|
23678
|
-
const finalValue = normalizeValue(interpolationState.
|
|
23686
|
+
const finalValue = normalizeValue(interpolationState.to);
|
|
23679
23687
|
applyFinalValue(finalValue);
|
|
23680
23688
|
return { state: null, active: false };
|
|
23681
23689
|
}
|
|
23682
23690
|
return { state: interpolationState, active: true };
|
|
23683
23691
|
};
|
|
23684
23692
|
const resolveManualRotationFromDisplayed = (image) => {
|
|
23685
|
-
var
|
|
23686
|
-
const baseRotation = (
|
|
23693
|
+
var _a;
|
|
23694
|
+
const baseRotation = (_a = image.resolvedBaseRotateDeg) != null ? _a : 0;
|
|
23687
23695
|
const fallbackRotation = normalizeAngleDeg(
|
|
23688
23696
|
baseRotation + image.rotationCommandDeg
|
|
23689
23697
|
);
|
|
@@ -23692,7 +23700,7 @@ const resolveManualRotationFromDisplayed = (image) => {
|
|
|
23692
23700
|
};
|
|
23693
23701
|
const refreshRotateDegInterpolatedValues = (image) => {
|
|
23694
23702
|
image.rotateDeg.current = resolveManualRotationFromDisplayed(image);
|
|
23695
|
-
if (!image.
|
|
23703
|
+
if (!image.rotateDeg.interpolation.state) {
|
|
23696
23704
|
image.rotateDeg.from = void 0;
|
|
23697
23705
|
image.rotateDeg.to = void 0;
|
|
23698
23706
|
}
|
|
@@ -23702,8 +23710,8 @@ const updateImageDisplayedRotation = (image, optionsOverride) => {
|
|
|
23702
23710
|
image.resolvedBaseRotateDeg + image.rotationCommandDeg
|
|
23703
23711
|
);
|
|
23704
23712
|
const currentAngle = Number.isFinite(image.displayedRotateDeg) ? image.displayedRotateDeg : targetAngle;
|
|
23705
|
-
const previousCommandAngle = image.
|
|
23706
|
-
const options = optionsOverride === void 0 ? image.
|
|
23713
|
+
const previousCommandAngle = image.rotateDeg.interpolation.lastCommandValue;
|
|
23714
|
+
const options = optionsOverride === void 0 ? image.rotateDeg.interpolation.options : optionsOverride;
|
|
23707
23715
|
const { nextAngleDeg, interpolationState } = resolveRotationTarget({
|
|
23708
23716
|
currentAngleDeg: currentAngle,
|
|
23709
23717
|
targetAngleDeg: targetAngle,
|
|
@@ -23711,11 +23719,11 @@ const updateImageDisplayedRotation = (image, optionsOverride) => {
|
|
|
23711
23719
|
options: options != null ? options : void 0
|
|
23712
23720
|
});
|
|
23713
23721
|
image.displayedRotateDeg = nextAngleDeg;
|
|
23714
|
-
image.
|
|
23722
|
+
image.rotateDeg.interpolation.state = interpolationState;
|
|
23715
23723
|
if (!interpolationState) {
|
|
23716
23724
|
image.displayedRotateDeg = targetAngle;
|
|
23717
23725
|
}
|
|
23718
|
-
image.
|
|
23726
|
+
image.rotateDeg.interpolation.lastCommandValue = targetAngle;
|
|
23719
23727
|
};
|
|
23720
23728
|
const syncImageRotationChannel = (image, optionsOverride) => {
|
|
23721
23729
|
updateImageDisplayedRotation(image, optionsOverride);
|
|
@@ -23723,7 +23731,7 @@ const syncImageRotationChannel = (image, optionsOverride) => {
|
|
|
23723
23731
|
};
|
|
23724
23732
|
const stepRotationInterpolation = (image, timestamp) => {
|
|
23725
23733
|
const { state, active } = stepDegreeInterpolationState(
|
|
23726
|
-
image.
|
|
23734
|
+
image.rotateDeg.interpolation.state,
|
|
23727
23735
|
timestamp,
|
|
23728
23736
|
(value) => {
|
|
23729
23737
|
image.displayedRotateDeg = value;
|
|
@@ -23732,19 +23740,19 @@ const stepRotationInterpolation = (image, timestamp) => {
|
|
|
23732
23740
|
normalize: normalizeAngleDeg
|
|
23733
23741
|
}
|
|
23734
23742
|
);
|
|
23735
|
-
image.
|
|
23743
|
+
image.rotateDeg.interpolation.state = state;
|
|
23736
23744
|
refreshRotateDegInterpolatedValues(image);
|
|
23737
23745
|
return active;
|
|
23738
23746
|
};
|
|
23739
23747
|
const stepOffsetDegInterpolation = (image, timestamp) => {
|
|
23740
23748
|
const { state, active } = stepDegreeInterpolationState(
|
|
23741
|
-
image.
|
|
23749
|
+
image.offset.offsetDeg.interpolation.state,
|
|
23742
23750
|
timestamp,
|
|
23743
23751
|
(value) => {
|
|
23744
23752
|
image.offset.offsetDeg.current = value;
|
|
23745
23753
|
}
|
|
23746
23754
|
);
|
|
23747
|
-
image.
|
|
23755
|
+
image.offset.offsetDeg.interpolation.state = state;
|
|
23748
23756
|
if (!state) {
|
|
23749
23757
|
image.offset.offsetDeg.from = void 0;
|
|
23750
23758
|
image.offset.offsetDeg.to = void 0;
|
|
@@ -23752,12 +23760,12 @@ const stepOffsetDegInterpolation = (image, timestamp) => {
|
|
|
23752
23760
|
return active;
|
|
23753
23761
|
};
|
|
23754
23762
|
const clearOffsetDegInterpolation = (image) => {
|
|
23755
|
-
image.
|
|
23763
|
+
image.offset.offsetDeg.interpolation.state = null;
|
|
23756
23764
|
image.offset.offsetDeg.from = void 0;
|
|
23757
23765
|
image.offset.offsetDeg.to = void 0;
|
|
23758
23766
|
};
|
|
23759
23767
|
const stepDistanceInterpolationState = (interpolationState, timestamp, applyValue, options) => {
|
|
23760
|
-
var
|
|
23768
|
+
var _a, _b;
|
|
23761
23769
|
if (!interpolationState) {
|
|
23762
23770
|
return { state: null, active: false };
|
|
23763
23771
|
}
|
|
@@ -23768,24 +23776,24 @@ const stepDistanceInterpolationState = (interpolationState, timestamp, applyValu
|
|
|
23768
23776
|
if (interpolationState.startTimestamp < 0) {
|
|
23769
23777
|
interpolationState.startTimestamp = evaluation.effectiveStartTimestamp;
|
|
23770
23778
|
}
|
|
23771
|
-
const normalizeValue = (
|
|
23779
|
+
const normalizeValue = (_a = options == null ? void 0 : options.normalize) != null ? _a : ((value) => value);
|
|
23772
23780
|
const applyFinalValue = (_b = options == null ? void 0 : options.applyFinalValue) != null ? _b : applyValue;
|
|
23773
23781
|
const interpolatedValue = normalizeValue(evaluation.value);
|
|
23774
23782
|
applyValue(interpolatedValue);
|
|
23775
23783
|
if (evaluation.completed) {
|
|
23776
|
-
const finalValue = normalizeValue(interpolationState.
|
|
23784
|
+
const finalValue = normalizeValue(interpolationState.to);
|
|
23777
23785
|
applyFinalValue(finalValue);
|
|
23778
23786
|
return { state: null, active: false };
|
|
23779
23787
|
}
|
|
23780
23788
|
return { state: interpolationState, active: true };
|
|
23781
23789
|
};
|
|
23782
23790
|
const clearOffsetMetersInterpolation = (image) => {
|
|
23783
|
-
image.
|
|
23791
|
+
image.offset.offsetMeters.interpolation.state = null;
|
|
23784
23792
|
image.offset.offsetMeters.from = void 0;
|
|
23785
23793
|
image.offset.offsetMeters.to = void 0;
|
|
23786
23794
|
};
|
|
23787
23795
|
const clearOpacityInterpolation = (image) => {
|
|
23788
|
-
image.
|
|
23796
|
+
image.opacity.interpolation.state = null;
|
|
23789
23797
|
};
|
|
23790
23798
|
const applyOffsetDegUpdate = (image, nextOffset, interpolationOptions) => {
|
|
23791
23799
|
const options = interpolationOptions;
|
|
@@ -23793,26 +23801,26 @@ const applyOffsetDegUpdate = (image, nextOffset, interpolationOptions) => {
|
|
|
23793
23801
|
image.offset.offsetDeg.current = nextOffset.offsetDeg;
|
|
23794
23802
|
image.offset.offsetDeg.from = void 0;
|
|
23795
23803
|
image.offset.offsetDeg.to = void 0;
|
|
23796
|
-
image.
|
|
23797
|
-
image.
|
|
23804
|
+
image.offset.offsetDeg.interpolation.state = null;
|
|
23805
|
+
image.offset.offsetDeg.interpolation.lastCommandValue = nextOffset.offsetDeg;
|
|
23798
23806
|
return;
|
|
23799
23807
|
}
|
|
23800
23808
|
const { state, requiresInterpolation } = createDegreeInterpolationState({
|
|
23801
23809
|
currentValue: image.offset.offsetDeg.current,
|
|
23802
23810
|
targetValue: nextOffset.offsetDeg,
|
|
23803
|
-
previousCommandValue: image.
|
|
23811
|
+
previousCommandValue: image.offset.offsetDeg.interpolation.lastCommandValue,
|
|
23804
23812
|
options
|
|
23805
23813
|
});
|
|
23806
|
-
image.
|
|
23814
|
+
image.offset.offsetDeg.interpolation.lastCommandValue = nextOffset.offsetDeg;
|
|
23807
23815
|
if (requiresInterpolation) {
|
|
23808
|
-
image.
|
|
23816
|
+
image.offset.offsetDeg.interpolation.state = state;
|
|
23809
23817
|
image.offset.offsetDeg.from = image.offset.offsetDeg.current;
|
|
23810
23818
|
image.offset.offsetDeg.to = nextOffset.offsetDeg;
|
|
23811
23819
|
} else {
|
|
23812
23820
|
image.offset.offsetDeg.current = nextOffset.offsetDeg;
|
|
23813
23821
|
image.offset.offsetDeg.from = void 0;
|
|
23814
23822
|
image.offset.offsetDeg.to = void 0;
|
|
23815
|
-
image.
|
|
23823
|
+
image.offset.offsetDeg.interpolation.state = null;
|
|
23816
23824
|
}
|
|
23817
23825
|
};
|
|
23818
23826
|
const applyOffsetMetersUpdate = (image, nextOffset, interpolationOptions) => {
|
|
@@ -23821,79 +23829,92 @@ const applyOffsetMetersUpdate = (image, nextOffset, interpolationOptions) => {
|
|
|
23821
23829
|
image.offset.offsetMeters.current = nextOffset.offsetMeters;
|
|
23822
23830
|
image.offset.offsetMeters.from = void 0;
|
|
23823
23831
|
image.offset.offsetMeters.to = void 0;
|
|
23824
|
-
image.
|
|
23825
|
-
image.
|
|
23832
|
+
image.offset.offsetMeters.interpolation.state = null;
|
|
23833
|
+
image.offset.offsetMeters.interpolation.lastCommandValue = nextOffset.offsetMeters;
|
|
23826
23834
|
return;
|
|
23827
23835
|
}
|
|
23828
23836
|
const { state, requiresInterpolation } = createDistanceInterpolationState({
|
|
23829
23837
|
currentValue: image.offset.offsetMeters.current,
|
|
23830
23838
|
targetValue: nextOffset.offsetMeters,
|
|
23831
|
-
previousCommandValue: image.
|
|
23839
|
+
previousCommandValue: image.offset.offsetMeters.interpolation.lastCommandValue,
|
|
23832
23840
|
options
|
|
23833
23841
|
});
|
|
23834
|
-
image.
|
|
23842
|
+
image.offset.offsetMeters.interpolation.lastCommandValue = nextOffset.offsetMeters;
|
|
23835
23843
|
if (requiresInterpolation) {
|
|
23836
|
-
image.
|
|
23844
|
+
image.offset.offsetMeters.interpolation.state = state;
|
|
23837
23845
|
image.offset.offsetMeters.from = image.offset.offsetMeters.current;
|
|
23838
23846
|
image.offset.offsetMeters.to = nextOffset.offsetMeters;
|
|
23839
23847
|
} else {
|
|
23840
23848
|
image.offset.offsetMeters.current = nextOffset.offsetMeters;
|
|
23841
23849
|
image.offset.offsetMeters.from = void 0;
|
|
23842
23850
|
image.offset.offsetMeters.to = void 0;
|
|
23843
|
-
image.
|
|
23851
|
+
image.offset.offsetMeters.interpolation.state = null;
|
|
23844
23852
|
}
|
|
23845
23853
|
};
|
|
23846
23854
|
const stepOffsetMetersInterpolation = (image, timestamp) => {
|
|
23847
23855
|
const { state, active } = stepDistanceInterpolationState(
|
|
23848
|
-
image.
|
|
23856
|
+
image.offset.offsetMeters.interpolation.state,
|
|
23849
23857
|
timestamp,
|
|
23850
23858
|
(value) => {
|
|
23851
23859
|
image.offset.offsetMeters.current = value;
|
|
23852
23860
|
}
|
|
23853
23861
|
);
|
|
23854
|
-
image.
|
|
23862
|
+
image.offset.offsetMeters.interpolation.state = state;
|
|
23855
23863
|
if (!state) {
|
|
23856
23864
|
image.offset.offsetMeters.from = void 0;
|
|
23857
23865
|
image.offset.offsetMeters.to = void 0;
|
|
23858
23866
|
}
|
|
23859
23867
|
return active;
|
|
23860
23868
|
};
|
|
23861
|
-
const
|
|
23862
|
-
const clampedTarget = clampOpacity(
|
|
23869
|
+
const runOpacityTargetTransition = (image, targetOpacity, interpolationOptions) => {
|
|
23870
|
+
const clampedTarget = clampOpacity(targetOpacity);
|
|
23863
23871
|
const options = interpolationOptions;
|
|
23864
23872
|
if (!options || options.durationMs <= 0) {
|
|
23865
23873
|
image.opacity.current = clampedTarget;
|
|
23866
23874
|
image.opacity.from = void 0;
|
|
23867
23875
|
image.opacity.to = void 0;
|
|
23868
|
-
image.
|
|
23869
|
-
image.lastCommandOpacity = clampedTarget;
|
|
23870
|
-
image.opacityTargetValue = clampedTarget;
|
|
23871
|
-
image.lodLastCommandOpacity = clampedTarget;
|
|
23872
|
-
return;
|
|
23873
|
-
}
|
|
23874
|
-
const { state, requiresInterpolation } = createDistanceInterpolationState({
|
|
23875
|
-
currentValue: clampOpacity(image.opacity.current),
|
|
23876
|
-
targetValue: clampedTarget,
|
|
23877
|
-
previousCommandValue: image.lastCommandOpacity,
|
|
23878
|
-
options
|
|
23879
|
-
});
|
|
23880
|
-
image.lastCommandOpacity = clampedTarget;
|
|
23881
|
-
image.opacityTargetValue = clampedTarget;
|
|
23882
|
-
image.lodLastCommandOpacity = clampedTarget;
|
|
23883
|
-
if (requiresInterpolation) {
|
|
23884
|
-
image.opacityInterpolationState = state;
|
|
23885
|
-
image.opacity.from = image.opacity.current;
|
|
23886
|
-
image.opacity.to = clampedTarget;
|
|
23876
|
+
image.opacity.interpolation.state = null;
|
|
23887
23877
|
} else {
|
|
23888
|
-
|
|
23889
|
-
|
|
23890
|
-
|
|
23891
|
-
|
|
23878
|
+
const { state, requiresInterpolation } = createDistanceInterpolationState({
|
|
23879
|
+
currentValue: clampOpacity(image.opacity.current),
|
|
23880
|
+
targetValue: clampedTarget,
|
|
23881
|
+
previousCommandValue: image.opacity.interpolation.lastCommandValue,
|
|
23882
|
+
options
|
|
23883
|
+
});
|
|
23884
|
+
if (requiresInterpolation) {
|
|
23885
|
+
image.opacity.interpolation.state = state;
|
|
23886
|
+
image.opacity.from = image.opacity.current;
|
|
23887
|
+
image.opacity.to = clampedTarget;
|
|
23888
|
+
} else {
|
|
23889
|
+
image.opacity.current = clampedTarget;
|
|
23890
|
+
image.opacity.from = void 0;
|
|
23891
|
+
image.opacity.to = void 0;
|
|
23892
|
+
image.opacity.interpolation.state = null;
|
|
23893
|
+
}
|
|
23892
23894
|
}
|
|
23895
|
+
image.opacity.interpolation.lastCommandValue = clampedTarget;
|
|
23896
|
+
image.opacity.interpolation.targetValue = clampedTarget;
|
|
23897
|
+
};
|
|
23898
|
+
const applyOpacityUpdate = (image, nextOpacity, interpolationOptions, spriteOpacityMultiplier = 1) => {
|
|
23899
|
+
const clampedBase = clampOpacity(nextOpacity);
|
|
23900
|
+
const lodMultiplier = typeof image.lodOpacity === "number" ? image.lodOpacity : 1;
|
|
23901
|
+
image.opacity.interpolation.baseValue = clampedBase;
|
|
23902
|
+
runOpacityTargetTransition(
|
|
23903
|
+
image,
|
|
23904
|
+
clampedBase * spriteOpacityMultiplier * lodMultiplier,
|
|
23905
|
+
interpolationOptions != null ? interpolationOptions : null
|
|
23906
|
+
);
|
|
23907
|
+
};
|
|
23908
|
+
const applyResolvedOpacityTarget = (image, resolvedTarget, interpolationOptions) => {
|
|
23909
|
+
runOpacityTargetTransition(
|
|
23910
|
+
image,
|
|
23911
|
+
resolvedTarget,
|
|
23912
|
+
interpolationOptions != null ? interpolationOptions : null
|
|
23913
|
+
);
|
|
23893
23914
|
};
|
|
23894
23915
|
const stepOpacityInterpolation = (image, timestamp) => {
|
|
23895
23916
|
const { state, active } = stepDistanceInterpolationState(
|
|
23896
|
-
image.
|
|
23917
|
+
image.opacity.interpolation.state,
|
|
23897
23918
|
timestamp,
|
|
23898
23919
|
(value) => {
|
|
23899
23920
|
image.opacity.current = value;
|
|
@@ -23902,7 +23923,7 @@ const stepOpacityInterpolation = (image, timestamp) => {
|
|
|
23902
23923
|
normalize: clampOpacity
|
|
23903
23924
|
}
|
|
23904
23925
|
);
|
|
23905
|
-
image.
|
|
23926
|
+
image.opacity.interpolation.state = state;
|
|
23906
23927
|
if (!state) {
|
|
23907
23928
|
image.opacity.from = void 0;
|
|
23908
23929
|
image.opacity.to = void 0;
|
|
@@ -23916,9 +23937,9 @@ const IMAGE_INTERPOLATION_STEPPERS = [
|
|
|
23916
23937
|
{ id: "opacity", step: stepOpacityInterpolation }
|
|
23917
23938
|
];
|
|
23918
23939
|
const stepSpriteImageInterpolations = (image, timestamp, options) => {
|
|
23919
|
-
var
|
|
23940
|
+
var _a;
|
|
23920
23941
|
let active = false;
|
|
23921
|
-
const skipChannels = (
|
|
23942
|
+
const skipChannels = (_a = options == null ? void 0 : options.skipChannels) != null ? _a : null;
|
|
23922
23943
|
for (const { id, step } of IMAGE_INTERPOLATION_STEPPERS) {
|
|
23923
23944
|
if (skipChannels && skipChannels[id]) {
|
|
23924
23945
|
continue;
|
|
@@ -23930,7 +23951,7 @@ const stepSpriteImageInterpolations = (image, timestamp, options) => {
|
|
|
23930
23951
|
return active;
|
|
23931
23952
|
};
|
|
23932
23953
|
const hasActiveImageInterpolations = (image) => {
|
|
23933
|
-
return image.
|
|
23954
|
+
return image.rotateDeg.interpolation.state !== null || image.offset.offsetDeg.interpolation.state !== null || image.offset.offsetMeters.interpolation.state !== null || image.opacity.interpolation.state !== null;
|
|
23934
23955
|
};
|
|
23935
23956
|
const applyOffsetUpdate = (image, nextOffset, options = {}) => {
|
|
23936
23957
|
applyOffsetDegUpdate(image, nextOffset, options.deg);
|
|
@@ -24061,8 +24082,8 @@ const computeBillboardCornersShaderModel = ({
|
|
|
24061
24082
|
anchor,
|
|
24062
24083
|
rotationDeg
|
|
24063
24084
|
}) => {
|
|
24064
|
-
var
|
|
24065
|
-
const anchorX = (
|
|
24085
|
+
var _a, _b;
|
|
24086
|
+
const anchorX = (_a = anchor == null ? void 0 : anchor.x) != null ? _a : 0;
|
|
24066
24087
|
const anchorY = (_b = anchor == null ? void 0 : anchor.y) != null ? _b : 0;
|
|
24067
24088
|
const rad = -rotationDeg * DEG2RAD;
|
|
24068
24089
|
const cosR = Math.cos(rad);
|
|
@@ -24084,7 +24105,7 @@ const computeBillboardCornersShaderModel = ({
|
|
|
24084
24105
|
});
|
|
24085
24106
|
};
|
|
24086
24107
|
const compileShader = (glContext, type, source) => {
|
|
24087
|
-
var
|
|
24108
|
+
var _a;
|
|
24088
24109
|
const shader = glContext.createShader(type);
|
|
24089
24110
|
if (!shader) {
|
|
24090
24111
|
throw new Error("Failed to create shader.");
|
|
@@ -24092,14 +24113,14 @@ const compileShader = (glContext, type, source) => {
|
|
|
24092
24113
|
glContext.shaderSource(shader, source);
|
|
24093
24114
|
glContext.compileShader(shader);
|
|
24094
24115
|
if (!glContext.getShaderParameter(shader, glContext.COMPILE_STATUS)) {
|
|
24095
|
-
const info = (
|
|
24116
|
+
const info = (_a = glContext.getShaderInfoLog(shader)) != null ? _a : "unknown error";
|
|
24096
24117
|
glContext.deleteShader(shader);
|
|
24097
24118
|
throw new Error(`Shader compile failed: ${info}`);
|
|
24098
24119
|
}
|
|
24099
24120
|
return shader;
|
|
24100
24121
|
};
|
|
24101
24122
|
const createShaderProgram = (glContext, vertexSource, fragmentSource) => {
|
|
24102
|
-
var
|
|
24123
|
+
var _a;
|
|
24103
24124
|
const vertexShader = compileShader(
|
|
24104
24125
|
glContext,
|
|
24105
24126
|
glContext.VERTEX_SHADER,
|
|
@@ -24122,7 +24143,7 @@ const createShaderProgram = (glContext, vertexSource, fragmentSource) => {
|
|
|
24122
24143
|
glContext.deleteShader(vertexShader);
|
|
24123
24144
|
glContext.deleteShader(fragmentShader);
|
|
24124
24145
|
if (!glContext.getProgramParameter(program, glContext.LINK_STATUS)) {
|
|
24125
|
-
const info = (
|
|
24146
|
+
const info = (_a = glContext.getProgramInfoLog(program)) != null ? _a : "unknown error";
|
|
24126
24147
|
glContext.deleteProgram(program);
|
|
24127
24148
|
throw new Error(`Program link failed: ${info}`);
|
|
24128
24149
|
}
|
|
@@ -24862,7 +24883,7 @@ const MIPMAP_MIN_FILTERS = /* @__PURE__ */ new Set([
|
|
|
24862
24883
|
]);
|
|
24863
24884
|
const filterRequiresMipmaps = (filter) => MIPMAP_MIN_FILTERS.has(filter);
|
|
24864
24885
|
const resolveTextureFilteringOptions = (options) => {
|
|
24865
|
-
var
|
|
24886
|
+
var _a, _b;
|
|
24866
24887
|
const minCandidate = options == null ? void 0 : options.minFilter;
|
|
24867
24888
|
const minFilter = MIN_FILTER_VALUES.includes(
|
|
24868
24889
|
minCandidate
|
|
@@ -24871,7 +24892,7 @@ const resolveTextureFilteringOptions = (options) => {
|
|
|
24871
24892
|
const magFilter = MAG_FILTER_VALUES.includes(
|
|
24872
24893
|
magCandidate
|
|
24873
24894
|
) ? magCandidate : DEFAULT_TEXTURE_FILTERING_OPTIONS.magFilter;
|
|
24874
|
-
let generateMipmaps = (
|
|
24895
|
+
let generateMipmaps = (_a = options == null ? void 0 : options.generateMipmaps) != null ? _a : DEFAULT_TEXTURE_FILTERING_OPTIONS.generateMipmaps;
|
|
24875
24896
|
if (filterRequiresMipmaps(minFilter)) {
|
|
24876
24897
|
generateMipmaps = true;
|
|
24877
24898
|
}
|
|
@@ -25323,7 +25344,7 @@ const MAX_MERCATOR_HORIZON_ANGLE = 89.25;
|
|
|
25323
25344
|
const MIN_RENDER_DISTANCE_BELOW_CAMERA = 100;
|
|
25324
25345
|
const NEAR_CLIP_DIVISOR = 50;
|
|
25325
25346
|
const SIN_DENOMINATOR_EPSILON = 0.01;
|
|
25326
|
-
const toFiniteOr$1 = (value,
|
|
25347
|
+
const toFiniteOr$1 = (value, fallback2) => Number.isFinite(value) ? value : fallback2;
|
|
25327
25348
|
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
25328
25349
|
const circumferenceAtLatitude = (latitudeDeg) => 2 * Math.PI * EARTH_RADIUS_METERS * Math.cos(latitudeDeg * DEG2RAD);
|
|
25329
25350
|
const mercatorXfromLng = (lng) => (180 + lng) / 360;
|
|
@@ -25413,7 +25434,7 @@ const calculateNearFarZ = (params, cameraToCenterDistance, cameraToSeaLevelDista
|
|
|
25413
25434
|
};
|
|
25414
25435
|
};
|
|
25415
25436
|
const prepareProjectionState = (params) => {
|
|
25416
|
-
var
|
|
25437
|
+
var _a;
|
|
25417
25438
|
const width = Math.max(0, params.width);
|
|
25418
25439
|
const height = Math.max(0, params.height);
|
|
25419
25440
|
const zoom = toFiniteOr$1(params.zoom, 0);
|
|
@@ -25514,7 +25535,7 @@ const prepareProjectionState = (params) => {
|
|
|
25514
25535
|
clipSpaceToPixelsMatrix,
|
|
25515
25536
|
worldMatrix
|
|
25516
25537
|
);
|
|
25517
|
-
const pixelMatrixInverse = (
|
|
25538
|
+
const pixelMatrixInverse = (_a = invert(createMat4f64(), pixelMatrix)) != null ? _a : void 0;
|
|
25518
25539
|
const clipContext = mercatorMatrix ? { mercatorMatrix } : void 0;
|
|
25519
25540
|
return {
|
|
25520
25541
|
zoom,
|
|
@@ -25620,7 +25641,7 @@ const createProjectionHost = (params) => {
|
|
|
25620
25641
|
};
|
|
25621
25642
|
};
|
|
25622
25643
|
const calculatePerspectiveRatio = (location2, cachedMercator) => {
|
|
25623
|
-
var
|
|
25644
|
+
var _a;
|
|
25624
25645
|
if (!state.mercatorMatrix || state.cameraToCenterDistance <= 0) {
|
|
25625
25646
|
return 1;
|
|
25626
25647
|
}
|
|
@@ -25630,7 +25651,7 @@ const createProjectionHost = (params) => {
|
|
|
25630
25651
|
state.mercatorMatrix,
|
|
25631
25652
|
mercator.x,
|
|
25632
25653
|
mercator.y,
|
|
25633
|
-
(
|
|
25654
|
+
(_a = mercator.z) != null ? _a : 0,
|
|
25634
25655
|
1
|
|
25635
25656
|
);
|
|
25636
25657
|
if (!Number.isFinite(w) || w <= 0) {
|
|
@@ -25657,11 +25678,11 @@ const createProjectionHost = (params) => {
|
|
|
25657
25678
|
};
|
|
25658
25679
|
};
|
|
25659
25680
|
const createProjectionHostParamsFromMapLibre = (map) => {
|
|
25660
|
-
var
|
|
25681
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
25661
25682
|
const ensureFinite2 = (value) => typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
25662
25683
|
const centerLngLat = map.getCenter();
|
|
25663
25684
|
const transform = map.transform;
|
|
25664
|
-
const canvas = typeof map.getCanvas === "function" ? (
|
|
25685
|
+
const canvas = typeof map.getCanvas === "function" ? (_a = map.getCanvas()) != null ? _a : null : null;
|
|
25665
25686
|
if (!transform) {
|
|
25666
25687
|
return {
|
|
25667
25688
|
zoom: (_b = ensureFinite2(map.getZoom())) != null ? _b : 0,
|
|
@@ -25729,9 +25750,9 @@ const createFromLngLat = (wasm) => {
|
|
|
25729
25750
|
WASM_FromLngLat_RESULT_ELEMENT_COUNT
|
|
25730
25751
|
);
|
|
25731
25752
|
const fromLngLat = (location2) => {
|
|
25732
|
-
var
|
|
25753
|
+
var _a;
|
|
25733
25754
|
const { ptr, buffer } = resultHolder.prepare();
|
|
25734
|
-
wasm.fromLngLat(location2.lng, location2.lat, (
|
|
25755
|
+
wasm.fromLngLat(location2.lng, location2.lat, (_a = location2.z) != null ? _a : 0, ptr);
|
|
25735
25756
|
const x = buffer[0];
|
|
25736
25757
|
const y = buffer[1];
|
|
25737
25758
|
const z = buffer[2];
|
|
@@ -25758,13 +25779,13 @@ const createProject = (wasm, preparedState) => {
|
|
|
25758
25779
|
WASM_Project_RESULT_ELEMENT_COUNT
|
|
25759
25780
|
);
|
|
25760
25781
|
const project = (location2) => {
|
|
25761
|
-
var
|
|
25782
|
+
var _a;
|
|
25762
25783
|
const { ptr: matrixPtr } = matrixHolder.prepare();
|
|
25763
25784
|
const { ptr: resultPtr, buffer: result } = resultHolder.prepare();
|
|
25764
25785
|
if (wasm.project(
|
|
25765
25786
|
location2.lng,
|
|
25766
25787
|
location2.lat,
|
|
25767
|
-
(
|
|
25788
|
+
(_a = location2.z) != null ? _a : 0,
|
|
25768
25789
|
preparedState.worldSize,
|
|
25769
25790
|
matrixPtr,
|
|
25770
25791
|
resultPtr
|
|
@@ -25845,7 +25866,7 @@ const createCalculatePerspectiveRatio = (wasm, preparedState) => {
|
|
|
25845
25866
|
WASM_CalculatePerspectiveRatio_RESULT_ELEMENT_COUNT
|
|
25846
25867
|
);
|
|
25847
25868
|
const calculatePerspectiveRatio = (location2, cachedMercator) => {
|
|
25848
|
-
var
|
|
25869
|
+
var _a, _b;
|
|
25849
25870
|
if (cachedMercator) {
|
|
25850
25871
|
const { ptr: matrixPtr } = matrixHolder.prepare();
|
|
25851
25872
|
const { ptr: cachedMercatorPtr, buffer: cachedMercatorBuffer } = cachedMercatorHolder.prepare();
|
|
@@ -25856,7 +25877,7 @@ const createCalculatePerspectiveRatio = (wasm, preparedState) => {
|
|
|
25856
25877
|
if (wasm.calculatePerspectiveRatio(
|
|
25857
25878
|
location2.lng,
|
|
25858
25879
|
location2.lat,
|
|
25859
|
-
(
|
|
25880
|
+
(_a = location2.z) != null ? _a : 0,
|
|
25860
25881
|
cachedMercatorPtr,
|
|
25861
25882
|
preparedState.cameraToCenterDistance,
|
|
25862
25883
|
matrixPtr,
|
|
@@ -26054,7 +26075,7 @@ const collectDepthSortedItemsInternal = (projectionHost, zoom, zoomScaleFactor,
|
|
|
26054
26075
|
drawingBufferHeight,
|
|
26055
26076
|
pixelRatio
|
|
26056
26077
|
}) => {
|
|
26057
|
-
var
|
|
26078
|
+
var _a, _b, _c;
|
|
26058
26079
|
const itemsWithDepth = [];
|
|
26059
26080
|
const projectToClipSpace = (location2) => projectLngLatToClipSpace(projectionHost, location2, clipContext);
|
|
26060
26081
|
const unprojectPoint = (point) => {
|
|
@@ -26108,7 +26129,7 @@ const collectDepthSortedItemsInternal = (projectionHost, zoom, zoomScaleFactor,
|
|
|
26108
26129
|
clipContext,
|
|
26109
26130
|
resolveOrigin
|
|
26110
26131
|
};
|
|
26111
|
-
const anchorResolved = (
|
|
26132
|
+
const anchorResolved = (_a = imageEntry.anchor) != null ? _a : DEFAULT_ANCHOR;
|
|
26112
26133
|
const offsetResolved = resolveImageOffset$2(imageEntry);
|
|
26113
26134
|
const depthCenter = computeImageCenterXY(
|
|
26114
26135
|
spriteEntry,
|
|
@@ -26148,7 +26169,7 @@ const collectDepthSortedItemsInternal = (projectionHost, zoom, zoomScaleFactor,
|
|
|
26148
26169
|
offsetMeters
|
|
26149
26170
|
});
|
|
26150
26171
|
const baseLngLat = (() => {
|
|
26151
|
-
var
|
|
26172
|
+
var _a2;
|
|
26152
26173
|
if (imageEntry.originLocation !== void 0) {
|
|
26153
26174
|
const refImg = resolveOrigin(spriteEntry, imageEntry);
|
|
26154
26175
|
if (refImg) {
|
|
@@ -26156,7 +26177,7 @@ const collectDepthSortedItemsInternal = (projectionHost, zoom, zoomScaleFactor,
|
|
|
26156
26177
|
spriteEntry,
|
|
26157
26178
|
refImg,
|
|
26158
26179
|
centerParams,
|
|
26159
|
-
(
|
|
26180
|
+
(_a2 = imageEntry.originLocation.useResolvedAnchor) != null ? _a2 : false
|
|
26160
26181
|
);
|
|
26161
26182
|
const baseLngLatLike = projectionHost.unproject(baseCenter);
|
|
26162
26183
|
if (baseLngLatLike) {
|
|
@@ -26241,7 +26262,7 @@ const projectLngLatToClipSpace = (projectionHost, location2, context) => {
|
|
|
26241
26262
|
return [clipX, clipY, clipZ, clipW];
|
|
26242
26263
|
};
|
|
26243
26264
|
const computeImageCenterXY = (sprite, image, params, useResolvedAnchor) => {
|
|
26244
|
-
var
|
|
26265
|
+
var _a, _b, _c, _d, _e;
|
|
26245
26266
|
const {
|
|
26246
26267
|
originCenterCache,
|
|
26247
26268
|
projected,
|
|
@@ -26285,7 +26306,7 @@ const computeImageCenterXY = (sprite, image, params, useResolvedAnchor) => {
|
|
|
26285
26306
|
}
|
|
26286
26307
|
}
|
|
26287
26308
|
const totalRotDeg = Number.isFinite(image.displayedRotateDeg) ? image.displayedRotateDeg : normalizeAngleDeg(
|
|
26288
|
-
((
|
|
26309
|
+
((_a = image.resolvedBaseRotateDeg) != null ? _a : 0) + image.rotationCommandDeg
|
|
26289
26310
|
);
|
|
26290
26311
|
const imageScaleLocal = (_b = image.scale) != null ? _b : 1;
|
|
26291
26312
|
const imageResourceRef = imageResources[image.imageHandle];
|
|
@@ -26364,7 +26385,7 @@ const calculateWorldToMercatorScale = (projectionHost, base) => {
|
|
|
26364
26385
|
};
|
|
26365
26386
|
};
|
|
26366
26387
|
const prepareSurfaceShaderInputs = (projectionHost, params) => {
|
|
26367
|
-
var
|
|
26388
|
+
var _a;
|
|
26368
26389
|
const {
|
|
26369
26390
|
baseLngLat,
|
|
26370
26391
|
worldWidthMeters,
|
|
@@ -26401,7 +26422,7 @@ const prepareSurfaceShaderInputs = (projectionHost, params) => {
|
|
|
26401
26422
|
mercatorCenter: {
|
|
26402
26423
|
x: mercatorCenter.x,
|
|
26403
26424
|
y: mercatorCenter.y,
|
|
26404
|
-
z: (
|
|
26425
|
+
z: (_a = mercatorCenter.z) != null ? _a : 0
|
|
26405
26426
|
},
|
|
26406
26427
|
worldToMercatorScale,
|
|
26407
26428
|
halfSizeMeters,
|
|
@@ -26452,7 +26473,7 @@ const prepareDrawSpriteImageInternal = (projectionHost, item, zoom, zoomScaleFac
|
|
|
26452
26473
|
screenToClipOffsetX,
|
|
26453
26474
|
screenToClipOffsetY
|
|
26454
26475
|
}) => {
|
|
26455
|
-
var
|
|
26476
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
26456
26477
|
const spriteEntry = item.sprite;
|
|
26457
26478
|
const imageEntry = item.image;
|
|
26458
26479
|
const imageResource = item.resource;
|
|
@@ -26479,7 +26500,7 @@ const prepareDrawSpriteImageInternal = (projectionHost, item, zoom, zoomScaleFac
|
|
|
26479
26500
|
offsetY: identityOffsetY
|
|
26480
26501
|
};
|
|
26481
26502
|
let borderSizeScaleAdjustment = 1;
|
|
26482
|
-
const anchor = (
|
|
26503
|
+
const anchor = (_a = imageEntry.anchor) != null ? _a : DEFAULT_ANCHOR;
|
|
26483
26504
|
const offsetDef = resolveImageOffset$2(imageEntry);
|
|
26484
26505
|
const totalRotateDeg = Number.isFinite(imageEntry.displayedRotateDeg) ? imageEntry.displayedRotateDeg : normalizeAngleDeg(
|
|
26485
26506
|
((_b = imageEntry.resolvedBaseRotateDeg) != null ? _b : 0) + imageEntry.rotationCommandDeg
|
|
@@ -26536,22 +26557,22 @@ const prepareDrawSpriteImageInternal = (projectionHost, item, zoom, zoomScaleFac
|
|
|
26536
26557
|
}
|
|
26537
26558
|
}
|
|
26538
26559
|
const resolveBaseLocation = () => {
|
|
26539
|
-
var
|
|
26540
|
-
const
|
|
26560
|
+
var _a2, _b2, _c2;
|
|
26561
|
+
const fallback2 = spriteEntry.location.current;
|
|
26541
26562
|
if (imageEntry.originLocation !== void 0) {
|
|
26542
26563
|
const unprojected = projectionHost.unproject(baseProjected);
|
|
26543
26564
|
if (unprojected) {
|
|
26544
26565
|
return {
|
|
26545
26566
|
lng: unprojected.lng,
|
|
26546
26567
|
lat: unprojected.lat,
|
|
26547
|
-
z: (_b2 = (
|
|
26568
|
+
z: (_b2 = (_a2 = fallback2.z) != null ? _a2 : unprojected.z) != null ? _b2 : 0
|
|
26548
26569
|
};
|
|
26549
26570
|
}
|
|
26550
26571
|
}
|
|
26551
26572
|
return {
|
|
26552
|
-
lng:
|
|
26553
|
-
lat:
|
|
26554
|
-
z: (_c2 =
|
|
26573
|
+
lng: fallback2.lng,
|
|
26574
|
+
lat: fallback2.lat,
|
|
26575
|
+
z: (_c2 = fallback2.z) != null ? _c2 : 0
|
|
26555
26576
|
};
|
|
26556
26577
|
};
|
|
26557
26578
|
const baseLocation = resolveBaseLocation();
|
|
@@ -26900,10 +26921,10 @@ const prepareDrawSpriteImageInternal = (projectionHost, item, zoom, zoomScaleFac
|
|
|
26900
26921
|
};
|
|
26901
26922
|
};
|
|
26902
26923
|
const prepareDrawSpriteImages = (projectionHost, params) => {
|
|
26903
|
-
var
|
|
26924
|
+
var _a;
|
|
26904
26925
|
const originCenterCache = /* @__PURE__ */ new Map();
|
|
26905
26926
|
const zoom = projectionHost.getZoom();
|
|
26906
|
-
const resolvedScaling = (
|
|
26927
|
+
const resolvedScaling = (_a = params.resolvedScaling) != null ? _a : resolveScalingOptions({
|
|
26907
26928
|
metersPerPixel: params.baseMetersPerPixel,
|
|
26908
26929
|
spriteMinPixel: params.spriteMinPixel,
|
|
26909
26930
|
spriteMaxPixel: params.spriteMaxPixel,
|
|
@@ -26936,29 +26957,39 @@ const prepareDrawSpriteImages = (projectionHost, params) => {
|
|
|
26936
26957
|
}
|
|
26937
26958
|
return preparedItems;
|
|
26938
26959
|
};
|
|
26939
|
-
const
|
|
26940
|
-
const baseOpacity = clampOpacity(image.lastCommandOpacity);
|
|
26960
|
+
const resolveVisibilityLodMultiplier = (sprite, cameraDistanceMeters) => {
|
|
26941
26961
|
const threshold = sprite.visibilityDistanceMeters;
|
|
26942
26962
|
if (threshold === void 0 || !Number.isFinite(threshold) || threshold <= 0 || !Number.isFinite(cameraDistanceMeters)) {
|
|
26943
|
-
return
|
|
26963
|
+
return 1;
|
|
26944
26964
|
}
|
|
26945
|
-
return cameraDistanceMeters >= threshold ? 0 :
|
|
26965
|
+
return cameraDistanceMeters >= threshold ? 0 : 1;
|
|
26946
26966
|
};
|
|
26947
26967
|
const applyVisibilityDistanceLod = (preparedItems) => {
|
|
26968
|
+
var _a, _b, _c, _d;
|
|
26948
26969
|
if (!preparedItems.length) {
|
|
26949
26970
|
return;
|
|
26950
26971
|
}
|
|
26951
26972
|
for (const prepared of preparedItems) {
|
|
26952
26973
|
const image = prepared.imageEntry;
|
|
26953
26974
|
const sprite = prepared.spriteEntry;
|
|
26954
|
-
const
|
|
26975
|
+
const lodMultiplier = resolveVisibilityLodMultiplier(
|
|
26955
26976
|
sprite,
|
|
26956
|
-
image,
|
|
26957
26977
|
prepared.cameraDistanceMeters
|
|
26958
26978
|
);
|
|
26959
|
-
|
|
26960
|
-
|
|
26979
|
+
const previousLod = (_a = image.lodOpacity) != null ? _a : 1;
|
|
26980
|
+
if (Math.abs(previousLod - lodMultiplier) <= OPACITY_TARGET_EPSILON) {
|
|
26981
|
+
continue;
|
|
26961
26982
|
}
|
|
26983
|
+
image.lodOpacity = lodMultiplier;
|
|
26984
|
+
const baseOpacity = (_b = image.opacity.interpolation.baseValue) != null ? _b : image.opacity.current;
|
|
26985
|
+
const combinedTarget = clampOpacity(
|
|
26986
|
+
baseOpacity * ((_c = sprite.opacityMultiplier) != null ? _c : 1) * lodMultiplier
|
|
26987
|
+
);
|
|
26988
|
+
applyResolvedOpacityTarget(
|
|
26989
|
+
image,
|
|
26990
|
+
combinedTarget,
|
|
26991
|
+
(_d = image.opacity.interpolation.options) != null ? _d : null
|
|
26992
|
+
);
|
|
26962
26993
|
}
|
|
26963
26994
|
};
|
|
26964
26995
|
const syncPreparedOpacities = (preparedItems) => {
|
|
@@ -27005,12 +27036,12 @@ const defaultInterpolationEvaluationHandlers = {
|
|
|
27005
27036
|
evaluateSprite: (requests) => evaluateSpriteInterpolationsBatch(requests)
|
|
27006
27037
|
};
|
|
27007
27038
|
const applySpriteInterpolationEvaluations$1 = (workItems, evaluations, timestamp) => {
|
|
27008
|
-
var
|
|
27039
|
+
var _a;
|
|
27009
27040
|
let active = false;
|
|
27010
27041
|
for (let index = 0; index < workItems.length; index += 1) {
|
|
27011
27042
|
const item = workItems[index];
|
|
27012
27043
|
const { sprite, state } = item;
|
|
27013
|
-
const evaluation = (
|
|
27044
|
+
const evaluation = (_a = evaluations[index]) != null ? _a : evaluateInterpolation({
|
|
27014
27045
|
state,
|
|
27015
27046
|
timestamp
|
|
27016
27047
|
});
|
|
@@ -27022,39 +27053,37 @@ const applySpriteInterpolationEvaluations$1 = (workItems, evaluations, timestamp
|
|
|
27022
27053
|
sprite.location.current = cloneSpriteLocation(state.to);
|
|
27023
27054
|
sprite.location.from = void 0;
|
|
27024
27055
|
sprite.location.to = void 0;
|
|
27025
|
-
sprite.
|
|
27056
|
+
sprite.location.interpolation.state = null;
|
|
27026
27057
|
} else {
|
|
27027
27058
|
active = true;
|
|
27028
27059
|
}
|
|
27029
27060
|
}
|
|
27030
27061
|
return active;
|
|
27031
27062
|
};
|
|
27032
|
-
const ensureOpacityInterpolationTarget = (image) => {
|
|
27033
|
-
var
|
|
27063
|
+
const ensureOpacityInterpolationTarget = (sprite, image) => {
|
|
27064
|
+
var _a, _b, _c, _d;
|
|
27034
27065
|
const target = clampOpacity(
|
|
27035
|
-
(
|
|
27066
|
+
((_a = image.opacity.interpolation.baseValue) != null ? _a : image.opacity.current) * ((_b = sprite.opacityMultiplier) != null ? _b : 1) * ((_c = image.lodOpacity) != null ? _c : 1)
|
|
27036
27067
|
);
|
|
27037
|
-
const interpolationState = image.
|
|
27038
|
-
const currentStateTarget = interpolationState ? clampOpacity(interpolationState.
|
|
27068
|
+
const interpolationState = image.opacity.interpolation.state;
|
|
27069
|
+
const currentStateTarget = interpolationState ? clampOpacity((_d = interpolationState.pathTarget) != null ? _d : interpolationState.to) : image.opacity.current;
|
|
27039
27070
|
if (interpolationState) {
|
|
27040
27071
|
if (Math.abs(currentStateTarget - target) <= OPACITY_TARGET_EPSILON) {
|
|
27041
27072
|
return;
|
|
27042
27073
|
}
|
|
27043
27074
|
} else if (Math.abs(image.opacity.current - target) <= OPACITY_TARGET_EPSILON) {
|
|
27044
|
-
image.lodLastCommandOpacity = target;
|
|
27045
27075
|
return;
|
|
27046
27076
|
}
|
|
27047
|
-
const options = image.
|
|
27077
|
+
const options = image.opacity.interpolation.options;
|
|
27048
27078
|
if (options && options.durationMs > 0) {
|
|
27049
27079
|
const { state, requiresInterpolation } = createDistanceInterpolationState({
|
|
27050
27080
|
currentValue: clampOpacity(image.opacity.current),
|
|
27051
27081
|
targetValue: target,
|
|
27052
|
-
previousCommandValue: image.
|
|
27082
|
+
previousCommandValue: image.opacity.interpolation.lastCommandValue,
|
|
27053
27083
|
options
|
|
27054
27084
|
});
|
|
27055
|
-
image.lodLastCommandOpacity = target;
|
|
27056
27085
|
if (requiresInterpolation) {
|
|
27057
|
-
image.
|
|
27086
|
+
image.opacity.interpolation.state = state;
|
|
27058
27087
|
image.opacity.from = image.opacity.current;
|
|
27059
27088
|
image.opacity.to = target;
|
|
27060
27089
|
return;
|
|
@@ -27063,11 +27092,12 @@ const ensureOpacityInterpolationTarget = (image) => {
|
|
|
27063
27092
|
image.opacity.current = target;
|
|
27064
27093
|
image.opacity.from = void 0;
|
|
27065
27094
|
image.opacity.to = void 0;
|
|
27066
|
-
image.
|
|
27067
|
-
image.
|
|
27095
|
+
image.opacity.interpolation.state = null;
|
|
27096
|
+
image.opacity.interpolation.lastCommandValue = target;
|
|
27097
|
+
image.opacity.interpolation.targetValue = target;
|
|
27068
27098
|
};
|
|
27069
27099
|
const processInterpolationsInternal = (params, handlers = defaultInterpolationEvaluationHandlers) => {
|
|
27070
|
-
var
|
|
27100
|
+
var _a;
|
|
27071
27101
|
const evaluationHandlers = handlers != null ? handlers : defaultInterpolationEvaluationHandlers;
|
|
27072
27102
|
const { sprites, timestamp } = params;
|
|
27073
27103
|
if (!sprites.length) {
|
|
@@ -27081,13 +27111,14 @@ const processInterpolationsInternal = (params, handlers = defaultInterpolationEv
|
|
|
27081
27111
|
const spriteInterpolationWorkItems = [];
|
|
27082
27112
|
let hasActiveInterpolation = false;
|
|
27083
27113
|
for (const sprite of sprites) {
|
|
27084
|
-
const
|
|
27114
|
+
const locationInterpolation = sprite.location.interpolation;
|
|
27115
|
+
const state = locationInterpolation.state;
|
|
27085
27116
|
if (state) {
|
|
27086
27117
|
spriteInterpolationWorkItems.push({ sprite, state });
|
|
27087
27118
|
}
|
|
27088
27119
|
sprite.images.forEach((orderMap) => {
|
|
27089
27120
|
orderMap.forEach((image) => {
|
|
27090
|
-
const hasOffsetMetersInterpolation = image.
|
|
27121
|
+
const hasOffsetMetersInterpolation = image.offset.offsetMeters.interpolation.state !== null;
|
|
27091
27122
|
if (hasOffsetMetersInterpolation) {
|
|
27092
27123
|
collectDistanceInterpolationWorkItems(
|
|
27093
27124
|
image,
|
|
@@ -27097,9 +27128,9 @@ const processInterpolationsInternal = (params, handlers = defaultInterpolationEv
|
|
|
27097
27128
|
}
|
|
27098
27129
|
);
|
|
27099
27130
|
}
|
|
27100
|
-
ensureOpacityInterpolationTarget(image);
|
|
27101
|
-
const hasOpacityInterpolation = image.
|
|
27102
|
-
const hasDegreeInterpolation = image.
|
|
27131
|
+
ensureOpacityInterpolationTarget(sprite, image);
|
|
27132
|
+
const hasOpacityInterpolation = image.opacity.interpolation.state !== null;
|
|
27133
|
+
const hasDegreeInterpolation = image.rotateDeg.interpolation.state !== null || image.offset.offsetDeg.interpolation.state !== null;
|
|
27103
27134
|
if (hasDegreeInterpolation) {
|
|
27104
27135
|
collectDegreeInterpolationWorkItems(
|
|
27105
27136
|
image,
|
|
@@ -27145,7 +27176,7 @@ const processInterpolationsInternal = (params, handlers = defaultInterpolationEv
|
|
|
27145
27176
|
})) : [];
|
|
27146
27177
|
const hasRequests = distanceRequests.length > 0 || degreeRequests.length > 0 || spriteRequests.length > 0;
|
|
27147
27178
|
if (hasRequests) {
|
|
27148
|
-
(
|
|
27179
|
+
(_a = evaluationHandlers.prepare) == null ? void 0 : _a.call(evaluationHandlers, {
|
|
27149
27180
|
distance: distanceRequests,
|
|
27150
27181
|
degree: degreeRequests,
|
|
27151
27182
|
sprite: spriteRequests
|
|
@@ -27187,7 +27218,7 @@ const processInterpolationsInternal = (params, handlers = defaultInterpolationEv
|
|
|
27187
27218
|
};
|
|
27188
27219
|
};
|
|
27189
27220
|
const processOpacityInterpolationsAfterPreparation = (params, preparedItems, handlers = defaultInterpolationEvaluationHandlers) => {
|
|
27190
|
-
var
|
|
27221
|
+
var _a;
|
|
27191
27222
|
const evaluationHandlers = handlers != null ? handlers : defaultInterpolationEvaluationHandlers;
|
|
27192
27223
|
const { sprites, timestamp } = params;
|
|
27193
27224
|
if (!sprites.length) {
|
|
@@ -27200,8 +27231,8 @@ const processOpacityInterpolationsAfterPreparation = (params, preparedItems, han
|
|
|
27200
27231
|
for (const sprite of sprites) {
|
|
27201
27232
|
sprite.images.forEach((orderMap) => {
|
|
27202
27233
|
orderMap.forEach((image) => {
|
|
27203
|
-
ensureOpacityInterpolationTarget(image);
|
|
27204
|
-
if (image.
|
|
27234
|
+
ensureOpacityInterpolationTarget(sprite, image);
|
|
27235
|
+
if (image.opacity.interpolation.state !== null) {
|
|
27205
27236
|
collectDistanceInterpolationWorkItems(image, opacityWorkItems, {
|
|
27206
27237
|
includeOffsetMeters: false
|
|
27207
27238
|
});
|
|
@@ -27220,7 +27251,7 @@ const processOpacityInterpolationsAfterPreparation = (params, preparedItems, han
|
|
|
27220
27251
|
timestamp
|
|
27221
27252
|
})) : [];
|
|
27222
27253
|
if (opacityRequests.length > 0) {
|
|
27223
|
-
(
|
|
27254
|
+
(_a = evaluationHandlers.prepare) == null ? void 0 : _a.call(evaluationHandlers, {
|
|
27224
27255
|
distance: opacityRequests,
|
|
27225
27256
|
degree: [],
|
|
27226
27257
|
sprite: []
|
|
@@ -27292,8 +27323,8 @@ const EASING_PRESET_IDS = {
|
|
|
27292
27323
|
back: 9
|
|
27293
27324
|
};
|
|
27294
27325
|
const encodeEasingPreset = (preset) => {
|
|
27295
|
-
var
|
|
27296
|
-
const id = (
|
|
27326
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
27327
|
+
const id = (_a = EASING_PRESET_IDS[preset.type]) != null ? _a : -1;
|
|
27297
27328
|
switch (preset.type) {
|
|
27298
27329
|
case "ease": {
|
|
27299
27330
|
const mode = preset.mode === "in" ? 1 : preset.mode === "out" ? 2 : (
|
|
@@ -27366,8 +27397,9 @@ const resolveImageOffset$1 = (image) => {
|
|
|
27366
27397
|
};
|
|
27367
27398
|
};
|
|
27368
27399
|
const encodeDistanceInterpolationRequest = (buffer, cursor, request) => {
|
|
27400
|
+
var _a;
|
|
27369
27401
|
const { state, timestamp } = request;
|
|
27370
|
-
const preset = encodeEasingPreset(state.
|
|
27402
|
+
const preset = encodeEasingPreset(state.easingParam);
|
|
27371
27403
|
if (preset.id < 0) {
|
|
27372
27404
|
throw new Error(
|
|
27373
27405
|
"Distance interpolation request missing preset easing function."
|
|
@@ -27375,8 +27407,8 @@ const encodeDistanceInterpolationRequest = (buffer, cursor, request) => {
|
|
|
27375
27407
|
}
|
|
27376
27408
|
buffer[cursor++] = state.durationMs;
|
|
27377
27409
|
buffer[cursor++] = state.from;
|
|
27410
|
+
buffer[cursor++] = (_a = state.pathTarget) != null ? _a : state.to;
|
|
27378
27411
|
buffer[cursor++] = state.to;
|
|
27379
|
-
buffer[cursor++] = state.finalValue;
|
|
27380
27412
|
buffer[cursor++] = state.startTimestamp;
|
|
27381
27413
|
buffer[cursor++] = timestamp;
|
|
27382
27414
|
buffer[cursor++] = preset.id;
|
|
@@ -27386,8 +27418,9 @@ const encodeDistanceInterpolationRequest = (buffer, cursor, request) => {
|
|
|
27386
27418
|
return cursor;
|
|
27387
27419
|
};
|
|
27388
27420
|
const encodeDegreeInterpolationRequest = (buffer, cursor, request) => {
|
|
27421
|
+
var _a;
|
|
27389
27422
|
const { state, timestamp } = request;
|
|
27390
|
-
const preset = encodeEasingPreset(state.
|
|
27423
|
+
const preset = encodeEasingPreset(state.easingParam);
|
|
27391
27424
|
if (preset.id < 0) {
|
|
27392
27425
|
throw new Error(
|
|
27393
27426
|
"Degree interpolation request missing preset easing function."
|
|
@@ -27395,8 +27428,8 @@ const encodeDegreeInterpolationRequest = (buffer, cursor, request) => {
|
|
|
27395
27428
|
}
|
|
27396
27429
|
buffer[cursor++] = state.durationMs;
|
|
27397
27430
|
buffer[cursor++] = state.from;
|
|
27431
|
+
buffer[cursor++] = (_a = state.pathTarget) != null ? _a : state.to;
|
|
27398
27432
|
buffer[cursor++] = state.to;
|
|
27399
|
-
buffer[cursor++] = state.finalValue;
|
|
27400
27433
|
buffer[cursor++] = state.startTimestamp;
|
|
27401
27434
|
buffer[cursor++] = timestamp;
|
|
27402
27435
|
buffer[cursor++] = preset.id;
|
|
@@ -27406,9 +27439,9 @@ const encodeDegreeInterpolationRequest = (buffer, cursor, request) => {
|
|
|
27406
27439
|
return cursor;
|
|
27407
27440
|
};
|
|
27408
27441
|
const encodeSpriteInterpolationRequest = (buffer, cursor, request) => {
|
|
27409
|
-
var
|
|
27442
|
+
var _a, _b;
|
|
27410
27443
|
const { state, timestamp } = request;
|
|
27411
|
-
const preset = encodeEasingPreset(state.
|
|
27444
|
+
const preset = encodeEasingPreset(state.easingParam);
|
|
27412
27445
|
if (preset.id < 0) {
|
|
27413
27446
|
throw new Error(
|
|
27414
27447
|
"Sprite interpolation request missing preset easing function."
|
|
@@ -27418,7 +27451,7 @@ const encodeSpriteInterpolationRequest = (buffer, cursor, request) => {
|
|
|
27418
27451
|
buffer[cursor++] = state.durationMs;
|
|
27419
27452
|
buffer[cursor++] = state.from.lng;
|
|
27420
27453
|
buffer[cursor++] = state.from.lat;
|
|
27421
|
-
buffer[cursor++] = (
|
|
27454
|
+
buffer[cursor++] = (_a = state.from.z) != null ? _a : 0;
|
|
27422
27455
|
buffer[cursor++] = state.to.lng;
|
|
27423
27456
|
buffer[cursor++] = state.to.lat;
|
|
27424
27457
|
buffer[cursor++] = (_b = state.to.z) != null ? _b : 0;
|
|
@@ -27541,12 +27574,12 @@ const processInterpolationsViaWasm = (wasm, requests) => {
|
|
|
27541
27574
|
}
|
|
27542
27575
|
};
|
|
27543
27576
|
const applySpriteInterpolationEvaluations = (workItems, evaluations, timestamp) => {
|
|
27544
|
-
var
|
|
27577
|
+
var _a;
|
|
27545
27578
|
let active = false;
|
|
27546
27579
|
for (let index = 0; index < workItems.length; index += 1) {
|
|
27547
27580
|
const item = workItems[index];
|
|
27548
27581
|
const { sprite, state } = item;
|
|
27549
|
-
const evaluation = (
|
|
27582
|
+
const evaluation = (_a = evaluations[index]) != null ? _a : evaluateInterpolation({
|
|
27550
27583
|
state,
|
|
27551
27584
|
timestamp
|
|
27552
27585
|
});
|
|
@@ -27558,7 +27591,7 @@ const applySpriteInterpolationEvaluations = (workItems, evaluations, timestamp)
|
|
|
27558
27591
|
sprite.location.current = cloneSpriteLocation(state.to);
|
|
27559
27592
|
sprite.location.from = void 0;
|
|
27560
27593
|
sprite.location.to = void 0;
|
|
27561
|
-
sprite.
|
|
27594
|
+
sprite.location.interpolation.state = null;
|
|
27562
27595
|
} else {
|
|
27563
27596
|
active = true;
|
|
27564
27597
|
}
|
|
@@ -27579,7 +27612,8 @@ const processInterpolationsWithWasm = (wasm, params) => {
|
|
|
27579
27612
|
const processedSprites = [];
|
|
27580
27613
|
let hasActiveInterpolation = false;
|
|
27581
27614
|
for (const sprite of sprites) {
|
|
27582
|
-
const
|
|
27615
|
+
const locationInterpolation = sprite.location.interpolation;
|
|
27616
|
+
const state = locationInterpolation.state;
|
|
27583
27617
|
const hasSpriteInterpolation = state !== null;
|
|
27584
27618
|
if (!hasSpriteInterpolation && !sprite.interpolationDirty) {
|
|
27585
27619
|
continue;
|
|
@@ -27598,7 +27632,7 @@ const processInterpolationsWithWasm = (wasm, params) => {
|
|
|
27598
27632
|
if (!imageHasInterpolations) {
|
|
27599
27633
|
return;
|
|
27600
27634
|
}
|
|
27601
|
-
const hasOffsetMetersInterpolation = image.
|
|
27635
|
+
const hasOffsetMetersInterpolation = image.offset.offsetMeters.interpolation.state !== null;
|
|
27602
27636
|
if (hasOffsetMetersInterpolation) {
|
|
27603
27637
|
collectDistanceInterpolationWorkItems(
|
|
27604
27638
|
image,
|
|
@@ -27608,8 +27642,8 @@ const processInterpolationsWithWasm = (wasm, params) => {
|
|
|
27608
27642
|
}
|
|
27609
27643
|
);
|
|
27610
27644
|
}
|
|
27611
|
-
const hasOpacityInterpolation = image.
|
|
27612
|
-
const hasDegreeInterpolation = image.
|
|
27645
|
+
const hasOpacityInterpolation = image.opacity.interpolation.state !== null;
|
|
27646
|
+
const hasDegreeInterpolation = image.rotateDeg.interpolation.state !== null || image.offset.offsetDeg.interpolation.state !== null;
|
|
27613
27647
|
if (hasDegreeInterpolation) {
|
|
27614
27648
|
collectDegreeInterpolationWorkItems(
|
|
27615
27649
|
image,
|
|
@@ -27746,7 +27780,7 @@ const RESULT_COMMON_ITEM_LENGTH = 4 + // spriteIndex,imageIndex,resourceIndex,op
|
|
|
27746
27780
|
3 + // useShaderSurface, surfaceClipEnabled, useShaderBillboard
|
|
27747
27781
|
RESULT_BILLBOARD_UNIFORM_LENGTH + 1;
|
|
27748
27782
|
const RESULT_ITEM_STRIDE = RESULT_COMMON_ITEM_LENGTH + RESULT_VERTEX_COMPONENT_LENGTH + RESULT_HIT_TEST_COMPONENT_LENGTH + RESULT_SURFACE_BLOCK_LENGTH;
|
|
27749
|
-
const toFiniteOr = (value,
|
|
27783
|
+
const toFiniteOr = (value, fallback2) => Number.isFinite(value) ? value : fallback2;
|
|
27750
27784
|
const boolToNumber = (value) => value ? 1 : 0;
|
|
27751
27785
|
const modeToNumber = (mode) => mode === "surface" ? 0 : 1;
|
|
27752
27786
|
const computeInputElementCount = (resourceCount, spriteCount, resultItemCount) => {
|
|
@@ -27768,17 +27802,17 @@ const ensureHitTestCorners = (imageEntry) => {
|
|
|
27768
27802
|
return imageEntry.hitTestCorners;
|
|
27769
27803
|
};
|
|
27770
27804
|
const converToPreparedDrawImageParams = (state, deps, resultBuffer) => {
|
|
27771
|
-
var
|
|
27805
|
+
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;
|
|
27772
27806
|
const { buffer } = resultBuffer.prepare();
|
|
27773
27807
|
if (buffer.length < RESULT_HEADER_LENGTH) {
|
|
27774
27808
|
return [];
|
|
27775
27809
|
}
|
|
27776
27810
|
const preparedCount = Math.max(
|
|
27777
27811
|
0,
|
|
27778
|
-
Math.trunc((
|
|
27812
|
+
Math.trunc((_a = buffer[
|
|
27779
27813
|
0
|
|
27780
27814
|
/* PREPARED_COUNT */
|
|
27781
|
-
]) != null ?
|
|
27815
|
+
]) != null ? _a : 0)
|
|
27782
27816
|
);
|
|
27783
27817
|
const itemStride = Math.trunc((_b = buffer[
|
|
27784
27818
|
1
|
|
@@ -27808,12 +27842,12 @@ const converToPreparedDrawImageParams = (state, deps, resultBuffer) => {
|
|
|
27808
27842
|
return altitude / circumferenceAtLatitude2;
|
|
27809
27843
|
};
|
|
27810
27844
|
const calculatePerspectiveRatio = (location2) => {
|
|
27811
|
-
var
|
|
27845
|
+
var _a2, _b2, _c2;
|
|
27812
27846
|
const { mercatorMatrix, cameraToCenterDistance } = state.preparedProjection;
|
|
27813
27847
|
if (!mercatorMatrix || !Number.isFinite(cameraToCenterDistance)) {
|
|
27814
27848
|
return 1;
|
|
27815
27849
|
}
|
|
27816
|
-
const lng = (
|
|
27850
|
+
const lng = (_a2 = location2.lng) != null ? _a2 : 0;
|
|
27817
27851
|
const lat = clampLatitude((_b2 = location2.lat) != null ? _b2 : 0);
|
|
27818
27852
|
const altitude = (_c2 = location2.z) != null ? _c2 : 0;
|
|
27819
27853
|
const mercatorX = (180 + lng) / 360;
|
|
@@ -27837,10 +27871,10 @@ const converToPreparedDrawImageParams = (state, deps, resultBuffer) => {
|
|
|
27837
27871
|
}
|
|
27838
27872
|
};
|
|
27839
27873
|
const resolveEffectivePixelsPerMeter = (location2) => {
|
|
27840
|
-
var
|
|
27874
|
+
var _a2;
|
|
27841
27875
|
const metersPerPixelAtLat = calculateMetersPerPixelAtLatitude(
|
|
27842
27876
|
state.preparedProjection.zoom,
|
|
27843
|
-
(
|
|
27877
|
+
(_a2 = location2.lat) != null ? _a2 : 0
|
|
27844
27878
|
);
|
|
27845
27879
|
const perspectiveRatio = calculatePerspectiveRatio(location2);
|
|
27846
27880
|
const effective = calculateEffectivePixelsPerMeter(
|
|
@@ -28116,13 +28150,13 @@ const convertToWasmProjectionState = (wasm, params, deps) => {
|
|
|
28116
28150
|
let resourceRefs = [];
|
|
28117
28151
|
let state;
|
|
28118
28152
|
const writeMatrix = (buffer, start, matrix) => {
|
|
28119
|
-
var
|
|
28153
|
+
var _a;
|
|
28120
28154
|
for (let i = 0; i < 16; i++) {
|
|
28121
|
-
buffer[start + i] = matrix ? (
|
|
28155
|
+
buffer[start + i] = matrix ? (_a = matrix[i]) != null ? _a : 0 : 0;
|
|
28122
28156
|
}
|
|
28123
28157
|
};
|
|
28124
28158
|
const prepareInputBuffer = (callParams) => {
|
|
28125
|
-
var
|
|
28159
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
28126
28160
|
const { bucket } = callParams;
|
|
28127
28161
|
const resultItemCount = bucket.length;
|
|
28128
28162
|
const spriteHandleSet = /* @__PURE__ */ new Set();
|
|
@@ -28247,7 +28281,7 @@ const convertToWasmProjectionState = (wasm, params, deps) => {
|
|
|
28247
28281
|
frameConstView[fcCursor++] = EPS_NDC;
|
|
28248
28282
|
frameConstView[fcCursor++] = boolToNumber(ENABLE_NDC_BIAS_SURFACE);
|
|
28249
28283
|
const cameraLocation = preparedProjection.cameraLocation;
|
|
28250
|
-
frameConstView[fcCursor++] = (
|
|
28284
|
+
frameConstView[fcCursor++] = (_a = cameraLocation == null ? void 0 : cameraLocation.lng) != null ? _a : 0;
|
|
28251
28285
|
frameConstView[fcCursor++] = (_b = cameraLocation == null ? void 0 : cameraLocation.lat) != null ? _b : 0;
|
|
28252
28286
|
frameConstView[fcCursor++] = (_c = cameraLocation == null ? void 0 : cameraLocation.z) != null ? _c : 0;
|
|
28253
28287
|
state.lastFrameParams = {
|
|
@@ -28295,7 +28329,7 @@ const convertToWasmProjectionState = (wasm, params, deps) => {
|
|
|
28295
28329
|
}
|
|
28296
28330
|
cursor = spriteOffset;
|
|
28297
28331
|
spriteHandles.forEach((handle) => {
|
|
28298
|
-
var
|
|
28332
|
+
var _a2, _b2;
|
|
28299
28333
|
const sprite = spriteByHandle.get(handle);
|
|
28300
28334
|
if (!sprite) {
|
|
28301
28335
|
return;
|
|
@@ -28304,7 +28338,7 @@ const convertToWasmProjectionState = (wasm, params, deps) => {
|
|
|
28304
28338
|
const mercator = sprite.cachedMercator;
|
|
28305
28339
|
parameterBuffer[cursor++] = location2.lng;
|
|
28306
28340
|
parameterBuffer[cursor++] = location2.lat;
|
|
28307
|
-
parameterBuffer[cursor++] = (
|
|
28341
|
+
parameterBuffer[cursor++] = (_a2 = location2.z) != null ? _a2 : 0;
|
|
28308
28342
|
parameterBuffer[cursor++] = mercator.x;
|
|
28309
28343
|
parameterBuffer[cursor++] = mercator.y;
|
|
28310
28344
|
parameterBuffer[cursor++] = (_b2 = mercator.z) != null ? _b2 : 0;
|
|
@@ -28313,10 +28347,10 @@ const convertToWasmProjectionState = (wasm, params, deps) => {
|
|
|
28313
28347
|
const originTargetIndices = (_g = (_f = callParams.bucketBuffers) == null ? void 0 : _f.originTargetIndices) != null ? _g : null;
|
|
28314
28348
|
cursor = itemOffset;
|
|
28315
28349
|
bucket.forEach(([sprite, image], index) => {
|
|
28316
|
-
var
|
|
28350
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k;
|
|
28317
28351
|
const imageHandle = image.imageHandle;
|
|
28318
28352
|
const spriteHandle = sprite.handle;
|
|
28319
|
-
const originKeyCandidate = (
|
|
28353
|
+
const originKeyCandidate = (_a2 = originReferenceKeys == null ? void 0 : originReferenceKeys[index]) != null ? _a2 : image.originReferenceKey;
|
|
28320
28354
|
const originKey = originKeyCandidate !== void 0 && originKeyCandidate !== SPRITE_ORIGIN_REFERENCE_KEY_NONE ? originKeyCandidate : originReference.encodeKey(image.subLayer, image.order);
|
|
28321
28355
|
const originIndex = (_b2 = originTargetIndices == null ? void 0 : originTargetIndices[index]) != null ? _b2 : image.originRenderTargetIndex;
|
|
28322
28356
|
const originLocation = image.originLocation;
|
|
@@ -28859,9 +28893,9 @@ const createAtlasManager = (options) => {
|
|
|
28859
28893
|
return removed;
|
|
28860
28894
|
},
|
|
28861
28895
|
getImagePlacement: (id) => {
|
|
28862
|
-
var
|
|
28896
|
+
var _a;
|
|
28863
28897
|
const entry = images.get(id);
|
|
28864
|
-
return (
|
|
28898
|
+
return (_a = entry == null ? void 0 : entry.placement) != null ? _a : null;
|
|
28865
28899
|
},
|
|
28866
28900
|
getPages: () => {
|
|
28867
28901
|
return pages.slice();
|
|
@@ -29013,8 +29047,8 @@ const rectContainsRectInclusive = (container, target) => container.x0 <= target.
|
|
|
29013
29047
|
const rectsOverlapInclusive = (a, b) => !(a.x1 < b.x0 || a.x0 > b.x1 || a.y1 < b.y0 || a.y0 > b.y1);
|
|
29014
29048
|
const rectEquals = (a, b) => a.x0 === b.x0 && a.y0 === b.y0 && a.x1 === b.x1 && a.y1 === b.y1;
|
|
29015
29049
|
const createLooseQuadTree = (options) => {
|
|
29016
|
-
var
|
|
29017
|
-
const maxItemsPerNode = (
|
|
29050
|
+
var _a, _b, _c;
|
|
29051
|
+
const maxItemsPerNode = (_a = options.maxItemsPerNode) != null ? _a : DEFAULT_MAX_ITEMS_PER_NODE;
|
|
29018
29052
|
const maxDepth = (_b = options.maxDepth) != null ? _b : DEFAULT_MAX_DEPTH;
|
|
29019
29053
|
const looseness = (_c = options.looseness) != null ? _c : DEFAULT_LOOSENESS;
|
|
29020
29054
|
if (maxItemsPerNode <= 0) {
|
|
@@ -29296,7 +29330,7 @@ const createHitTestController = ({
|
|
|
29296
29330
|
return rectFromLngLatPoints([cornerNE, cornerSW]);
|
|
29297
29331
|
};
|
|
29298
29332
|
const estimateSurfaceImageBounds = (projectionHost, sprite, image) => {
|
|
29299
|
-
var
|
|
29333
|
+
var _a, _b, _c;
|
|
29300
29334
|
const imageResource = images.get(image.imageId);
|
|
29301
29335
|
if (!imageResource) {
|
|
29302
29336
|
return null;
|
|
@@ -29324,7 +29358,7 @@ const createHitTestController = ({
|
|
|
29324
29358
|
if (!Number.isFinite(effectivePixelsPerMeter) || effectivePixelsPerMeter <= 0) {
|
|
29325
29359
|
return null;
|
|
29326
29360
|
}
|
|
29327
|
-
const imageScale = (
|
|
29361
|
+
const imageScale = (_a = image.scale) != null ? _a : 1;
|
|
29328
29362
|
const baseMetersPerPixel = scaling.metersPerPixel;
|
|
29329
29363
|
const spriteMinPixel = scaling.spriteMinPixel;
|
|
29330
29364
|
const spriteMaxPixel = scaling.spriteMaxPixel;
|
|
@@ -29367,7 +29401,7 @@ const createHitTestController = ({
|
|
|
29367
29401
|
return rectFromLngLatPoints(corners);
|
|
29368
29402
|
};
|
|
29369
29403
|
const estimateBillboardImageBounds = (projectionHost, sprite, image) => {
|
|
29370
|
-
var
|
|
29404
|
+
var _a, _b;
|
|
29371
29405
|
const imageResource = images.get(image.imageId);
|
|
29372
29406
|
if (!imageResource) {
|
|
29373
29407
|
return null;
|
|
@@ -29398,7 +29432,7 @@ const createHitTestController = ({
|
|
|
29398
29432
|
const baseMetersPerPixel = scaling.metersPerPixel;
|
|
29399
29433
|
const spriteMinPixel = scaling.spriteMinPixel;
|
|
29400
29434
|
const spriteMaxPixel = scaling.spriteMaxPixel;
|
|
29401
|
-
const imageScale = (
|
|
29435
|
+
const imageScale = (_a = image.scale) != null ? _a : 1;
|
|
29402
29436
|
const totalRotateDeg = Number.isFinite(image.displayedRotateDeg) ? image.displayedRotateDeg : normalizeAngleDeg(
|
|
29403
29437
|
((_b = image.resolvedBaseRotateDeg) != null ? _b : 0) + image.rotationCommandDeg
|
|
29404
29438
|
);
|
|
@@ -29675,7 +29709,7 @@ const createHitTestController = ({
|
|
|
29675
29709
|
return findTopmostHitEntryLinear(point);
|
|
29676
29710
|
};
|
|
29677
29711
|
const resolveScreenPointFromEvent = (nativeEvent, canvasElement) => {
|
|
29678
|
-
var
|
|
29712
|
+
var _a, _b, _c;
|
|
29679
29713
|
if (!canvasElement) {
|
|
29680
29714
|
return void 0;
|
|
29681
29715
|
}
|
|
@@ -29686,7 +29720,7 @@ const createHitTestController = ({
|
|
|
29686
29720
|
});
|
|
29687
29721
|
if ("changedTouches" in nativeEvent) {
|
|
29688
29722
|
const touchEvent = nativeEvent;
|
|
29689
|
-
const touch = (_c = (
|
|
29723
|
+
const touch = (_c = (_a = touchEvent.changedTouches) == null ? void 0 : _a[0]) != null ? _c : (_b = touchEvent.touches) == null ? void 0 : _b[0];
|
|
29690
29724
|
if (!touch) {
|
|
29691
29725
|
return void 0;
|
|
29692
29726
|
}
|
|
@@ -29796,19 +29830,19 @@ const resolveTextAlign = (align) => {
|
|
|
29796
29830
|
}
|
|
29797
29831
|
};
|
|
29798
29832
|
const resolveFontStyle = (style) => style === "italic" ? "italic" : DEFAULT_TEXT_GLYPH_FONT_STYLE;
|
|
29799
|
-
const resolvePositiveFinite = (value,
|
|
29833
|
+
const resolvePositiveFinite = (value, fallback2) => {
|
|
29800
29834
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
29801
|
-
return
|
|
29835
|
+
return fallback2;
|
|
29802
29836
|
}
|
|
29803
|
-
return value > 0 ? value :
|
|
29837
|
+
return value > 0 ? value : fallback2;
|
|
29804
29838
|
};
|
|
29805
|
-
const resolveNonNegativeFinite = (value,
|
|
29839
|
+
const resolveNonNegativeFinite = (value, fallback2 = 0) => {
|
|
29806
29840
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
29807
|
-
return
|
|
29841
|
+
return fallback2;
|
|
29808
29842
|
}
|
|
29809
|
-
return value >= 0 ? value :
|
|
29843
|
+
return value >= 0 ? value : fallback2;
|
|
29810
29844
|
};
|
|
29811
|
-
const resolveFiniteOrDefault = (value,
|
|
29845
|
+
const resolveFiniteOrDefault = (value, fallback2) => typeof value === "number" && Number.isFinite(value) ? value : fallback2;
|
|
29812
29846
|
const resolveRenderPixelRatio = (value) => {
|
|
29813
29847
|
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
29814
29848
|
return DEFAULT_TEXT_GLYPH_RENDER_PIXEL_RATIO;
|
|
@@ -29943,7 +29977,7 @@ const drawTextWithLetterSpacing = (ctx, text, startX, y, letterSpacing) => {
|
|
|
29943
29977
|
}
|
|
29944
29978
|
};
|
|
29945
29979
|
const resolveTextGlyphOptions = (options, preferredLineHeight) => {
|
|
29946
|
-
var
|
|
29980
|
+
var _a, _b, _c;
|
|
29947
29981
|
const fallbackFontSize = typeof preferredLineHeight === "number" && preferredLineHeight > 0 ? (
|
|
29948
29982
|
// When a preferred line height is provided, use it as the baseline font size.
|
|
29949
29983
|
preferredLineHeight
|
|
@@ -29956,7 +29990,7 @@ const resolveTextGlyphOptions = (options, preferredLineHeight) => {
|
|
|
29956
29990
|
fallbackFontSize
|
|
29957
29991
|
);
|
|
29958
29992
|
return {
|
|
29959
|
-
fontFamily: (
|
|
29993
|
+
fontFamily: (_a = options == null ? void 0 : options.fontFamily) != null ? _a : DEFAULT_TEXT_GLYPH_FONT_FAMILY,
|
|
29960
29994
|
fontStyle: resolveFontStyle(options == null ? void 0 : options.fontStyle),
|
|
29961
29995
|
fontWeight: (_b = options == null ? void 0 : options.fontWeight) != null ? _b : DEFAULT_TEXT_GLYPH_FONT_WEIGHT,
|
|
29962
29996
|
fontSizePixel: resolvedFontSize,
|
|
@@ -30218,6 +30252,7 @@ const renderTextGlyphBitmap = async (text, dimensions, options) => {
|
|
|
30218
30252
|
);
|
|
30219
30253
|
return { bitmap, width: totalWidth, height: totalHeight };
|
|
30220
30254
|
};
|
|
30255
|
+
const OPACITY_VISIBILITY_EPSILON = 1e-4;
|
|
30221
30256
|
const ATLAS_PAGE_INDEX_NONE = -1;
|
|
30222
30257
|
const updateImageInterpolationDirtyState = (sprite, image) => {
|
|
30223
30258
|
const dirty = hasActiveImageInterpolations(image);
|
|
@@ -30226,22 +30261,37 @@ const updateImageInterpolationDirtyState = (sprite, image) => {
|
|
|
30226
30261
|
sprite.interpolationDirty = true;
|
|
30227
30262
|
}
|
|
30228
30263
|
};
|
|
30229
|
-
const
|
|
30264
|
+
const reapplySpriteOpacityMultiplier = (sprite) => {
|
|
30265
|
+
var _a;
|
|
30266
|
+
const multiplier = (_a = sprite.opacityMultiplier) != null ? _a : 1;
|
|
30267
|
+
sprite.images.forEach((orderMap) => {
|
|
30268
|
+
orderMap.forEach((image) => {
|
|
30269
|
+
var _a2, _b;
|
|
30270
|
+
const baseOpacity = (_a2 = image.opacity.interpolation.baseValue) != null ? _a2 : image.opacity.current;
|
|
30271
|
+
const interpolationOption = (_b = image.opacity.interpolation.options) != null ? _b : null;
|
|
30272
|
+
applyOpacityUpdate(image, baseOpacity, interpolationOption, multiplier);
|
|
30273
|
+
});
|
|
30274
|
+
});
|
|
30275
|
+
};
|
|
30276
|
+
const applyAutoRotation = (sprite, nextLocation, forceAutoRotation) => {
|
|
30230
30277
|
let hasAutoRotation = false;
|
|
30231
30278
|
let requiredDistance = 0;
|
|
30232
30279
|
sprite.images.forEach((orderMap) => {
|
|
30233
30280
|
orderMap.forEach((image) => {
|
|
30234
|
-
var
|
|
30281
|
+
var _a;
|
|
30235
30282
|
if (!image.autoRotation) {
|
|
30236
30283
|
return;
|
|
30237
30284
|
}
|
|
30238
30285
|
hasAutoRotation = true;
|
|
30239
|
-
const minDistance = Math.max(0, (
|
|
30286
|
+
const minDistance = Math.max(0, (_a = image.autoRotationMinDistanceMeters) != null ? _a : 0);
|
|
30240
30287
|
if (minDistance > requiredDistance) {
|
|
30241
30288
|
requiredDistance = minDistance;
|
|
30242
30289
|
}
|
|
30243
30290
|
});
|
|
30244
30291
|
});
|
|
30292
|
+
if (forceAutoRotation) {
|
|
30293
|
+
requiredDistance = 0;
|
|
30294
|
+
}
|
|
30245
30295
|
if (!hasAutoRotation) {
|
|
30246
30296
|
return false;
|
|
30247
30297
|
}
|
|
@@ -30306,13 +30356,27 @@ const createInterpolatedOffsetState = (offset, invalidated) => {
|
|
|
30306
30356
|
current: base.offsetMeters,
|
|
30307
30357
|
from: void 0,
|
|
30308
30358
|
to: void 0,
|
|
30309
|
-
invalidated
|
|
30359
|
+
invalidated,
|
|
30360
|
+
interpolation: {
|
|
30361
|
+
state: null,
|
|
30362
|
+
options: null,
|
|
30363
|
+
lastCommandValue: base.offsetMeters,
|
|
30364
|
+
baseValue: void 0,
|
|
30365
|
+
targetValue: void 0
|
|
30366
|
+
}
|
|
30310
30367
|
},
|
|
30311
30368
|
offsetDeg: {
|
|
30312
30369
|
current: base.offsetDeg,
|
|
30313
30370
|
from: void 0,
|
|
30314
30371
|
to: void 0,
|
|
30315
|
-
invalidated
|
|
30372
|
+
invalidated,
|
|
30373
|
+
interpolation: {
|
|
30374
|
+
state: null,
|
|
30375
|
+
options: null,
|
|
30376
|
+
lastCommandValue: base.offsetDeg,
|
|
30377
|
+
baseValue: void 0,
|
|
30378
|
+
targetValue: void 0
|
|
30379
|
+
}
|
|
30316
30380
|
}
|
|
30317
30381
|
};
|
|
30318
30382
|
};
|
|
@@ -30351,9 +30415,18 @@ const sanitizeVisibilityDistanceMeters = (value) => {
|
|
|
30351
30415
|
}
|
|
30352
30416
|
return value;
|
|
30353
30417
|
};
|
|
30418
|
+
const sanitizeOpacityMultiplier = (value) => {
|
|
30419
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
30420
|
+
return 1;
|
|
30421
|
+
}
|
|
30422
|
+
if (value <= 0) {
|
|
30423
|
+
return 0;
|
|
30424
|
+
}
|
|
30425
|
+
return value;
|
|
30426
|
+
};
|
|
30354
30427
|
const createImageStateFromInit = (imageInit, subLayer, order, originReference, invalidated) => {
|
|
30355
|
-
var
|
|
30356
|
-
const mode = (
|
|
30428
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
30429
|
+
const mode = (_a = imageInit.mode) != null ? _a : "surface";
|
|
30357
30430
|
const autoRotationDefault = mode === "surface";
|
|
30358
30431
|
const initialOffset = cloneOffset(imageInit.offset);
|
|
30359
30432
|
const initialOpacity = clampOpacity((_b = imageInit.opacity) != null ? _b : 1);
|
|
@@ -30370,8 +30443,16 @@ const createImageStateFromInit = (imageInit, subLayer, order, originReference, i
|
|
|
30370
30443
|
current: initialOpacity,
|
|
30371
30444
|
from: void 0,
|
|
30372
30445
|
to: void 0,
|
|
30373
|
-
invalidated
|
|
30446
|
+
invalidated,
|
|
30447
|
+
interpolation: {
|
|
30448
|
+
state: null,
|
|
30449
|
+
options: null,
|
|
30450
|
+
targetValue: initialOpacity,
|
|
30451
|
+
baseValue: initialOpacity,
|
|
30452
|
+
lastCommandValue: initialOpacity
|
|
30453
|
+
}
|
|
30374
30454
|
},
|
|
30455
|
+
lodOpacity: 1,
|
|
30375
30456
|
scale: (_d = imageInit.scale) != null ? _d : 1,
|
|
30376
30457
|
anchor: cloneAnchor(imageInit.anchor),
|
|
30377
30458
|
border: resolveSpriteImageLineAttribute(imageInit.border),
|
|
@@ -30383,7 +30464,14 @@ const createImageStateFromInit = (imageInit, subLayer, order, originReference, i
|
|
|
30383
30464
|
current: initialRotateDeg,
|
|
30384
30465
|
from: void 0,
|
|
30385
30466
|
to: void 0,
|
|
30386
|
-
invalidated
|
|
30467
|
+
invalidated,
|
|
30468
|
+
interpolation: {
|
|
30469
|
+
state: null,
|
|
30470
|
+
options: null,
|
|
30471
|
+
lastCommandValue: initialRotateDeg,
|
|
30472
|
+
baseValue: void 0,
|
|
30473
|
+
targetValue: void 0
|
|
30474
|
+
}
|
|
30387
30475
|
},
|
|
30388
30476
|
rotationCommandDeg: initialRotateDeg,
|
|
30389
30477
|
displayedRotateDeg: initialRotateDeg,
|
|
@@ -30393,34 +30481,22 @@ const createImageStateFromInit = (imageInit, subLayer, order, originReference, i
|
|
|
30393
30481
|
originLocation,
|
|
30394
30482
|
originReferenceKey,
|
|
30395
30483
|
originRenderTargetIndex: SPRITE_ORIGIN_REFERENCE_INDEX_NONE,
|
|
30396
|
-
rotationInterpolationState: null,
|
|
30397
|
-
rotationInterpolationOptions: null,
|
|
30398
|
-
offsetDegInterpolationState: null,
|
|
30399
|
-
offsetMetersInterpolationState: null,
|
|
30400
|
-
opacityInterpolationState: null,
|
|
30401
|
-
opacityInterpolationOptions: null,
|
|
30402
|
-
opacityTargetValue: initialOpacity,
|
|
30403
|
-
lodLastCommandOpacity: initialOpacity,
|
|
30404
|
-
lastCommandRotateDeg: initialRotateDeg,
|
|
30405
|
-
lastCommandOffsetDeg: initialOffset.offsetDeg,
|
|
30406
|
-
lastCommandOffsetMeters: initialOffset.offsetMeters,
|
|
30407
|
-
lastCommandOpacity: initialOpacity,
|
|
30408
30484
|
interpolationDirty: false
|
|
30409
30485
|
};
|
|
30410
30486
|
const rotateInitOption = (_h = (_g = imageInit.interpolation) == null ? void 0 : _g.rotateDeg) != null ? _h : null;
|
|
30411
30487
|
if (rotateInitOption) {
|
|
30412
|
-
state.
|
|
30488
|
+
state.rotateDeg.interpolation.options = cloneInterpolationOptions(rotateInitOption);
|
|
30413
30489
|
}
|
|
30414
30490
|
const opacityInitOption = (_j = (_i = imageInit.interpolation) == null ? void 0 : _i.opacity) != null ? _j : null;
|
|
30415
30491
|
if (opacityInitOption) {
|
|
30416
|
-
state.
|
|
30492
|
+
state.opacity.interpolation.options = cloneInterpolationOptions(opacityInitOption);
|
|
30417
30493
|
}
|
|
30418
30494
|
syncImageRotationChannel(state);
|
|
30419
30495
|
return state;
|
|
30420
30496
|
};
|
|
30421
30497
|
const createSpriteLayer = (options) => {
|
|
30422
|
-
var
|
|
30423
|
-
const id = (
|
|
30498
|
+
var _a;
|
|
30499
|
+
const id = (_a = options == null ? void 0 : options.id) != null ? _a : "sprite-layer";
|
|
30424
30500
|
let resolvedScaling = resolveScalingOptions(options == null ? void 0 : options.spriteScaling);
|
|
30425
30501
|
const resolvedTextureFiltering = resolveTextureFilteringOptions(
|
|
30426
30502
|
options == null ? void 0 : options.textureFiltering
|
|
@@ -30511,13 +30587,13 @@ const createSpriteLayer = (options) => {
|
|
|
30511
30587
|
scheduleTextGlyphQueueProcessing();
|
|
30512
30588
|
};
|
|
30513
30589
|
const cancelPendingTextGlyphJob = (imageId, reason) => {
|
|
30514
|
-
var
|
|
30590
|
+
var _a2;
|
|
30515
30591
|
for (let idx = textGlyphQueue.length - 1; idx >= 0; idx -= 1) {
|
|
30516
30592
|
const entry = textGlyphQueue[idx];
|
|
30517
30593
|
if (entry && entry.glyphId === imageId) {
|
|
30518
30594
|
textGlyphQueue.splice(idx, 1);
|
|
30519
30595
|
pendingTextGlyphIds.delete(imageId);
|
|
30520
|
-
(
|
|
30596
|
+
(_a2 = entry.abortHandle) == null ? void 0 : _a2.release();
|
|
30521
30597
|
entry.deferred.reject(
|
|
30522
30598
|
reason != null ? reason : new Error(
|
|
30523
30599
|
`[SpriteLayer][GlyphQueue] Image "${imageId}" was cancelled before generation.`
|
|
@@ -30527,19 +30603,19 @@ const createSpriteLayer = (options) => {
|
|
|
30527
30603
|
}
|
|
30528
30604
|
};
|
|
30529
30605
|
const rejectAllPendingTextGlyphJobs = (reason) => {
|
|
30530
|
-
var
|
|
30606
|
+
var _a2;
|
|
30531
30607
|
while (textGlyphQueue.length > 0) {
|
|
30532
30608
|
const entry = textGlyphQueue.shift();
|
|
30533
30609
|
if (entry) {
|
|
30534
30610
|
pendingTextGlyphIds.delete(entry.glyphId);
|
|
30535
|
-
(
|
|
30611
|
+
(_a2 = entry.abortHandle) == null ? void 0 : _a2.release();
|
|
30536
30612
|
entry.deferred.reject(reason);
|
|
30537
30613
|
}
|
|
30538
30614
|
}
|
|
30539
30615
|
};
|
|
30540
30616
|
const executeTextGlyphJob = async (entry) => {
|
|
30541
|
-
var
|
|
30542
|
-
if ((
|
|
30617
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
|
30618
|
+
if ((_a2 = entry.signal) == null ? void 0 : _a2.aborted) {
|
|
30543
30619
|
(_b = entry.abortHandle) == null ? void 0 : _b.release();
|
|
30544
30620
|
entry.deferred.reject(entry.signal.reason);
|
|
30545
30621
|
pendingTextGlyphIds.delete(entry.glyphId);
|
|
@@ -30691,51 +30767,52 @@ const createSpriteLayer = (options) => {
|
|
|
30691
30767
|
};
|
|
30692
30768
|
const sprites = /* @__PURE__ */ new Map();
|
|
30693
30769
|
const invalidateImageInterpolationState = (sprite, image) => {
|
|
30694
|
-
var
|
|
30695
|
-
|
|
30696
|
-
|
|
30697
|
-
|
|
30698
|
-
image.
|
|
30699
|
-
image.offsetDegInterpolationState = null;
|
|
30700
|
-
image.offsetMetersInterpolationState = null;
|
|
30701
|
-
image.opacityInterpolationState = null;
|
|
30702
|
-
image.rotateDeg.current = manualRotation;
|
|
30770
|
+
var _a2;
|
|
30771
|
+
image.rotateDeg.interpolation.state = null;
|
|
30772
|
+
image.offset.offsetDeg.interpolation.state = null;
|
|
30773
|
+
image.offset.offsetMeters.interpolation.state = null;
|
|
30774
|
+
image.opacity.interpolation.state = null;
|
|
30703
30775
|
image.rotateDeg.from = void 0;
|
|
30704
30776
|
image.rotateDeg.to = void 0;
|
|
30705
30777
|
image.rotateDeg.invalidated = true;
|
|
30706
|
-
image.
|
|
30707
|
-
image.displayedRotateDeg = displayedRotation;
|
|
30708
|
-
image.lastCommandRotateDeg = normalizeAngleDeg(displayedRotation);
|
|
30778
|
+
image.rotateDeg.interpolation.lastCommandValue = image.rotateDeg.current;
|
|
30709
30779
|
image.offset.offsetDeg.from = void 0;
|
|
30710
30780
|
image.offset.offsetDeg.to = void 0;
|
|
30711
30781
|
image.offset.offsetDeg.invalidated = true;
|
|
30712
|
-
image.
|
|
30782
|
+
image.offset.offsetDeg.interpolation.lastCommandValue = image.offset.offsetDeg.current;
|
|
30713
30783
|
image.offset.offsetMeters.from = void 0;
|
|
30714
30784
|
image.offset.offsetMeters.to = void 0;
|
|
30715
30785
|
image.offset.offsetMeters.invalidated = true;
|
|
30716
|
-
image.
|
|
30786
|
+
image.offset.offsetMeters.interpolation.lastCommandValue = image.offset.offsetMeters.current;
|
|
30717
30787
|
image.opacity.from = void 0;
|
|
30718
30788
|
image.opacity.to = void 0;
|
|
30719
30789
|
image.opacity.invalidated = true;
|
|
30720
|
-
image.
|
|
30721
|
-
image.
|
|
30722
|
-
|
|
30790
|
+
image.opacity.interpolation.targetValue = image.opacity.current;
|
|
30791
|
+
image.opacity.interpolation.lastCommandValue = image.opacity.current;
|
|
30792
|
+
const spriteOpacityMultiplier = (_a2 = sprite.opacityMultiplier) != null ? _a2 : 1;
|
|
30793
|
+
const lodMultiplier = image.lodOpacity || 1;
|
|
30794
|
+
if (spriteOpacityMultiplier > 0 && lodMultiplier > 0) {
|
|
30795
|
+
image.opacity.interpolation.baseValue = clampOpacity(
|
|
30796
|
+
image.opacity.current / (spriteOpacityMultiplier * lodMultiplier)
|
|
30797
|
+
);
|
|
30798
|
+
}
|
|
30723
30799
|
updateImageInterpolationDirtyState(sprite, image);
|
|
30724
30800
|
};
|
|
30725
30801
|
const invalidateSpriteInterpolationState = (sprite) => {
|
|
30802
|
+
const currentSnapshot = cloneSpriteLocation(sprite.location.current);
|
|
30726
30803
|
sprite.location.from = void 0;
|
|
30727
30804
|
sprite.location.to = void 0;
|
|
30728
30805
|
sprite.location.invalidated = true;
|
|
30729
|
-
sprite.
|
|
30730
|
-
sprite.
|
|
30731
|
-
sprite.
|
|
30732
|
-
sprite.lastAutoRotationLocation = cloneSpriteLocation(
|
|
30733
|
-
|
|
30734
|
-
);
|
|
30806
|
+
sprite.location.interpolation.state = null;
|
|
30807
|
+
sprite.location.interpolation.options = null;
|
|
30808
|
+
sprite.location.interpolation.lastCommandValue = cloneSpriteLocation(currentSnapshot);
|
|
30809
|
+
sprite.lastAutoRotationLocation = cloneSpriteLocation(currentSnapshot);
|
|
30810
|
+
sprite.autoRotationInvalidated = true;
|
|
30735
30811
|
sprite.interpolationDirty = false;
|
|
30736
30812
|
sprite.images.forEach((orderMap) => {
|
|
30737
30813
|
orderMap.forEach((image) => {
|
|
30738
30814
|
invalidateImageInterpolationState(sprite, image);
|
|
30815
|
+
image.displayedRotateDeg = image.resolvedBaseRotateDeg + image.rotationCommandDeg;
|
|
30739
30816
|
});
|
|
30740
30817
|
});
|
|
30741
30818
|
};
|
|
@@ -30764,10 +30841,10 @@ const createSpriteLayer = (options) => {
|
|
|
30764
30841
|
});
|
|
30765
30842
|
};
|
|
30766
30843
|
const getImageState = (sprite, subLayer, order) => {
|
|
30767
|
-
var
|
|
30844
|
+
var _a2;
|
|
30768
30845
|
return (
|
|
30769
30846
|
// Use optional chaining to safely traverse the nested map hierarchy.
|
|
30770
|
-
(
|
|
30847
|
+
(_a2 = sprite.images.get(subLayer)) == null ? void 0 : _a2.get(order)
|
|
30771
30848
|
);
|
|
30772
30849
|
};
|
|
30773
30850
|
const setImageState = (sprite, state) => {
|
|
@@ -30779,10 +30856,10 @@ const createSpriteLayer = (options) => {
|
|
|
30779
30856
|
inner.set(state.order, state);
|
|
30780
30857
|
};
|
|
30781
30858
|
const hasImageState = (sprite, subLayer, order) => {
|
|
30782
|
-
var
|
|
30859
|
+
var _a2, _b;
|
|
30783
30860
|
return (
|
|
30784
30861
|
// Return true only when the nested map exists and contains the desired order entry.
|
|
30785
|
-
(_b = (
|
|
30862
|
+
(_b = (_a2 = sprite.images.get(subLayer)) == null ? void 0 : _a2.has(order)) != null ? _b : false
|
|
30786
30863
|
);
|
|
30787
30864
|
};
|
|
30788
30865
|
const deleteImageState = (sprite, subLayer, order) => {
|
|
@@ -30834,22 +30911,22 @@ const createSpriteLayer = (options) => {
|
|
|
30834
30911
|
const inputListenerDisposers = [];
|
|
30835
30912
|
let mapVisible = typeof document !== "undefined" ? document.visibilityState !== "hidden" : true;
|
|
30836
30913
|
const resolveDocumentVisibility = () => {
|
|
30837
|
-
var
|
|
30838
|
-
const doc = (
|
|
30914
|
+
var _a2;
|
|
30915
|
+
const doc = (_a2 = canvasElement == null ? void 0 : canvasElement.ownerDocument) != null ? _a2 : typeof document !== "undefined" ? document : void 0;
|
|
30839
30916
|
return doc ? doc.visibilityState !== "hidden" : true;
|
|
30840
30917
|
};
|
|
30841
30918
|
const isLayerVisible = () => mapVisible;
|
|
30842
30919
|
const hasSpriteListeners = (type) => {
|
|
30843
|
-
var
|
|
30920
|
+
var _a2, _b;
|
|
30844
30921
|
return (
|
|
30845
30922
|
// Treat missing listener sets as zero, otherwise check the registered count.
|
|
30846
|
-
((_b = (
|
|
30923
|
+
((_b = (_a2 = eventListeners.get(type)) == null ? void 0 : _a2.size) != null ? _b : 0) > 0
|
|
30847
30924
|
);
|
|
30848
30925
|
};
|
|
30849
30926
|
const hasSpriteClickListeners = () => hasSpriteListeners("spriteclick");
|
|
30850
30927
|
const hasSpriteHoverListeners = () => hasSpriteListeners("spritehover");
|
|
30851
30928
|
const resolveSpriteEventPayload = (hitEntry) => {
|
|
30852
|
-
var
|
|
30929
|
+
var _a2, _b;
|
|
30853
30930
|
if (!hitEntry) {
|
|
30854
30931
|
return {
|
|
30855
30932
|
sprite: void 0,
|
|
@@ -30857,7 +30934,7 @@ const createSpriteLayer = (options) => {
|
|
|
30857
30934
|
};
|
|
30858
30935
|
}
|
|
30859
30936
|
const spriteState = getSpriteState(hitEntry.sprite.spriteId);
|
|
30860
|
-
const imageState = (_b = (
|
|
30937
|
+
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;
|
|
30861
30938
|
return {
|
|
30862
30939
|
sprite: spriteState,
|
|
30863
30940
|
image: imageState
|
|
@@ -30937,7 +31014,7 @@ const createSpriteLayer = (options) => {
|
|
|
30937
31014
|
scheduleRender();
|
|
30938
31015
|
};
|
|
30939
31016
|
const ensureRenderTargetEntries = () => {
|
|
30940
|
-
var
|
|
31017
|
+
var _a2;
|
|
30941
31018
|
renderTargetEntries.length = 0;
|
|
30942
31019
|
sprites.forEach((sprite) => {
|
|
30943
31020
|
if (!sprite.isEnabled) {
|
|
@@ -30948,7 +31025,9 @@ const createSpriteLayer = (options) => {
|
|
|
30948
31025
|
}
|
|
30949
31026
|
sprite.images.forEach((orderMap) => {
|
|
30950
31027
|
orderMap.forEach((image) => {
|
|
30951
|
-
|
|
31028
|
+
var _a3;
|
|
31029
|
+
const baseOpacity = (_a3 = image.opacity.interpolation.baseValue) != null ? _a3 : image.opacity.interpolation.lastCommandValue;
|
|
31030
|
+
const shouldForceVisibilityCheck = sprite.visibilityDistanceMeters !== void 0 && (baseOpacity != null ? baseOpacity : 0) > OPACITY_VISIBILITY_EPSILON;
|
|
30952
31031
|
if (image.opacity.current <= 0 && !shouldForceVisibilityCheck) {
|
|
30953
31032
|
image.originRenderTargetIndex = SPRITE_ORIGIN_REFERENCE_INDEX_NONE;
|
|
30954
31033
|
image.originReferenceKey = SPRITE_ORIGIN_REFERENCE_KEY_NONE;
|
|
@@ -31003,12 +31082,12 @@ const createSpriteLayer = (options) => {
|
|
|
31003
31082
|
continue;
|
|
31004
31083
|
}
|
|
31005
31084
|
const indexMap = originIndexBySprite.get(sprite.spriteId);
|
|
31006
|
-
const targetIndex = (
|
|
31085
|
+
const targetIndex = (_a2 = indexMap == null ? void 0 : indexMap.get(image.originReferenceKey)) != null ? _a2 : SPRITE_ORIGIN_REFERENCE_INDEX_NONE;
|
|
31007
31086
|
image.originRenderTargetIndex = targetIndex;
|
|
31008
31087
|
}
|
|
31009
31088
|
};
|
|
31010
31089
|
const onAdd = (mapInstance, glContext) => {
|
|
31011
|
-
var
|
|
31090
|
+
var _a2;
|
|
31012
31091
|
map = mapInstance;
|
|
31013
31092
|
gl = glContext;
|
|
31014
31093
|
anisotropyExtension = resolveAnisotropyExtension(glContext);
|
|
@@ -31094,7 +31173,7 @@ const createSpriteLayer = (options) => {
|
|
|
31094
31173
|
canvasElement == null ? void 0 : canvasElement.removeEventListener("mousemove", mouseMoveListener);
|
|
31095
31174
|
});
|
|
31096
31175
|
}
|
|
31097
|
-
const visibilityTarget = (
|
|
31176
|
+
const visibilityTarget = (_a2 = canvasElement.ownerDocument) != null ? _a2 : typeof document !== "undefined" ? document : void 0;
|
|
31098
31177
|
if (visibilityTarget) {
|
|
31099
31178
|
const visibilityListener = () => updateVisibilityState();
|
|
31100
31179
|
visibilityTarget.addEventListener(
|
|
@@ -31237,12 +31316,12 @@ const createSpriteLayer = (options) => {
|
|
|
31237
31316
|
const drawProgram = spriteDrawProgram;
|
|
31238
31317
|
let drawOrderCounter = 0;
|
|
31239
31318
|
const drawPreparedSprite = (prepared) => {
|
|
31240
|
-
var
|
|
31319
|
+
var _a2;
|
|
31241
31320
|
const didDraw = drawProgram.draw(prepared);
|
|
31242
31321
|
if (!didDraw) {
|
|
31243
31322
|
return;
|
|
31244
31323
|
}
|
|
31245
|
-
prepared.imageEntry.surfaceShaderInputs = (
|
|
31324
|
+
prepared.imageEntry.surfaceShaderInputs = (_a2 = prepared.surfaceShaderInputs) != null ? _a2 : void 0;
|
|
31246
31325
|
if (prepared.hitTestCorners && prepared.hitTestCorners.length === 4) {
|
|
31247
31326
|
hitTestController.registerHitTestEntry(
|
|
31248
31327
|
prepared.spriteEntry,
|
|
@@ -31465,7 +31544,7 @@ const createSpriteLayer = (options) => {
|
|
|
31465
31544
|
glContext.disable(glContext.BLEND);
|
|
31466
31545
|
};
|
|
31467
31546
|
const registerImage = async (imageId, imageSource, options2, signal) => {
|
|
31468
|
-
var
|
|
31547
|
+
var _a2;
|
|
31469
31548
|
let bitmap;
|
|
31470
31549
|
try {
|
|
31471
31550
|
bitmap = typeof imageSource === "string" ? await loadImageBitmap(imageSource, options2) : imageSource;
|
|
@@ -31513,7 +31592,7 @@ const createSpriteLayer = (options) => {
|
|
|
31513
31592
|
updateSpriteImageHandles(imageId, 0);
|
|
31514
31593
|
imageHandleBuffersController.markDirty(images);
|
|
31515
31594
|
atlasManager.removeImage(imageId);
|
|
31516
|
-
(
|
|
31595
|
+
(_a2 = bitmap.close) == null ? void 0 : _a2.call(bitmap);
|
|
31517
31596
|
throw e;
|
|
31518
31597
|
} finally {
|
|
31519
31598
|
abortHandle == null ? void 0 : abortHandle.release();
|
|
@@ -31547,7 +31626,7 @@ const createSpriteLayer = (options) => {
|
|
|
31547
31626
|
}
|
|
31548
31627
|
};
|
|
31549
31628
|
const unregisterImage = (imageId) => {
|
|
31550
|
-
var
|
|
31629
|
+
var _a2, _b;
|
|
31551
31630
|
const image = images.get(imageId);
|
|
31552
31631
|
if (!image) {
|
|
31553
31632
|
if (pendingTextGlyphIds.has(imageId)) {
|
|
@@ -31577,7 +31656,7 @@ const createSpriteLayer = (options) => {
|
|
|
31577
31656
|
});
|
|
31578
31657
|
});
|
|
31579
31658
|
if (image.bitmap) {
|
|
31580
|
-
(_b = (
|
|
31659
|
+
(_b = (_a2 = image.bitmap).close) == null ? void 0 : _b.call(_a2);
|
|
31581
31660
|
}
|
|
31582
31661
|
images.delete(imageId);
|
|
31583
31662
|
imageIdHandler.release(imageId);
|
|
@@ -31607,9 +31686,9 @@ const createSpriteLayer = (options) => {
|
|
|
31607
31686
|
});
|
|
31608
31687
|
atlasPageTextures.clear();
|
|
31609
31688
|
images.forEach((image) => {
|
|
31610
|
-
var
|
|
31689
|
+
var _a2, _b;
|
|
31611
31690
|
if (image.bitmap) {
|
|
31612
|
-
(_b = (
|
|
31691
|
+
(_b = (_a2 = image.bitmap).close) == null ? void 0 : _b.call(_a2);
|
|
31613
31692
|
}
|
|
31614
31693
|
});
|
|
31615
31694
|
images.clear();
|
|
@@ -31630,11 +31709,11 @@ const createSpriteLayer = (options) => {
|
|
|
31630
31709
|
};
|
|
31631
31710
|
const getAllImageIds = () => Array.from(images.keys());
|
|
31632
31711
|
const addSpriteInternal = (projectionHost, spriteId, init) => {
|
|
31633
|
-
var
|
|
31712
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
31634
31713
|
if (sprites.get(spriteId)) {
|
|
31635
31714
|
return false;
|
|
31636
31715
|
}
|
|
31637
|
-
const initialInvalidated = ((
|
|
31716
|
+
const initialInvalidated = ((_a2 = init.invalidate) != null ? _a2 : false) || !isLayerVisible();
|
|
31638
31717
|
const imagesInit = (_b = init.images) != null ? _b : [];
|
|
31639
31718
|
const images2 = /* @__PURE__ */ new Map();
|
|
31640
31719
|
for (const imageInit of imagesInit) {
|
|
@@ -31658,8 +31737,8 @@ const createSpriteLayer = (options) => {
|
|
|
31658
31737
|
}
|
|
31659
31738
|
const keyToStr = (k) => `${k.subLayer}:${k.order}`;
|
|
31660
31739
|
const getRef = (k) => {
|
|
31661
|
-
var
|
|
31662
|
-
const ref = (_b2 = (
|
|
31740
|
+
var _a3, _b2;
|
|
31741
|
+
const ref = (_b2 = (_a3 = images2.get(k.subLayer)) == null ? void 0 : _a3.get(k.order)) == null ? void 0 : _b2.originLocation;
|
|
31663
31742
|
if (!ref) return void 0;
|
|
31664
31743
|
return { subLayer: ref.subLayer, order: ref.order };
|
|
31665
31744
|
};
|
|
@@ -31708,20 +31787,26 @@ const createSpriteLayer = (options) => {
|
|
|
31708
31787
|
// Sprites default to enabled unless explicitly disabled in the init payload.
|
|
31709
31788
|
isEnabled: (_e = init.isEnabled) != null ? _e : true,
|
|
31710
31789
|
visibilityDistanceMeters: spriteVisibilityDistanceMeters != null ? spriteVisibilityDistanceMeters : void 0,
|
|
31790
|
+
opacityMultiplier: sanitizeOpacityMultiplier(init.opacityMultiplier),
|
|
31711
31791
|
location: {
|
|
31712
31792
|
current: currentLocation,
|
|
31713
31793
|
from: void 0,
|
|
31714
31794
|
to: void 0,
|
|
31715
|
-
invalidated: initialInvalidated
|
|
31795
|
+
invalidated: initialInvalidated,
|
|
31796
|
+
interpolation: {
|
|
31797
|
+
state: null,
|
|
31798
|
+
options: initialInterpolationOptions,
|
|
31799
|
+
lastCommandValue: cloneSpriteLocation(currentLocation),
|
|
31800
|
+
baseValue: void 0,
|
|
31801
|
+
targetValue: void 0
|
|
31802
|
+
}
|
|
31716
31803
|
},
|
|
31717
31804
|
images: images2,
|
|
31718
31805
|
// Tags default to null to simplify downstream comparisons.
|
|
31719
31806
|
tag: (_f = init.tag) != null ? _f : null,
|
|
31720
|
-
interpolationState: null,
|
|
31721
|
-
pendingInterpolationOptions: initialInterpolationOptions,
|
|
31722
|
-
lastCommandLocation: cloneSpriteLocation(currentLocation),
|
|
31723
31807
|
lastAutoRotationLocation: cloneSpriteLocation(currentLocation),
|
|
31724
31808
|
lastAutoRotationAngleDeg: 0,
|
|
31809
|
+
autoRotationInvalidated: false,
|
|
31725
31810
|
interpolationDirty: false,
|
|
31726
31811
|
cachedMercator: initialMercator,
|
|
31727
31812
|
cachedMercatorLng: currentLocation.lng,
|
|
@@ -31873,8 +31958,8 @@ const createSpriteLayer = (options) => {
|
|
|
31873
31958
|
}
|
|
31874
31959
|
const keyToStr = (k) => `${k.subLayer}:${k.order}`;
|
|
31875
31960
|
const getRef = (k) => {
|
|
31876
|
-
var
|
|
31877
|
-
return (
|
|
31961
|
+
var _a2;
|
|
31962
|
+
return (_a2 = getImageState(sprite, k.subLayer, k.order)) == null ? void 0 : _a2.originLocation;
|
|
31878
31963
|
};
|
|
31879
31964
|
const visited = /* @__PURE__ */ new Set();
|
|
31880
31965
|
let curMaybe = state.originLocation;
|
|
@@ -31935,7 +32020,7 @@ const createSpriteLayer = (options) => {
|
|
|
31935
32020
|
}
|
|
31936
32021
|
};
|
|
31937
32022
|
const updateSpriteImageInternal = (projectionHost, sprite, subLayer, order, imageUpdate, resultOut) => {
|
|
31938
|
-
var
|
|
32023
|
+
var _a2;
|
|
31939
32024
|
const state = getImageState(sprite, subLayer, order);
|
|
31940
32025
|
if (!state) return false;
|
|
31941
32026
|
const mapCurrentlyVisible = isLayerVisible();
|
|
@@ -31950,18 +32035,17 @@ const createSpriteLayer = (options) => {
|
|
|
31950
32035
|
const interpolationOptions = imageUpdate.interpolation;
|
|
31951
32036
|
const opacityInterpolationOption = interpolationOptions == null ? void 0 : interpolationOptions.opacity;
|
|
31952
32037
|
if (opacityInterpolationOption !== void 0) {
|
|
31953
|
-
state.
|
|
32038
|
+
state.opacity.interpolation.options = opacityInterpolationOption === null ? null : cloneInterpolationOptions(opacityInterpolationOption);
|
|
31954
32039
|
}
|
|
31955
32040
|
const allowOpacityInterpolation = interpolationAllowed && !state.opacity.invalidated;
|
|
31956
|
-
const resolvedOpacityInterpolationOption = allowOpacityInterpolation ? opacityInterpolationOption === void 0 ? (
|
|
32041
|
+
const resolvedOpacityInterpolationOption = allowOpacityInterpolation ? opacityInterpolationOption === void 0 ? (_a2 = state.opacity.interpolation.options) != null ? _a2 : null : opacityInterpolationOption : null;
|
|
31957
32042
|
if (imageUpdate.opacity !== void 0) {
|
|
31958
32043
|
applyOpacityUpdate(
|
|
31959
32044
|
state,
|
|
31960
32045
|
imageUpdate.opacity,
|
|
31961
|
-
resolvedOpacityInterpolationOption
|
|
32046
|
+
resolvedOpacityInterpolationOption,
|
|
32047
|
+
sprite.opacityMultiplier
|
|
31962
32048
|
);
|
|
31963
|
-
state.opacityTargetValue = state.lastCommandOpacity;
|
|
31964
|
-
state.lodLastCommandOpacity = state.lastCommandOpacity;
|
|
31965
32049
|
if (mapCurrentlyVisible && state.opacity.invalidated) {
|
|
31966
32050
|
state.opacity.invalidated = false;
|
|
31967
32051
|
}
|
|
@@ -32020,11 +32104,11 @@ const createSpriteLayer = (options) => {
|
|
|
32020
32104
|
}
|
|
32021
32105
|
if (rotateInterpolationOption !== void 0) {
|
|
32022
32106
|
if (rotateInterpolationOption === null) {
|
|
32023
|
-
state.
|
|
32107
|
+
state.rotateDeg.interpolation.options = null;
|
|
32024
32108
|
rotationOverride = null;
|
|
32025
32109
|
} else {
|
|
32026
32110
|
const cloned = cloneInterpolationOptions(rotateInterpolationOption);
|
|
32027
|
-
state.
|
|
32111
|
+
state.rotateDeg.interpolation.options = cloned;
|
|
32028
32112
|
rotationOverride = cloned;
|
|
32029
32113
|
}
|
|
32030
32114
|
hasRotationOverride = true;
|
|
@@ -32061,7 +32145,7 @@ const createSpriteLayer = (options) => {
|
|
|
32061
32145
|
requireRotationSync = true;
|
|
32062
32146
|
}
|
|
32063
32147
|
if (shouldReapplyAutoRotation) {
|
|
32064
|
-
const applied = applyAutoRotation(sprite, sprite.location.current);
|
|
32148
|
+
const applied = applyAutoRotation(sprite, sprite.location.current, true);
|
|
32065
32149
|
if (!applied && state.autoRotation) {
|
|
32066
32150
|
state.resolvedBaseRotateDeg = sprite.lastAutoRotationAngleDeg;
|
|
32067
32151
|
requireRotationSync = true;
|
|
@@ -32138,7 +32222,7 @@ const createSpriteLayer = (options) => {
|
|
|
32138
32222
|
return true;
|
|
32139
32223
|
};
|
|
32140
32224
|
const updateSpriteInternal = (projectionHost, spriteId, update) => {
|
|
32141
|
-
var
|
|
32225
|
+
var _a2;
|
|
32142
32226
|
const sprite = sprites.get(spriteId);
|
|
32143
32227
|
if (!sprite) {
|
|
32144
32228
|
return "notfound";
|
|
@@ -32166,33 +32250,49 @@ const createSpriteLayer = (options) => {
|
|
|
32166
32250
|
if (previousVisibilityDistance !== void 0 && (resolved === void 0 || resolved === null)) {
|
|
32167
32251
|
sprite.images.forEach((orderMap) => {
|
|
32168
32252
|
orderMap.forEach((image) => {
|
|
32169
|
-
|
|
32253
|
+
var _a3;
|
|
32254
|
+
const baseOpacity = (_a3 = image.opacity.interpolation.baseValue) != null ? _a3 : image.opacity.current;
|
|
32255
|
+
if (!(Number.isFinite(baseOpacity) && baseOpacity > 0)) {
|
|
32170
32256
|
return;
|
|
32171
32257
|
}
|
|
32172
32258
|
if (image.opacity.current > 0) {
|
|
32173
32259
|
return;
|
|
32174
32260
|
}
|
|
32261
|
+
image.lodOpacity = 1;
|
|
32175
32262
|
applyOpacityUpdate(
|
|
32176
32263
|
image,
|
|
32177
|
-
|
|
32178
|
-
image.
|
|
32264
|
+
baseOpacity,
|
|
32265
|
+
image.opacity.interpolation.options,
|
|
32266
|
+
sprite.opacityMultiplier
|
|
32179
32267
|
);
|
|
32180
32268
|
});
|
|
32181
32269
|
});
|
|
32182
32270
|
}
|
|
32183
32271
|
}
|
|
32184
32272
|
}
|
|
32273
|
+
if (update.opacityMultiplier !== void 0) {
|
|
32274
|
+
const nextMultiplier = sanitizeOpacityMultiplier(
|
|
32275
|
+
update.opacityMultiplier
|
|
32276
|
+
);
|
|
32277
|
+
if (nextMultiplier !== sprite.opacityMultiplier) {
|
|
32278
|
+
sprite.opacityMultiplier = nextMultiplier;
|
|
32279
|
+
reapplySpriteOpacityMultiplier(sprite);
|
|
32280
|
+
updated = true;
|
|
32281
|
+
isRequiredRender = true;
|
|
32282
|
+
}
|
|
32283
|
+
}
|
|
32284
|
+
const locationState = sprite.location;
|
|
32285
|
+
const locationInterpolation = locationState.interpolation;
|
|
32185
32286
|
let interpolationOptionsForLocation = void 0;
|
|
32186
32287
|
let interpolationExplicitlySpecified = false;
|
|
32187
32288
|
const mapCurrentlyVisible = isLayerVisible();
|
|
32188
|
-
const interpolationAllowed = interpolationCalculationEnabled && mapCurrentlyVisible && !
|
|
32289
|
+
const interpolationAllowed = interpolationCalculationEnabled && mapCurrentlyVisible && !locationState.invalidated;
|
|
32189
32290
|
if (update.interpolation !== void 0) {
|
|
32190
32291
|
interpolationExplicitlySpecified = true;
|
|
32191
32292
|
if (update.interpolation === null) {
|
|
32192
|
-
|
|
32193
|
-
|
|
32194
|
-
|
|
32195
|
-
sprite.interpolationState = null;
|
|
32293
|
+
if (locationInterpolation.state !== null || locationState.from !== void 0 || locationState.to !== void 0) {
|
|
32294
|
+
locationInterpolation.state = null;
|
|
32295
|
+
locationInterpolation.options = null;
|
|
32196
32296
|
locationState.from = void 0;
|
|
32197
32297
|
locationState.to = void 0;
|
|
32198
32298
|
updated = true;
|
|
@@ -32200,8 +32300,8 @@ const createSpriteLayer = (options) => {
|
|
|
32200
32300
|
interpolationOptionsForLocation = null;
|
|
32201
32301
|
} else {
|
|
32202
32302
|
const nextOptions = cloneInterpolationOptions(update.interpolation);
|
|
32203
|
-
if (!
|
|
32204
|
-
|
|
32303
|
+
if (!locationInterpolation.options || locationInterpolation.options.durationMs !== nextOptions.durationMs || locationInterpolation.options.mode !== nextOptions.mode || locationInterpolation.options.easing !== nextOptions.easing) {
|
|
32304
|
+
locationInterpolation.options = nextOptions;
|
|
32205
32305
|
updated = true;
|
|
32206
32306
|
}
|
|
32207
32307
|
interpolationOptionsForLocation = nextOptions;
|
|
@@ -32210,15 +32310,15 @@ const createSpriteLayer = (options) => {
|
|
|
32210
32310
|
if (update.location !== void 0) {
|
|
32211
32311
|
const newCommandLocation = cloneSpriteLocation(update.location);
|
|
32212
32312
|
const locationChanged = !spriteLocationsEqual(
|
|
32213
|
-
|
|
32313
|
+
locationInterpolation.lastCommandValue,
|
|
32214
32314
|
newCommandLocation
|
|
32215
32315
|
);
|
|
32216
32316
|
const optionsForLocation = interpolationExplicitlySpecified ? (
|
|
32217
32317
|
// When new interpolation parameters accompanied the update, prefer them (or null to disable).
|
|
32218
32318
|
interpolationOptionsForLocation != null ? interpolationOptionsForLocation : null
|
|
32219
32319
|
) : (
|
|
32220
|
-
// Otherwise reuse any previously
|
|
32221
|
-
|
|
32320
|
+
// Otherwise reuse any previously interpolation request.
|
|
32321
|
+
locationInterpolation.options
|
|
32222
32322
|
);
|
|
32223
32323
|
const effectiveOptions = (
|
|
32224
32324
|
// Treat `undefined` as "no interpolation change" whereas explicit `null` disables interpolation.
|
|
@@ -32227,45 +32327,52 @@ const createSpriteLayer = (options) => {
|
|
|
32227
32327
|
let handledByInterpolation = false;
|
|
32228
32328
|
if (effectiveOptions && effectiveOptions.durationMs > 0) {
|
|
32229
32329
|
const { state, requiresInterpolation } = createInterpolationState({
|
|
32230
|
-
currentLocation:
|
|
32231
|
-
lastCommandLocation:
|
|
32330
|
+
currentLocation: locationState.current,
|
|
32331
|
+
lastCommandLocation: locationInterpolation.lastCommandValue,
|
|
32232
32332
|
nextCommandLocation: newCommandLocation,
|
|
32233
32333
|
options: effectiveOptions
|
|
32234
32334
|
});
|
|
32235
|
-
|
|
32335
|
+
locationInterpolation.state = null;
|
|
32236
32336
|
if (requiresInterpolation) {
|
|
32237
|
-
|
|
32238
|
-
|
|
32239
|
-
|
|
32240
|
-
|
|
32337
|
+
locationInterpolation.state = state;
|
|
32338
|
+
locationInterpolation.options = effectiveOptions;
|
|
32339
|
+
locationState.from = cloneSpriteLocation(state.from);
|
|
32340
|
+
locationState.to = cloneSpriteLocation(state.to);
|
|
32341
|
+
locationState.current = cloneSpriteLocation(state.from);
|
|
32241
32342
|
handledByInterpolation = true;
|
|
32242
32343
|
updated = true;
|
|
32243
32344
|
isRequiredRender = true;
|
|
32244
32345
|
}
|
|
32245
32346
|
}
|
|
32246
|
-
|
|
32347
|
+
locationInterpolation.lastCommandValue = cloneSpriteLocation(newCommandLocation);
|
|
32247
32348
|
if (handledByInterpolation) ;
|
|
32248
32349
|
else if (locationChanged) {
|
|
32249
|
-
|
|
32250
|
-
|
|
32251
|
-
|
|
32252
|
-
|
|
32350
|
+
locationState.current = cloneSpriteLocation(newCommandLocation);
|
|
32351
|
+
locationState.from = void 0;
|
|
32352
|
+
locationState.to = void 0;
|
|
32353
|
+
locationInterpolation.state = null;
|
|
32253
32354
|
updated = true;
|
|
32254
32355
|
isRequiredRender = true;
|
|
32255
32356
|
} else {
|
|
32256
|
-
|
|
32257
|
-
|
|
32258
|
-
|
|
32357
|
+
locationInterpolation.state = null;
|
|
32358
|
+
locationState.from = void 0;
|
|
32359
|
+
locationState.to = void 0;
|
|
32360
|
+
}
|
|
32361
|
+
if (mapCurrentlyVisible && locationState.invalidated) {
|
|
32362
|
+
locationState.invalidated = false;
|
|
32259
32363
|
}
|
|
32260
|
-
if (mapCurrentlyVisible
|
|
32261
|
-
sprite.
|
|
32364
|
+
if (!mapCurrentlyVisible) {
|
|
32365
|
+
sprite.autoRotationInvalidated = true;
|
|
32366
|
+
sprite.lastAutoRotationLocation = cloneSpriteLocation(newCommandLocation);
|
|
32367
|
+
} else {
|
|
32368
|
+
const forceAutoRotation = sprite.autoRotationInvalidated;
|
|
32369
|
+
sprite.autoRotationInvalidated = false;
|
|
32370
|
+
applyAutoRotation(sprite, newCommandLocation, forceAutoRotation);
|
|
32262
32371
|
}
|
|
32263
|
-
sprite.pendingInterpolationOptions = null;
|
|
32264
|
-
applyAutoRotation(sprite, newCommandLocation);
|
|
32265
32372
|
needsHitTestRefresh = true;
|
|
32266
32373
|
}
|
|
32267
32374
|
if (update.tag !== void 0) {
|
|
32268
|
-
const nextTag = (
|
|
32375
|
+
const nextTag = (_a2 = update.tag) != null ? _a2 : null;
|
|
32269
32376
|
if (sprite.tag !== nextTag) {
|
|
32270
32377
|
sprite.tag = nextTag;
|
|
32271
32378
|
updated = true;
|