Skip to content

Commit 22d6dd9

Browse files
committed
Add home marker after map starts
1 parent cc61113 commit 22d6dd9

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Loading

google-maps/src/Map/Map.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ const Map: React.FC<IMap> = ({ mapType, mapTypeControl = false}) => {
2525
const startMap = (): void => {
2626
if (!map) {
2727
defaultMapStart();
28+
} else {
29+
const homeLocation = new google.maps.LatLng(65.166013499, 13.3698147);
30+
addHomeMarker(homeLocation);
2831
}
2932
};
3033
useEffect(startMap, [map]);
@@ -71,6 +74,16 @@ const Map: React.FC<IMap> = ({ mapType, mapTypeControl = false}) => {
7174
});
7275
};
7376

77+
const addHomeMarker = (location: GoogleLatLng): void => {
78+
const marker:GoogleMarker = new google.maps.Marker({
79+
position: location,
80+
map: map,
81+
icon: {
82+
url: window.location.origin + '/assets/images/homeAddressMarker.png'
83+
}
84+
});
85+
};
86+
7487
const getIconAttributes = (iconColor: string) => {
7588
return {
7689
path: 'M11.0639 15.3003L26.3642 2.47559e-05L41.6646 15.3003L26.3638 51.3639L11.0639 15.3003 M22,17.5a4.5,4.5 0 1,0 9,0a4.5,4.5 0 1,0 -9,0Z',

0 commit comments

Comments
 (0)