Skip to content

Commit 259f816

Browse files
committed
Add geolocation control
1 parent d11ad48 commit 259f816

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

app.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ body.modal #map {
8787
transform: translateY(-15%);
8888
}
8989

90+
.mapboxgl-ctrl-top-right {
91+
top: 55px;
92+
}
93+
9094
#layers-button {
9195
outline: 0;
9296
border: 0;
@@ -432,6 +436,9 @@ body.modal #card{
432436
}
433437

434438
@media (min-width: 768px) and (min-height: 600px) {
439+
.mapboxgl-ctrl-top-right {
440+
top: 0;
441+
}
435442
#layers-button,
436443
#modal,
437444
#layers .close {

app.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ var map = new mapboxgl.Map({
3636
attributionControl: false, // Attribution is inside Layers modal
3737
});
3838
map.touchZoomRotate.disableRotation();
39+
map.addControl(new mapboxgl.GeolocateControl({
40+
positionOptions: {
41+
enableHighAccuracy: true,
42+
},
43+
trackUserLocation: true,
44+
}));
3945

4046
var maxBoundsLike = [
4147
[ 103.6016626883025, 1.233357600011331 ], // sw

0 commit comments

Comments
 (0)