icn3d 3.49.3 → 3.49.4

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.module.js CHANGED
@@ -129075,6 +129075,68 @@ class Diagram2d {
129075
129075
 
129076
129076
  thisClass.clickNode(this);
129077
129077
  });
129078
+
129079
+ // event for R2DT
129080
+ //document.addEventListener('click', (event) => {
129081
+ $(document).on("click", "r2dt-web", function(e) { let ic = thisClass.icn3d;
129082
+ // The 2nd element in the path is the actual clicked g element
129083
+ const path = e.originalEvent.composedPath();
129084
+ const clickedElement = path[1];
129085
+ let titleElem = clickedElement.querySelector('title');
129086
+
129087
+ if(titleElem) {
129088
+ titleElem.style.cursor = "pointer";
129089
+ let title = titleElem.textContent; // e.g., 14 (position.label in template: 14.A)
129090
+ let textArray = title.split(' ');
129091
+ let position_resn = textArray[textArray.length - 1].split('.');
129092
+ let pos = position_resn[0];
129093
+ let resn = position_resn[1].substr(0, position_resn[1].length - 1);
129094
+
129095
+ let resid = ic.ncbi2resid[ic.r2dt_chainid + '_' + pos];
129096
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
129097
+
129098
+ if(!atom) {
129099
+ var aaa = 1; //alert("This residue has no 3D coordinates...");
129100
+ }
129101
+ else {
129102
+ let oneLetterRes = me.utilsCls.residueName2Abbr(atom.resn);
129103
+
129104
+ let realResn = (resn == 'T') ? 'U' : resn;
129105
+
129106
+ if(resn != oneLetterRes && realResn != oneLetterRes) {
129107
+ var aaa = 1; //alert("The mouseover text in R2DT didn't match the residue number in 3D view...");
129108
+ }
129109
+ else {
129110
+ // highlight the selected residue
129111
+ if(ic.bCtrl || ic.bShift) {
129112
+ ic.hAtoms = me.hashUtilsCls.unionHash(ic.hAtoms, ic.residues[resid]);
129113
+ }
129114
+ else {
129115
+ ic.hAtoms = ic.residues[resid];
129116
+ }
129117
+
129118
+ ic.hlUpdateCls.showHighlight();
129119
+ }
129120
+ }
129121
+
129122
+ // highlight the selected residue in 2D
129123
+ let textElem = clickedElement.querySelector('text');
129124
+ textElem.setAttribute("stroke", "#f8b84e");
129125
+ textElem.setAttribute("stroke-width", "0.5px");
129126
+ }
129127
+
129128
+ // set cursor for all nodes
129129
+ if(!ic.bSetCursor) {
129130
+ ic.bSetCursor = true;
129131
+ let r2dt = document.querySelector('r2dt-web').shadowRoot;
129132
+ let elemArray = r2dt.querySelectorAll('g:has(title)');
129133
+ for(let i = 0, il = elemArray.length; i < il; ++i) {
129134
+ if(!elemArray[i].hasAttribute('id')) { // skip the main g element
129135
+ elemArray[i].style.cursor = "pointer";
129136
+ }
129137
+ }
129138
+ }
129139
+ });
129078
129140
  }
129079
129141
 
129080
129142
  clickNode(node) { let ic = this.icn3d, me = ic.icn3dui;
@@ -129301,12 +129363,16 @@ class Diagram2d {
129301
129363
  }
129302
129364
 
129303
129365
  async drawR2dt(chainid) { let ic = this.icn3d, me = ic.icn3dui;
129366
+ ic.r2dt_chainid = chainid;
129367
+
129304
129368
  let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid2rnaid=" + chainid;
129305
129369
 
129306
129370
  let data = await me.getAjaxPromise(url, 'jsonp');
129307
129371
 
129308
129372
  let html = '';
129309
129373
  if(data && data.rnaid) {
129374
+ ic.bSetCursor = false;
129375
+
129310
129376
  html += '<r2dt-web search=\'{"urs": "' + data.rnaid + '"}\' />';
129311
129377
  html += '<script type="text/javascript" src="https://rnacentral.github.io/r2dt-web/dist/r2dt-web.js"></script>';
129312
129378
  $("#" + me.pre + "2ddiagramDiv").html(html);
@@ -129352,7 +129418,7 @@ class Diagram2d {
129352
129418
  }
129353
129419
 
129354
129420
  if(!bFound) {
129355
- var aaa = 1; //alert("The Ig type for chain " + chainid + " is " + igTypeArray + ". Currently only IgV, IgC1, IgC2 and IgI types are supported for drawing Ig diagrams.");
129421
+ var aaa = 1; //alert("The Ig type(s) for chain " + chainid + " is/are " + igTypeArray + ". Currently only IgV, IgC1, IgC2 and IgI types are supported for drawing Ig diagrams.");
129356
129422
  return;
129357
129423
  }
129358
129424
 
@@ -135699,7 +135765,7 @@ class iCn3DUI {
135699
135765
  //even when multiple iCn3D viewers are shown together.
135700
135766
  this.pre = this.cfg.divid + "_";
135701
135767
 
135702
- this.REVISION = '3.49.1';
135768
+ this.REVISION = '3.49.2';
135703
135769
 
135704
135770
  // In nodejs, iCn3D defines "window = {navigator: {}}", and added window = {navigator: {}, "__THREE__":"177"}
135705
135771
  this.bNode = (Object.keys(window).length < 3) ? true : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.49.3",
3
+ "version": "3.49.4",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {