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

Function createSearchMarker

static/js/map.js:205–245  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

203}
204
205function createSearchMarker () {
206 var searchMarker = new google.maps.Marker({ // need to keep reference.
207 position: {
208 lat: centerLat,
209 lng: centerLng
210 },
211 map: map,
212 animation: google.maps.Animation.DROP,
213 draggable: !Store.get('lockMarker'),
214 icon: null,
215 optimized: false,
216 zIndex: google.maps.Marker.MAX_ZINDEX + 1
217 })
218
219 searchMarker.infoWindow = new google.maps.InfoWindow({
220 content: '<div><b>Search Location</b></div>',
221 disableAutoPan: true
222 })
223
224 addListeners(searchMarker)
225
226 var oldLocation = null
227 google.maps.event.addListener(searchMarker, 'dragstart', function () {
228 oldLocation = searchMarker.getPosition()
229 })
230
231 google.maps.event.addListener(searchMarker, 'dragend', function () {
232 var newLocation = searchMarker.getPosition()
233 changeSearchLocation(newLocation.lat(), newLocation.lng())
234 .done(function () {
235 oldLocation = null
236 })
237 .fail(function () {
238 if (oldLocation) {
239 searchMarker.setPosition(oldLocation)
240 }
241 })
242 })
243
244 return searchMarker
245}
246
247var searchControlURI = 'search_control'
248function searchControl (action) {

Callers 1

initMapFunction · 0.85

Calls 2

changeSearchLocationFunction · 0.85
addListenersFunction · 0.70

Tested by

no test coverage detected