modrzew / pokeminer

Pokemon location scraper
MIT License
220 stars 61 forks source link

Use larger-icons on some pokemons #138

Open SapitoSucio opened 8 years ago

SapitoSucio commented 8 years ago

Used to just copy and rewrite the images from icons folder using the icons from larger-icons, but now the icon size is fixed at newmap.html ( iconSize: [30, 30],)

I commented that line but the icons are so inaccurate, specially the larger icons

Could there be a new config line (like trash_id) to specify which pokemons are "important" so they are bigger than usual?

Tried using this but it didn't work if (raw.pokemon_id == 10){ // Caterpie just for testing var bigicon = new BigPokemonIcon({iconUrl: '/static/larger-icons/' + raw.pokemon_id + '.png'}); }

modrzew commented 8 years ago

There's no such config yet. You'd need to create a "class" similar to PokemonIcon with different properties (like size), and then place similar if in PokemonMarker.

SapitoSucio commented 8 years ago

I wrote this:

//This Below PokemonIcon var BigPokemonIcon = L.Icon.extend({ options: { iconSize: [80, 60], popupAnchor: [0, -16] } });

// This in Pokemon Marker if (raw.pokemon_id == 10){ var bigicon = new BigPokemonIcon({iconUrl: '/static/larger-icons/' + raw.pokemon_id + '.png'}); }

Is raw.pokemon_id the ideal way to get the ID ? I know I need to compare IDs to get working this "feature"

modrzew commented 8 years ago

Yeah, raw.pokemon_id contains Pokemon number. Then just use it in a marker:

var marker = L.marker([raw.lat, raw.lon], {icon: bigicon, opacity: 1});
SapitoSucio commented 8 years ago

Done, thank you! http://i.imgur.com/pydsHmR.png