1. 54
    Import and Add the Default React Leaflet Shadows back to our Markers
    28s

Import and Add the Default React Leaflet Shadows back to our Markers

Colby Fayock
InstructorColby Fayock
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 3 years ago

As we just noticed, we don't get the shadows to our markers by default. While we can add a custom one, we can use the default shadows which will work just as well with our custom markers.

Click here for exercise instructions

Colby Fayock: [0:00] Our markers are looking good, but we're missing one thing. The shadows. Those shadows aren't specified by default, so we have to add them back in. To do that, we're going to first import that image straight from Leaflet.

[0:09] We're here. We have our markers shadow right from the Leaflet distribution. Back to our icon, we're going to set a shadowUrl, which we're going to set to our marker shadow.

[0:17] If we look at the map, we can see the shadow images, but they're not quite in the right spot. To fix this, we can set a shadowAnchor, which for this I've already figured out that it's 13 by 28. With that positioning, when we look back on our map, we can see our shadows.

egghead
egghead
~ an hour ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today