Skip to content

Implement maxWidth for Marker InfoWindow#503

Merged
hirbod merged 6 commits intomapsplugin:masterfrom
trancee:master
Sep 3, 2015
Merged

Implement maxWidth for Marker InfoWindow#503
hirbod merged 6 commits intomapsplugin:masterfrom
trancee:master

Conversation

@trancee
Copy link
Contributor

@trancee trancee commented Apr 21, 2015

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%.

Philipp Grosswiler and others added 6 commits April 20, 2015 10:49
@hirbod
Copy link
Contributor

hirbod commented May 3, 2015

Looks good to me. We'll wait until someone or masashi had find time to develop it for android.

@trancee
Copy link
Contributor Author

trancee commented May 4, 2015

@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!

@hirbod
Copy link
Contributor

hirbod commented May 4, 2015

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.

@hirbod
Copy link
Contributor

hirbod commented Jul 9, 2015

@masashiGMS @wf9a5m75 I'd like to merge this. Ok?

@hirbod
Copy link
Contributor

hirbod commented Sep 1, 2015

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

@trancee
Copy link
Contributor Author

trancee commented Sep 2, 2015

@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.

@hirbod
Copy link
Contributor

hirbod commented Sep 2, 2015

@trancee thanks, could you please provide some examples what is possible for the documentation. I have limited time currently.

@trancee
Copy link
Contributor Author

trancee commented Sep 3, 2015

@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
    }, ...

hirbod pushed a commit that referenced this pull request Sep 3, 2015
Implement maxWidth for Marker InfoWindow
@hirbod hirbod merged commit 5a7a7c5 into mapsplugin:master Sep 3, 2015
@hirbod
Copy link
Contributor

hirbod commented Sep 3, 2015

@trancee just merged your code, but I get:

...platforms/ios/Nachbarschaft/Plugins/plugin.google.maps/GoogleMapsViewController.m:385:27: error: 
      no visible @interface for 'NSString' declares the selector 'isNumeric:'
                } else if ([widthString isNumeric:widthString]) {
                            ~~~~~~~~~~~ ^~~~~~~~~
...platforms/ios/Nachbarschaft/Plugins/plugin.google.maps/GoogleMapsViewController.m:408:27: error: 
      no visible @interface for 'NSString' declares the selector 'isNumeric:'
                } else if ([widthString isNumeric:widthString]) {

@hirbod
Copy link
Contributor

hirbod commented Sep 3, 2015

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) {

@trancee
Copy link
Contributor Author

trancee commented Sep 4, 2015

Strange, I did not get those errors. But thanks for fixing them!

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

Successfully merging this pull request may close these issues.

2 participants