CodingTrain / Intro-to-Data-APIs-JS

Working with Data and APIs in JavaScript
MIT License
756 stars 611 forks source link

Solutions to exercises to code 1-6 #28

Closed blinkityblank closed 5 years ago

blinkityblank commented 5 years ago
shiffman commented 5 years ago

Checking off the first one above with 374d7876997534ed42dbba082b3c97ae9c749dad, however, the example actually doesn't work as the size doesn't update unless I delete and re-add the marker . . which causes it to blink. For the video I think it's ok just to show that altitude is an additional DOM element and I'll figure it out later! Code for reference:

const w = (altitude * aspect) / 10;
const h = altitude / 10;
issIcon.options.iconSize = [w, h];
issIcon.options.iconAnchor = [w / 2, h / 2];

// Size not changing unless I remove and re-add marker?
// TODO: There has got to be a better way!
// mymap.removeLayer(marker);
// marker = L.marker([0, 0], { icon: issIcon }).addTo(mymap);