From 87de8107303173c806852cef70817349ac4785a8 Mon Sep 17 00:00:00 2001 From: "Wang, Jiyao" Date: Fri, 8 Mar 2019 15:16:14 -0500 Subject: [PATCH 1/2] fix link in README --- README.md | 2 +- src/icn3dui/annotations/addtrack.js | 13 ++- src/icn3dui/annotations/annotations.js | 128 +++++++++---------------- src/icn3dui/html/set_html.js | 2 +- 4 files changed, 57 insertions(+), 88 deletions(-) diff --git a/README.md b/README.md index b0138c96..de9492f8 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ iCn3D can be embedded in a web page by including the URL in HTML iframe, e.g. 1) { - var pdbid2 = pdbArray[1]; - url = "https://www.ncbi.nlm.nih.gov/Structure/mmdb/mmdb_strview.cgi?v=2&program=icn3d&domain&molinfor&uid=" + pdbid2; - - $.ajax({ - url: url, - dataType: 'json', - cache: true, - tryCount : 0, - retryLimit : 1, - success: function(data) { - me.mmdb_data2 = data; - - for(var chnid in me.protein_chainid) { - if(chnid.indexOf(pdbid2) !== -1) { - me.showDomainWithData(chnid, me.mmdb_data2); - } - } - - // add here after the ajax call - me.enableHlSeq(); - - me.bAjax3ddomain = true; - bAjaxDone2 = true; - - if(me.deferred3ddomain !== undefined) { - if(me.cfg.align === undefined) { - me.deferred3ddomain.resolve(); - } - else if(bAjaxDone1 && bAjaxDone2) { - me.deferred3ddomain.resolve(); - } - } - }, - error : function(xhr, textStatus, errorThrown ) { - this.tryCount++; - if (this.tryCount <= this.retryLimit) { - //try again - $.ajax(this); - return; - } - - console.log( "No 3D domain data were found for the protein " + pdbid + "..." ); - - for(var chnid in me.protein_chainid) { - if(chnid.indexOf(pdbid2) !== -1) { - $("#" + me.pre + "dt_domain_" + chnid).html(''); - $("#" + me.pre + "ov_domain_" + chnid).html(''); - $("#" + me.pre + "tt_domain_" + chnid).html(''); - } - } +iCn3DUI.prototype.showDomainAll = function() { var me = this; + //var chnid = Object.keys(me.protein_chainid)[0]; + //var pdbid = chnid.substr(0, chnid.indexOf('_')); + var pdbArray = Object.keys(me.icn3d.structures); - me.enableHlSeq(); + // show 3D domains + me.mmdb_dataArray = []; - me.bAjax3ddomain = true; - bAjaxDone2 = true; + me.bAjaxDoneArray = []; + for(var i = 0, il = pdbArray.length; i < il; ++i) { + me.bAjaxDoneArray[i] = false; + } - if(me.deferred3ddomain !== undefined) { - if(me.cfg.align === undefined) { - me.deferred3ddomain.resolve(); - } - else if(bAjaxDone1 && bAjaxDone2) { - me.deferred3ddomain.resolve(); - } - } - return; - } - }); + for(var i = 0, il = pdbArray.length; i < il; ++i) { + me.showDomainPerStructure(i); } }; diff --git a/src/icn3dui/html/set_html.js b/src/icn3dui/html/set_html.js index e4d871d5..c1edab43 100644 --- a/src/icn3dui/html/set_html.js +++ b/src/icn3dui/html/set_html.js @@ -1210,7 +1210,7 @@ iCn3DUI.prototype.setDialogs = function() { var me = this; html += " "; From 058d2327bc3a9d453a4059f9bc55bd7315980482 Mon Sep 17 00:00:00 2001 From: "Wang, Jiyao" Date: Tue, 12 Mar 2019 12:47:06 -0400 Subject: [PATCH 2/2] Added commands for up arraow and down arrow after picking a residue --- CHANGELOG.md | 2 + README.md | 2 +- icn3d.html | 20 +++- package.json | 2 +- src/icn3d/icn3d.js | 2 +- src/icn3d/other.js | 156 ++++------------------------- src/icn3dui/full_ui.js | 157 +++++++++++++++++++++++++++--- src/icn3dui/selection/commands.js | 6 ++ 8 files changed, 190 insertions(+), 157 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 229e3450..b86ceeb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ ## Change Log +The production version [icn3d-2.5.3](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.5.3.zip) was release on March 12, 2019. Added commands for up arraow and down arrow after picking a residue. + The production version [icn3d-2.5.2](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.5.2.zip) was release on March 5, 2019. The style Lines was fixed by replacing THREE.Line with THREE.LineSegments. The production version [icn3d-2.5.1](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.5.1.zip) was release on February 14, 2019. Change log was moved to the file CHANGELOG.md. Share Link was changed from https://d55qc.app.goo.gl/### to https://icn3d.page.link/###. All previous share links still work. iCn3D library file was renamed from full_ui_all_#.#.#.min.js to icn3d_full_ui_#.#.#.min.js. Both files are available to make it backward compatible. diff --git a/README.md b/README.md index de9492f8..d3d82cbe 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ We provided two types of iCn3D widgets: [basic interface](https://www.ncbi.nlm.n Either of these widgets could be easily added to your own web pages. Please see the [help page](https://www.ncbi.nlm.nih.gov/Structure/icn3d/docs/icn3d_help.html#HowToUse) for more details. -Complete package of iCn3D including Three.js and jQuery can be downloaded from [https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.5.2.zip](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.5.2.zip). The "Download ZIP" link in this page does not include third-party libraries. +Complete package of iCn3D including Three.js and jQuery can be downloaded from [https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.5.3.zip](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-2.5.3.zip). The "Download ZIP" link in this page does not include third-party libraries. ## Usage diff --git a/icn3d.html b/icn3d.html index 02cf13ec..203dd2b9 100644 --- a/icn3d.html +++ b/icn3d.html @@ -367,6 +367,8 @@

iCn3D Web APIs

outputSelection
selectAAlignChain
selectAChain
+switchHighlightLevelDown
+switchHighlightLevelUp
toggleSelection

Highlight Methods
@@ -668,9 +670,9 @@

Menus, Commands, and Methods of the advanced interfacef) Save Files iCn3D PNG Image: export canvas (URL example: https://www.ncbi.nlm.nih.gov/Structure/icn3d/full.html?mmdbid=1top&command=export%20canvas) saveFile([filename], 'png') -State File: [no command available] saveFile -All Selections: [no command available] saveFile -Residue Counts: [no command available] saveFile +State File: [no command available] saveFile +All Selections: [no command available] saveFile +Residue Counts: [no command available] saveFile Interaction List: export interactions exportInteractions g) Share Link: [no command available] shareLink @@ -711,6 +713,10 @@

Menus, Commands, and Methods of the advanced interfaceOutline: set highlight style outline me.icn3d.bHighlight = 1; 3D Objects: set highlight style 3d me.icn3d.bHighlight = 2; +
l) Switch Highlight Level +↑: highlight level up switchHighlightLevelUp +↓: highlight level down switchHighlightLevelDown +
2b. Selection Definition    
@@ -1771,6 +1777,11 @@

Methods    



showTitle()    
Show the title and PDB ID of the PDB structure at the beginning of the viewer. +

switchHighlightLevelDown()    
+When users pick an atom, a residue, a strand/helix, a chain, or a structure, they can use upper arrow to increase the highlight level by one, or use down arrow to decrease the highlight level by one. This function switchHighlightLevelDown() decreases the highlight level by one. + +

switchHighlightLevelUp()    
+When users pick an atom, a residue, a strand/helix, a chain, or a structure, they can use upper arrow to increase the highlight level by one, or use down arrow to decrease the highlight level by one. This function switchHighlightLevelUp() increases the highlight level by one.

toggleSelection()    
Toggle on and off the current selection. @@ -1799,6 +1810,9 @@

Methods    

Change Log:back to top

+The production version icn3d-2.5.3 was release on March 12, 2019. Added commands for up arraow and down arrow after picking a residue. +

+ The production version icn3d-2.5.2 was release on March 5, 2019. The style Lines was fixed by replacing THREE.Line with THREE.LineSegments.

diff --git a/package.json b/package.json index a1041809..17c68872 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "icn3d", - "version": "2.5.2", + "version": "2.5.3", "description": "iCn3D Structure Viewer", "main": "index.html", "scripts": { diff --git a/src/icn3d/icn3d.js b/src/icn3d/icn3d.js index 7efd7c88..9ca84457 100644 --- a/src/icn3d/icn3d.js +++ b/src/icn3d/icn3d.js @@ -217,7 +217,7 @@ var iCn3D = function (id) { e.preventDefault(); }); - me.switchHighlightLevel(); + //me.switchHighlightLevel(); // key event has to use the document because it requires the focus me.typetext = false; diff --git a/src/icn3d/other.js b/src/icn3d/other.js index 4c439be3..0fa266e2 100644 --- a/src/icn3d/other.js +++ b/src/icn3d/other.js @@ -510,129 +510,6 @@ iCn3D.prototype.addHlObjects = function (color, bRender, atomsHash) { if(bRender === undefined || bRender) this.render(); }; -iCn3D.prototype.switchHighlightLevelBase = function() { var me = this; - $(document).bind('keydown', function (e) { - if(e.keyCode === 38) { // arrow up, select upper level of atoms - e.preventDefault(); - - if(!me.bShift && !me.bCtrl) me.removeHlObjects(); - - if(me.highlightlevel === 1) { // atom -> residue - me.highlightlevel = 2; - - var firstAtom = me.getFirstAtomObj(me.pickedAtomList); - - if(!me.bShift && !me.bCtrl) { - me.hAtoms = me.cloneHash(me.residues[firstAtom.structure + '_' + firstAtom.chain + '_' + firstAtom.resi]); - } - else { - me.hAtoms = me.unionHash(me.hAtoms, me.residues[firstAtom.structure + '_' + firstAtom.chain + '_' + firstAtom.resi]); - } - } - else if(me.highlightlevel === 2) { // residue -> strand - me.highlightlevel = 3; - - var firstAtom = me.getFirstAtomObj(me.pickedAtomList); - if(!me.bShift && !me.bCtrl) { - me.hAtoms = me.cloneHash(me.selectStrandHelixFromAtom(firstAtom)); - } - else { - me.hAtoms = me.unionHash(me.hAtoms, me.selectStrandHelixFromAtom(firstAtom)); - } - } - else if(me.highlightlevel === 3) { // strand -> chain - me.highlightlevel = 4; - - var firstAtom = me.getFirstAtomObj(me.pickedAtomList); - if(!me.bShift && !me.bCtrl) { - me.hAtoms = me.cloneHash(me.chains[firstAtom.structure + '_' + firstAtom.chain]); - } - else { - me.hAtoms = me.unionHash(me.hAtoms, me.chains[firstAtom.structure + '_' + firstAtom.chain]); - } - } - else if(me.highlightlevel === 4 || me.highlightlevel === 5) { // chain -> structure - me.highlightlevel = 5; - - var firstAtom = me.getFirstAtomObj(me.pickedAtomList); - - if(!me.bShift && !me.bCtrl) me.hAtoms = {}; - var chainArray = me.structures[firstAtom.structure]; - for(var i = 0, il = chainArray.length; i < il; ++i) { - me.hAtoms = me.unionHash(me.hAtoms, me.chains[chainArray[i]]); - } - } - - me.addHlObjects(); - } - else if(e.keyCode === 40) { // arrow down, select down level of atoms - e.preventDefault(); - - me.removeHlObjects(); - - if( (me.highlightlevel === 2 || me.highlightlevel === 1) && Object.keys(me.pickedAtomList).length === 1) { // residue -> atom - me.highlightlevel = 1; - - me.hAtoms = me.cloneHash(me.pickedAtomList); - if(!me.bShift && !me.bCtrl) { - me.hAtoms = me.cloneHash(me.pickedAtomList); - } - else { - me.hAtoms = me.unionHash(me.hAtoms, me.pickedAtomList); - } - } - else if(me.highlightlevel === 3) { // strand -> residue - var residueHash = {}; - - for(var i in me.pickedAtomList) { - residueid = me.atoms[i].structure + '_' + me.atoms[i].chain + '_' + me.atoms[i].resi; - residueHash[residueid] = 1; - } - - if(Object.keys(residueHash).length === 1) { - me.highlightlevel = 2; - - var firstAtom = me.getFirstAtomObj(me.pickedAtomList); - if(!me.bShift && !me.bCtrl) { - me.hAtoms = me.cloneHash(me.residues[firstAtom.structure + '_' + firstAtom.chain + '_' + firstAtom.resi]); - } - else { - me.hAtoms = me.unionHash(me.hAtoms, me.residues[firstAtom.structure + '_' + firstAtom.chain + '_' + firstAtom.resi]); - } - } - } - else if(me.highlightlevel === 4) { // chain -> strand - me.highlightlevel = 3; - - var firstAtom = me.getFirstAtomObj(me.pickedAtomList); - if(!me.bShift && !me.bCtrl) { - me.hAtoms = me.cloneHash(me.selectStrandHelixFromAtom(firstAtom)); - } - else { - me.hAtoms = me.unionHash(me.hAtoms, me.selectStrandHelixFromAtom(firstAtom)); - } - } - else if(me.highlightlevel === 5) { // structure -> chain - me.highlightlevel = 4; - - var firstAtom = me.getFirstAtomObj(me.pickedAtomList); - if(!me.bShift && !me.bCtrl) { - me.hAtoms = me.cloneHash(me.chains[firstAtom.structure + '_' + firstAtom.chain]); - } - else { - me.hAtoms = me.unionHash(me.hAtoms, me.chains[firstAtom.structure + '_' + firstAtom.chain]); - } - } - - me.addHlObjects(); - } - }); -}; - -iCn3D.prototype.switchHighlightLevel = function() { var me = this; - this.switchHighlightLevelBase(); -}; - iCn3D.prototype.resetOrientation = function() { var bSet = false; if(this.commands.length > 0) { @@ -757,24 +634,27 @@ iCn3D.prototype.selectStrandHelixFromAtom = function(atom) { // fill the beginning var beginResi = firstAtom.resi; - for(var i = firstAtom.resi - 1; i > 0; --i) { - var residueid = firstAtom.structure + '_' + firstAtom.chain + '_' + i; - if(!this.residues.hasOwnProperty(residueid)) break; - - var atom = this.getFirstCalphaAtomObj(this.residues[residueid]); - beginResi = atom.resi; - - if( (firstAtom.ss !== 'coil' && atom.ss === firstAtom.ss && atom.ssbegin) || (firstAtom.ss === 'coil' && atom.ss !== firstAtom.ss) ) { - if(firstAtom.ss === 'coil' && atom.ss !== firstAtom.ss) { - beginResi = atom.resi + 1; + if(!firstAtom.ssbegin) { + for(var i = firstAtom.resi - 1; i > 0; --i) { + var residueid = firstAtom.structure + '_' + firstAtom.chain + '_' + i; + if(!this.residues.hasOwnProperty(residueid)) break; + + var atom = this.getFirstCalphaAtomObj(this.residues[residueid]); + beginResi = atom.resi; + + if( (firstAtom.ss !== 'coil' && atom.ss === firstAtom.ss && atom.ssbegin) + || (firstAtom.ss === 'coil' && atom.ss !== firstAtom.ss) ) { + if(firstAtom.ss === 'coil' && atom.ss !== firstAtom.ss) { + beginResi = atom.resi + 1; + } + break; } - break; } - } - for(var i = beginResi; i <= firstAtom.resi; ++i) { - var residueid = firstAtom.structure + '_' + firstAtom.chain + '_' + i; - atomsHash = this.unionHash(atomsHash, this.hash2Atoms(this.residues[residueid])); + for(var i = beginResi; i <= firstAtom.resi; ++i) { + var residueid = firstAtom.structure + '_' + firstAtom.chain + '_' + i; + atomsHash = this.unionHash(atomsHash, this.hash2Atoms(this.residues[residueid])); + } } // fill the end diff --git a/src/icn3dui/full_ui.js b/src/icn3dui/full_ui.js index 62dd7b8f..6c8c7936 100644 --- a/src/icn3dui/full_ui.js +++ b/src/icn3dui/full_ui.js @@ -134,7 +134,147 @@ iCn3DUI.prototype = { // modify iCn3D function modifyIcn3d: function() {var me = this; me.modifyIcn3dshowPicking(); - me.modifySwitchHighlightLevel(); + }, + + switchHighlightLevelUp: function() { var me = this; + if(!me.icn3d.bShift && !me.icn3d.bCtrl) me.icn3d.removeHlObjects(); + + if(me.icn3d.highlightlevel === 1) { // atom -> residue + me.icn3d.highlightlevel = 2; + + var firstAtom = me.icn3d.getFirstAtomObj(me.icn3d.pickedAtomList); + + if(!me.icn3d.bShift && !me.icn3d.bCtrl) { + me.icn3d.hAtoms = me.icn3d.cloneHash(me.icn3d.residues[firstAtom.structure + '_' + firstAtom.chain + '_' + firstAtom.resi]); + } + else { + me.icn3d.hAtoms = me.icn3d.unionHash(me.icn3d.hAtoms, me.icn3d.residues[firstAtom.structure + '_' + firstAtom.chain + '_' + firstAtom.resi]); + } + } + else if(me.icn3d.highlightlevel === 2) { // residue -> strand + me.icn3d.highlightlevel = 3; + + var firstAtom = me.icn3d.getFirstAtomObj(me.icn3d.pickedAtomList); + if(!me.icn3d.bShift && !me.icn3d.bCtrl) { + me.icn3d.hAtoms = me.icn3d.cloneHash(me.icn3d.selectStrandHelixFromAtom(firstAtom)); + } + else { + me.icn3d.hAtoms = me.icn3d.unionHash(me.icn3d.hAtoms, me.icn3d.selectStrandHelixFromAtom(firstAtom)); + } + } + else if(me.icn3d.highlightlevel === 3) { // strand -> chain + me.icn3d.highlightlevel = 4; + + var firstAtom = me.icn3d.getFirstAtomObj(me.icn3d.pickedAtomList); + if(!me.icn3d.bShift && !me.icn3d.bCtrl) { + me.icn3d.hAtoms = me.icn3d.cloneHash(me.icn3d.chains[firstAtom.structure + '_' + firstAtom.chain]); + } + else { + me.icn3d.hAtoms = me.icn3d.unionHash(me.icn3d.hAtoms, me.icn3d.chains[firstAtom.structure + '_' + firstAtom.chain]); + } + } + else if(me.icn3d.highlightlevel === 4 || me.icn3d.highlightlevel === 5) { // chain -> structure + me.icn3d.highlightlevel = 5; + + var firstAtom = me.icn3d.getFirstAtomObj(me.icn3d.pickedAtomList); + + if(!me.icn3d.bShift && !me.icn3d.bCtrl) me.icn3d.hAtoms = {}; + var chainArray = me.icn3d.structures[firstAtom.structure]; + for(var i = 0, il = chainArray.length; i < il; ++i) { + me.icn3d.hAtoms = me.icn3d.unionHash(me.icn3d.hAtoms, me.icn3d.chains[chainArray[i]]); + } + } + + me.icn3d.addHlObjects(); + me.updateHlAll(); + }, + + switchHighlightLevelDown: function() { var me = this; + me.icn3d.removeHlObjects(); + + if( (me.icn3d.highlightlevel === 2 || me.icn3d.highlightlevel === 1) && Object.keys(me.icn3d.pickedAtomList).length === 1) { // residue -> atom + me.icn3d.highlightlevel = 1; + + me.icn3d.hAtoms = me.icn3d.cloneHash(me.icn3d.pickedAtomList); + if(!me.icn3d.bShift && !me.icn3d.bCtrl) { + me.icn3d.hAtoms = me.icn3d.cloneHash(me.icn3d.pickedAtomList); + } + else { + me.icn3d.hAtoms = me.icn3d.unionHash(me.icn3d.hAtoms, me.icn3d.pickedAtomList); + } + } + else if(me.icn3d.highlightlevel === 3) { // strand -> residue + var residueHash = {}; + + for(var i in me.icn3d.pickedAtomList) { + residueid = me.icn3d.atoms[i].structure + '_' + me.icn3d.atoms[i].chain + '_' + me.icn3d.atoms[i].resi; + residueHash[residueid] = 1; + } + + if(Object.keys(residueHash).length === 1) { + me.icn3d.highlightlevel = 2; + + var firstAtom = me.icn3d.getFirstAtomObj(me.icn3d.pickedAtomList); + if(!me.icn3d.bShift && !me.icn3d.bCtrl) { + me.icn3d.hAtoms = me.icn3d.cloneHash(me.icn3d.residues[firstAtom.structure + '_' + firstAtom.chain + '_' + firstAtom.resi]); + } + else { + me.icn3d.hAtoms = me.icn3d.unionHash(me.icn3d.hAtoms, me.icn3d.residues[firstAtom.structure + '_' + firstAtom.chain + '_' + firstAtom.resi]); + } + } + } + else if(me.icn3d.highlightlevel === 4) { // chain -> strand + me.icn3d.highlightlevel = 3; + + var firstAtom = me.icn3d.getFirstAtomObj(me.icn3d.pickedAtomList); + if(!me.icn3d.bShift && !me.icn3d.bCtrl) { + me.icn3d.hAtoms = me.icn3d.cloneHash(me.icn3d.selectStrandHelixFromAtom(firstAtom)); + } + else { + me.icn3d.hAtoms = me.icn3d.unionHash(me.icn3d.hAtoms, me.icn3d.selectStrandHelixFromAtom(firstAtom)); + } + } + else if(me.icn3d.highlightlevel === 5) { // structure -> chain + me.icn3d.highlightlevel = 4; + + var firstAtom = me.icn3d.getFirstAtomObj(me.icn3d.pickedAtomList); + if(!me.icn3d.bShift && !me.icn3d.bCtrl) { + me.icn3d.hAtoms = me.icn3d.cloneHash(me.icn3d.chains[firstAtom.structure + '_' + firstAtom.chain]); + } + else { + me.icn3d.hAtoms = me.icn3d.unionHash(me.icn3d.hAtoms, me.icn3d.chains[firstAtom.structure + '_' + firstAtom.chain]); + } + } + + me.icn3d.addHlObjects(); + me.updateHlAll(); + }, + + switchHighlightLevel: function() { var me = this; + $(document).bind('keydown', function (e) { + if(e.keyCode === 38) { // arrow up, select upper level of atoms + e.preventDefault(); + + if(Object.keys(me.icn3d.pickedAtomList).length == 0 || !me.icn3d.hAtoms.hasOwnProperty(me.icn3d.getFirstAtomObj(me.icn3d.pickedAtomList).serial)) { + me.icn3d.pickedAtomList = me.icn3d.cloneHash(me.icn3d.hAtoms); + //me.icn3d.pk = 2; + } + + me.switchHighlightLevelUp(); + me.setLogCmd("highlight level up", true); + } + else if(e.keyCode === 40) { // arrow down, select down level of atoms + e.preventDefault(); + + if(Object.keys(me.icn3d.pickedAtomList).length == 0 || !me.icn3d.hAtoms.hasOwnProperty(me.icn3d.getFirstAtomObj(me.icn3d.pickedAtomList).serial)) { + me.icn3d.pickedAtomList = me.icn3d.cloneHash(me.icn3d.hAtoms); + //me.icn3d.pk = 2; + } + + me.switchHighlightLevelDown(); + me.setLogCmd("highlight level down", true); + } + }); }, allCustomEvents: function() { var me = this; @@ -156,6 +296,8 @@ iCn3DUI.prototype = { // do not change the picking option } + me.icn3d.highlightlevel = me.icn3d.pk; + this.showPickingBase(atom, x, y); if(x !== undefined && y !== undefined) { // mouse over @@ -239,18 +381,6 @@ iCn3DUI.prototype = { }; }, - modifySwitchHighlightLevel: function() {var me = this; - iCn3D.prototype.switchHighlightLevel = function() { - this.switchHighlightLevelBase(); - - $(document).bind('keydown', function (e) { - if(e.keyCode === 38 || e.keyCode === 40) { // arrow up/down, select upper/down level of atoms - me.updateHlAll(); - } - }); - }; - }, - // ======= functions start============== // show3DStructure is the main function to show 3D structure show3DStructure: function() { var me = this; @@ -4614,5 +4744,6 @@ iCn3DUI.prototype = { me.expandShrink(); me.scrollAnno(); + me.switchHighlightLevel(); } }; diff --git a/src/icn3dui/selection/commands.js b/src/icn3dui/selection/commands.js index f7a197d8..602f3157 100644 --- a/src/icn3dui/selection/commands.js +++ b/src/icn3dui/selection/commands.js @@ -810,6 +810,12 @@ iCn3DUI.prototype.applyCommand = function (commandStr) { var me = this; else if(command == 'set annotation ssbond') { me.setAnnoTabSsbond(); } + else if(command == 'highlight level up') { + me.switchHighlightLevelUp(); + } + else if(command == 'highlight level down') { + me.switchHighlightLevelDown(); + } else if(command.indexOf('hide annotation') == 0) { var pos = command.lastIndexOf(' '); var type = command.substr(pos + 1);