Skip to content

Commit 653d036

Browse files
committed
Replace transform calls by map calls
1 parent b2d083c commit 653d036

File tree

3 files changed

+16
-202
lines changed

3 files changed

+16
-202
lines changed

package-lock.json

Lines changed: 9 additions & 196 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"@maptiler/client": "^2.0.0",
6666
"events": "^3.3.0",
6767
"js-base64": "^3.7.4",
68-
"maplibre-gl": "4.7.1",
68+
"maplibre-gl": "^5.0.0-pre.3",
6969
"uuid": "^9.0.0"
7070
}
7171
}

src/MaptilerNavigationControl.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@ export class MaptilerNavigationControl extends NavigationControl {
4848
* Overloading: Limit how flat the compass icon can get
4949
*/
5050
_rotateCompassArrow = () => {
51+
const angle = this._map.getBearing();
52+
const pitch = this._map.getPitch();
53+
5154
const rotate = this.options.visualizePitch
5255
? `scale(${Math.min(
5356
1.5,
54-
1 / Math.cos(this._map.transform.pitch * (Math.PI / 180)) ** 0.5,
55-
)}) rotateX(${Math.min(70, this._map.transform.pitch)}deg) rotateZ(${
56-
this._map.transform.angle * (180 / Math.PI)
57-
}deg)`
58-
: `rotate(${this._map.transform.angle * (180 / Math.PI)}deg)`;
57+
1 / Math.cos(pitch * (Math.PI / 180)) ** 0.5,
58+
)}) rotateX(${Math.min(70, pitch)}deg) rotateZ(${-angle}deg)`
59+
: `rotate(${-angle}deg)`;
5960

6061
this._compassIcon.style.transform = rotate;
6162
};

0 commit comments

Comments
 (0)