diff --git a/frontend-js/src/main/js/map/AbstractCustomMap.js b/frontend-js/src/main/js/map/AbstractCustomMap.js index 0241373a2a9e94f7b5340386df18834ba286911b..0793b60d3b6ba805002e411866bde6f2b1a58811 100644 --- a/frontend-js/src/main/js/map/AbstractCustomMap.js +++ b/frontend-js/src/main/js/map/AbstractCustomMap.js @@ -805,10 +805,12 @@ AbstractCustomMap.prototype._openInfoWindowForReaction = function (reaction, goo infoWindow = new ReactionInfoWindow({ reaction: reaction, map: self, - marker: googleMarker, + marker: googleMarker }); self._reactionInfoWindow[reaction.getId()] = infoWindow; return infoWindow.init(); + }).then(function () { + return infoWindow.open(); }).then(function () { return infoWindow; }); diff --git a/frontend-js/src/main/js/map/window/AbstractInfoWindow.js b/frontend-js/src/main/js/map/window/AbstractInfoWindow.js index 7b0378b139cbfeb65750045c55b1bb110150f6a9..544fb08307676531b19c408dbffd0e690757ea9c 100644 --- a/frontend-js/src/main/js/map/window/AbstractInfoWindow.js +++ b/frontend-js/src/main/js/map/window/AbstractInfoWindow.js @@ -147,9 +147,10 @@ AbstractInfoWindow.prototype.open = function (newMarker) { * new content of the window */ AbstractInfoWindow.prototype.setContent = function (content) { - this._content = content; - if (this.googleInfowindow !== undefined) { - this.googleInfowindow.setContent(content); + var self = this; + self._content = content; + if (self.googleInfowindow !== undefined) { + self.googleInfowindow.setContent(content); } }; @@ -381,9 +382,8 @@ AbstractInfoWindow.prototype._updateContent = function () { contentDiv.appendChild(overlaysDiv); } self.setContent(contentDiv); - - self.callListeners("onUpdate"); - + return self.callListeners("onUpdate"); + }).then(function () { return contentDiv; }); } diff --git a/frontend-js/src/main/js/map/window/ReactionInfoWindow.js b/frontend-js/src/main/js/map/window/ReactionInfoWindow.js index 1f566037b923e749413ae6e743bf4a44dfa2ed50..200384d00e74d88f9697b4df952860d616b88bba 100644 --- a/frontend-js/src/main/js/map/window/ReactionInfoWindow.js +++ b/frontend-js/src/main/js/map/window/ReactionInfoWindow.js @@ -36,7 +36,6 @@ function ReactionInfoWindow(params) { return MathJax.Hub.Queue(["Typeset", MathJax.Hub]); }); } - self.googleInfowindow.open(self.getCustomMap().getGoogleMap(), self.getGoogleMarker()); } ReactionInfoWindow.prototype = Object.create(AbstractInfoWindow.prototype); @@ -88,10 +87,6 @@ ReactionInfoWindow.prototype.createContentDiv = function () { }).then(function (parameters) { result.appendChild(self.createSbmlParameterDiv(parameters)); result.appendChild(self.createKineticsElementsDiv(reaction.getElements())); - - if (global.MathJax !== undefined) { - return MathJax.Hub.Queue(["Typeset", MathJax.Hub]); - } }).then(function () { return Promise.resolve(result); }); diff --git a/frontend-js/src/test/js/map/window/ReactionInfoWindow-test.js b/frontend-js/src/test/js/map/window/ReactionInfoWindow-test.js index 125ab1088d651824ec77a3b07c480e9cb5b66053..b8f33d0f26da8d21aec326c412ba49d0c3156620 100644 --- a/frontend-js/src/test/js/map/window/ReactionInfoWindow-test.js +++ b/frontend-js/src/test/js/map/window/ReactionInfoWindow-test.js @@ -32,7 +32,7 @@ describe('ReactionInfoWindow', function () { it("with invalid kinetics", function () { var map = helper.createCustomMap(); - var reaction = helper.createReaction(map); + var reaction = helper.createReaction(map, true); reaction.setKineticLaw(new KineticLaw({ definition: '<math xmlns="http://www.w3.org/1998/Math/MathML">' + '<apply xmlns="http://www.w3.org/1998/Math/MathML">' + @@ -53,7 +53,7 @@ describe('ReactionInfoWindow', function () { it("with kinetics", function () { var map = helper.createCustomMap(); - var reaction = helper.createReaction(map); + var reaction = helper.createReaction(map, true); reaction.setKineticLaw(new KineticLaw({ definition: '<math xmlns="http://www.w3.org/1998/Math/MathML">' + '<apply xmlns="http://www.w3.org/1998/Math/MathML">' + @@ -81,7 +81,7 @@ describe('ReactionInfoWindow', function () { var sbmlFunction = helper.createSbmlFunction(); map.getModel().addSbmlFunction(sbmlFunction); - var reaction = helper.createReaction(map); + var reaction = helper.createReaction(map, true); reaction.setKineticLaw(helper.createKineticLaw()); reaction.getKineticLaw().getFunctionIds().push(sbmlFunction.getId()); @@ -101,7 +101,7 @@ describe('ReactionInfoWindow', function () { var sbmlParameter = helper.createSbmlParameter(); map.getModel().addSbmlParameter(sbmlParameter); - var reaction = helper.createReaction(map); + var reaction = helper.createReaction(map, true); reaction.setKineticLaw(helper.createKineticLaw()); reaction.getKineticLaw().getParameterIds().push(sbmlParameter.getId());