@@ -2,7 +2,8 @@ import { css, unsafeCSS, customElement, html, LitElement, property, internalProp
2
2
import { Icon , map , marker , tileLayer , LatLngTuple } from 'leaflet' ;
3
3
import leafletCss from 'leaflet/dist/leaflet.css' ;
4
4
import leafletMarkerCss from 'leaflet.markercluster/dist/MarkerCluster.Default.css' ;
5
- import { MarkerClusterGroup } from 'leaflet.markercluster' ;
5
+ import * as L from 'leaflet' ;
6
+ import 'leaflet.markercluster' ;
6
7
import { Router } from '../routing/Router' ;
7
8
import { LieuAffichableAvecDistance , Coordinates , SearchRequest , TYPES_LIEUX } from '../state/State' ;
8
9
import { CSS_Global } from '../styles/ConstructibleStyleSheets' ;
@@ -43,8 +44,8 @@ export class VmdAppointmentMapComponent extends LitElement {
43
44
44
45
private loadMap ( ) {
45
46
const coordinates =
46
- this . currentSearch &&
47
- ( this . toCoordinates ( this . currentSearch . commune ) || this . toCoordinates ( this . currentSearch . departement ) ) ;
47
+ this . currentSearch instanceof SearchRequest . ByCommune &&
48
+ this . toCoordinates ( ( this . currentSearch as SearchRequest . ByCommune ) . commune ) ;
48
49
const mymap = map ( this . shadowRoot ! . querySelector ( '#appointment-map' ) as HTMLElement ) . setView (
49
50
coordinates || [ 46.505 , 3 ] ,
50
51
13
@@ -87,7 +88,7 @@ export class VmdAppointmentMapComponent extends LitElement {
87
88
} ;
88
89
const markers = lieux
89
90
. filter ( ( lieu ) => lieu . disponible )
90
- . reduce ( ( markers : MarkerClusterGroup , lieu : LieuAffichableAvecDistance ) => {
91
+ . reduce ( ( markers : L . MarkerClusterGroup , lieu : LieuAffichableAvecDistance ) => {
91
92
const coordinates = this . toCoordinates ( lieu . location ) ;
92
93
if ( coordinates ) {
93
94
var string_popup = `
@@ -143,7 +144,7 @@ export class VmdAppointmentMapComponent extends LitElement {
143
144
}
144
145
145
146
return markers ;
146
- } , new MarkerClusterGroup ( { disableClusteringAtZoom : 9 } ) ) ;
147
+ } , new L . MarkerClusterGroup ( { disableClusteringAtZoom : 9 } ) ) ;
147
148
148
149
return { markers, bounds } ;
149
150
}
0 commit comments