shramov / leaflet-plugins

Plugins for Leaflet library
http://psha.org.ru/b/leaflet-plugins.html
MIT License
722 stars 289 forks source link

Marker text creating new lines after every word/space #273

Closed RajibChanda closed 3 years ago

RajibChanda commented 6 years ago

I am using Marker.Text.js, but when I am adding a text string in marker it breaks down that string in separate lines after every space. Is there any way to show a limited number of words per line without losing the actual position of the marker/ without offsetting the marker position? issue @brunob

brunob commented 6 years ago

Can you provide a link to a page or a fiddle showing the bug please ?

AntoniBCN commented 6 years ago

I've the same problem:


var marker = new L.Marker.Text(map.getCenter(), 'LOREM LIPSUM DOLOR');
map.addLayer(marker);

Generates: textmarker

Any idea?

Thanks in advance

RajibChanda commented 6 years ago

@brunob

brunob commented 6 years ago

@RajibChanda i've read that, not necessary to ping me, i'll take a look at this asap. Anyway, feel free to send a patch.

velocat commented 3 years ago

into Marker.Text.js line 11 add css rule "nowrap" :)

el.style.cssText = "color:blue; font-size:14px; font-weight:bold; white-space:nowrap;";
el.style.textShadow = '2px 2px 2px #fff';
brunob commented 3 years ago

thx for the hint @velocat ;)