Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom icon example? #2

Open
PigheadedGnu opened this issue Oct 15, 2015 · 2 comments
Open

Custom icon example? #2

PigheadedGnu opened this issue Oct 15, 2015 · 2 comments

Comments

@PigheadedGnu
Copy link

It's not super clear how to implement custom icons. I think an example would do wonders...

@Treer
Copy link
Owner

Treer commented Oct 15, 2015

  • Example of a map with a custom icon
  • The locations list file that created the map. It has the following changes:
    • It specifies the url for the icons file (line 10).
    • One of the locations has an icon index set to 64, which is the index that custom icons currenty start at (line 50)
    • The location has had two newlines - "\n\n" - added to the start of the label, this drops the label by two lines so it appears under the large custom image instead of over the top of it (line 50)
  • The custom icons image file used. This only contains one icon, so it might not be as illustrative as desired. The image is 64 x 128, the top 64 x 64 square is for the icon foreground (which I've left blank), and the bottom 64 x 64 square is for the icon's background, which I've placed the picture in. The difference between the foreground and background is that label text and all icon foregrounds are drawn on top of backgrounds. In this case I put the picture in the background because it's so big it might cover labels. If the .png were to contain 2 custom icons, it would have been 128 x 128.

The custom icons feature could probably do with some extra polishing, but I don't think anybody is using them. Perhaps that's due to my lack of clear documentation and an example, but you're the first person to ask about them. Next time I update the documentation I'll include the example.

@Treer
Copy link
Owner

Treer commented Oct 16, 2015

I may have found your problem.

  • There's a bug in v1.7.2: it doesn't load custom icons if they're cross-domain, even if your image hosting site enables CORS (e.g. imgur.com), and it doesn't give an error message either it just fails to draw the map.

    This bug is fixed in the repository now, and icons can be loaded cross domain via CORS, but I still need to push out a new release v1.7.3 has now been released.

    My example above was unaffected as the image file is hosted on the same site as the map webpage, but anyone wanting to use custom icons without hosting their own copy of the map needs v1.7.3.

  • Browsers have now also started disallowing webpages loaded via https from dynamically loading via http, and this can block the loading of custom icons if you use mismatching urls. However, I suspect the lack of CORS support is the first problem.

@Treer Treer added the bug label Oct 16, 2015
@Treer Treer removed the bug label Mar 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants