maplibre-gl 6.0.0-18 → 6.0.0-19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/maplibre-gl-dev.mjs +298 -8
- package/dist/maplibre-gl-dev.mjs.map +1 -1
- package/dist/maplibre-gl-shared-dev.mjs +681 -537
- package/dist/maplibre-gl-shared-dev.mjs.map +1 -1
- package/dist/maplibre-gl-shared.mjs +2 -2
- package/dist/maplibre-gl-shared.mjs.map +1 -1
- package/dist/maplibre-gl-worker-dev.mjs +2 -2
- package/dist/maplibre-gl-worker.mjs +2 -2
- package/dist/maplibre-gl-worker.mjs.map +1 -1
- package/dist/maplibre-gl.d.ts +1 -0
- package/dist/maplibre-gl.mjs +13 -13
- package/dist/maplibre-gl.mjs.map +1 -1
- package/package.json +14 -15
- package/src/render/painter.test.ts +18 -0
- package/src/render/painter.ts +1 -1
- package/src/render/subdivision.test.ts +48 -47
- package/src/style/style.test.ts +115 -0
- package/src/style/style.ts +10 -3
- package/src/tile/terrain_tile_manager.ts +1 -1
- package/src/tile/tile_id.ts +29 -1
- package/src/ui/map_tests/map_images.test.ts +57 -1
package/dist/maplibre-gl-dev.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MapLibre GL JS
|
|
3
|
-
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.0.0-
|
|
3
|
+
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.0.0-19/LICENSE.txt
|
|
4
4
|
*/
|
|
5
|
-
import { $n as
|
|
5
|
+
import { $n as findLineIntersection, $r as rotateX$1, $t as validateStyle, A as earthRadius, Ai as isOffscreenCanvasDistorted, Ar as warnOnce, At as SegmentVector, B as evaluateSizeForFeature, Bn as createMat4f64, Br as zero, Bt as isRasterStyleLayer, C as altitudeFromMercatorZ, Ci as scale, Cn as addProtocol, Cr as rollPitchBearingToQuat, Ct as Uniform2f, D as mercatorYfromLat, Di as create$2, Dn as AbortError, Dr as threePlaneIntersection, Dt as UniformColorArray, E as mercatorXfromLng, Ei as fromRotation, En as config, Er as subscribe, Et as UniformColor, F as isBackgroundStyleLayer, Fn as bezier, Fr as create$3, Ft as PosArray, G as ImagePosition, Gn as degreesToRadians, Gr as transformMat4, Gt as EvaluationParameters, Hn as createVec4f64, Hr as slerp, Ht as Properties, I as isSymbolStyleLayer, In as clamp, Ir as length, It as QuadTriangleArray, J as parseGlyphPbf, Jn as easeCubicInOut, Jr as cross, Jt as ZoomHistory, K as potpack, Kn as differenceOfAnglesDegrees, Kr as add, L as SymbolBucket, Ln as clone$2, Lr as scale$1, Lt as RasterBoundsArray, M as createStyleLayer, Mi as Point, Mn as angleToRotateBetweenVectors2D, Mr as zoomScale, Mt as CollisionCircleLayoutArray, N as isCustomStyleLayer, Nn as arrayBufferToImage, Nr as pixelsToTileUnits, Nt as LineStripIndexArray, O as mercatorZfromAltitude, Oi as invert, On as isAbortError, Or as translatePosition, Ot as UniformFloatArray, P as validateCustomStyleLayer, Pn as arrayBufferToImageBitmap, Pr as EXTENT, Pt as Pos3dArray, Qn as filterObject, Qr as normalize, Qt as validateSky, R as addDynamicAttributes, Rn as createIdentityMat4f32, Rr as sqrLen, Rt as TriangleIndexArray, S as MercatorCoordinate, Si as rotateZ, Sn as sameOrigin, Sr as rollPitchBearingEqual, St as Uniform1i, T as lngFromMercatorX, Ti as create$4, Tn as removeProtocol, Tr as sphericalToCartesian, Tt as Uniform4f, U as getAnchorAlignment, Un as deepEqual, Ur as mul, Ut as TRANSITION_SUFFIX, V as evaluateSizeForZoom, Vn as createVec3f64, Vr as fromEuler, Vt as DataConstantProperty, Wn as defaultEasing, Wr as scale$3, Wt as Transitionable, X as collisionCircleLayout, Xn as evaluateZoomSnap, Xr as len, Xt as emitValidationErrors$1, Yn as ensureError, Yr as dot, Z as isLineStyleLayer, Zn as extend, Zr as length$1, Zt as validateLight, _ as OverscaledTileID, _i as multiply, _n as getArrayBuffer, _r as pointPlaneSignedDistance, _t as RGBAImage, a as clipLine, ai as transformMat3, an as diff, ar as isImageBitmap, at as NORTH_POLE_Y, b as compareTileId, bi as rotateX, bn as getVideo, br as readImageUsingVideoFrame, bt as toEvaluationFeature, ci as zero$1, cr as isTouchableEvent, ct as SubdivisionGranularitySetting, di as create$1, dn as v8, dr as lerp, dt as Texture, ei as rotateY, en as Color, er as getAABB, et as isFillExtrusionStyleLayer, f as GEOJSON_TILE_LAYER_NAME, fi as equals, fn as ErrorEvent, fr as mapObject, ft as isHillshadeStyleLayer, g as CanonicalTileID, gi as invert$1, gn as GLOBAL_DISPATCHER_ID, gr as pick, gt as AlphaImage, h as Bounds, hi as identity, hn as AJAXError, hr as parseCacheControl, ht as renderColorRamp, ii as sub, in as derefLayers, ir as getRollPitchBearing, j as Actor, ji as offscreenCanvasSupported, jn as MAX_VALID_LATITUDE, jr as wrap, jt as CollisionBoxArray, k as LngLat, ki as rotate, kn as throwIfAborted, kr as uniqueId, kt as UniformMatrix4f, li as clone$1, ln as interpolateFactory, lr as isTouchableOrPointableType, lt as isColorReliefStyleLayer, mi as fromScaling, mn as Evented, mr as nextPowerOfTwo, mt as isHeatmapStyleLayer, ni as scale$2, nn as ValidationError, nr as getEdgeTiles, oi as transformMat4$1, on as emptyStyle, or as isPointableEvent, ot as SOUTH_POLE_Y, pi as exactEquals, pn as Event, pr as mod, pt as HEATMAP_FULL_RENDER_FBO_KEY, q as renderStyleImage, qn as distanceOfAnglesRadians, qr as clone, qt as codePointUsesLocalIdeographFontFamily, r as TextAnchorEnum, ri as scaleAndAdd, rt as isFillStyleLayer, s as TileCache, si as transformQuat, sn as featureFilter, sr as isSafari, st as SubdivisionGranularityExpression, t as getAnchorJustification, ti as rotateZ$1, tn as ProjectionDefinition, tr as getAngleDelta, u as GeoJSONFeature, ui as copy, un as latest_default, ur as isWorker, v as UnwrappedTileID, vi as ortho, vn as getJSON, vr as radiansToDegrees, vt as isCircleStyleLayer, w as latFromMercatorY, wi as translate, wn as getProtocol, wr as scaleZoom, wt as Uniform3f, x as isInBoundsForZoomLngLat, xi as rotateY$1, xn as makeRequest, xr as remapSaturate, xt as Uniform1f, y as calculateTileKey, yi as perspective, yn as getReferrer, yr as rayPlaneIntersection, yt as polygonIntersectsPolygon, z as getOverlapMode, zn as createIdentityMat4f64, zr as transformMat4$2, zt as createLayout } from "./maplibre-gl-shared-dev.mjs";
|
|
6
6
|
//#region package.json
|
|
7
|
-
var version$2 = "6.0.0-
|
|
7
|
+
var version$2 = "6.0.0-19";
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/util/browser.ts
|
|
10
10
|
let linkEl;
|
|
@@ -7742,6 +7742,291 @@ var PauseablePlacement = class {
|
|
|
7742
7742
|
}
|
|
7743
7743
|
};
|
|
7744
7744
|
//#endregion
|
|
7745
|
+
//#region node_modules/kdbush/index.js
|
|
7746
|
+
const ARRAY_TYPES = [
|
|
7747
|
+
Int8Array,
|
|
7748
|
+
Uint8Array,
|
|
7749
|
+
Uint8ClampedArray,
|
|
7750
|
+
Int16Array,
|
|
7751
|
+
Uint16Array,
|
|
7752
|
+
Int32Array,
|
|
7753
|
+
Uint32Array,
|
|
7754
|
+
Float32Array,
|
|
7755
|
+
Float64Array
|
|
7756
|
+
];
|
|
7757
|
+
/** @typedef {Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor} TypedArrayConstructor */
|
|
7758
|
+
/** @typedef {Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array} TypedArray */
|
|
7759
|
+
const VERSION = 1;
|
|
7760
|
+
const HEADER_SIZE = 8;
|
|
7761
|
+
const STACK = /* @__PURE__ */ new Uint32Array(96);
|
|
7762
|
+
var KDBush = class KDBush {
|
|
7763
|
+
/**
|
|
7764
|
+
* Creates an index from raw `ArrayBuffer` data.
|
|
7765
|
+
* @param {ArrayBufferLike} data
|
|
7766
|
+
*/
|
|
7767
|
+
static from(data) {
|
|
7768
|
+
if (!data || data.byteLength === void 0 || data.buffer) throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");
|
|
7769
|
+
const [magic, versionAndType] = new Uint8Array(data, 0, 2);
|
|
7770
|
+
if (magic !== 219) throw new Error("Data does not appear to be in a KDBush format.");
|
|
7771
|
+
const version = versionAndType >> 4;
|
|
7772
|
+
if (version !== VERSION) throw new Error(`Got v${version} data when expected v${VERSION}.`);
|
|
7773
|
+
const ArrayType = ARRAY_TYPES[versionAndType & 15];
|
|
7774
|
+
if (!ArrayType) throw new Error("Unrecognized array type.");
|
|
7775
|
+
const [nodeSize] = new Uint16Array(data, 2, 1);
|
|
7776
|
+
const [numItems] = new Uint32Array(data, 4, 1);
|
|
7777
|
+
return new KDBush(numItems, nodeSize, ArrayType, void 0, data);
|
|
7778
|
+
}
|
|
7779
|
+
/**
|
|
7780
|
+
* Creates an index that will hold a given number of items.
|
|
7781
|
+
* @param {number} numItems
|
|
7782
|
+
* @param {number} [nodeSize=64] Size of the KD-tree node (64 by default).
|
|
7783
|
+
* @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
|
|
7784
|
+
* @param {ArrayBufferConstructor | SharedArrayBufferConstructor} [ArrayBufferType=ArrayBuffer] The array buffer type used for storage (`ArrayBuffer` by default).
|
|
7785
|
+
* @param {ArrayBufferLike} [data] (For internal use only)
|
|
7786
|
+
*/
|
|
7787
|
+
constructor(numItems, nodeSize = 64, ArrayType = Float64Array, ArrayBufferType = ArrayBuffer, data) {
|
|
7788
|
+
if (isNaN(numItems) || numItems < 0) throw new Error(`Unexpected numItems value: ${numItems}.`);
|
|
7789
|
+
this.numItems = +numItems;
|
|
7790
|
+
this.nodeSize = Math.min(Math.max(+nodeSize, 2), 65535);
|
|
7791
|
+
this.ArrayType = ArrayType;
|
|
7792
|
+
this.IndexArrayType = numItems < 65536 ? Uint16Array : Uint32Array;
|
|
7793
|
+
const arrayTypeIndex = ARRAY_TYPES.indexOf(this.ArrayType);
|
|
7794
|
+
const coordsByteSize = numItems * 2 * this.ArrayType.BYTES_PER_ELEMENT;
|
|
7795
|
+
const idsByteSize = numItems * this.IndexArrayType.BYTES_PER_ELEMENT;
|
|
7796
|
+
const padCoords = (8 - idsByteSize % 8) % 8;
|
|
7797
|
+
if (arrayTypeIndex < 0) throw new Error(`Unexpected typed array class: ${ArrayType}.`);
|
|
7798
|
+
if (data) {
|
|
7799
|
+
this.data = data;
|
|
7800
|
+
this.ids = new this.IndexArrayType(data, HEADER_SIZE, numItems);
|
|
7801
|
+
this.coords = new ArrayType(data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2);
|
|
7802
|
+
this._pos = numItems * 2;
|
|
7803
|
+
this._finished = true;
|
|
7804
|
+
} else {
|
|
7805
|
+
const data = this.data = new ArrayBufferType(HEADER_SIZE + coordsByteSize + idsByteSize + padCoords);
|
|
7806
|
+
this.ids = new this.IndexArrayType(data, HEADER_SIZE, numItems);
|
|
7807
|
+
this.coords = new ArrayType(data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2);
|
|
7808
|
+
this._pos = 0;
|
|
7809
|
+
this._finished = false;
|
|
7810
|
+
new Uint8Array(data, 0, 2).set([219, (VERSION << 4) + arrayTypeIndex]);
|
|
7811
|
+
new Uint16Array(data, 2, 1)[0] = nodeSize;
|
|
7812
|
+
new Uint32Array(data, 4, 1)[0] = numItems;
|
|
7813
|
+
}
|
|
7814
|
+
}
|
|
7815
|
+
/**
|
|
7816
|
+
* Add a point to the index.
|
|
7817
|
+
* @param {number} x
|
|
7818
|
+
* @param {number} y
|
|
7819
|
+
* @returns {number} An incremental index associated with the added item (starting from `0`).
|
|
7820
|
+
*/
|
|
7821
|
+
add(x, y) {
|
|
7822
|
+
const index = this._pos >> 1;
|
|
7823
|
+
this.ids[index] = index;
|
|
7824
|
+
this.coords[this._pos++] = x;
|
|
7825
|
+
this.coords[this._pos++] = y;
|
|
7826
|
+
return index;
|
|
7827
|
+
}
|
|
7828
|
+
/**
|
|
7829
|
+
* Perform indexing of the added points.
|
|
7830
|
+
*/
|
|
7831
|
+
finish() {
|
|
7832
|
+
const numAdded = this._pos >> 1;
|
|
7833
|
+
if (numAdded !== this.numItems) throw new Error(`Added ${numAdded} items when expected ${this.numItems}.`);
|
|
7834
|
+
sort(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0);
|
|
7835
|
+
this._finished = true;
|
|
7836
|
+
return this;
|
|
7837
|
+
}
|
|
7838
|
+
/**
|
|
7839
|
+
* Search the index for items within a given bounding box.
|
|
7840
|
+
* @param {number} minX
|
|
7841
|
+
* @param {number} minY
|
|
7842
|
+
* @param {number} maxX
|
|
7843
|
+
* @param {number} maxY
|
|
7844
|
+
* @returns {number[]} An array of indices correponding to the found items.
|
|
7845
|
+
*/
|
|
7846
|
+
range(minX, minY, maxX, maxY) {
|
|
7847
|
+
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
7848
|
+
const { ids, coords, nodeSize } = this;
|
|
7849
|
+
STACK[0] = 0;
|
|
7850
|
+
STACK[1] = ids.length - 1;
|
|
7851
|
+
STACK[2] = 0;
|
|
7852
|
+
let sp = 3;
|
|
7853
|
+
const result = [];
|
|
7854
|
+
while (sp > 0) {
|
|
7855
|
+
const axis = STACK[--sp];
|
|
7856
|
+
const right = STACK[--sp];
|
|
7857
|
+
const left = STACK[--sp];
|
|
7858
|
+
if (right - left <= nodeSize) {
|
|
7859
|
+
for (let i = left; i <= right; i++) {
|
|
7860
|
+
const x = coords[2 * i];
|
|
7861
|
+
const y = coords[2 * i + 1];
|
|
7862
|
+
if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[i]);
|
|
7863
|
+
}
|
|
7864
|
+
continue;
|
|
7865
|
+
}
|
|
7866
|
+
const m = left + right >> 1;
|
|
7867
|
+
const x = coords[2 * m];
|
|
7868
|
+
const y = coords[2 * m + 1];
|
|
7869
|
+
if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[m]);
|
|
7870
|
+
if (axis === 0 ? minX <= x : minY <= y) {
|
|
7871
|
+
STACK[sp++] = left;
|
|
7872
|
+
STACK[sp++] = m - 1;
|
|
7873
|
+
STACK[sp++] = 1 - axis;
|
|
7874
|
+
}
|
|
7875
|
+
if (axis === 0 ? maxX >= x : maxY >= y) {
|
|
7876
|
+
STACK[sp++] = m + 1;
|
|
7877
|
+
STACK[sp++] = right;
|
|
7878
|
+
STACK[sp++] = 1 - axis;
|
|
7879
|
+
}
|
|
7880
|
+
}
|
|
7881
|
+
return result;
|
|
7882
|
+
}
|
|
7883
|
+
/**
|
|
7884
|
+
* Search the index for items within a given radius.
|
|
7885
|
+
* @param {number} qx
|
|
7886
|
+
* @param {number} qy
|
|
7887
|
+
* @param {number} r Query radius.
|
|
7888
|
+
* @returns {number[]} An array of indices correponding to the found items.
|
|
7889
|
+
*/
|
|
7890
|
+
within(qx, qy, r) {
|
|
7891
|
+
const result = [];
|
|
7892
|
+
this.withinInto(qx, qy, r, result);
|
|
7893
|
+
return result;
|
|
7894
|
+
}
|
|
7895
|
+
/**
|
|
7896
|
+
* Search the index for items within a given radius, writing matching ids into `out`
|
|
7897
|
+
* via indexed assignment (`out[i] = id`). Accepts any indexed-writable container —
|
|
7898
|
+
* a typed array sized to the expected upper bound (allocation-free, fast) or a plain
|
|
7899
|
+
* `Array` (which will grow as needed). Returns the number of matches written.
|
|
7900
|
+
* @param {number} qx
|
|
7901
|
+
* @param {number} qy
|
|
7902
|
+
* @param {number} r Query radius.
|
|
7903
|
+
* @param {number[] | TypedArray} out Container to write matching ids into.
|
|
7904
|
+
* @returns {number} The number of matches written to `out`.
|
|
7905
|
+
*/
|
|
7906
|
+
withinInto(qx, qy, r, out) {
|
|
7907
|
+
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
7908
|
+
const { ids, coords, nodeSize } = this;
|
|
7909
|
+
STACK[0] = 0;
|
|
7910
|
+
STACK[1] = ids.length - 1;
|
|
7911
|
+
STACK[2] = 0;
|
|
7912
|
+
let sp = 3;
|
|
7913
|
+
let count = 0;
|
|
7914
|
+
const r2 = r * r;
|
|
7915
|
+
while (sp > 0) {
|
|
7916
|
+
const axis = STACK[--sp];
|
|
7917
|
+
const right = STACK[--sp];
|
|
7918
|
+
const left = STACK[--sp];
|
|
7919
|
+
if (right - left <= nodeSize) {
|
|
7920
|
+
for (let i = left; i <= right; i++) if (sqDist(coords[2 * i], coords[2 * i + 1], qx, qy) <= r2) out[count++] = ids[i];
|
|
7921
|
+
continue;
|
|
7922
|
+
}
|
|
7923
|
+
const m = left + right >> 1;
|
|
7924
|
+
const x = coords[2 * m];
|
|
7925
|
+
const y = coords[2 * m + 1];
|
|
7926
|
+
if (sqDist(x, y, qx, qy) <= r2) out[count++] = ids[m];
|
|
7927
|
+
if (axis === 0 ? qx - r <= x : qy - r <= y) {
|
|
7928
|
+
STACK[sp++] = left;
|
|
7929
|
+
STACK[sp++] = m - 1;
|
|
7930
|
+
STACK[sp++] = 1 - axis;
|
|
7931
|
+
}
|
|
7932
|
+
if (axis === 0 ? qx + r >= x : qy + r >= y) {
|
|
7933
|
+
STACK[sp++] = m + 1;
|
|
7934
|
+
STACK[sp++] = right;
|
|
7935
|
+
STACK[sp++] = 1 - axis;
|
|
7936
|
+
}
|
|
7937
|
+
}
|
|
7938
|
+
return count;
|
|
7939
|
+
}
|
|
7940
|
+
};
|
|
7941
|
+
/**
|
|
7942
|
+
* @param {Uint16Array | Uint32Array} ids
|
|
7943
|
+
* @param {TypedArray} coords
|
|
7944
|
+
* @param {number} nodeSize
|
|
7945
|
+
* @param {number} left
|
|
7946
|
+
* @param {number} right
|
|
7947
|
+
* @param {number} axis
|
|
7948
|
+
*/
|
|
7949
|
+
function sort(ids, coords, nodeSize, left, right, axis) {
|
|
7950
|
+
if (right - left <= nodeSize) return;
|
|
7951
|
+
const m = left + right >> 1;
|
|
7952
|
+
select(ids, coords, m, left, right, axis);
|
|
7953
|
+
sort(ids, coords, nodeSize, left, m - 1, 1 - axis);
|
|
7954
|
+
sort(ids, coords, nodeSize, m + 1, right, 1 - axis);
|
|
7955
|
+
}
|
|
7956
|
+
/**
|
|
7957
|
+
* Custom Floyd-Rivest selection algorithm: sort ids and coords so that
|
|
7958
|
+
* [left..k-1] items are smaller than k-th item (on either x or y axis)
|
|
7959
|
+
* @param {Uint16Array | Uint32Array} ids
|
|
7960
|
+
* @param {TypedArray} coords
|
|
7961
|
+
* @param {number} k
|
|
7962
|
+
* @param {number} left
|
|
7963
|
+
* @param {number} right
|
|
7964
|
+
* @param {number} axis
|
|
7965
|
+
*/
|
|
7966
|
+
function select(ids, coords, k, left, right, axis) {
|
|
7967
|
+
while (right > left) {
|
|
7968
|
+
if (right - left > 600) {
|
|
7969
|
+
const n = right - left + 1;
|
|
7970
|
+
const m = k - left + 1;
|
|
7971
|
+
const z = Math.log(n);
|
|
7972
|
+
const s = .5 * Math.exp(2 * z / 3);
|
|
7973
|
+
const sd = .5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
|
|
7974
|
+
select(ids, coords, k, Math.max(left, Math.floor(k - m * s / n + sd)), Math.min(right, Math.floor(k + (n - m) * s / n + sd)), axis);
|
|
7975
|
+
}
|
|
7976
|
+
const t = coords[2 * k + axis];
|
|
7977
|
+
let i = left;
|
|
7978
|
+
let j = right;
|
|
7979
|
+
swapItem(ids, coords, left, k);
|
|
7980
|
+
if (coords[2 * right + axis] > t) swapItem(ids, coords, left, right);
|
|
7981
|
+
while (i < j) {
|
|
7982
|
+
swapItem(ids, coords, i, j);
|
|
7983
|
+
i++;
|
|
7984
|
+
j--;
|
|
7985
|
+
while (coords[2 * i + axis] < t) i++;
|
|
7986
|
+
while (coords[2 * j + axis] > t) j--;
|
|
7987
|
+
}
|
|
7988
|
+
if (coords[2 * left + axis] === t) swapItem(ids, coords, left, j);
|
|
7989
|
+
else {
|
|
7990
|
+
j++;
|
|
7991
|
+
swapItem(ids, coords, j, right);
|
|
7992
|
+
}
|
|
7993
|
+
if (j <= k) left = j + 1;
|
|
7994
|
+
if (k <= j) right = j - 1;
|
|
7995
|
+
}
|
|
7996
|
+
}
|
|
7997
|
+
/**
|
|
7998
|
+
* @param {Uint16Array | Uint32Array} ids
|
|
7999
|
+
* @param {TypedArray} coords
|
|
8000
|
+
* @param {number} i
|
|
8001
|
+
* @param {number} j
|
|
8002
|
+
*/
|
|
8003
|
+
function swapItem(ids, coords, i, j) {
|
|
8004
|
+
swap(ids, i, j);
|
|
8005
|
+
swap(coords, 2 * i, 2 * j);
|
|
8006
|
+
swap(coords, 2 * i + 1, 2 * j + 1);
|
|
8007
|
+
}
|
|
8008
|
+
/**
|
|
8009
|
+
* @param {TypedArray} arr
|
|
8010
|
+
* @param {number} i
|
|
8011
|
+
* @param {number} j
|
|
8012
|
+
*/
|
|
8013
|
+
function swap(arr, i, j) {
|
|
8014
|
+
const tmp = arr[i];
|
|
8015
|
+
arr[i] = arr[j];
|
|
8016
|
+
arr[j] = tmp;
|
|
8017
|
+
}
|
|
8018
|
+
/**
|
|
8019
|
+
* @param {number} ax
|
|
8020
|
+
* @param {number} ay
|
|
8021
|
+
* @param {number} bx
|
|
8022
|
+
* @param {number} by
|
|
8023
|
+
*/
|
|
8024
|
+
function sqDist(ax, ay, bx, by) {
|
|
8025
|
+
const dx = ax - bx;
|
|
8026
|
+
const dy = ay - by;
|
|
8027
|
+
return dx * dx + dy * dy;
|
|
8028
|
+
}
|
|
8029
|
+
//#endregion
|
|
7745
8030
|
//#region src/symbol/cross_tile_symbol_index.ts
|
|
7746
8031
|
const roundingFactor = 512 / EXTENT / 2;
|
|
7747
8032
|
var TileLayerIndex = class {
|
|
@@ -12710,6 +12995,7 @@ var Style = class extends Evented {
|
|
|
12710
12995
|
this.tileManagers = {};
|
|
12711
12996
|
this.zoomHistory = new ZoomHistory();
|
|
12712
12997
|
this._availableImages = [];
|
|
12998
|
+
this._imagesListDirty = false;
|
|
12713
12999
|
this._globalState = {};
|
|
12714
13000
|
this._serializedLayers = {};
|
|
12715
13001
|
this.stylesheet = null;
|
|
@@ -12888,8 +13174,8 @@ var Style = class extends Evented {
|
|
|
12888
13174
|
}
|
|
12889
13175
|
this._spritesImagesIds = {};
|
|
12890
13176
|
this._availableImages = this.imageManager.listImages();
|
|
13177
|
+
this._imagesListDirty = true;
|
|
12891
13178
|
this._changed = true;
|
|
12892
|
-
this.dispatcher.broadcast("SI", this._availableImages);
|
|
12893
13179
|
this.fire(new MapStyleDataEvent("data"));
|
|
12894
13180
|
}
|
|
12895
13181
|
_validateLayer(layer) {
|
|
@@ -12958,6 +13244,10 @@ var Style = class extends Evented {
|
|
|
12958
13244
|
if (!this._loaded) return;
|
|
12959
13245
|
const changed = this._changed;
|
|
12960
13246
|
if (changed) {
|
|
13247
|
+
if (this._imagesListDirty) {
|
|
13248
|
+
this.dispatcher.broadcast("SI", this._availableImages);
|
|
13249
|
+
this._imagesListDirty = false;
|
|
13250
|
+
}
|
|
12961
13251
|
const updatedIds = Object.keys(this._updatedLayers);
|
|
12962
13252
|
const removedIds = Object.keys(this._removedLayers);
|
|
12963
13253
|
if (updatedIds.length || removedIds.length) this._updateWorkerLayers(updatedIds, removedIds);
|
|
@@ -13146,8 +13436,8 @@ var Style = class extends Evented {
|
|
|
13146
13436
|
_afterImageUpdated(id) {
|
|
13147
13437
|
this._availableImages = this.imageManager.listImages();
|
|
13148
13438
|
this._changedImages[id] = true;
|
|
13439
|
+
this._imagesListDirty = true;
|
|
13149
13440
|
this._changed = true;
|
|
13150
|
-
this.dispatcher.broadcast("SI", this._availableImages);
|
|
13151
13441
|
this.fire(new MapStyleDataEvent("data"));
|
|
13152
13442
|
}
|
|
13153
13443
|
listImages() {
|
|
@@ -13829,8 +14119,8 @@ var Style = class extends Evented {
|
|
|
13829
14119
|
this.stylesheet.sprite = internalSpriteRepresentation.length > 0 ? internalSpriteRepresentation : void 0;
|
|
13830
14120
|
delete this._spritesImagesIds[id];
|
|
13831
14121
|
this._availableImages = this.imageManager.listImages();
|
|
14122
|
+
this._imagesListDirty = true;
|
|
13832
14123
|
this._changed = true;
|
|
13833
|
-
this.dispatcher.broadcast("SI", this._availableImages);
|
|
13834
14124
|
this.fire(new MapStyleDataEvent("data"));
|
|
13835
14125
|
}
|
|
13836
14126
|
/**
|
|
@@ -17743,7 +18033,7 @@ var Painter = class Painter {
|
|
|
17743
18033
|
doUpdate ||= this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime);
|
|
17744
18034
|
if (!doUpdate) return;
|
|
17745
18035
|
copy(prevMatrix, currMatrix);
|
|
17746
|
-
this.terrainFacilitator.renderTime =
|
|
18036
|
+
this.terrainFacilitator.renderTime = now();
|
|
17747
18037
|
this.terrainFacilitator.depthDirty = false;
|
|
17748
18038
|
this.terrainFacilitator.coordsDirty = true;
|
|
17749
18039
|
this.drawFunctions.terrainDepth(this, this.style.map.terrain);
|
|
@@ -22062,7 +22352,7 @@ var TerrainTileManager = class extends Evented {
|
|
|
22062
22352
|
* @param time - the time
|
|
22063
22353
|
* @returns true if any tiles came into view at or after the specified time
|
|
22064
22354
|
*/
|
|
22065
|
-
anyTilesAfterTime(time =
|
|
22355
|
+
anyTilesAfterTime(time = now()) {
|
|
22066
22356
|
return this._lastTilesetChange >= time;
|
|
22067
22357
|
}
|
|
22068
22358
|
/**
|