@@ -59,7 +59,10 @@ async function loadMap(): Promise<maplibregl.Map> {
5959
6060 const bounds = Config .maxBounds ;
6161 if (bounds ) {
62- const center = [(bounds [2 ] + bounds [0 ]) / 2 , (bounds [3 ] + bounds [1 ]) / 2 ];
62+ const center: [number , number ] = [
63+ (bounds [2 ] + bounds [0 ]) / 2 ,
64+ (bounds [3 ] + bounds [1 ]) / 2 ,
65+ ];
6366 const scaleFactor = 1.0 / Math .cos ((3.14159 / 180 ) * center [1 ]);
6467 const extents = [bounds [2 ] - bounds [0 ], bounds [3 ] - bounds [1 ]];
6568 const maxExtent = Math .max (... extents ) * scaleFactor ;
@@ -151,8 +154,8 @@ interface SimpleMarker {
151154export default defineComponent ({
152155 name: ' BaseMap' ,
153156 data : function (): {
154- flyToOptions? : FlyToOptions ;
155- boundsToFit? : LngLatBoundsLike ;
157+ flyToOptions? : FlyToOptions | undefined ;
158+ boundsToFit? : LngLatBoundsLike | undefined ;
156159 markers: Map <string , SimpleMarker >;
157160 layers: string [];
158161 loaded: boolean ;
@@ -286,11 +289,11 @@ export default defineComponent({
286289 });
287290 });
288291 this .pushTouchHandler (' poi_click' , async (event ) => {
289- if (! event .features ) {
292+ if (! event .features || event . features . length === 0 ) {
290293 console .warn (' poi_click without features' );
291294 return ;
292295 }
293- const place = await mapFeatureToPlace (event ? .features [0 ]);
296+ const place = await mapFeatureToPlace (event .features [0 ]! );
294297 if (place ?.id .gid ) {
295298 const id = PlaceId .gid (place .id .gid );
296299 this .$router .push ({
@@ -510,20 +513,19 @@ export default defineComponent({
510513 pushLayer(
511514 layerId : TripLayerId ,
512515 source : SourceSpecification ,
513- layer : LayerSpecification ,
516+ newLayer : LayerSpecification ,
514517 beforeLayerType : string ,
515518 ) {
516519 const sourceKey = layerId .toString ();
517- const actualLayer = layer ;
518520 // eslint-disable-next-line @typescript-eslint/no-explicit-any
519- if ((actualLayer as any ).source ) {
521+ if ((newLayer as any ).source ) {
520522 // eslint-disable-next-line @typescript-eslint/no-explicit-any
521- (actualLayer as any ).source = sourceKey ;
523+ (newLayer as any ).source = sourceKey ;
522524 }
523525 // eslint-disable-next-line @typescript-eslint/no-explicit-any
524- if ((actualLayer as any ).id ) {
526+ if ((newLayer as any ).id ) {
525527 // eslint-disable-next-line @typescript-eslint/no-explicit-any
526- (actualLayer as any ).id = sourceKey ;
528+ (newLayer as any ).id = sourceKey ;
527529 }
528530 this .ensureMapLoaded ((map : maplibregl .Map ) => {
529531 if (map .getLayer (sourceKey )) {
@@ -536,14 +538,14 @@ export default defineComponent({
536538 let beforeLayerId = undefined ;
537539 if (beforeLayerType ) {
538540 for (const key in map .style ._layers ) {
539- const layer = map .style ._layers [key ];
540- if (layer .type == beforeLayerType ) {
541+ const layer = map .style ._layers [key ]! ;
542+ if (layer .type === beforeLayerType ) {
541543 beforeLayerId = layer .id ;
542544 break ;
543545 }
544546 }
545547 }
546- map .addLayer (layer , beforeLayerId );
548+ map .addLayer (newLayer , beforeLayerId );
547549 this .layers .push (layerId .toString ());
548550 });
549551 },
0 commit comments