refactor: fix map controlls

This commit is contained in:
Rainer Killinger
2026-10-01 18:10:57 +02:00
parent 32cc443600
commit dfb7336f25
4 changed files with 11 additions and 6 deletions
@@ -28,10 +28,10 @@ export class CompassControlComponent {
),
),
),
map(_event => {
// const pitch = event.target.transform.pitch;
// const bearing = event.target.transform.bearing;
// return `rotateX(${pitch}deg) rotateZ(${bearing}deg)`;
map(event => {
const pitch = event.target._camera.getPitch();
const bearing = event.target._camera.getBearing();
return `rotateX(${pitch}deg) rotateZ(${bearing}deg)`;
}),
);
}
@@ -40,6 +40,7 @@ class CustomGeolocateControl extends GeolocateControl {
this._container = document.createElement('div');
this._map = map;
this._setupUI();
this._finishSetupUI('geolocation' in navigator);
this._container = container;
return this._container;
}
@@ -21,7 +21,9 @@
<ion-content id="map">
<mgl-map
[mapStyle]="('(prefers-color-scheme: dark)' | mediaQuery | async) ? 'dark' : ('light' | mapStyleUrl)"
[mapStyle]="
('(prefers-color-scheme: dark)' | mediaQuery | async) ? ('dark' | mapStyleUrl) : ('light' | mapStyleUrl)
"
[attributionControl]="false"
[fitBounds]="(bounds | async) ?? undefined"
[fitBoundsOptions]="{maxZoom: 15, padding: {top: 100, bottom: 50, left: 50, right: 50}, animate: false}"
@@ -14,7 +14,9 @@
-->
<mgl-map
auto-3d
[mapStyle]="('(prefers-color-scheme: dark)' | mediaQuery | async) ? 'dark' : ('light' | mapStyleUrl)"
[mapStyle]="
('(prefers-color-scheme: dark)' | mediaQuery | async) ? ('dark' | mapStyleUrl) : ('light' | mapStyleUrl)
"
[interactive]="false"
[attributionControl]="false"
[center]="$any(place.geo.point.coordinates)"