diff --git a/CHANGELOG.md b/CHANGELOG.md index 98b0f5e68d..0deb7a4adc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### ✨ Features and improvements - Support Vertical Perspective projection ([#5023](https://github.com/maplibre/maplibre-gl-js/pull/5023)) +- Support projection expression support ([#5040](https://github.com/maplibre/maplibre-gl-js/pull/5040)) - _...Add new stuff here..._ ### 🐞 Bug fixes diff --git a/package-lock.json b/package-lock.json index 842a63d961..67973159f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@mapbox/unitbezier": "^0.0.1", "@mapbox/vector-tile": "^1.3.1", "@mapbox/whoots-js": "^3.1.0", - "@maplibre/maplibre-gl-style-spec": "^21.2.0", + "@maplibre/maplibre-gl-style-spec": "^22.0.0", "@types/geojson": "^7946.0.14", "@types/geojson-vt": "3.2.5", "@types/mapbox__point-geometry": "^0.1.4", @@ -2122,9 +2122,9 @@ } }, "node_modules/@maplibre/maplibre-gl-style-spec": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-21.2.0.tgz", - "integrity": "sha512-jd+YjJEhR2bg9EhF2UPEIpoK6imPEw0SzWhfUmaVgSWfxw92jKrkBVb3OP29CtDVPY17RYMkZj+kz7CP75kAHw==", + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-22.0.0.tgz", + "integrity": "sha512-kD8TxV6CdgHIEeam4xODVJNAT3hcvRhRl5RcNiu+FPR/JoMsExAQTruBGtv+jLppj4xt9V56pG/SHK8z6fv6xA==", "license": "ISC", "dependencies": { "@mapbox/jsonlint-lines-primitives": "~2.0.2", diff --git a/package.json b/package.json index 12fe8f4c98..fe7a8ebeab 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@mapbox/unitbezier": "^0.0.1", "@mapbox/vector-tile": "^1.3.1", "@mapbox/whoots-js": "^3.1.0", - "@maplibre/maplibre-gl-style-spec": "^21.2.0", + "@maplibre/maplibre-gl-style-spec": "^22.0.0", "@types/geojson": "^7946.0.14", "@types/geojson-vt": "3.2.5", "@types/mapbox__point-geometry": "^0.1.4", diff --git a/src/style/style.ts b/src/style/style.ts index 4e0beef7d4..4ef823eac5 100644 --- a/src/style/style.ts +++ b/src/style/style.ts @@ -18,7 +18,7 @@ import {Source} from '../source/source'; import {QueryRenderedFeaturesOptions, QueryRenderedFeaturesOptionsStrict, QuerySourceFeatureOptions, queryRenderedFeatures, queryRenderedSymbols, querySourceFeatures} from '../source/query_features'; import {SourceCache} from '../source/source_cache'; import {GeoJSONSource} from '../source/geojson_source'; -import {latest as styleSpec, derefLayers as deref, emptyStyle, diff as diffStyles, DiffCommand} from '@maplibre/maplibre-gl-style-spec'; +import {latest as styleSpec, derefLayers as deref, emptyStyle, diff as diffStyles, DiffCommand, createExpression} from '@maplibre/maplibre-gl-style-spec'; import {getGlobalWorkerPool} from '../util/global_worker_pool'; import {rtlMainThreadPluginFactory} from '../source/rtl_text_plugin_main_thread'; import {RTLPluginLoadedEventName} from '../source/rtl_text_plugin_status'; @@ -64,6 +64,7 @@ import { type GetImagesResponse } from '../util/actor_messages'; import {Projection} from '../geo/projection/projection'; + import {createProjectionFromName} from '../geo/projection/projection_factory'; const empty = emptyStyle() as StyleSpecification; @@ -579,6 +580,19 @@ export class Style extends Evented { * Apply queued style updates in a batch and recalculate zoom-dependent paint properties. */ update(parameters: EvaluationParameters) { + + try { + const exprestInt = createExpression(['interpolate', ['linear'], ['zoom'], 10, 'vertical-perspective', 12, 'mercator'], styleSpec.projection.type) + if (exprestInt.result === 'success') { + console.log(exprestInt.value.evaluate({zoom: parameters.zoom})) + + } else { + console.warn('Error parsing 22interpolate', exprestInt.result) + } + } catch (err) { + console.warn('Error parsing 11interpolate', err) + } + if (!this._loaded) { return; } diff --git a/typedoc.json b/typedoc.json index 95292f3ad2..b49d68767d 100644 --- a/typedoc.json +++ b/typedoc.json @@ -37,4 +37,4 @@ "SourceSpecification": "https://maplibre.org/maplibre-style-spec/sources/" } } - } \ No newline at end of file + }