Skip to content

Commit

Permalink
Code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
rugoncalves committed Feb 16, 2024
1 parent 0ae84ac commit af38a2b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/OSFramework/Maps/OSMap/AbstractMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ namespace OSFramework.Maps.OSMap {
}

public hasMarkerClusterer(): boolean {
return this._features && this._features.markerClusterer && this._features.markerClusterer.isEnabled;
return this._features?.markerClusterer?.isEnabled;
}

public hasShape(shapeId: string): boolean {
Expand Down
4 changes: 3 additions & 1 deletion src/Providers/Maps/Google/Features/Zoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ namespace Provider.Maps.Google.Feature {
const bounds = new google.maps.LatLngBounds();
this._map.markers.forEach(function (item) {
if (item.provider === undefined) return;
bounds.extend(item.provider.position.toJSON());
// The TS definitions appear to be outdated.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
bounds.extend((item.provider as google.maps.Marker as any).position.toJSON());
});

if (useShapes) {
Expand Down
8 changes: 6 additions & 2 deletions src/Providers/Maps/Google/OSMap/OSMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@ namespace Provider.Maps.Google.OSMap {
//center will not be changed.
if (isDefault || this.features.zoom.isAutofit) {
//Let's use the first marker as the center of the map.
position = this.markers[0].provider.position.toJSON();
// The TS definitions appear to be outdated.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
position = (this.markers[0].provider as google.maps.Marker as any).position.toJSON();
}
}
} else {
Expand All @@ -422,7 +424,9 @@ namespace Provider.Maps.Google.OSMap {
} else if (this.markers[0].provider !== undefined) {
//If there's only one marker, and is already created, its location will be
//used as the map center.
position = this.markers[0].provider.position.toJSON();
// The TS definitions appear to be outdated.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
position = (this.markers[0].provider as google.maps.Marker as any).position.toJSON();
}
}

Expand Down

0 comments on commit af38a2b

Please sign in to comment.