question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

drawing custom icon fails

See original GitHub issue

What is the latest official way to extend an icon and add it to the map? The way described on the examples page does not work anymore in the current master. I get the following error because the icon is only the extended part… it is missing the inheritance. TypeError: options.icon.createIcon is not a function

I now create icons this way… which does work, but I do not favour it…

var thisIcon = new L.Icon();

thisIcon.options.iconUrl = '/public/images/marker.png';
thisIcon.options.iconAnchor = new L.Point(16, 16),
thisIcon.options.iconSize   = new L.Point(newWidth, 32);
thisIcon.options.size       = new L.Point(32, 32);
thisIcon.options.shadowUrl  = '/public/images/shadow.png';
thisIcon.options.shadowSize = new L.Point(32, 32);
var thisMarker = new L.Marker(new L.LatLng(52.028898, 5.141505), {icon: thisIcon});
map.addLayer(thisMarker);

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
adcomdatamoldecommented, Sep 13, 2019

This is still not updated in the documentation, please update!

0reactions
srestrepoeecommented, Mar 23, 2020

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

c++ - .ico file looks wrong drawn with DrawIcon - Stack Overflow
The DrawIcon and DrawIconEx functions on a high DPI display scales up the icons that they draw. Even though they seem to be...
Read more >
Getting Around a Common Custom Icon Problem - MacMost
Creating a custom Finder icon for a file or folder is as simple as copy and paste. However, a common problem people experience...
Read more >
Custom Icons | Showit Help Center
To create a custom icon, it must be in the vector SVG format. You can generate an SVG from Illustrator and just make...
Read more >
Material Symbols and Icons - Google Fonts
Material Symbols are our newest icons consolidating over 2500 glyphs in a single font file with a wide range of design variants.
Read more >
How to Create and Use Custom Icons: 9 Steps (with Pictures)
1. Open Microsoft Paint.{"smallUrl":"https:\/\/www.wikihow.com\/images\/3\/3a\/Create-and-Use-Custom-Icons-Step-1.jpg","bigUrl":"\/images\/thumb\/3\/3a\/Create ... 2. Go to Image, then Attributes. Change the height & width to 32 exactly!{"smallUrl":"https:\/\/www.wikihow.com\/images\/8\/8a\/Create-and-Use-Custom-Icons ... 3. Click View,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found