Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved 3D panel initialization #58

Merged
merged 3 commits into from
Oct 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build/mutationMapper.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
z-index: 2;
overflow: hidden;
}
.mutation-3d-vis-loader {
.mutation-3d-vis-loader,
.mutation-3d-vis-main-loader {
text-align: center;
}
.mutation-3d-vis-help-init {
Expand Down
140 changes: 104 additions & 36 deletions build/mutationMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7819,7 +7819,7 @@ var Mutation3dVisView = Backbone.View.extend({

// initially hide the 3d visualizer container
var container3d = self.$el;
container3d.hide();
//container3d.hide();

// initially hide the residue warning message
self.hideResidueWarning();
Expand All @@ -7837,6 +7837,7 @@ var Mutation3dVisView = Backbone.View.extend({
if (mut3dVis != null)
{
mut3dVis.updateContainer(container3d);
mut3dVis.show();
}

// add listeners to panel (header) buttons
Expand Down Expand Up @@ -7874,6 +7875,8 @@ var Mutation3dVisView = Backbone.View.extend({
// init buttons
self._initButtons();

self.showMainLoader();

// make the main container draggable
container3d.draggable({
handle: ".mutation-3d-info-title",
Expand Down Expand Up @@ -8267,7 +8270,6 @@ var Mutation3dVisView = Backbone.View.extend({
chain.positionMap = positionMap;

// reload the selected pdb and chain data
mut3dVis.show();
self.refreshView(pdbId, chain);

// store pdb id and chain for future reference
Expand All @@ -8290,6 +8292,8 @@ var Mutation3dVisView = Backbone.View.extend({
model.molInfo = summary.molecule;
}

self.hideMainLoader();

// init info view
var infoView = new Mutation3dVisInfoView(
{el: self.$el.find(".mutation-3d-info"), model: model});
Expand All @@ -8300,6 +8304,8 @@ var Mutation3dVisView = Backbone.View.extend({
pdbProxy.getPositionMap(geneSymbol, chain, mapCallback);
};

self.showMainLoader();
mut3dVis.show();
pdbProxy.getPdbInfo(pdbId, infoCallback);
},
/**
Expand Down Expand Up @@ -8526,6 +8532,20 @@ var Mutation3dVisView = Backbone.View.extend({
self.dispatcher.trigger(
MutationDetailsEvents.VIEW_3D_PANEL_CLOSED);
},
/**
* Shows the 3D visualizer panel.
*/
showView: function()
{
var self = this;
var mut3dVis = self.options.mut3dVis;

// hide the vis pane
if (mut3dVis != null)
{
mut3dVis.show();
}
},
isVisible: function()
{
var self = this;
Expand Down Expand Up @@ -8621,6 +8641,36 @@ var Mutation3dVisView = Backbone.View.extend({
// show actual vis container
container.css("height", self._actualHeight);
},
/**
* Shows the loader for the entire panel body.
*/
showMainLoader: function()
{
var self = this;
var loaderImage = self.$el.find(".mutation-3d-vis-main-loader");
var mainContent = self.$el.find(".mutation-3d-vis-body");

// show the image
loaderImage.show();

// hide the main body
mainContent.hide();
},
/**
* Hides the loader image and shows the main content (panel body).
*/
hideMainLoader: function()
{
var self = this;
var loaderImage = self.$el.find(".mutation-3d-vis-main-loader");
var mainContent = self.$el.find(".mutation-3d-vis-body");

// show the image
loaderImage.hide();

// hide the main body
mainContent.show();
},
/**
* Shows a warning message for unmapped residues.
*
Expand Down Expand Up @@ -13687,48 +13737,53 @@ function Mutation3dVis(name, options)
if (_container != null)
{
_container.show();

// this is a workaround. see the hide() function below for details

var currentTop = parseInt(_container.css('top'));

// update the top position only if it is negative
if (currentTop < 0)
{
if (_prevTop != null && _prevTop > 0)
{
_container.css('top', _prevTop);
}
else
{
_container.css('top', 0);
}
}
}

// // this is a workaround. see the hide() function below for details
//
// var currentTop = parseInt(_container.css('top'));
//
// // update the top position only if it is negative
// if (currentTop < 0)
// {
// if (_prevTop != null && _prevTop > 0)
// {
// _container.css('top', _prevTop);
// }
// else
// {
// _container.css('top', 0);
// }
// }
//}
}

/**
* Hides the visualizer panel.
*/
function hide()
{
// TODO jQuery.hide function is problematic after Jmol init
// Reloading the PDB data throws an error message (Error: Bad NPObject as private data!)
// see https://code.google.com/p/gdata-issues/issues/detail?id=4820

// So, the current workaround is to reposition instead of hiding
if (_container != null)
{
//_container.hide();
var currentTop = parseInt(_container.css('top'));

if (currentTop > 0)
{
_prevTop = currentTop;
}

_container.css('top', -9999);
_container.hide();
}

// jQuery.hide function is problematic after Jmol init
// Reloading the PDB data throws an error message (Error: Bad NPObject as private data!)
// see https://code.google.com/p/gdata-issues/issues/detail?id=4820
// So, the current workaround is to reposition instead of hiding
//if (_container != null)
//{
// //_container.hide();
// var currentTop = parseInt(_container.css('top'));
//
// if (currentTop > 0)
// {
// _prevTop = currentTop;
// }
//
// _container.css('top', -9999);
//}
}

/**
Expand Down Expand Up @@ -17931,11 +17986,17 @@ MutationDiagram.prototype.highlightMutation = function(mutationSid)
var self = this;

var pileupId = self.mutationPileupMap[mutationSid];
var pileup = self.svg.select("#" + pileupId);

if (pileup.length > 0)
// there may not be a pileup corresponding to the given sid,
// because not every mutation is mapped onto the diagram
if (pileupId != null)
{
self.highlight(pileup[0][0]);
var pileup = self.svg.select("#" + pileupId);

if (pileup.length > 0)
{
self.highlight(pileup[0][0]);
}
}
};

Expand Down Expand Up @@ -21074,6 +21135,13 @@ function Mutation3dController(mutationDetailsView, mainMutationView, viewOptions
}
};

if (mut3dView != null &&
_mut3dVisView != null)
{
_mut3dVisView.showMainLoader();
_mut3dVisView.showView();
}

// init view with the pdb data
pdbProxy.getPdbData(uniprotId, initView);
}
Expand Down
2 changes: 1 addition & 1 deletion build/mutationMapper.min.css

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions build/mutationMapper.min.js

Large diffs are not rendered by default.

Loading