Skip to content
Snippets Groups Projects
Commit e783cc3c authored by Pierre Ecarlat's avatar Pierre Ecarlat
Browse files

fix(carto): Removed invalid LatLng error in carto

parent d5541d6f
No related branches found
No related tags found
2 merge requests!907V3.2.0,!894fix(carto): Removed invalid LatLng error in carto
......@@ -25,6 +25,8 @@ export class MapComponent implements OnChanges {
@Input() public searchedValue: string | [number, number];
@Output() public selectedStructure: EventEmitter<Structure> = new EventEmitter<Structure>();
@Output() public clickOrientationButton: EventEmitter<Structure> = new EventEmitter<Structure>();
private readonly maxMobileViewWidth = 980;
private currentStructure: Structure;
public map: Map;
......@@ -69,10 +71,8 @@ export class MapComponent implements OnChanges {
if (changes.structures) {
const previousStructures = changes.structures.previousValue;
this.handleStructurePosition(previousStructures);
}
this.handleMapMarkerTooltip(changes);
this.handleSelectedMapMarker(changes);
this.handlePrintableMarkers();
......@@ -322,11 +322,18 @@ export class MapComponent implements OnChanges {
});
}
private get isMobileView(): boolean {
return window.innerWidth <= this.maxMobileViewWidth;
}
private centerLeafletMapOnMarker(markerId: string): void {
if (this.mapService.getMarker(markerId)) {
const marker = this.mapService.getMarker(markerId);
const latLngs = marker.getLatLng();
this.map.flyTo(new L.LatLng(latLngs.lat, latLngs.lng), ZoomLevel.max, this.zoomOptions);
// If map isn't showed, we shouldn't fly
if (this.isMobileView && !this.isMapPhone) return;
const marker = this.mapService.getMarker(markerId);
if (marker) {
const latLng = marker.getLatLng();
this.map.flyTo(new L.LatLng(latLng.lat, latLng.lng), ZoomLevel.max, this.zoomOptions);
}
}
......
$map-selected-marker: 600;
// Phone view
$btn-phone-switch-map-list-z-index: 1002;
$btn-phone-switch-map-list-z-index: 1001;
$menu-phone-z-index: 1003;
// Structure details
$structure-details-z-index: 1001;
$structure-details-z-index: 1002;
$header-z-index: 1200;
// Modals (filters/confirmationPopup/authen/...)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment