diff --git a/frontend-js/src/main/js/map/AbstractCustomMap.js b/frontend-js/src/main/js/map/AbstractCustomMap.js index b2af8d23694c21c81f4677e476285575e75434b1..d14c68dd1fbd43792ea74cd248af577fe7864f9f 100644 --- a/frontend-js/src/main/js/map/AbstractCustomMap.js +++ b/frontend-js/src/main/js/map/AbstractCustomMap.js @@ -673,7 +673,7 @@ AbstractCustomMap.prototype._openInfoWindowForAlias = function(alias, googleMark var infoWindow = this.getAliasInfoWindowById(alias.getId()); if (infoWindow !== null && infoWindow !== undefined) { if (!infoWindow.isOpened()) { - infoWindow.open(); + infoWindow.open(googleMarker); } else { logger.warn("Info window for alias: " + alias.getId() + " is already opened"); } @@ -739,15 +739,16 @@ AbstractCustomMap.prototype._refreshInfoWindows = function() { */ AbstractCustomMap.prototype._openInfoWindowForIdentifiedElement = function(element, googleMarker) { var self = this; + var submap = self.getSubmapById(element.getModelId()); if (element.getType() === "ALIAS") { - return self.getModel().getByIdentifiedElement(element).then(function(alias) { - return self._openInfoWindowForAlias(alias, googleMarker); + return submap.getModel().getByIdentifiedElement(element).then(function(alias) { + return submap._openInfoWindowForAlias(alias, googleMarker); }); } else if (element.getType() === "POINT") { - return self._openInfoWindowForPoint(new PointData(element), googleMarker); + return submap._openInfoWindowForPoint(new PointData(element), googleMarker); } else if (element.getType() === "REACTION") { - return self.getModel().getByIdentifiedElement(element).then(function(reaction) { - return self._openInfoWindowForReaction(reaction, googleMarker); + return submap.getModel().getByIdentifiedElement(element).then(function(reaction) { + return submap._openInfoWindowForReaction(reaction, googleMarker); }); } else { throw new Error("Unknown element type: " + element.getType()); @@ -765,7 +766,7 @@ AbstractCustomMap.prototype._openInfoWindowForReaction = function(reaction, goog var self = this; if (infoWindow !== null && infoWindow !== undefined) { if (!infoWindow.isOpened()) { - infoWindow.open(); + infoWindow.open(googleMarker); } else { logger.warn("Info window for reaction: " + reaction.getId() + " is already opened"); } @@ -791,7 +792,7 @@ AbstractCustomMap.prototype._openInfoWindowForPoint = function(pointData, google var infoWindow = this.getPointInfoWindowById(pointData.getId()); if (infoWindow !== null && infoWindow !== undefined) { if (!infoWindow.isOpened()) { - infoWindow.open(); + infoWindow.open(googleMarker); } else { logger.warn("Info window for point: " + pointData.getId() + " is already opened"); } diff --git a/frontend-js/src/main/js/map/window/AbstractInfoWindow.js b/frontend-js/src/main/js/map/window/AbstractInfoWindow.js index 612b8b2d408395558ae6e9fc1a06d4e52f85dda9..e807019a6f9036c35e5b01b0f11f8e609005d31d 100644 --- a/frontend-js/src/main/js/map/window/AbstractInfoWindow.js +++ b/frontend-js/src/main/js/map/window/AbstractInfoWindow.js @@ -121,12 +121,15 @@ AbstractInfoWindow.prototype.isOpened = function() { /** * Opens Info Window. */ -AbstractInfoWindow.prototype.open = function() { +AbstractInfoWindow.prototype.open = function(newMarker) { var self = this; if (self.googleInfowindow === null) { logger.warn("Cannot open window."); return; } + if (newMarker !== undefined) { + self.setGoogleMarker(newMarker); + } self.googleInfowindow.open(self.getCustomMap().getGoogleMap(), self.getGoogleMarker()); return self.update().then(function() {