maplibre-gl 6.0.0-21 → 6.0.0-22
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/build/generate-struct-arrays.ts +3 -3
- package/build/generate-style-code.ts +232 -134
- package/dist/maplibre-gl-dev.mjs +59 -89
- package/dist/maplibre-gl-dev.mjs.map +1 -1
- package/dist/maplibre-gl-shared-dev.mjs +549 -351
- 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 +12 -12
- package/dist/maplibre-gl-worker-dev.mjs.map +1 -1
- package/dist/maplibre-gl-worker.mjs +2 -2
- package/dist/maplibre-gl-worker.mjs.map +1 -1
- package/dist/maplibre-gl.d.ts +1035 -1030
- package/dist/maplibre-gl.mjs +13 -13
- package/dist/maplibre-gl.mjs.map +1 -1
- package/package.json +20 -20
- package/src/data/feature_index.ts +2 -2
- package/src/geo/projection/globe_projection.test.ts +23 -0
- package/src/geo/projection/globe_projection.ts +5 -16
- package/src/source/geojson_source.ts +1 -1
- package/src/source/geojson_worker_source.test.ts +1 -0
- package/src/source/geojson_worker_source.ts +11 -9
- package/src/style/format_section_override.test.ts +1 -0
- package/src/style/light.test.ts +24 -3
- package/src/style/light.ts +17 -80
- package/src/style/light_properties.g.ts +41 -0
- package/src/style/projection_properties.g.ts +32 -0
- package/src/style/properties.test.ts +63 -7
- package/src/style/properties.ts +42 -16
- package/src/style/sky.test.ts +20 -1
- package/src/style/sky.ts +9 -48
- package/src/style/sky_properties.g.ts +50 -0
- package/src/style/style.test.ts +39 -0
- package/src/style/style.ts +11 -25
- package/src/style/style_layer/background_style_layer_properties.g.ts +5 -5
- package/src/style/style_layer/circle_style_layer_properties.g.ts +16 -15
- package/src/style/style_layer/color_relief_style_layer_properties.g.ts +5 -5
- package/src/style/style_layer/custom_style_layer.ts +8 -13
- package/src/style/style_layer/fill_extrusion_style_layer_properties.g.ts +10 -10
- package/src/style/style_layer/fill_style_layer_properties.g.ts +13 -12
- package/src/style/style_layer/heatmap_style_layer_properties.g.ts +7 -7
- package/src/style/style_layer/hillshade_style_layer_properties.g.ts +11 -11
- package/src/style/style_layer/line_style_layer.ts +1 -1
- package/src/style/style_layer/line_style_layer_properties.g.ts +21 -20
- package/src/style/style_layer/raster_style_layer_properties.g.ts +11 -11
- package/src/style/style_layer/symbol_style_layer.ts +1 -1
- package/src/style/style_layer/symbol_style_layer_properties.g.ts +62 -61
- package/src/style/style_layer.ts +13 -24
- package/src/style/style_layer_index.ts +1 -1
- package/src/style/validate_style.test.ts +109 -0
- package/src/style/validate_style.ts +93 -26
- package/src/tile/terrain_tile_manager.test.ts +1 -1
- package/src/tile/tile.ts +1 -1
- package/src/ui/map.ts +6 -1
- package/src/ui/map_tests/map_terrain.test.ts +25 -0
- package/src/util/color_ramp.test.ts +3 -3
- package/src/util/util.ts +7 -12
- package/src/util/web_worker_transfer.test.ts +1 -1
- package/src/webgl/draw/draw_sky.ts +2 -2
- package/src/webgl/program/fill_extrusion_program.ts +1 -2
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-22/LICENSE.txt
|
|
4
4
|
*/
|
|
5
|
-
import { $n as findLineIntersection, $r as
|
|
5
|
+
import { $n as findLineIntersection, $r as normalize, $t as validateStyle, A as earthRadius, Ai as rotate, Ar as warnOnce, At as SegmentVector, B as evaluateSizeForFeature, Bn as createMat4f64, Br as zero, Bt as isRasterStyleLayer, C as altitudeFromMercatorZ, Ci as rotateZ, Cn as addProtocol, Cr as rollPitchBearingToQuat, Ct as Uniform2f, D as mercatorYfromLat, Di as fromRotation, Dn as AbortError, Dr as threePlaneIntersection, Dt as UniformColorArray, E as mercatorXfromLng, Ei as create$4, 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 offscreenCanvasSupported, Mn as angleToRotateBetweenVectors2D, Mr as zoomScale, Mt as CollisionCircleLayoutArray, N as isCustomStyleLayer, Ni as Point, Nn as arrayBufferToImage, Nr as pixelsToTileUnits, Nt as LineStripIndexArray, O as mercatorZfromAltitude, Oi as create$2, 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 negate, Qt as validateAndEmit, R as addDynamicAttributes, Rn as createIdentityMat4f32, Rr as sqrLen, Rt as TriangleIndexArray, S as MercatorCoordinate, Si as rotateY$1, Sn as sameOrigin, Sr as rollPitchBearingEqual, St as Uniform1i, T as lngFromMercatorX, Ti as translate, 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 SPEC_SOURCE_TYPES, Yn as ensureError, Yr as dot, Z as isLineStyleLayer, Zn as extend, Zr as length$1, Zt as emitValidationErrors, _ as OverscaledTileID, _i as invert$1, _n as getArrayBuffer, _r as pointPlaneSignedDistance, _t as RGBAImage, a as clipLine, ai as sub, an as derefLayers, ar as isImageBitmap, at as NORTH_POLE_Y, b as compareTileId, bi as perspective, bn as getVideo, br as readImageUsingVideoFrame, bt as toEvaluationFeature, ci as transformQuat, cn as featureFilter, cr as isTouchableEvent, ct as SubdivisionGranularitySetting, di as copy, dn as latest, dr as lerp, dt as Texture, ei as rotateX$1, en as validateStyleAndEmit, er as getAABB, et as isFillExtrusionStyleLayer, f as GEOJSON_TILE_LAYER_NAME, fi as create$1, fn as ErrorEvent, fr as mapObject, ft as isHillshadeStyleLayer, g as CanonicalTileID, gi as identity, gn as GLOBAL_DISPATCHER_ID, gr as pick, gt as AlphaImage, h as Bounds, hi as fromScaling, hn as AJAXError, hr as parseCacheControl, ht as renderColorRamp, ii as scaleAndAdd, ir as getRollPitchBearing, j as Actor, ji as isOffscreenCanvasDistorted, jn as MAX_VALID_LATITUDE, jr as wrap, jt as CollisionBoxArray, k as LngLat, ki as invert, kn as throwIfAborted, kr as uniqueId, kt as UniformMatrix4f, li as zero$1, lr as isTouchableOrPointableType, lt as isColorReliefStyleLayer, mi as exactEquals, mn as Evented, mr as nextPowerOfTwo, mt as isHeatmapStyleLayer, ni as rotateZ$1, nn as ProjectionDefinition, nr as getEdgeTiles, oi as transformMat3, on as diff, or as isPointableEvent, ot as SOUTH_POLE_Y, pi as equals, 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 scale$2, rn as ValidationError, rt as isFillStyleLayer, s as TileCache, si as transformMat4$1, sn as emptyStyle, sr as isSafari, st as SubdivisionGranularityExpression, t as getAnchorJustification, ti as rotateY, tn as Color, tr as getAngleDelta, u as GeoJSONFeature, ui as clone$1, un as interpolateFactory, ur as isWorker, v as UnwrappedTileID, vi as multiply, vn as getJSON, vr as radiansToDegrees, vt as isCircleStyleLayer, w as latFromMercatorY, wi as scale, wn as getProtocol, wr as scaleZoom, wt as Uniform3f, x as isInBoundsForZoomLngLat, xi as rotateX, xn as makeRequest, xr as remapSaturate, xt as Uniform1f, y as calculateTileKey, yi as ortho, 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-22";
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/util/browser.ts
|
|
10
10
|
let linkEl;
|
|
@@ -1185,7 +1185,7 @@ function edt1d(grid, offset, stride, length, f, v, z) {
|
|
|
1185
1185
|
/**
|
|
1186
1186
|
* The style specification hard-codes some last resort fonts as a default fontstack.
|
|
1187
1187
|
*/
|
|
1188
|
-
const defaultStack =
|
|
1188
|
+
const defaultStack = latest.layout_symbol["text-font"].default.join(",");
|
|
1189
1189
|
/**
|
|
1190
1190
|
* The CSS generic font family closest to `defaultStack`.
|
|
1191
1191
|
*/
|
|
@@ -1399,41 +1399,34 @@ var GlyphManager = class GlyphManager {
|
|
|
1399
1399
|
}
|
|
1400
1400
|
};
|
|
1401
1401
|
//#endregion
|
|
1402
|
+
//#region src/style/light_properties.g.ts
|
|
1403
|
+
let properties$2;
|
|
1404
|
+
const getProperties$2 = () => properties$2 = properties$2 || new Properties({
|
|
1405
|
+
"anchor": new DataConstantProperty(latest["light"]["anchor"], "anchor"),
|
|
1406
|
+
"position": new DataConstantProperty(latest["light"]["position"], "position"),
|
|
1407
|
+
"color": new DataConstantProperty(latest["light"]["color"], "color"),
|
|
1408
|
+
"intensity": new DataConstantProperty(latest["light"]["intensity"], "intensity")
|
|
1409
|
+
});
|
|
1410
|
+
//#endregion
|
|
1402
1411
|
//#region src/style/light.ts
|
|
1403
|
-
var LightPositionProperty = class {
|
|
1404
|
-
constructor() {
|
|
1405
|
-
this.specification = latest_default.light.position;
|
|
1406
|
-
}
|
|
1407
|
-
possiblyEvaluate(value, parameters) {
|
|
1408
|
-
return sphericalToCartesian(value.expression.evaluate(parameters));
|
|
1409
|
-
}
|
|
1410
|
-
interpolate(a, b, t) {
|
|
1411
|
-
return {
|
|
1412
|
-
x: interpolateFactory.number(a.x, b.x, t),
|
|
1413
|
-
y: interpolateFactory.number(a.y, b.y, t),
|
|
1414
|
-
z: interpolateFactory.number(a.z, b.z, t)
|
|
1415
|
-
};
|
|
1416
|
-
}
|
|
1417
|
-
};
|
|
1418
|
-
let lightProperties;
|
|
1419
1412
|
var Light = class extends Evented {
|
|
1420
1413
|
constructor(lightOptions) {
|
|
1421
1414
|
super();
|
|
1422
|
-
|
|
1423
|
-
"anchor": new DataConstantProperty(latest_default.light.anchor),
|
|
1424
|
-
"position": new LightPositionProperty(),
|
|
1425
|
-
"color": new DataConstantProperty(latest_default.light.color),
|
|
1426
|
-
"intensity": new DataConstantProperty(latest_default.light.intensity)
|
|
1427
|
-
});
|
|
1428
|
-
this._transitionable = new Transitionable(lightProperties, void 0);
|
|
1415
|
+
this._transitionable = new Transitionable(getProperties$2(), "light", void 0);
|
|
1429
1416
|
this.setLight(lightOptions);
|
|
1430
1417
|
this._transitioning = this._transitionable.untransitioned();
|
|
1431
1418
|
}
|
|
1432
1419
|
getLight() {
|
|
1433
1420
|
return this._transitionable.serialize();
|
|
1434
1421
|
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Gets the light position in cartesian coordinates.
|
|
1424
|
+
*/
|
|
1425
|
+
getCartesianPosition() {
|
|
1426
|
+
return sphericalToCartesian(this.properties.get("position"));
|
|
1427
|
+
}
|
|
1435
1428
|
setLight(light, options = {}) {
|
|
1436
|
-
if (this._validate(
|
|
1429
|
+
if (this._validate(validateStyle.light, light, options)) return;
|
|
1437
1430
|
for (const name in light) {
|
|
1438
1431
|
const value = light[name];
|
|
1439
1432
|
if (name.endsWith("-transition")) this._transitionable.setTransition(name.slice(0, -TRANSITION_SUFFIX.length), value);
|
|
@@ -1450,38 +1443,33 @@ var Light = class extends Evented {
|
|
|
1450
1443
|
this.properties = this._transitioning.possiblyEvaluate(parameters);
|
|
1451
1444
|
}
|
|
1452
1445
|
_validate(validate, value, options) {
|
|
1453
|
-
|
|
1454
|
-
return emitValidationErrors$1(this, validate.call(validateStyle, {
|
|
1455
|
-
value,
|
|
1456
|
-
style: {
|
|
1457
|
-
glyphs: true,
|
|
1458
|
-
sprite: true
|
|
1459
|
-
},
|
|
1460
|
-
styleSpec: latest_default
|
|
1461
|
-
}));
|
|
1446
|
+
return validateAndEmit(this, validate, { value }, options);
|
|
1462
1447
|
}
|
|
1463
1448
|
};
|
|
1464
1449
|
//#endregion
|
|
1465
|
-
//#region src/style/
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
"
|
|
1469
|
-
"
|
|
1470
|
-
"fog-
|
|
1471
|
-
"
|
|
1472
|
-
"
|
|
1473
|
-
"
|
|
1450
|
+
//#region src/style/sky_properties.g.ts
|
|
1451
|
+
let properties$1;
|
|
1452
|
+
const getProperties$1 = () => properties$1 = properties$1 || new Properties({
|
|
1453
|
+
"sky-color": new DataConstantProperty(latest["sky"]["sky-color"], "sky-color"),
|
|
1454
|
+
"horizon-color": new DataConstantProperty(latest["sky"]["horizon-color"], "horizon-color"),
|
|
1455
|
+
"fog-color": new DataConstantProperty(latest["sky"]["fog-color"], "fog-color"),
|
|
1456
|
+
"fog-ground-blend": new DataConstantProperty(latest["sky"]["fog-ground-blend"], "fog-ground-blend"),
|
|
1457
|
+
"horizon-fog-blend": new DataConstantProperty(latest["sky"]["horizon-fog-blend"], "horizon-fog-blend"),
|
|
1458
|
+
"sky-horizon-blend": new DataConstantProperty(latest["sky"]["sky-horizon-blend"], "sky-horizon-blend"),
|
|
1459
|
+
"atmosphere-blend": new DataConstantProperty(latest["sky"]["atmosphere-blend"], "atmosphere-blend")
|
|
1474
1460
|
});
|
|
1461
|
+
//#endregion
|
|
1462
|
+
//#region src/style/sky.ts
|
|
1475
1463
|
var Sky = class extends Evented {
|
|
1476
1464
|
constructor(sky) {
|
|
1477
1465
|
super();
|
|
1478
|
-
this._transitionable = new Transitionable(
|
|
1466
|
+
this._transitionable = new Transitionable(getProperties$1(), "sky", void 0);
|
|
1479
1467
|
this.setSky(sky);
|
|
1480
1468
|
this._transitioning = this._transitionable.untransitioned();
|
|
1481
1469
|
this.recalculate(new EvaluationParameters(0));
|
|
1482
1470
|
}
|
|
1483
1471
|
setSky(sky, options = {}) {
|
|
1484
|
-
if (this._validate(
|
|
1472
|
+
if (this._validate(validateStyle.sky, sky, options)) return;
|
|
1485
1473
|
sky ||= {
|
|
1486
1474
|
"sky-color": "transparent",
|
|
1487
1475
|
"horizon-color": "transparent",
|
|
@@ -1508,15 +1496,7 @@ var Sky = class extends Evented {
|
|
|
1508
1496
|
this.properties = this._transitioning.possiblyEvaluate(parameters);
|
|
1509
1497
|
}
|
|
1510
1498
|
_validate(validate, value, options = {}) {
|
|
1511
|
-
|
|
1512
|
-
return emitValidationErrors$1(this, validate.call(validateStyle, extend({
|
|
1513
|
-
value,
|
|
1514
|
-
style: {
|
|
1515
|
-
glyphs: true,
|
|
1516
|
-
sprite: true
|
|
1517
|
-
},
|
|
1518
|
-
styleSpec: latest_default
|
|
1519
|
-
})));
|
|
1499
|
+
return validateAndEmit(this, validate, { value }, options);
|
|
1520
1500
|
}
|
|
1521
1501
|
/**
|
|
1522
1502
|
* Currently fog is a very simple implementation, and should only used
|
|
@@ -3503,7 +3483,10 @@ var GeoJSONSource = class extends Evented {
|
|
|
3503
3483
|
* Create the parameters object that will be sent to the worker and used to load GeoJSON.
|
|
3504
3484
|
*/
|
|
3505
3485
|
async _getLoadGeoJSONParameters(data, diff, updateCluster) {
|
|
3506
|
-
const params = extend({
|
|
3486
|
+
const params = extend({
|
|
3487
|
+
type: this.type,
|
|
3488
|
+
source: this.id
|
|
3489
|
+
}, this.workerOptions);
|
|
3507
3490
|
if (typeof data === "string") {
|
|
3508
3491
|
params.request = await this.map._requestManager.transformRequest(browser.resolveURL(data), "Source");
|
|
3509
3492
|
params.request.collectResourceTiming = this._collectResourceTiming;
|
|
@@ -4529,7 +4512,7 @@ var Tile = class {
|
|
|
4529
4512
|
const sourceLayer = params?.sourceLayer ? params.sourceLayer : "";
|
|
4530
4513
|
const layer = vtLayers["_geojsonTileLayer"] || vtLayers[sourceLayer];
|
|
4531
4514
|
if (!layer) return;
|
|
4532
|
-
const filter = featureFilter(params?.filter, params?.globalState);
|
|
4515
|
+
const filter = featureFilter(params?.filter, `querySourceFeatures[${sourceLayer}].filter`, params?.globalState);
|
|
4533
4516
|
const { z, x, y } = this.tileID.canonical;
|
|
4534
4517
|
const coord = {
|
|
4535
4518
|
z,
|
|
@@ -10303,6 +10286,10 @@ var MercatorCameraHelper = class {
|
|
|
10303
10286
|
}
|
|
10304
10287
|
};
|
|
10305
10288
|
//#endregion
|
|
10289
|
+
//#region src/style/projection_properties.g.ts
|
|
10290
|
+
let properties;
|
|
10291
|
+
const getProperties = () => properties = properties || new Properties({ "type": new DataConstantProperty(latest["projection"]["type"], "type") });
|
|
10292
|
+
//#endregion
|
|
10306
10293
|
//#region src/webgl/color_mode.ts
|
|
10307
10294
|
const ZERO = 0;
|
|
10308
10295
|
const ONE = 1;
|
|
@@ -10742,11 +10729,10 @@ var VerticalPerspectiveProjection = class {
|
|
|
10742
10729
|
};
|
|
10743
10730
|
//#endregion
|
|
10744
10731
|
//#region src/geo/projection/globe_projection.ts
|
|
10745
|
-
const properties = new Properties({ "type": new DataConstantProperty(latest_default.projection.type) });
|
|
10746
10732
|
var GlobeProjection = class extends Evented {
|
|
10747
10733
|
constructor(projection) {
|
|
10748
10734
|
super();
|
|
10749
|
-
this._transitionable = new Transitionable(
|
|
10735
|
+
this._transitionable = new Transitionable(getProperties(), "projection", void 0);
|
|
10750
10736
|
this.setProjection(projection);
|
|
10751
10737
|
this._transitioning = this._transitionable.untransitioned();
|
|
10752
10738
|
this.recalculate(new EvaluationParameters(0));
|
|
@@ -12937,7 +12923,6 @@ function createProjectionFromName(name, transformConstrain) {
|
|
|
12937
12923
|
}
|
|
12938
12924
|
//#endregion
|
|
12939
12925
|
//#region src/style/style.ts
|
|
12940
|
-
const emitValidationErrors = (evented, errors) => emitValidationErrors$1(evented, errors?.filter((error) => error.identifier !== "source.canvas"));
|
|
12941
12926
|
const empty = emptyStyle();
|
|
12942
12927
|
/**
|
|
12943
12928
|
* The Style base class
|
|
@@ -13096,7 +13081,7 @@ var Style = class extends Evented {
|
|
|
13096
13081
|
}
|
|
13097
13082
|
_load(json, options, previousStyle) {
|
|
13098
13083
|
let nextState = options.transformStyle ? options.transformStyle(previousStyle, json) : json;
|
|
13099
|
-
if (options.validate &&
|
|
13084
|
+
if (options.validate && validateStyleAndEmit(this, nextState)) return;
|
|
13100
13085
|
nextState = { ...nextState };
|
|
13101
13086
|
this._loaded = true;
|
|
13102
13087
|
this.stylesheet = nextState;
|
|
@@ -13108,7 +13093,7 @@ var Style = class extends Evented {
|
|
|
13108
13093
|
this.light = new Light(this.stylesheet.light);
|
|
13109
13094
|
this._setProjectionInternal(this.stylesheet.projection?.type || "mercator");
|
|
13110
13095
|
this.sky = new Sky(this.stylesheet.sky);
|
|
13111
|
-
this.map.setTerrain(this.stylesheet.terrain ?? null);
|
|
13096
|
+
this.map.setTerrain(this.stylesheet.terrain ?? null, { validate: false });
|
|
13112
13097
|
this.fire(new MapStyleDataEvent("data"));
|
|
13113
13098
|
this.fire(new MapStyleLoadEvent());
|
|
13114
13099
|
}
|
|
@@ -13326,7 +13311,7 @@ var Style = class extends Evented {
|
|
|
13326
13311
|
this._checkLoaded();
|
|
13327
13312
|
const serializedStyle = this.serialize();
|
|
13328
13313
|
nextState = options.transformStyle ? options.transformStyle(serializedStyle, nextState) : nextState;
|
|
13329
|
-
if ((options.validate ?? true) &&
|
|
13314
|
+
if ((options.validate ?? true) && validateStyleAndEmit(this, nextState)) return false;
|
|
13330
13315
|
nextState = clone$2(nextState);
|
|
13331
13316
|
nextState.layers = derefLayers(nextState.layers);
|
|
13332
13317
|
const changes = diff(serializedStyle, nextState);
|
|
@@ -13448,13 +13433,7 @@ var Style = class extends Evented {
|
|
|
13448
13433
|
this._checkLoaded();
|
|
13449
13434
|
if (this.tileManagers[id] !== void 0) throw new Error(`Source "${id}" already exists.`);
|
|
13450
13435
|
if (!source.type) throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(source).join(", ")}.`);
|
|
13451
|
-
if (
|
|
13452
|
-
"vector",
|
|
13453
|
-
"raster",
|
|
13454
|
-
"geojson",
|
|
13455
|
-
"video",
|
|
13456
|
-
"image"
|
|
13457
|
-
].includes(source.type) && this._validate(validateStyle.source, `sources.${id}`, source, null, options)) return;
|
|
13436
|
+
if (SPEC_SOURCE_TYPES.has(source.type) && this._validate(validateStyle.source, `sources.${id}`, source, null, options)) return;
|
|
13458
13437
|
if (this.map?._collectResourceTiming) source.collectResourceTiming = true;
|
|
13459
13438
|
const tileManager = this.tileManagers[id] = new TileManager(id, source, this.dispatcher);
|
|
13460
13439
|
tileManager.style = this;
|
|
@@ -13965,13 +13944,12 @@ var Style = class extends Evented {
|
|
|
13965
13944
|
for (const key in this.tileManagers) this.tileManagers[key].reload();
|
|
13966
13945
|
}
|
|
13967
13946
|
_validate(validate, key, value, props, options = {}) {
|
|
13968
|
-
|
|
13969
|
-
return emitValidationErrors(this, validate.call(validateStyle, extend({
|
|
13947
|
+
return validateAndEmit(this, validate, {
|
|
13970
13948
|
key,
|
|
13971
13949
|
style: this.serialize(),
|
|
13972
13950
|
value,
|
|
13973
|
-
|
|
13974
|
-
},
|
|
13951
|
+
...props
|
|
13952
|
+
}, options);
|
|
13975
13953
|
}
|
|
13976
13954
|
_remove(mapRemoved = true) {
|
|
13977
13955
|
if (this._frameRequest) {
|
|
@@ -14535,12 +14513,7 @@ const fillExtrusionPatternUniforms = (context, locations) => ({
|
|
|
14535
14513
|
});
|
|
14536
14514
|
const fillExtrusionUniformValues = (painter, shouldUseVerticalGradient, opacity, translate) => {
|
|
14537
14515
|
const light = painter.style.light;
|
|
14538
|
-
const
|
|
14539
|
-
const lightPos = [
|
|
14540
|
-
_lp.x,
|
|
14541
|
-
_lp.y,
|
|
14542
|
-
_lp.z
|
|
14543
|
-
];
|
|
14516
|
+
const lightPos = light.getCartesianPosition();
|
|
14544
14517
|
const lightMat = create$4();
|
|
14545
14518
|
if (light.properties.get("anchor") === "viewport") fromRotation(lightMat, painter.transform.bearingInRadians);
|
|
14546
14519
|
transformMat3(lightPos, lightPos, lightMat);
|
|
@@ -17569,12 +17542,8 @@ function drawSky(painter, sky) {
|
|
|
17569
17542
|
program.draw(context, gl.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.disabled, skyUniforms, null, void 0, "sky", mesh.vertexBuffer, mesh.indexBuffer, mesh.segments);
|
|
17570
17543
|
}
|
|
17571
17544
|
function getSunPos(light, transform) {
|
|
17572
|
-
const
|
|
17573
|
-
|
|
17574
|
-
-_lp.x,
|
|
17575
|
-
-_lp.y,
|
|
17576
|
-
-_lp.z
|
|
17577
|
-
];
|
|
17545
|
+
const lightPos = light.getCartesianPosition();
|
|
17546
|
+
negate(lightPos, lightPos);
|
|
17578
17547
|
const lightMat = identity(/* @__PURE__ */ new Float64Array(16));
|
|
17579
17548
|
if (light.properties.get("anchor") === "map") {
|
|
17580
17549
|
rotateZ(lightMat, lightMat, transform.rollInRadians);
|
|
@@ -24450,8 +24419,9 @@ var Map$1 = class extends Evented {
|
|
|
24450
24419
|
* map.setTerrain({ source: 'terrain' });
|
|
24451
24420
|
* ```
|
|
24452
24421
|
*/
|
|
24453
|
-
setTerrain(options) {
|
|
24422
|
+
setTerrain(options, styleOptions = {}) {
|
|
24454
24423
|
this.style._checkLoaded();
|
|
24424
|
+
if (options && validateAndEmit(this, validateStyle.terrain, { value: options }, styleOptions)) return this;
|
|
24455
24425
|
if (this._terrainDataCallback) this.style.off("data", this._terrainDataCallback);
|
|
24456
24426
|
if (!options) {
|
|
24457
24427
|
if (this.terrain) this.terrain.destroy();
|