sigma-geosistemas / Leaflet.awesome-markers

Colorful, iconic & retina-proof markers for Leaflet, based on the Font Awesome/Twitter Bootstrap icons.
MIT License
42 stars 20 forks source link

Feature Request: Additional Text Below Icon #3

Closed TimoStaudinger closed 7 years ago

TimoStaudinger commented 7 years ago

For our project, we have a requirement to be able to add some additional text to the marker below the icon, e.g.:

image

This will be used to represent locations with more than one meaning, in the case of the mock-up e.g. 'Coffee and one other offer'.


The API could look like this:

var redMarker = L.AwesomeMarkers.icon({
    icon: 'coffee',
    markerColor: 'darkblue',
    text: '+1'
});

Is that something you would like to see as part of the library? If so, I will happily implement and merge it.

george-silva commented 7 years ago

That is interesting. But how would that behave when there is too many characters?

TimoStaudinger commented 7 years ago

@george-silva Good point and not something we have been worrying about so far. In our case, the text will never exceed 2 characters, the plus sign and one digit.

In general, I think the trivial solution of letting the text overflow the marker is also best approach here. This leaves it up the the library user to make sure the text length does not exceed the marker width. It also does not hide any information from the user in case it does exceed it.

Any other solution seems too opinionated in regards to the design and look and feel of the embedding site. E.g. it would be possible to have a 'textbox' extend over the borders of the marker, but I think that looks kind of shitty: (and not only because of my ninja-level mockup skills :-) ) image


Then again, maybe the use case is simply too narrow to include it in the library. In this case, I'll just work on my own clone. Looking forward to your thoughts.

george-silva commented 7 years ago

Hey @TimoSta !

Well, I guess this might not really belong here.

Let's close this issue and monitor. If there are any other requests for this, we can talk something out later. What do you think?

TimoStaudinger commented 7 years ago

Sure, that works for me. I'll make the change in my own repo then. We can always merge it back later if there is demand.

george-silva commented 7 years ago

Ok, cool. Thanks for the suggestion, nevertheless. Looking forward for other collabs.