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

Function addRangeCircle

static/js/map.js:486–526  ·  view source on GitHub ↗
(marker, map, type, teamId)

Source from the content-addressed store, hash-verified

484}
485
486function addRangeCircle (marker, map, type, teamId) {
487 var targetmap = null
488 var circleCenter = new google.maps.LatLng(marker.position.lat(), marker.position.lng())
489 var gymColors = ['#999999', '#0051CF', '#FF260E', '#FECC23'] // 'Uncontested', 'Mystic', 'Valor', 'Instinct']
490 var teamColor = gymColors[0]
491 if (teamId) teamColor = gymColors[teamId]
492
493 var range
494 var circleColor
495
496 // handle each type of marker and be explicit about the range circle attributes
497 switch (type) {
498 case 'pokemon':
499 circleColor = '#C233F2'
500 range = 40 // pokemon appear at 40m and then you can move away. still have to be 40m close to see it though, so ignore the further disappear distance
501 break
502 case 'pokestop':
503 circleColor = '#3EB0FF'
504 range = 40
505 break
506 case 'gym':
507 circleColor = teamColor
508 range = 40
509 break
510 }
511
512 if (map) targetmap = map
513
514 var rangeCircleOpts = {
515 map: targetmap,
516 radius: range, // meters
517 strokeWeight: 1,
518 strokeColor: circleColor,
519 strokeOpacity: 0.9,
520 center: circleCenter,
521 fillColor: circleColor,
522 fillOpacity: 0.3
523 }
524 var rangeCircle = new google.maps.Circle(rangeCircleOpts)
525 return rangeCircle
526}
527
528function isRangeActive (map) {
529 if (map.getZoom() < 16) return false

Callers 4

customizePokemonMarkerFunction · 0.85
setupGymMarkerFunction · 0.85
setupPokestopMarkerFunction · 0.85
showInBoundsMarkersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected