Bug fix: Uncaught TypeError: Cannot read property 'getMap' of undefined" in HTMLInfoWindow.close
MODIFY
www/HtmlInfoWindow.js
www/HtmlInfoWindow.js
@@ -166,21 +166,32 @@ var HTMLInfoWindow = function() {
utils.extend(HTMLInfoWindow, BaseClass);
+
+HTMLInfoWindow.prototype.isInfoWindowShown = function() {
+ return self.get("marker") ? true : false;
+};
+
HTMLInfoWindow.prototype.close = function() {
var self = this;
var marker = self.get("marker");
+ if (!marker) {
+ return;
+ }
+ this.set('marker', undefined);
+
var map = marker.getMap();
map.off("infoPosition_changed");
marker.off("icon_changed");
marker.off("infoWindowAnchor_changed");
- marker.off(event.INFO_CLOSE, self.close);
+ marker.trigger(event.INFO_CLOSE);
+ self.trigger(event.INFO_CLOSE);
+ //marker.off(event.INFO_CLOSE, self.close);
map.set("active_marker_id", null);
var div = map.getDiv();
var frame = self.get("frame");
div.removeChild(frame);
- this.set('marker', undefined);
// Remove the contents from this HTMLInfoWindow
var contentFrame = frame.firstChild;

MODIFY
www/Map.js
www/Map.js
@@ -41,8 +41,10 @@ var Map = function(id) {
self.on("active_marker_id_changed", function(prevId, newId) {
if (prevId in self.MARKERS) {
+ if (self.MARKERS[prevId].isInfoWindowShown()) {
self.MARKERS[prevId].trigger.call(self.MARKERS[prevId], event.INFO_CLOSE);
}
+ }
exec(null, null, self.id + "-marker", 'setActiveMarkerId', [newId]);
});
};

Bug fix: Uncaught TypeError: Cannot read property 'getMap' of undefined" in HTMLInfoWindow.close (#1536)