1
The manipulation of texts in mark is very complex and limited. I found no way to do this, except by using the markerwithlabel library.
Using the same simply create the markwithlabel:
js:
marker = new MarkerWithLabel({
position: new google.maps.LatLng(point.Latitude, point.Longitude),
icon: icon.jpg,
labelContent: "Ponto de chegada",
labelAnchor: new google.maps.Point(62, 42),
labelClass: "my-custom-class-for-label",
map: map
});
And create the class that responds to his training:
.my-custom-class-for-label {
text-align: left;
font-weight: bold;
font-size: 20px;
color: #fff;
}
Remembering that it is important that you include the same scripts in your project, you can copy this js (https://github.com/LuizSD/mapsWithUrlParam/blob/master/js/markerwithlabel.js)
Example of use: https://github.com/LuizSD/mapsWithUrlParam
Text explaining use: https://medium.com/@barvysta/google-Marker-api-Lets-play-level-1-Dynamic-label-on-Marker-f9b94f2e3585
Thanks already more didn’t work, I don’t know why these parts aren’t working: labelContent: "Finish point", labelAnchor: new google.maps.Point(62, 42), labelClass: "my-custom-class-for-label",
– Carlos Alexandre R Ramos
Opa, you even included the https://github.com/LuizSD/mapsWithUrlParam/blob/master/js/markerwithlabel.js library you need to add it to your project. Only then it will be possible to instantiate an object of type Markerwithlabel.
– Luiz Santos
In this object you can use the attributes labelClass and labelContent. Which are the content of the label and the class that it respects
– Luiz Santos
I imported the Library when use: new google.maps.Marker the marker appears as in the example more when use: Markerwithlabel the image some does not appear
– Carlos Alexandre R Ramos