@@ -7819,7 +7819,7 @@ var Mutation3dVisView = Backbone.View.extend({
78197819
78207820 // initially hide the 3d visualizer container
78217821 var container3d = self.$el;
7822- container3d.hide();
7822+ // container3d.hide();
78237823
78247824 // initially hide the residue warning message
78257825 self.hideResidueWarning();
@@ -7837,6 +7837,7 @@ var Mutation3dVisView = Backbone.View.extend({
78377837 if (mut3dVis != null)
78387838 {
78397839 mut3dVis.updateContainer(container3d);
7840+ mut3dVis.show();
78407841 }
78417842
78427843 // add listeners to panel (header) buttons
@@ -7874,6 +7875,8 @@ var Mutation3dVisView = Backbone.View.extend({
78747875 // init buttons
78757876 self._initButtons();
78767877
7878+ self.showMainLoader();
7879+
78777880 // make the main container draggable
78787881 container3d.draggable({
78797882 handle: ".mutation-3d-info-title",
@@ -8267,7 +8270,6 @@ var Mutation3dVisView = Backbone.View.extend({
82678270 chain.positionMap = positionMap;
82688271
82698272 // reload the selected pdb and chain data
8270- mut3dVis.show();
82718273 self.refreshView(pdbId, chain);
82728274
82738275 // store pdb id and chain for future reference
@@ -8290,6 +8292,8 @@ var Mutation3dVisView = Backbone.View.extend({
82908292 model.molInfo = summary.molecule;
82918293 }
82928294
8295+ self.hideMainLoader();
8296+
82938297 // init info view
82948298 var infoView = new Mutation3dVisInfoView(
82958299 {el: self.$el.find(".mutation-3d-info"), model: model});
@@ -8300,6 +8304,8 @@ var Mutation3dVisView = Backbone.View.extend({
83008304 pdbProxy.getPositionMap(geneSymbol, chain, mapCallback);
83018305 };
83028306
8307+ self.showMainLoader();
8308+ mut3dVis.show();
83038309 pdbProxy.getPdbInfo(pdbId, infoCallback);
83048310 },
83058311 /**
@@ -8526,6 +8532,20 @@ var Mutation3dVisView = Backbone.View.extend({
85268532 self.dispatcher.trigger(
85278533 MutationDetailsEvents.VIEW_3D_PANEL_CLOSED);
85288534 },
8535+ /**
8536+ * Shows the 3D visualizer panel.
8537+ */
8538+ showView: function()
8539+ {
8540+ var self = this;
8541+ var mut3dVis = self.options.mut3dVis;
8542+
8543+ // hide the vis pane
8544+ if (mut3dVis != null)
8545+ {
8546+ mut3dVis.show();
8547+ }
8548+ },
85298549 isVisible: function()
85308550 {
85318551 var self = this;
@@ -8621,6 +8641,36 @@ var Mutation3dVisView = Backbone.View.extend({
86218641 // show actual vis container
86228642 container.css("height", self._actualHeight);
86238643 },
8644+ /**
8645+ * Shows the loader for the entire panel body.
8646+ */
8647+ showMainLoader: function()
8648+ {
8649+ var self = this;
8650+ var loaderImage = self.$el.find(".mutation-3d-vis-main-loader");
8651+ var mainContent = self.$el.find(".mutation-3d-vis-body");
8652+
8653+ // show the image
8654+ loaderImage.show();
8655+
8656+ // hide the main body
8657+ mainContent.hide();
8658+ },
8659+ /**
8660+ * Hides the loader image and shows the main content (panel body).
8661+ */
8662+ hideMainLoader: function()
8663+ {
8664+ var self = this;
8665+ var loaderImage = self.$el.find(".mutation-3d-vis-main-loader");
8666+ var mainContent = self.$el.find(".mutation-3d-vis-body");
8667+
8668+ // show the image
8669+ loaderImage.hide();
8670+
8671+ // hide the main body
8672+ mainContent.show();
8673+ },
86248674 /**
86258675 * Shows a warning message for unmapped residues.
86268676 *
@@ -13687,48 +13737,53 @@ function Mutation3dVis(name, options)
1368713737 if (_container != null)
1368813738 {
1368913739 _container.show();
13690-
13691- // this is a workaround. see the hide() function below for details
13692-
13693- var currentTop = parseInt(_container.css('top'));
13694-
13695- // update the top position only if it is negative
13696- if (currentTop < 0)
13697- {
13698- if (_prevTop != null && _prevTop > 0)
13699- {
13700- _container.css('top', _prevTop);
13701- }
13702- else
13703- {
13704- _container.css('top', 0);
13705- }
13706- }
1370713740 }
13741+
13742+ // // this is a workaround. see the hide() function below for details
13743+ //
13744+ // var currentTop = parseInt(_container.css('top'));
13745+ //
13746+ // // update the top position only if it is negative
13747+ // if (currentTop < 0)
13748+ // {
13749+ // if (_prevTop != null && _prevTop > 0)
13750+ // {
13751+ // _container.css('top', _prevTop);
13752+ // }
13753+ // else
13754+ // {
13755+ // _container.css('top', 0);
13756+ // }
13757+ // }
13758+ //}
1370813759 }
1370913760
1371013761 /**
1371113762 * Hides the visualizer panel.
1371213763 */
1371313764 function hide()
1371413765 {
13715- // TODO jQuery.hide function is problematic after Jmol init
13716- // Reloading the PDB data throws an error message (Error: Bad NPObject as private data!)
13717- // see https://code.google.com/p/gdata-issues/issues/detail?id=4820
13718-
13719- // So, the current workaround is to reposition instead of hiding
1372013766 if (_container != null)
1372113767 {
13722- //_container.hide();
13723- var currentTop = parseInt(_container.css('top'));
13724-
13725- if (currentTop > 0)
13726- {
13727- _prevTop = currentTop;
13728- }
13729-
13730- _container.css('top', -9999);
13768+ _container.hide();
1373113769 }
13770+
13771+ // jQuery.hide function is problematic after Jmol init
13772+ // Reloading the PDB data throws an error message (Error: Bad NPObject as private data!)
13773+ // see https://code.google.com/p/gdata-issues/issues/detail?id=4820
13774+ // So, the current workaround is to reposition instead of hiding
13775+ //if (_container != null)
13776+ //{
13777+ // //_container.hide();
13778+ // var currentTop = parseInt(_container.css('top'));
13779+ //
13780+ // if (currentTop > 0)
13781+ // {
13782+ // _prevTop = currentTop;
13783+ // }
13784+ //
13785+ // _container.css('top', -9999);
13786+ //}
1373213787 }
1373313788
1373413789 /**
@@ -17931,11 +17986,17 @@ MutationDiagram.prototype.highlightMutation = function(mutationSid)
1793117986 var self = this;
1793217987
1793317988 var pileupId = self.mutationPileupMap[mutationSid];
17934- var pileup = self.svg.select("#" + pileupId);
1793517989
17936- if (pileup.length > 0)
17990+ // there may not be a pileup corresponding to the given sid,
17991+ // because not every mutation is mapped onto the diagram
17992+ if (pileupId != null)
1793717993 {
17938- self.highlight(pileup[0][0]);
17994+ var pileup = self.svg.select("#" + pileupId);
17995+
17996+ if (pileup.length > 0)
17997+ {
17998+ self.highlight(pileup[0][0]);
17999+ }
1793918000 }
1794018001};
1794118002
@@ -21074,6 +21135,13 @@ function Mutation3dController(mutationDetailsView, mainMutationView, viewOptions
2107421135 }
2107521136 };
2107621137
21138+ if (mut3dView != null &&
21139+ _mut3dVisView != null)
21140+ {
21141+ _mut3dVisView.showMainLoader();
21142+ _mut3dVisView.showView();
21143+ }
21144+
2107721145 // init view with the pdb data
2107821146 pdbProxy.getPdbData(uniprotId, initView);
2107921147 }
0 commit comments