Skip to content

Commit

Permalink
Merge pull request #100 from swoocn/fix-bugs
Browse files Browse the repository at this point in the history
Self approved.
  • Loading branch information
swoocn authored Mar 14, 2024
2 parents 30b2f02 + 18c0981 commit c6061a6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions frontend/src/app/core/service/geolocation.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable, signal } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import { Icon, icon, Map, MapOptions, tileLayer } from 'leaflet';
import { Icon, icon, LatLng, LatLngBounds, MapOptions, tileLayer } from 'leaflet';
import axios from 'axios';

@Injectable({
Expand All @@ -16,8 +16,6 @@ export class GeolocationService {
readonly geoLoading = signal<boolean>(false);
readonly geolocationTriggerEvent$ = this.geolocationTrigger.asObservable();

private map!: Map;

triggerGeolocation(): void {
this.geolocationTrigger.next();
}
Expand Down Expand Up @@ -49,16 +47,24 @@ export class GeolocationService {
}

getMapOptions(): MapOptions {
const southWest = new LatLng(-90, -180);
const northEast = new LatLng(90, 180);
const bounds = new LatLngBounds(southWest, northEast);

return {
layers: [
tileLayer(this.tileLayer, {
noWrap: true,
maxZoom: this.maxZoomLevel,
minZoom: this.minZoomLevel,
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
// attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
}),
],
zoom: this.initZoomLevel,
zoomControl: false,
center: [37.5665, 126.978],
maxBounds: bounds,
attributionControl: false,
};
}

Expand Down

0 comments on commit c6061a6

Please sign in to comment.