diff --git a/CHANGELOG.md b/CHANGELOG.md index b2f8a60..6f2f49f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,11 +3,12 @@ ## NEXT ### Bug Fixes - Updating from MapLibre v4.4.1 to v4.6.0. See Maplibre changelogs for [v4.5.0](https://github.com/maplibre/maplibre-gl-js/blob/main/CHANGELOG.md#450), [v4.5.1](https://github.com/maplibre/maplibre-gl-js/blob/main/CHANGELOG.md#451), [v4.5.2](https://github.com/maplibre/maplibre-gl-js/blob/main/CHANGELOG.md#452), and [v4.6.0](https://github.com/maplibre/maplibre-gl-js/blob/main/CHANGELOG.md#460) +- Fixed the elevation shift glitch happening with terrain animation after calling `.easeTo()` (https://github.com/maptiler/maptiler-sdk-js/pull/110) ### New Features - Updating from MapLibre v4.4.1 to v4.5.2, adding the following features. See Maplibre changelogs for for [v4.5.0](https://github.com/maplibre/maplibre-gl-js/blob/main/CHANGELOG.md#450), [v4.5.1](https://github.com/maplibre/maplibre-gl-js/blob/main/CHANGELOG.md#451), [v4.5.2](https://github.com/maplibre/maplibre-gl-js/blob/main/CHANGELOG.md#452), and [v4.6.0](https://github.com/maplibre/maplibre-gl-js/blob/main/CHANGELOG.md#460) ### Others - Updating from MapLibre v4.4.1 to v4.5.2 -- Updating `MapTilerGeolocateControl` to match latest Maplibre update +- Updating `MapTilerGeolocateControl` to match latest Maplibre update (https://github.com/maptiler/maptiler-sdk-js/pull/104) ## 2.2.2 ### Bug Fixes diff --git a/src/Map.ts b/src/Map.ts index a140e24..d8c8a63 100644 --- a/src/Map.ts +++ b/src/Map.ts @@ -1034,6 +1034,8 @@ export class Map extends maplibregl.Map { this.terrain.exaggeration = exaggeration; } + // When growing the terrain, this is only necessary before rendering + this._elevationFreeze = false; this.triggerRepaint(); }; @@ -1162,6 +1164,10 @@ export class Map extends maplibregl.Map { // normalized value in interval [0, 1] of where we are currently in the animation loop const positionInLoop = (performance.now() - startTime) / animationLoopDuration; + // At disabling, this should be togled fo both the setTerrain() (at the end of the animation) + // and also just before triggerRepain(), this is why we moved it this high + this._elevationFreeze = false; + // The animation goes on until we reached 99% of the growing sequence duration if (positionInLoop < 0.99) { const exaggerationFactor = (1 - positionInLoop) ** 4; @@ -1172,6 +1178,7 @@ export class Map extends maplibregl.Map { this.terrain.exaggeration = 0; this.terrainGrowing = false; this.terrainFlattening = false; + // @ts-expect-error - https://github.com/maplibre/maplibre-gl-js/issues/2992 this.setTerrain(); if (this.getSource(defaults.terrainSourceId)) {