Implement maxWidth for Marker InfoWindow#503
Implement maxWidth for Marker InfoWindow#503hirbod merged 6 commits intomapsplugin:masterfrom trancee:master
Conversation
This can be percentage (%) or just a numeric value from 0.0 to 1.0 for percentile representation, or the numeric width in pixels.
|
Looks good to me. We'll wait until someone or masashi had find time to develop it for android. |
|
@hirbod, I actually made the commit for both platforms. Could someone review and test my pull request, and if all is good, push it into the master branch? It already works for me as expected. Thanks! |
|
Your right, sorry for that. Did not look close enough. I'm fine with that but the final decision has to be made by Masashi. He is very busy these days, please be patient. |
|
@masashiGMS @wf9a5m75 I'd like to merge this. Ok? |
|
Dear @trancee would you please be so kind and provide a short documentation? I would like to add it to the wiki and finally merge this one here |
|
@hirbod, thanks for finally merging this pull request. It has been quite some time. Generally, I have tried to apply the same logic as in the original Google Maps implementation, with one slight difference. Besides the option maxWidth for defining the maximum width of the InfoWindow, there is a new option width to define the initial width of the InfoWindow. This can be percentage (%) or just a numeric value from 0.0 to 1.0 for percentile representation, or the numeric width in pixels. I hope that helps. |
|
@trancee thanks, could you please provide some examples what is possible for the documentation. I have limited time currently. |
|
@hirbod yes, sure. That is an example how I am using it in my project: map.addMarker (
{
"position": position,
"title": "This is the title.",
"snippet": "And the description of this marker.",
"styles": {
"maxWidth": "80%"
},
// allows all users to drag the marker.
"draggable": false
}, ...
|
Implement maxWidth for Marker InfoWindow
|
@trancee just merged your code, but I get: |
|
I'll change your code. NSNumberFormatter *nf = [[NSNumberFormatter alloc] init]; // new
BOOL isNumeric = [nf numberFromString:widthString] != nil; // new
...
...
...
//} else if ([widthString isNumeric:widthString]) {
} else if (isNumeric) { |
|
Strange, I did not get those errors. But thanks for fixing them! |
If there is much text in the content of the InfoWindow, currently it takes up full width of the available map screen and just does not look good.
I have added a new option called "width" to the styles dictionary. With this it is possible to set the width of the InfoWindow by specifying either a numeric value (pixel), or a percentage (0.0-1.0) or 50%.