MCPcopy Create free account
hub / github.com/RocketMap/RocketMap / centerMapOnLocation

Function centerMapOnLocation

static/js/map.js:1151–1175  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1149}
1150
1151function centerMapOnLocation () {
1152 var currentLocation = document.getElementById('current-location')
1153 var imgX = '0'
1154 var animationInterval = setInterval(function () {
1155 if (imgX === '-18') {
1156 imgX = '0'
1157 } else {
1158 imgX = '-18'
1159 }
1160 currentLocation.style.backgroundPosition = imgX + 'px 0'
1161 }, 500)
1162 if (navigator.geolocation) {
1163 navigator.geolocation.getCurrentPosition(function (position) {
1164 var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude)
1165 locationMarker.setPosition(latlng)
1166 map.setCenter(latlng)
1167 Store.set('followMyLocationPosition', { lat: position.coords.latitude, lng: position.coords.longitude })
1168 clearInterval(animationInterval)
1169 currentLocation.style.backgroundPosition = '-144px 0px'
1170 })
1171 } else {
1172 clearInterval(animationInterval)
1173 currentLocation.style.backgroundPosition = '0px 0px'
1174 }
1175}
1176
1177function changeLocation (lat, lng) {
1178 var loc = new google.maps.LatLng(lat, lng)

Callers 2

createMyLocationButtonFunction · 0.85
map.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected