prasanth13131 / geoxml3

Automatically exported from code.google.com/p/geoxml3
0 stars 0 forks source link

Standardize InfoWindowOptions handling for a marker #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Does it make sense to standardize on the way InfoWindowOptions is managed for a 
marker?  Currently it varies when an infowindow is passed in the parser options 
(and implicitly when only one window is used).

      if (parserOptions.infoWindow) {
        marker.infoWindow = parserOptions.infoWindow;
      } else {
        marker.infoWindow = new google.maps.InfoWindow(infoWindowOptions);
      }
      // Infowindow-opening event handler
      google.maps.event.addListener(marker, 'click', function() {
        this.infoWindow.close();
        marker.infoWindow.setOptions(infoWindowOptions);
        this.infoWindow.open(this.map, this);
      });

May I suggest instead:

      if (parserOptions.infoWindow) {
        marker.infoWindow = parserOptions.infoWindow;
      } else {
        marker.infoWindow = new google.maps.InfoWindow();
      }
    marker.infoWindowOptions = infoWindowOptions;

    // Infowindow-opening event handler
      google.maps.event.addListener(marker, 'click', function() {
        this.infoWindow.close();
        marker.infoWindow.setOptions(this.infoWindowOptions);
        this.infoWindow.open(this.map, this);
      });

Original issue reported on code.google.com by johnbyr...@gmail.com on 28 Sep 2011 at 2:16

GoogleCodeExporter commented 9 years ago
Where does this cause an issue?

Under what conditions did you observe a difference in the behavior?

Original comment by geocodezip on 28 Sep 2011 at 11:57

GoogleCodeExporter commented 9 years ago
Thanks for the quick reply.

I have a custom placemark parser for the options passed to geoxml.  This
parser sets the content for the placemark differently for mobile devices

options: {
        pmParseFn: (function addAttributes (node, placemark) {
              if (tisMobile)
                    placemark.description =
geoXML3.nodeValue(node.getElementsByTagName('description_Mobile')[0]);
        }),
  };

I was unable to get this custom description to display in the InfoWindow
until I made the change.

JB

Original comment by johnbyr...@gmail.com on 29 Sep 2011 at 1:42

GoogleCodeExporter commented 9 years ago
implemented revision #60
Please verify addresses your request.

Original comment by geocodezip on 2 Oct 2011 at 2:07