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

Function getGoogleSprite

static/js/map.common.js:803–821  ·  view source on GitHub ↗
(index, sprite, displayHeight)

Source from the content-addressed store, hash-verified

801}
802
803function getGoogleSprite (index, sprite, displayHeight) {
804 displayHeight = Math.max(displayHeight, 3)
805 var scale = displayHeight / sprite.iconHeight
806 // Crop icon just a tiny bit to avoid bleedover from neighbor
807 var scaledIconSize = new google.maps.Size(scale * sprite.iconWidth - 1, scale * sprite.iconHeight - 1)
808 var scaledIconOffset = new google.maps.Point(
809 (index % sprite.columns) * sprite.iconWidth * scale + 0.5,
810 Math.floor(index / sprite.columns) * sprite.iconHeight * scale + 0.5)
811 var scaledSpriteSize = new google.maps.Size(scale * sprite.spriteWidth, scale * sprite.spriteHeight)
812 var scaledIconCenterOffset = new google.maps.Point(scale * sprite.iconWidth / 2, scale * sprite.iconHeight / 2)
813
814 return {
815 url: sprite.filename,
816 size: scaledIconSize,
817 scaledSize: scaledSpriteSize,
818 origin: scaledIconOffset,
819 anchor: scaledIconCenterOffset
820 }
821}
822
823function setupPokemonMarker (item, map, isBounceDisabled) {
824 // Scale icon size up with the map exponentially

Callers 1

setupPokemonMarkerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected