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.js CHANGED
@@ -128174,6 +128174,68 @@ class Diagram2d {
128174
128174
 
128175
128175
  thisClass.clickNode(this);
128176
128176
  });
128177
+
128178
+ // event for R2DT
128179
+ //document.addEventListener('click', (event) => {
128180
+ $(document).on("click", "r2dt-web", function(e) { let ic = thisClass.icn3d;
128181
+ // The 2nd element in the path is the actual clicked g element
128182
+ const path = e.originalEvent.composedPath();
128183
+ const clickedElement = path[1];
128184
+ let titleElem = clickedElement.querySelector('title');
128185
+
128186
+ if(titleElem) {
128187
+ titleElem.style.cursor = "pointer";
128188
+ let title = titleElem.textContent; // e.g., 14 (position.label in template: 14.A)
128189
+ let textArray = title.split(' ');
128190
+ let position_resn = textArray[textArray.length - 1].split('.');
128191
+ let pos = position_resn[0];
128192
+ let resn = position_resn[1].substr(0, position_resn[1].length - 1);
128193
+
128194
+ let resid = ic.ncbi2resid[ic.r2dt_chainid + '_' + pos];
128195
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
128196
+
128197
+ if(!atom) {
128198
+ var aaa = 1; //alert("This residue has no 3D coordinates...");
128199
+ }
128200
+ else {
128201
+ let oneLetterRes = me.utilsCls.residueName2Abbr(atom.resn);
128202
+
128203
+ let realResn = (resn == 'T') ? 'U' : resn;
128204
+
128205
+ if(resn != oneLetterRes && realResn != oneLetterRes) {
128206
+ var aaa = 1; //alert("The mouseover text in R2DT didn't match the residue number in 3D view...");
128207
+ }
128208
+ else {
128209
+ // highlight the selected residue
128210
+ if(ic.bCtrl || ic.bShift) {
128211
+ ic.hAtoms = me.hashUtilsCls.unionHash(ic.hAtoms, ic.residues[resid]);
128212
+ }
128213
+ else {
128214
+ ic.hAtoms = ic.residues[resid];
128215
+ }
128216
+
128217
+ ic.hlUpdateCls.showHighlight();
128218
+ }
128219
+ }
128220
+
128221
+ // highlight the selected residue in 2D
128222
+ let textElem = clickedElement.querySelector('text');
128223
+ textElem.setAttribute("stroke", "#f8b84e");
128224
+ textElem.setAttribute("stroke-width", "0.5px");
128225
+ }
128226
+
128227
+ // set cursor for all nodes
128228
+ if(!ic.bSetCursor) {
128229
+ ic.bSetCursor = true;
128230
+ let r2dt = document.querySelector('r2dt-web').shadowRoot;
128231
+ let elemArray = r2dt.querySelectorAll('g:has(title)');
128232
+ for(let i = 0, il = elemArray.length; i < il; ++i) {
128233
+ if(!elemArray[i].hasAttribute('id')) { // skip the main g element
128234
+ elemArray[i].style.cursor = "pointer";
128235
+ }
128236
+ }
128237
+ }
128238
+ });
128177
128239
  }
128178
128240
 
128179
128241
  clickNode(node) { let ic = this.icn3d, me = ic.icn3dui;
@@ -128400,12 +128462,16 @@ class Diagram2d {
128400
128462
  }
128401
128463
 
128402
128464
  async drawR2dt(chainid) { let ic = this.icn3d, me = ic.icn3dui;
128465
+ ic.r2dt_chainid = chainid;
128466
+
128403
128467
  let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid2rnaid=" + chainid;
128404
128468
 
128405
128469
  let data = await me.getAjaxPromise(url, 'jsonp');
128406
128470
 
128407
128471
  let html = '';
128408
128472
  if(data && data.rnaid) {
128473
+ ic.bSetCursor = false;
128474
+
128409
128475
  html += '<r2dt-web search=\'{"urs": "' + data.rnaid + '"}\' />';
128410
128476
  html += '<script type="text/javascript" src="https://rnacentral.github.io/r2dt-web/dist/r2dt-web.js"></script>';
128411
128477
  $("#" + me.pre + "2ddiagramDiv").html(html);
@@ -128451,7 +128517,7 @@ class Diagram2d {
128451
128517
  }
128452
128518
 
128453
128519
  if(!bFound) {
128454
- 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.");
128520
+ 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.");
128455
128521
  return;
128456
128522
  }
128457
128523
 
@@ -134798,7 +134864,7 @@ class iCn3DUI {
134798
134864
  //even when multiple iCn3D viewers are shown together.
134799
134865
  this.pre = this.cfg.divid + "_";
134800
134866
 
134801
- this.REVISION = '3.49.1';
134867
+ this.REVISION = '3.49.2';
134802
134868
 
134803
134869
  // In nodejs, iCn3D defines "window = {navigator: {}}", and added window = {navigator: {}, "__THREE__":"177"}
134804
134870
  this.bNode = (Object.keys(window).length < 3) ? true : false;