diff --git a/src/views/index-js.mustache b/src/views/index-js.mustache index 6e69de4c..68bad2dc 100644 --- a/src/views/index-js.mustache +++ b/src/views/index-js.mustache @@ -256,13 +256,13 @@ $(function () { iconUrl: availableIconStyles[selectedIconStyle] + '/device/0.png', iconSize: [30, 30], iconAnchor: [30 / 2, 30 / 2], - popupAnchor: [0, 30 * -1.567] + popupAnchor: [0, 30 * -.6] }); deviceOfflineIcon = L.icon({ iconUrl: availableIconStyles[selectedIconStyle] + '/device/1.png', iconSize: [30, 30], iconAnchor: [30 / 2, 30 / 2], - popupAnchor: [0, 30 * -1.567] + popupAnchor: [0, 30 * -.6] }); $('#filtersModal').on('show.bs.modal', function () { @@ -3619,7 +3619,7 @@ function getNestMarker (nest, geojson, ts) { iconUrl: '/img/pokemon/1.png', iconSize: [30, 30], iconAnchor: [30 / 2, 30 / 2], - popupAnchor: [0, 30 * -1.567] + popupAnchor: [0, 30 * -.6] }); return L.marker(latlng, {icon: icon}); }, @@ -3637,7 +3637,7 @@ function getNestMarker (nest, geojson, ts) { const icon = L.divIcon({ iconSize: [40, 40], iconAnchor: [40 / 2, 40 / 2], - popupAnchor: [0, 30 * -1.567], + popupAnchor: [0, 40 * -.6], className: 'nest-marker', html: `

${typesIcon}
` }); @@ -3646,7 +3646,7 @@ function getNestMarker (nest, geojson, ts) { iconUrl: '/img/pokemon/' + nest.pokemon_id + '.png', iconSize: [30, 30], iconAnchor: [30 / 2, 30 / 2], - popupAnchor: [0, 30 * -1.567], + popupAnchor: [0, 30 * -.6], shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png', shadowSize: [41, 41] }); @@ -3693,7 +3693,7 @@ function getPokemonMarkerIcon (pokemon, ts) { const icon = L.divIcon({ iconSize: [size, size], iconAnchor: [size / 2, size / 2], - popupAnchor: [0, -(size / 2)], + popupAnchor: [0, size * -.6], className: 'pokemon-marker', html: `
'; - let iconUrl = ''; - let sizeId = '0'; - let iconAnchor = []; + let questSize = 0; + let iconHtml = ''; const lureIconId = getLureIconId(pokestop.lure_id); const activeLure = showPokestops && lureIconId > 0 && pokestop.lure_expire_timestamp >= ts; const activeInvasion = showInvasions && pokestop.incident_expire_timestamp >= ts; @@ -3741,6 +3738,7 @@ function getPokestopMarkerIcon (pokestop, ts) { const id = pokestop.quest_rewards[0].type; const info = pokestop.quest_rewards[0].info; let rewardString; + let iconUrl; if (id === 1 && info !== undefined && info.amount !== undefined) { iconUrl = `${availableIconStyles[selectedIconStyle]}/item/-2.png`; } else if (id === 2 && info !== undefined && info.amount !== undefined && info.item_id !== undefined) { @@ -3761,35 +3759,28 @@ function getPokestopMarkerIcon (pokestop, ts) { iconUrl = `${availableIconStyles[selectedIconStyle]}/pokemon/${getPokemonIcon(info.pokemon_id, 0)}`; } } - iconHtml += ``; - iconSize = getQuestSize(rewardString); - iconAnchor = [iconSize / 2, iconSize * 1.9];//1.567]; - } else { - iconSize = getPokestopSize(sizeId); - iconAnchor = [iconSize / 2, iconSize];// * 1.567]; + questSize = getQuestSize(rewardString); + iconHtml += `
`; } + let sizeId = '0'; if (activeInvasion && activeLure) { sizeId = 'i' + lureIconId; - iconSize = getPokestopSize(sizeId); - iconAnchor = [iconSize / 2, iconSize * 1.567]; } else if (activeInvasion) { sizeId = 'i0'; - iconSize = getPokestopSize(sizeId); - iconAnchor = [iconSize / 2, iconSize];// * 1.567], } else if (activeLure) { sizeId = lureIconId; - iconSize = getPokestopSize(sizeId); - iconAnchor = [iconSize / 2, iconSize];// * 1.567], } - iconHtml += ''; + const stopSize = getPokestopSize(sizeId); + const iconWidth = Math.max(questSize, stopSize); + const iconAnchorY = questSize + stopSize * .896; const icon = L.divIcon({ - iconSize: [iconSize, iconSize], - iconAnchor: iconAnchor, - popupAnchor: [0, iconSize * -1.567], + iconSize: [iconWidth, questSize + stopSize], + iconAnchor: [iconWidth / 2, iconAnchorY], + popupAnchor: [0, -8 - iconAnchorY], className: 'pokestop-marker', html: activeInvasion - ? `
${iconHtml}
` - : `
${iconHtml}
` + ? `
${iconHtml}
` + : `
${iconHtml}
` }); return icon; } @@ -3858,43 +3849,42 @@ function getGymMarkerIcon (gym, ts) { } const raidLevel = gym.raid_level; - let iconSize; + let raidSize = 0; let iconHtml = ''; - let ignoreGymIcon = false; if (gym.raid_battle_timestamp <= ts && gym.raid_end_timestamp >= ts && showRaids && parseInt(gym.raid_level) > 0) { if (gym.raid_pokemon_id !== 0 && gym.raid_pokemon_id !== null) { // Raid Boss - iconSize = getRaidSize('p' + gym.raid_pokemon_id); - iconHtml = ``; + raidSize = getRaidSize('p' + gym.raid_pokemon_id); + iconHtml = `
`; } else { // Egg - iconSize = getRaidSize('l' + raidLevel); - iconHtml = ``; + raidSize = getRaidSize('l' + raidLevel); + iconHtml = `
`; } } else if (gym.raid_end_timestamp >= ts && parseInt(gym.raid_level) > 0 && showRaids) { // Egg - iconSize = getRaidSize('l' + raidLevel); - iconHtml = ``; + raidSize = getRaidSize('l' + raidLevel); + iconHtml = `
`; + } + // Gym + let gymSize; + if (gym.in_battle) { + // Gym Battle + gymSize = 55; //Set Larger Size For Battle + iconHtml += ``; } else { // Gym - if (gym.in_battle) { - // Gym Battle - iconSize = 55; //Set Larger Size For Battle - iconHtml = ``; - ignoreGymIcon = true; - } else { - // Gym - iconSize = getGymSize(gym.team_id); - } + gymSize = getGymSize(gym.team_id); + iconHtml += ``; } + const iconWidth = Math.max(raidSize, gymSize); + const iconAnchorY = raidSize + gymSize * .917; const icon = L.divIcon({ - iconSize: [iconSize, iconSize], - iconAnchor: [iconSize / 2, iconSize * 1.567], - popupAnchor: [0, iconSize * -1.567], // 0, -20 + iconSize: [iconWidth, raidSize + gymSize], + iconAnchor: [iconWidth / 2, iconAnchorY], + popupAnchor: [0, -8 - iconAnchorY], className: 'gym-marker', - html: ignoreGymIcon - ? `
${iconHtml}
` - : `
${iconHtml}

` + html: `
${iconHtml}
` }); return icon; }