icn3d 3.39.1 → 3.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/icn3d.js CHANGED
@@ -12792,6 +12792,10 @@ class SetMenu {
12792
12792
 
12793
12793
  html += "<ul class='icn3d-mn-item'>";
12794
12794
 
12795
+ if(me.cfg.cid !== undefined || me.cfg.smiles !== undefined) {
12796
+ html += this.getLink('mn2_2ddepiction', '2D Depiction ' + me.htmlCls.wifiStr, 1, 1);
12797
+ }
12798
+
12795
12799
  if(me.cfg.cid === undefined) {
12796
12800
  html += this.getLink('mn6_selectannotations', 'Seq. & Annotations ' + me.htmlCls.wifiStr, 1, 1);
12797
12801
 
@@ -14616,24 +14620,30 @@ class SetDialog {
14616
14620
  html += "</div>";
14617
14621
 
14618
14622
 
14619
- html += me.htmlCls.divStr + "dl_ligplot' sty2D Interaction for One Ligand/Residule='background-color:white' class='" + dialogClass + "'>";
14620
- html += this.addNotebookTitle('dl_ligplot', 'e with Atom Details');
14623
+ html += me.htmlCls.divStr + "dl_ligplot' style='background-color:white' class='" + dialogClass + "'>";
14621
14624
 
14622
- html += me.htmlCls.divNowrapStr + "<b>Note</b>: Nodes/Residues can be dragged. Both nodes and dashed lines/interactions can be clicked to select residues. " + me.htmlCls.space3;
14625
+ if(me.cfg.cid !== undefined || me.cfg.smiles !== undefined) {
14626
+ html += this.addNotebookTitle('dl_ligplot', '2D Depiction for Chemicals');
14627
+ }
14628
+ else {
14629
+ html += this.addNotebookTitle('dl_ligplot', '2D Interaction for One Ligand/Residue with Atom Details');
14623
14630
 
14624
- html += '<div style="width:20px; margin-top:6px; display:inline-block;"><span id="'
14625
- + me.pre + 'dl_ligplotcolor_expand" class="ui-icon ui-icon-plus icn3d-expand icn3d-link" style="display:none; width:15px;" title="Expand"></span><span id="'
14626
- + me.pre + 'dl_ligplotcolor_shrink" class="ui-icon ui-icon-minus icn3d-shrink icn3d-link" style="width:15px;" title="Shrink"></span></div></div>';
14631
+ html += me.htmlCls.divNowrapStr + "<b>Note</b>: Nodes/Residues can be dragged. Both nodes and dashed lines/interactions can be clicked to select residues. " + me.htmlCls.space3;
14627
14632
 
14628
- html += me.htmlCls.divStr + "dl_ligplotcolor' style='inline-block;'>";
14633
+ html += '<div style="width:20px; margin-top:6px; display:inline-block;"><span id="'
14634
+ + me.pre + 'dl_ligplotcolor_expand" class="ui-icon ui-icon-plus icn3d-expand icn3d-link" style="display:none; width:15px;" title="Expand"></span><span id="'
14635
+ + me.pre + 'dl_ligplotcolor_shrink" class="ui-icon ui-icon-minus icn3d-shrink icn3d-link" style="width:15px;" title="Shrink"></span></div></div>';
14629
14636
 
14630
- // html += "The real interaction distances are not in scale, and are about twice the distances of dashed line segments.<br>Some \"Contact\" lines are only shown partially to simplify the view.<br>";
14631
- // html += "Mouseover the dashed lines to see interaction types and distances.<br>";
14632
- html += "<b>Color legend</b> for interactions (dashed lines): <br>";
14637
+ html += me.htmlCls.divStr + "dl_ligplotcolor' style='inline-block;'>";
14633
14638
 
14634
- html += me.htmlCls.setHtmlCls.setColorHints();
14639
+ // html += "The real interaction distances are not in scale, and are about twice the distances of dashed line segments.<br>Some \"Contact\" lines are only shown partially to simplify the view.<br>";
14640
+ // html += "Mouseover the dashed lines to see interaction types and distances.<br>";
14641
+ html += "<b>Color legend</b> for interactions (dashed lines): <br>";
14635
14642
 
14636
- html += "<br></div>";
14643
+ html += me.htmlCls.setHtmlCls.setColorHints();
14644
+
14645
+ html += "<br></div>";
14646
+ }
14637
14647
 
14638
14648
  me.ligplotid = me.pre + 'ligplot';
14639
14649
  html += me.htmlCls.divNowrapStr + buttonStrTmp + me.ligplotid + '_svg">SVG</button>' + me.htmlCls.space2;
@@ -16019,6 +16029,11 @@ class Events {
16019
16029
  thisClass.setLogCmd("view interactions", true);
16020
16030
  });
16021
16031
 
16032
+ me.myEventCls.onIds("#" + me.pre + "mn2_2ddepiction", "click", async function(e) { let ic = me.icn3d;
16033
+ await ic.ligplotCls.drawLigplot(ic.atoms, true);
16034
+ thisClass.setLogCmd("view 2d depiction", true);
16035
+ });
16036
+
16022
16037
  me.myEventCls.onIds("#" + me.pre + "search_seq_button", "click", async function(e) { me.icn3d;
16023
16038
  e.stopImmediatePropagation();
16024
16039
  await thisClass.searchSeq();
@@ -27222,6 +27237,8 @@ class Camera {
27222
27237
  }
27223
27238
  }
27224
27239
 
27240
+ // ic.cam.add(ic.directionalLight);
27241
+
27225
27242
  ic.cam.updateProjectionMatrix();
27226
27243
  // }
27227
27244
  }
@@ -37157,6 +37174,11 @@ class Alternate {
37157
37174
  ic.directionalLight.position.copy(ic.lightPos.clone().applyQuaternion( quaternion ).normalize());
37158
37175
  ic.directionalLight2.position.copy(ic.lightPos2.clone().applyQuaternion( quaternion ).normalize());
37159
37176
  ic.directionalLight3.position.copy(ic.lightPos3.clone().applyQuaternion( quaternion ).normalize());
37177
+
37178
+ // adjust the light according to the position of camera
37179
+ ic.directionalLight.applyMatrix4(cam.matrixWorld);
37180
+ ic.directionalLight2.applyMatrix4(cam.matrixWorld);
37181
+ ic.directionalLight3.applyMatrix4(cam.matrixWorld);
37160
37182
  }
37161
37183
 
37162
37184
  if(!ic.bVr) ic.renderer.setPixelRatio( window.devicePixelRatio ); // r71
@@ -69100,7 +69122,9 @@ class LoadScript {
69100
69122
  }
69101
69123
  else if(command.indexOf('view interactions') == 0 && me.cfg.align !== undefined) { // the command may have "|||{"factor"...
69102
69124
  await thisClass.applyCommandViewinteraction(strArray[0].trim());
69103
-
69125
+ }
69126
+ else if(command.indexOf('view 2d depiction') == 0) { // the command may have "|||{"factor"...
69127
+ await ic.ligplotCls.drawLigplot(ic.atoms, true);
69104
69128
  }
69105
69129
  else if(command.indexOf('symmetry') == 0) {
69106
69130
  ic.bAxisOnly = false;
@@ -69310,6 +69334,9 @@ class LoadScript {
69310
69334
  else if(lastCommand.indexOf('view interactions') == 0 && me.cfg.align !== undefined) {
69311
69335
  await thisClass.applyCommandViewinteraction(lastCommand);
69312
69336
  }
69337
+ else if(lastCommand.indexOf('view 2d depiction') == 0) {
69338
+ await ic.ligplotCls.drawLigplot(ic.atoms, true);
69339
+ }
69313
69340
  else if(lastCommand.indexOf('symmetry') == 0) {
69314
69341
  let title = lastCommand.substr(lastCommand.indexOf(' ') + 1);
69315
69342
  ic.symmetrytitle =(title === 'none') ? undefined : title;
@@ -77693,8 +77720,13 @@ class Ligplot {
77693
77720
  this.icn3d = icn3d;
77694
77721
  }
77695
77722
 
77696
- async drawLigplot(atomSet1) { let ic = this.icn3d, me = ic.icn3dui;
77697
- me.htmlCls.dialogCls.openDlg('dl_ligplot', 'Show ligand interactions with atom details');
77723
+ async drawLigplot(atomSet1, bDepiction) { let ic = this.icn3d, me = ic.icn3dui;
77724
+ if(bDepiction) {
77725
+ me.htmlCls.dialogCls.openDlg('dl_ligplot', '2D Depiction');
77726
+ }
77727
+ else {
77728
+ me.htmlCls.dialogCls.openDlg('dl_ligplot', 'Show ligand interactions with atom details');
77729
+ }
77698
77730
 
77699
77731
  let widthOri, heightOri, width = 100, height = 100;
77700
77732
  ic.len4ang = 80;
@@ -77776,19 +77808,28 @@ class Ligplot {
77776
77808
  let offset = - ic.len4ang;
77777
77809
  let svgHtml = "<svg id='" + id + "' viewBox='" + offset + "," + offset + "," + width + "," + heightAll + "' width='" + graphWidth + "px' font-family='sans-serif' stroke='rgb(0,0,0)' stroke-width='2' stroke-linecap='round'>";
77778
77810
 
77779
- let xlen = parseInt(widthOri / ic.svgGridSize), ylen = parseInt(heightOri / ic.svgGridSize);
77780
- let result = ic.viewInterPairsCls.getAllInteractionTable("save1", index2xy, xlen, ylen, xcenter, ycenter); // sort on the ligand/set1
77781
- ic.bLigplot = true;
77811
+ if(bDepiction) {
77812
+ svgHtml += lineSvg + nodeSvg;
77813
+ }
77814
+ else {
77815
+ let xlen = parseInt(widthOri / ic.svgGridSize), ylen = parseInt(heightOri / ic.svgGridSize);
77816
+ let result = ic.viewInterPairsCls.getAllInteractionTable("save1", index2xy, xlen, ylen, xcenter, ycenter); // sort on the ligand/set1
77817
+ // ic.bLigplot = true;
77782
77818
 
77783
- svgHtml += lineSvg + result.svgHtmlLine;
77819
+ svgHtml += lineSvg + result.svgHtmlLine;
77784
77820
 
77785
- svgHtml += nodeSvg + result.svgHtmlNode;
77821
+ svgHtml += nodeSvg + result.svgHtmlNode;
77822
+ }
77786
77823
 
77787
77824
  svgHtml += "</svg>";
77788
77825
 
77789
- $("#" + ic.pre + "ligplotDiv").html(svgHtml);
77790
-
77791
- this.setEventsForLigplot();
77826
+ if(bDepiction) {
77827
+ $("#" + ic.pre + "ligplotDiv").html(svgHtml);
77828
+ }
77829
+ else {
77830
+ $("#" + ic.pre + "ligplotDiv").html(svgHtml);
77831
+ this.setEventsForLigplot();
77832
+ }
77792
77833
  }
77793
77834
 
77794
77835
 
@@ -82862,7 +82903,7 @@ class iCn3DUI {
82862
82903
  //even when multiple iCn3D viewers are shown together.
82863
82904
  this.pre = this.cfg.divid + "_";
82864
82905
 
82865
- this.REVISION = '3.39.0';
82906
+ this.REVISION = '3.40.0';
82866
82907
 
82867
82908
  // In nodejs, iCn3D defines "window = {navigator: {}}"
82868
82909
  this.bNode = (Object.keys(window).length < 2) ? true : false;