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 { ...@@ -25,6 +25,8 @@ export class MapComponent implements OnChanges {
@Input() public searchedValue: string | [number, number]; @Input() public searchedValue: string | [number, number];
@Output() public selectedStructure: EventEmitter<Structure> = new EventEmitter<Structure>(); @Output() public selectedStructure: EventEmitter<Structure> = new EventEmitter<Structure>();
@Output() public clickOrientationButton: EventEmitter<Structure> = new EventEmitter<Structure>(); @Output() public clickOrientationButton: EventEmitter<Structure> = new EventEmitter<Structure>();
private readonly maxMobileViewWidth = 980;
private currentStructure: Structure; private currentStructure: Structure;
public map: Map; public map: Map;
...@@ -69,10 +71,8 @@ export class MapComponent implements OnChanges { ...@@ -69,10 +71,8 @@ export class MapComponent implements OnChanges {
if (changes.structures) { if (changes.structures) {
const previousStructures = changes.structures.previousValue; const previousStructures = changes.structures.previousValue;
this.handleStructurePosition(previousStructures); this.handleStructurePosition(previousStructures);
} }
this.handleMapMarkerTooltip(changes); this.handleMapMarkerTooltip(changes);
this.handleSelectedMapMarker(changes); this.handleSelectedMapMarker(changes);
this.handlePrintableMarkers(); this.handlePrintableMarkers();
...@@ -322,11 +322,18 @@ export class MapComponent implements OnChanges { ...@@ -322,11 +322,18 @@ export class MapComponent implements OnChanges {
}); });
} }
private get isMobileView(): boolean {
return window.innerWidth <= this.maxMobileViewWidth;
}
private centerLeafletMapOnMarker(markerId: string): void { private centerLeafletMapOnMarker(markerId: string): void {
if (this.mapService.getMarker(markerId)) { // If map isn't showed, we shouldn't fly
const marker = this.mapService.getMarker(markerId); if (this.isMobileView && !this.isMapPhone) return;
const latLngs = marker.getLatLng();
this.map.flyTo(new L.LatLng(latLngs.lat, latLngs.lng), ZoomLevel.max, this.zoomOptions); 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; $map-selected-marker: 600;
// Phone view // Phone view
$btn-phone-switch-map-list-z-index: 1002; $btn-phone-switch-map-list-z-index: 1001;
$menu-phone-z-index: 1003; $menu-phone-z-index: 1003;
// Structure details // Structure details
$structure-details-z-index: 1001; $structure-details-z-index: 1002;
$header-z-index: 1200; $header-z-index: 1200;
// Modals (filters/confirmationPopup/authen/...) // 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