Skip to content
Snippets Groups Projects
Commit 6424d98b authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '188-show-infowindow' into 'master'

fix on reopening info window on submap

Closes #188

See merge request !96
parents 6eaf4b0f 2034397a
No related branches found
No related tags found
1 merge request!96fix on reopening info window on submap
......@@ -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");
}
......
......@@ -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() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment