icn3d 3.54.1 → 3.54.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.js CHANGED
@@ -56739,7 +56739,7 @@ class SubdivideCls {
56739
56739
 
56740
56740
  // cubic splines for four points: http://thalestriangles.blogspot.com/2014/02/a-bit-of-ex-spline-ation.html
56741
56741
  // https://math.stackexchange.com/questions/577641/how-to-calculate-interpolating-splines-in-3d-space
56742
- subdivide(_pnts, _clrs, DIV) { let me = this.icn3dui;
56742
+ subdivide(_pnts, _clrs, DIV, bOld) { let me = this.icn3dui;
56743
56743
 
56744
56744
  let ret = [];
56745
56745
  let pos = [];
@@ -56822,6 +56822,16 @@ class SubdivideCls {
56822
56822
  savedColor = [];
56823
56823
  pnts = [];
56824
56824
 
56825
+ // adjust the color
56826
+ if(!bOld) {
56827
+ let half = Math.floor(DIV / 2);
56828
+ for(let i = 0, il = color.length; i < il; ++i) {
56829
+ let j = i + half;
56830
+ if(j > il - 1) j = il - 1;
56831
+ color[i] = color[j];
56832
+ }
56833
+ }
56834
+
56825
56835
  pnts_positions.push(ret);
56826
56836
  pnts_positions.push(pos);
56827
56837
  pnts_positions.push(color);
@@ -78233,6 +78243,7 @@ class CurveStripArrow {
78233
78243
  // use the sheet coord for n-2 residues
78234
78244
  let colorsTmp = [];
78235
78245
  let extraArrow = (bStrip) ? 2 : 0; // extend the tube by 5 sub-points into a preceding/following helix/sheet
78246
+ // let extraArrow = (bStrip) ? 0 : 0; // extend the tube by 5 sub-points into a preceding/following helix/sheet
78236
78247
 
78237
78248
  let i, lastIndex = (bShowArrow === undefined || bShowArrow) ? pntsCA.length - ic.axisDIV + extraArrow : pntsCA.length;
78238
78249
 
@@ -78248,20 +78259,22 @@ class CurveStripArrow {
78248
78259
  posIndex.push(positions[i]);
78249
78260
  }
78250
78261
 
78251
- if(bStrip) {
78252
- if(bHelix) {
78253
- ic.stripCls.createStrip(pnts[0], pnts[1], colorsTmp, div, thickness, bHighlight, true,
78254
- undefined, posIndex, pntsCATmp, prevCOArrayTmp);
78262
+ // if(!(bShowArrow === undefined || bShowArrow)) {
78263
+ if(bStrip) {
78264
+ if(bHelix) {
78265
+ ic.stripCls.createStrip(pnts[0], pnts[1], colorsTmp, div, thickness, bHighlight, true,
78266
+ undefined, posIndex, pntsCATmp, prevCOArrayTmp);
78267
+ }
78268
+ else {
78269
+ ic.stripCls.createStrip(pnts[0], pnts[1], colorsTmp, div, thickness, bHighlight, true,
78270
+ undefined, posIndex);
78271
+ }
78255
78272
  }
78256
78273
  else {
78257
- ic.stripCls.createStrip(pnts[0], pnts[1], colorsTmp, div, thickness, bHighlight, true,
78258
- undefined, posIndex);
78274
+ ic.curveCls.createCurveSub(pnts[0], width, colorsTmp, div, bHighlight, bRibbon, true,
78275
+ undefined, posIndex);
78259
78276
  }
78260
- }
78261
- else {
78262
- ic.curveCls.createCurveSub(pnts[0], width, colorsTmp, div, bHighlight, bRibbon, true,
78263
- undefined, posIndex);
78264
- }
78277
+ // }
78265
78278
 
78266
78279
  if(bShowArrow === undefined || bShowArrow) {
78267
78280
  // draw the arrow
@@ -80240,7 +80253,8 @@ class Tube {
80240
80253
  let pnts;
80241
80254
 
80242
80255
  if(bSubdivide) {
80243
- let pnts_clrs = me.subdivideCls.subdivide(_pnts, colors, axisDiv);
80256
+ let bOld = true;
80257
+ let pnts_clrs = me.subdivideCls.subdivide(_pnts, colors, axisDiv, bOld);
80244
80258
 
80245
80259
  pnts = pnts_clrs[0];
80246
80260
  colors = pnts_clrs[2];
@@ -80487,7 +80501,7 @@ class Strand {
80487
80501
  let pntsCAAllSub = [], prevCOArrayAllSub = [], positionsSub = [], colorsAllSub = [];
80488
80502
 
80489
80503
  let currentChain, currentStyle, currentCA = null, currentColor = null, prevCoorCA = null, prevCoorO = null, prevColor = null;
80490
- let prevCO = null, ss = null, ssend = false, ssJoint = false, prevResi = null, prevResid = null;
80504
+ let prevCO = null, ss = null, ssend = false, prevResi = null, prevResid = null;
80491
80505
  let strandWidth, bSheetSegment = false, bHelixSegment = false;
80492
80506
  let atom, tubeAtoms = [];
80493
80507
 
@@ -80589,10 +80603,15 @@ class Strand {
80589
80603
  let delta = -1 + numM1Inv2 * j;
80590
80604
  let v = new Vector3$1(prevCoorCA.x + prevCO.x * delta, prevCoorCA.y + prevCO.y * delta, prevCoorCA.z + prevCO.z * delta);
80591
80605
  // no smoothen for the last two residues in sheet
80592
- if (!doNotSmoothen && ss === 'sheet' && !ssJoint && !(atom.ssend)) v.smoothen = true;
80606
+ // if (!doNotSmoothen && ss === 'sheet' && !ssJoint && !(atom.ssend)) v.smoothen = true;
80607
+ if (!doNotSmoothen && ss === 'sheet') v.smoothen = true;
80593
80608
  pntsAll[j].push(v);
80594
80609
  }
80595
80610
 
80611
+ if (!doNotSmoothen && ss === 'sheet') {
80612
+ prevCoorCA.smoothen = true;
80613
+ prevCO.smoothen = true;
80614
+ }
80596
80615
  pntsCAAll.push(prevCoorCA);
80597
80616
  prevCOArrayAll.push(prevCO);
80598
80617
  }
@@ -80606,7 +80625,7 @@ class Strand {
80606
80625
 
80607
80626
  ss = atom.ss;
80608
80627
  ssend = atom.ssend;
80609
- ssJoint = atom.ssbegin || atom.ssend;
80628
+ atom.ssbegin || atom.ssend;
80610
80629
  } // end if (atom.name === 'O' || (ic.bCalphaOnly && atom.name === 'CA') ) {
80611
80630
  } // end if ((atom.name === 'O' || atom.name === 'CA') && !atom.het) {
80612
80631
  } // end for
@@ -80620,9 +80639,14 @@ class Strand {
80620
80639
  let delta = -1 + numM1Inv2 * j;
80621
80640
  let v = new Vector3$1(prevCoorCA.x + prevCO.x * delta, prevCoorCA.y + prevCO.y * delta, prevCoorCA.z + prevCO.z * delta);
80622
80641
  // no smoothen for the last two residues in sheet
80623
- if (!doNotSmoothen && ss === 'sheet' && !ssJoint && !(ssend)) v.smoothen = true;
80642
+ //if (!doNotSmoothen && ss === 'sheet' && !ssJoint && !(ssend)) v.smoothen = true;
80643
+ if (!doNotSmoothen && ss === 'sheet') v.smoothen = true;
80624
80644
  pntsAll[j].push(v);
80625
80645
  }
80646
+ if (!doNotSmoothen && ss === 'sheet') {
80647
+ prevCoorCA.smoothen = true;
80648
+ prevCO.smoothen = true;
80649
+ }
80626
80650
  pntsCAAll.push(prevCoorCA);
80627
80651
  prevCOArrayAll.push(prevCO);
80628
80652
 
@@ -80646,7 +80670,6 @@ class Strand {
80646
80670
  prevCoorCA = null;
80647
80671
  ss = null;
80648
80672
  ssend = false;
80649
- ssJoint = false;
80650
80673
 
80651
80674
  index = 0;
80652
80675
  let bLastResDrawn = false;
@@ -104802,9 +104825,37 @@ class WebGLPathTracer {
104802
104825
  ic.impostorCls.clearImpostors();
104803
104826
 
104804
104827
  if(ic.bRender && (!ic.hAtoms || Object.keys(ic.hAtoms) == 0)) ic.hAtoms = me.hashUtilsCls.cloneHash(ic.atoms);
104805
-
104828
+ /*
104829
+ // save the current view when the URL used |||pos:...
104830
+ let cam = (ic.bControlGl && !me.bNode) ? window.cam : ic.cam;
104831
+ let controls = (ic.bControlGl && !me.bNode) ? window.controls : ic.controls;
104832
+ let bKeepCamera = (!ic.bSetCamera || ic.bKeepCamera) && cam && controls && !me.bNode;
104833
+
104834
+ let camState;
104835
+ if(bKeepCamera) {
104836
+ camState = {
104837
+ pos: cam.position.clone(), up: cam.up.clone(), quat: cam.quaternion.clone(),
104838
+ target: controls.target.clone(), fov: cam.fov, zoom: cam.zoom,
104839
+ left: cam.left, right: cam.right, top: cam.top, bottom: cam.bottom
104840
+ };
104841
+ }
104842
+ */
104806
104843
  ic.sceneCls.rebuildScene();
104807
-
104844
+ /*
104845
+ // restore the saved cam state
104846
+ if(bKeepCamera) {
104847
+ // setCamera() created new controls, so re-read them
104848
+ //controls = (ic.bControlGl && !me.bNode) ? window.controls : ic.controls;
104849
+ cam.position.copy(camState.pos);
104850
+ cam.up.copy(camState.up);
104851
+ cam.quaternion.copy(camState.quat);
104852
+ controls.target.copy(camState.target);
104853
+ cam.zoom = camState.zoom;
104854
+ if(cam.isPerspectiveCamera) cam.fov = camState.fov;
104855
+ cam.updateProjectionMatrix();
104856
+ cam.updateMatrixWorld(true);
104857
+ }
104858
+ */
104808
104859
  // Impostor display using the saved arrays
104809
104860
  if(ic.bImpo) {
104810
104861
  ic.impostorCls.drawImpostorShader(); // target
@@ -104838,7 +104889,13 @@ class WebGLPathTracer {
104838
104889
  if($("#" + ic.pre + "cmdlog")) $("#" + ic.pre + "cmdlog").show();
104839
104890
  }
104840
104891
 
104841
- this.applyTransformation(ic._zoomFactor, ic.mouseChange, ic.quaternion);
104892
+ if(ic.bSetCamera) {
104893
+ this.applyTransformation(ic._zoomFactor, ic.mouseChange, ic.quaternion);
104894
+ }
104895
+ else {
104896
+ let commandTransformation = ic.commands[ic.commands.length-1].split('|||');
104897
+ ic.transformCls.resetOrientation_base(commandTransformation);
104898
+ }
104842
104899
 
104843
104900
  this.render(bVrAr, bPathTracer);
104844
104901
  }