Added better distance measuring

This commit is contained in:
ztimson 2019-07-22 12:58:17 -04:00
parent 105d1bb27d
commit 4c3c233f06
4 changed files with 34 additions and 17 deletions

3
src/app/models/map.ts Normal file
View File

@ -0,0 +1,3 @@
export interface Map {
name: string
}

8
src/app/models/marker.ts Normal file
View File

@ -0,0 +1,8 @@
export class Marker {
latitude: number;
longitude: number;
name: string;
color: string;
notes: string;
icon: string;
}

View File

@ -113,26 +113,25 @@ export class MapComponent {
let distance = distanceInM(first.lat, first.lng, coords.lat, coords.lng);
let marker = new google.maps.Marker({
map: this.mapApi,
icon: null,
position: {lat: (first.lat + coords.lat) / 2, lng: (first.lng + coords.lng) / 2},
label: distance >= 1000 ? `${Math.round(distance / 100) / 10} km` : `${Math.round(distance)} m`
let info = new google.maps.InfoWindow({
content: distance >= 1000 ? `${Math.round(distance / 100) / 10} km` : `${Math.round(distance)} m`,
position: {lat: (first.lat + coords.lat) / 2, lng: (first.lng + coords.lng) / 2}
});
info.open(this.mapApi);
google.maps.event.addListener(line, 'click', () => {
if(this.menu[1][3].enabled) {
line.setMap(null);
marker.setMap(null);
info.setMap(null);
}
})
});
google.maps.event.addListener(marker, 'click', () => {
google.maps.event.addListener(info, 'click', () => {
if(this.menu[1][3].enabled) {
line.setMap(null);
marker.setMap(null);
info.setMap(null);
}
})
});
}
})
}

View File

@ -16,15 +16,22 @@ body {
}
// Remove google maps branding
a[href^="http://maps.google.com/maps"]{display:none !important}
a[href^="https://maps.google.com/maps"]{display:none !important}
agm-map {
a[href^="http://maps.google.com/maps"]{display:none !important}
a[href^="https://maps.google.com/maps"]{display:none !important}
.gmnoprint a, .gmnoprint span, .gm-style-cc {
display:none;
}
.gmnoprint a, .gmnoprint span, .gm-style-cc {
display: none;
}
.gmnoprint div {
background:none !important;
.gmnoprint div {
background: none !important;
}
button[title="Close"] {
display: none !important;
}
}
.mat-padding-0 {