icn3d 3.45.0 → 3.45.2

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
@@ -59810,7 +59810,7 @@ class SetMenu {
59810
59810
  html += this.setTools();
59811
59811
 
59812
59812
  // show title at the top left corner
59813
- html += me.htmlCls.divStr + "title' class='icn3d-commandTitle' style='font-size:1.2em; font-weight:normal; position:absolute; z-index:1; float:left; display:table-row; margin: 85px 0px 0px 5px; color:" + titleColor + "; width:" + me.htmlCls.WIDTH + "px'></div>";
59813
+ html += me.htmlCls.divStr + "title' class='icn3d-commandTitle icn3d-title' style='display:table-row; margin: 85px 0px 0px 5px; color:" + titleColor + "; width:" + me.htmlCls.WIDTH + "px'></div>";
59814
59814
 
59815
59815
  html += me.htmlCls.divStr + "viewer' style='position:relative; width:100%; height:100%; background-color: " + me.htmlCls.GREYD + ";'>";
59816
59816
 
@@ -59944,7 +59944,7 @@ class SetMenu {
59944
59944
  //html += me.htmlCls.setMenuCls.setTools();
59945
59945
 
59946
59946
  // show title at the top left corner
59947
- html += me.htmlCls.divStr + "title' class='icn3d-commandTitle' style='font-size:1.2em; font-weight:normal; position:absolute; z-index:1; float:left; display:block; margin: 12px 0px 0px 40px; color:" + titleColor + "; width:" +(me.htmlCls.WIDTH - 40).toString() + "px'></div>";
59947
+ html += me.htmlCls.divStr + "title' class='icn3d-commandTitle icn3d-title' style='display:block; margin: 12px 0px 0px 40px; color:" + titleColor + "; width:" +(me.htmlCls.WIDTH - 40).toString() + "px'></div>";
59948
59948
  html += me.htmlCls.divStr + "viewer' style='position:relative; width:100%; height:100%; background-color: " + me.htmlCls.GREYD + ";'>";
59949
59949
  // don't show legend in mobile
59950
59950
  //html += me.htmlCls.divStr + "legend' class='icn3d-text icn3d-legend'></div>";
@@ -75144,7 +75144,7 @@ class Scene {
75144
75144
  ic.shininess = shininess;
75145
75145
  }
75146
75146
 
75147
- if(!me.bNode && me.htmlCls.setHtmlCls.getCookie('light1') != '') {
75147
+ if(!me.bNode && me.htmlCls.setHtmlCls.getCookie('light1') != '' && !me.bNode && me.htmlCls.setHtmlCls.getCookie('light2') != '' && !me.bNode && me.htmlCls.setHtmlCls.getCookie('light3') != '') {
75148
75148
  let light1 = parseFloat(me.htmlCls.setHtmlCls.getCookie('light1'));
75149
75149
  let light2 = parseFloat(me.htmlCls.setHtmlCls.getCookie('light2'));
75150
75150
  let light3 = parseFloat(me.htmlCls.setHtmlCls.getCookie('light3'));
@@ -79894,19 +79894,25 @@ class Tube {
79894
79894
  //mesh = new THREE.Mesh(geo, new THREE.MeshPhongMaterial({ transparent: true, opacity: 0.5, specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, vertexColors: THREE.FaceColors, side: THREE.DoubleSide }));
79895
79895
  mesh = new Mesh$1(geo, new MeshPhongMaterial({ transparent: true, opacity: 0.5, specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, vertexColors: true, side: DoubleSide$1 }));
79896
79896
 
79897
- if(ic.mdl) ic.mdl.add(mesh);
79897
+ if(ic.mdl) {
79898
+ ic.mdl.add(mesh);
79899
+ }
79898
79900
  }
79899
79901
  else if(bHighlight === 1) {
79900
79902
  mesh = new Mesh$1(geo, ic.matShader);
79901
79903
  mesh.renderOrder = ic.renderOrderPicking;
79902
79904
  //ic.mdlPicking.add(mesh);
79903
- if(ic.mdl) ic.mdl.add(mesh);
79905
+ if(ic.mdl) {
79906
+ ic.mdl.add(mesh);
79907
+ }
79904
79908
  }
79905
79909
  else {
79906
79910
  //mesh = new THREE.Mesh(geo, new THREE.MeshPhongMaterial({ specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, vertexColors: THREE.FaceColors, side: THREE.DoubleSide }));
79907
79911
  mesh = new Mesh$1(geo, new MeshPhongMaterial({ specular: ic.frac, shininess: ic.shininess, emissive: ic.emissive, vertexColors: true, side: DoubleSide$1 }));
79908
79912
 
79909
- if(ic.mdl) ic.mdl.add(mesh);
79913
+ if(ic.mdl) {
79914
+ ic.mdl.add(mesh);
79915
+ }
79910
79916
  }
79911
79917
 
79912
79918
  if(bHighlight === 1 || bHighlight === 2) {
@@ -84304,7 +84310,11 @@ class ApplyClbonds {
84304
84310
  applyClbondsOptions(options) { let ic = this.icn3d, me = ic.icn3dui;
84305
84311
  if(options === undefined) options = ic.opts;
84306
84312
 
84307
- if(!ic.bCalcCrossLink) {
84313
+ ic.lines['clbond'] = [];
84314
+
84315
+ if(options.chemicals == 'nothing') return {};
84316
+
84317
+ // if(!ic.bCalcCrossLink) {
84308
84318
  // find all bonds to chemicals
84309
84319
  ic.clbondpnts = {};
84310
84320
  ic.clbondResid2serial = {};
@@ -84315,10 +84325,11 @@ class ApplyClbonds {
84315
84325
  // chemical to protein/nucleotide
84316
84326
  this.applyClbondsOptions_base('all');
84317
84327
 
84318
- ic.bCalcCrossLink = true;
84319
- }
84328
+ // ic.bCalcCrossLink = true;
84329
+ // }
84320
84330
 
84321
- if (options.clbonds.toLowerCase() === 'yes' && options.chemicals !== 'nothing') {
84331
+ // if (options.clbonds.toLowerCase() === 'yes' && options.chemicals !== 'nothing') {
84332
+ if (options.clbonds.toLowerCase() === 'yes') {
84322
84333
  let color = '#006400';
84323
84334
  me.parasCls.thr(0x006400);
84324
84335
 
@@ -84344,7 +84355,8 @@ class ApplyClbonds {
84344
84355
  line.serial1 = ic.clbondResid2serial[resid0 + ',' + resid1];
84345
84356
  line.serial2 = ic.clbondResid2serial[resid1 + ',' + resid0];
84346
84357
 
84347
- if(!ic.dAtoms.hasOwnProperty(line.serial1) || !ic.dAtoms.hasOwnProperty(line.serial2)) continue;
84358
+ // only apply to displayed atoms
84359
+ // if(!ic.dAtoms.hasOwnProperty(line.serial1) || !ic.dAtoms.hasOwnProperty(line.serial2)) continue;
84348
84360
 
84349
84361
  line.position1 = ic.atoms[line.serial1].coord;
84350
84362
  line.position2 = ic.atoms[line.serial2].coord;
@@ -84376,9 +84388,14 @@ class ApplyClbonds {
84376
84388
  return ic.residuesHashClbonds;
84377
84389
  }
84378
84390
 
84379
- applyClbondsOptions_base(type) { let ic = this.icn3d; ic.icn3dui;
84391
+ applyClbondsOptions_base(type) { let ic = this.icn3d, me = ic.icn3dui;
84392
+ // only apply to displayed atoms
84393
+ let atomHash = me.hashUtilsCls.cloneHash(ic.chemicals);
84394
+ atomHash = me.hashUtilsCls.intHash(atomHash, ic.dAtoms);
84395
+
84380
84396
  // chemical to chemical first
84381
- for (let i in ic.chemicals) {
84397
+ // for (let i in ic.chemicals) {
84398
+ for (let i in atomHash) {
84382
84399
  let atom0 = ic.atoms[i];
84383
84400
 
84384
84401
  let chain0 = atom0.structure + '_' + atom0.chain;
@@ -86973,24 +86990,27 @@ class Instancing {
86973
86990
  let normalArray2 = (baseGeometry.attributes.normal) ? me.hashUtilsCls.hashvalue2array(baseGeometry.attributes.normal.array) : [];
86974
86991
  let colorArray2 = (baseGeometry.attributes.color) ? me.hashUtilsCls.hashvalue2array(baseGeometry.attributes.color.array) : [];
86975
86992
  let indexArray2 = (baseGeometry.index) ? me.hashUtilsCls.hashvalue2array(baseGeometry.index.array) : [];
86993
+
86994
+ if(colorArray2.length > 0) { // avoid an black object in the center of of assembly, e.g., https://www.ncbi.nlm.nih.gov/Structure/icn3d/?pdbid=1qqp
86995
+ positionArray = positionArray.concat(positionArray2);
86996
+ normalArray = normalArray.concat(normalArray2);
86997
+ colorArray = colorArray.concat(colorArray2);
86998
+ indexArray = indexArray.concat(indexArray2);
86976
86999
 
86977
- positionArray = positionArray.concat(positionArray2);
86978
- normalArray = normalArray.concat(normalArray2);
86979
- colorArray = colorArray.concat(colorArray2);
86980
- indexArray = indexArray.concat(indexArray2);
86981
-
86982
- let bCylinderArray = [];
86983
- let bCylinder = (baseGeometry.type == 'CylinderGeometry') ? 1.0 : 0.0;
86984
- for(let i = 0, il = positionArray.length / 3; i < il; ++i) {
86985
- bCylinderArray.push(bCylinder);
86986
- }
87000
+ let bCylinderArray = [];
87001
+ let bCylinder = (baseGeometry.type == 'CylinderGeometry') ? 1.0 : 0.0;
87002
+ // let bCylinder = (baseGeometry.geometry.type == 'CylinderGeometry') ? 1.0 : 0.0;
87003
+ for(let i = 0, il = positionArray.length / 3; i < il; ++i) {
87004
+ bCylinderArray.push(bCylinder);
87005
+ }
86987
87006
 
86988
- geometry.setAttribute('position', new BufferAttribute$1(new Float32Array(positionArray), 3));
86989
- geometry.setAttribute('normal', new BufferAttribute$1(new Float32Array(normalArray), 3) );
86990
- geometry.setAttribute('color', new BufferAttribute$1(new Float32Array(colorArray), 3) );
87007
+ geometry.setAttribute('position', new BufferAttribute$1(new Float32Array(positionArray), 3));
87008
+ geometry.setAttribute('normal', new BufferAttribute$1(new Float32Array(normalArray), 3) );
87009
+ geometry.setAttribute('color', new BufferAttribute$1(new Float32Array(colorArray), 3) );
86991
87010
 
86992
- geometry.setAttribute('cylinder', new BufferAttribute$1(new Float32Array(bCylinderArray), 1) );
86993
- geometry.setIndex(new BufferAttribute$1(new Uint32Array(indexArray), 1));
87011
+ geometry.setAttribute('cylinder', new BufferAttribute$1(new Float32Array(bCylinderArray), 1) );
87012
+ geometry.setIndex(new BufferAttribute$1(new Uint32Array(indexArray), 1));
87013
+ }
86994
87014
 
86995
87015
  positionArray2 = null;
86996
87016
  normalArray2 = null;
@@ -87052,7 +87072,7 @@ class Instancing {
87052
87072
 
87053
87073
  let mesh2 = new Mesh$1(geometry, ic.instancedMaterial);
87054
87074
 
87055
- mesh2.onBeforeRender = ic.impostorCls.onBeforeRender;
87075
+ if(ic.bImpo) mesh2.onBeforeRender = ic.impostorCls.onBeforeRender;
87056
87076
  //mesh2.onBeforeRender = this.onBeforeRender;
87057
87077
 
87058
87078
  // important: https://stackoverflow.com/questions/21184061/mesh-suddenly-disappears-in-three-js-clipping
@@ -87278,7 +87298,7 @@ class Alternate {
87278
87298
 
87279
87299
  //ic.glycanCls.showGlycans();
87280
87300
 
87281
- ic.opts['rotationcenter'] = 'highlight center';
87301
+ // ic.opts['rotationcenter'] = 'highlight center';
87282
87302
 
87283
87303
  ic.drawCls.draw();
87284
87304
 
@@ -97529,9 +97549,14 @@ class Annotation {
97529
97549
  $("[id^=" + ic.pre + "transmem]").hide();
97530
97550
  if($("#" + ic.pre + "anno_transmem").length) $("#" + ic.pre + "anno_transmem")[0].checked = false;
97531
97551
  }
97532
- async setAnnoTabIg(bSelection, template) { let ic = this.icn3d; ic.icn3dui;
97552
+ async setAnnoTabIg(bSelection, template) { let ic = this.icn3d, me = ic.icn3dui;
97553
+ let selAtoms = me.hashUtilsCls.cloneHash(ic.hAtoms);
97554
+
97533
97555
  await this.updateIg(bSelection, template);
97534
97556
 
97557
+ // preserve previous selection
97558
+ ic.hAtoms = me.hashUtilsCls.cloneHash(selAtoms);
97559
+
97535
97560
  $("[id^=" + ic.pre + "ig]").show();
97536
97561
  if($("#" + ic.pre + "anno_ig").length) $("#" + ic.pre + "anno_ig")[0].checked = true;
97537
97562
  }
@@ -128949,7 +128974,6 @@ class Transform {
128949
128974
  ic.quaternion._y = transformation.quaternion._y;
128950
128975
  ic.quaternion._z = transformation.quaternion._z;
128951
128976
  ic.quaternion._w = transformation.quaternion._w;
128952
- bSet1 = true;
128953
128977
  }
128954
128978
  else { // |||pos:a,b,c|dir:a,b,c|up:a,b,c|fov:a
128955
128979
  let bcfArray = commandTransformation[1].split('|');
@@ -128971,8 +128995,6 @@ class Transform {
128971
128995
  }
128972
128996
  }
128973
128997
  });
128974
-
128975
-
128976
128998
  }
128977
128999
  }
128978
129000
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.45.0",
3
+ "version": "3.45.2",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {