icn3d 3.44.3 → 3.45.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
@@ -55114,7 +55114,7 @@ class MyEventCls {
55114
55114
  }
55115
55115
 
55116
55116
  onId(id, eventName, myFunction) { this.icn3dui;
55117
- if(Object.keys(window).length < 2) return;
55117
+ if(Object.keys(window).length < 3) return;
55118
55118
 
55119
55119
  if(id.substr(0, 1) == '#') id = id.substr(1);
55120
55120
  if(document.getElementById(id)) {
@@ -74147,13 +74147,18 @@ class Scene {
74147
74147
  rebuildScene(options) { let ic = this.icn3d, me = ic.icn3dui;
74148
74148
  if(options === undefined) options = ic.opts;
74149
74149
 
74150
+ // whether camera was set
74151
+ me.bCamera = (ic.cam) ? true : false;
74152
+
74150
74153
  this.rebuildSceneBase(options);
74151
74154
 
74152
74155
  ic.fogCls.setFog();
74153
74156
 
74154
- // if(!ic.bVr && !ic.bAr) { // first time
74157
+ if(ic.bSetCamera) { // load a URL with trackball transformation, or no info after "|||"
74155
74158
  ic.cameraCls.setCamera();
74156
- // }
74159
+ }
74160
+
74161
+ if(ic.opts['slab'] === 'yes') ic.cameraCls.setSlab();
74157
74162
 
74158
74163
  // if(!ic.bSetVrArButtons) { // call once
74159
74164
  if(!me.cfg.imageonly) this.setVrArButtons();
@@ -75353,7 +75358,7 @@ function TrackballControls( object, domElement, icn3d ) {
75353
75358
  function keydown( event ) {
75354
75359
  //console.log("keydown");
75355
75360
 
75356
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
75361
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
75357
75362
 
75358
75363
  window.removeEventListener( 'keydown', keydown );
75359
75364
 
@@ -75384,7 +75389,7 @@ function TrackballControls( object, domElement, icn3d ) {
75384
75389
  function keyup( event ) {
75385
75390
  //console.log("keyup");
75386
75391
 
75387
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
75392
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
75388
75393
 
75389
75394
  _this._state = _prevState;
75390
75395
 
@@ -75394,7 +75399,7 @@ function TrackballControls( object, domElement, icn3d ) {
75394
75399
 
75395
75400
  function mousedown( event ) {
75396
75401
 
75397
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
75402
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
75398
75403
 
75399
75404
  //event.preventDefault();
75400
75405
  event.stopPropagation();
@@ -75431,7 +75436,7 @@ function TrackballControls( object, domElement, icn3d ) {
75431
75436
 
75432
75437
  function mousemove( event ) {
75433
75438
 
75434
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
75439
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
75435
75440
 
75436
75441
  //event.preventDefault();
75437
75442
  event.stopPropagation();
@@ -75454,7 +75459,7 @@ function TrackballControls( object, domElement, icn3d ) {
75454
75459
  }
75455
75460
 
75456
75461
  function mouseup( event ) {
75457
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
75462
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
75458
75463
 
75459
75464
  //event.preventDefault();
75460
75465
  event.stopPropagation();
@@ -75469,7 +75474,7 @@ function TrackballControls( object, domElement, icn3d ) {
75469
75474
 
75470
75475
  function mousewheel( event ) {
75471
75476
 
75472
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
75477
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
75473
75478
 
75474
75479
  //event.preventDefault();
75475
75480
  event.stopPropagation();
@@ -75496,7 +75501,7 @@ function TrackballControls( object, domElement, icn3d ) {
75496
75501
 
75497
75502
  function touchstart( event ) {
75498
75503
 
75499
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
75504
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
75500
75505
 
75501
75506
  switch ( event.touches.length ) {
75502
75507
  case 1:
@@ -75528,7 +75533,7 @@ function TrackballControls( object, domElement, icn3d ) {
75528
75533
 
75529
75534
  function touchmove( event ) {
75530
75535
 
75531
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
75536
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
75532
75537
 
75533
75538
  //event.preventDefault();
75534
75539
  event.stopPropagation();
@@ -75558,7 +75563,7 @@ function TrackballControls( object, domElement, icn3d ) {
75558
75563
 
75559
75564
  function touchend( event ) {
75560
75565
 
75561
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
75566
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
75562
75567
 
75563
75568
  switch ( event.touches.length ) {
75564
75569
 
@@ -75583,7 +75588,7 @@ function TrackballControls( object, domElement, icn3d ) {
75583
75588
 
75584
75589
  }
75585
75590
 
75586
- if(Object.keys(window).length >= 2 && this.domElement) {
75591
+ if(Object.keys(window).length >= 3 && this.domElement) {
75587
75592
  this.domElement.addEventListener( 'contextmn', function ( event ) {
75588
75593
  //event.preventDefault();
75589
75594
  }, false );
@@ -75597,8 +75602,8 @@ function TrackballControls( object, domElement, icn3d ) {
75597
75602
  this.domElement.addEventListener( 'touchend', touchend, false );
75598
75603
  this.domElement.addEventListener( 'touchmove', touchmove, false );
75599
75604
 
75600
- if(Object.keys(window).length >= 2) window.addEventListener( 'keydown', keydown, false );
75601
- if(Object.keys(window).length >= 2) window.addEventListener( 'keyup', keyup, false );
75605
+ if(Object.keys(window).length >= 3) window.addEventListener( 'keydown', keydown, false );
75606
+ if(Object.keys(window).length >= 3) window.addEventListener( 'keyup', keyup, false );
75602
75607
  }
75603
75608
 
75604
75609
  this.handleResize();
@@ -76031,7 +76036,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
76031
76036
 
76032
76037
  function keydown( event ) {
76033
76038
 
76034
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76039
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76035
76040
 
76036
76041
  window.removeEventListener( 'keydown', keydown );
76037
76042
 
@@ -76059,7 +76064,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
76059
76064
 
76060
76065
  function keyup( event ) {
76061
76066
 
76062
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76067
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76063
76068
 
76064
76069
  _this._state = _prevState;
76065
76070
 
@@ -76069,7 +76074,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
76069
76074
 
76070
76075
  function mousedown( event ) {
76071
76076
 
76072
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76077
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76073
76078
 
76074
76079
  //event.preventDefault();
76075
76080
  event.stopPropagation();
@@ -76106,7 +76111,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
76106
76111
 
76107
76112
  function mousemove( event ) {
76108
76113
 
76109
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76114
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76110
76115
 
76111
76116
  //event.preventDefault();
76112
76117
  event.stopPropagation();
@@ -76129,7 +76134,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
76129
76134
 
76130
76135
  function mouseup( event ) {
76131
76136
 
76132
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76137
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76133
76138
 
76134
76139
  //event.preventDefault();
76135
76140
  event.stopPropagation();
@@ -76144,7 +76149,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
76144
76149
 
76145
76150
  function mousewheel( event ) {
76146
76151
 
76147
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76152
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76148
76153
 
76149
76154
  //event.preventDefault();
76150
76155
  event.stopPropagation();
@@ -76170,7 +76175,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
76170
76175
 
76171
76176
  function touchstart( event ) {
76172
76177
 
76173
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76178
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76174
76179
 
76175
76180
  switch ( event.touches.length ) {
76176
76181
 
@@ -76203,7 +76208,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
76203
76208
 
76204
76209
  function touchmove( event ) {
76205
76210
 
76206
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76211
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76207
76212
 
76208
76213
  //event.preventDefault();
76209
76214
  event.stopPropagation();
@@ -76233,7 +76238,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
76233
76238
 
76234
76239
  function touchend( event ) {
76235
76240
 
76236
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76241
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76237
76242
 
76238
76243
  switch ( event.touches.length ) {
76239
76244
 
@@ -76258,7 +76263,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
76258
76263
 
76259
76264
  }
76260
76265
 
76261
- if(Object.keys(window).length >= 2 && this.domElement) {
76266
+ if(Object.keys(window).length >= 3 && this.domElement) {
76262
76267
  this.domElement.addEventListener( 'contextmn', function ( event ) {
76263
76268
  //event.preventDefault();
76264
76269
  }, false );
@@ -76304,7 +76309,8 @@ class Camera {
76304
76309
 
76305
76310
  let maxD = ic.maxD;
76306
76311
 
76307
- if(window.cam === ic.perspectiveCamera) {
76312
+ // if(window.cam === ic.perspectiveCamera) {
76313
+ if(ic.opts.camera.toLowerCase() == 'perspective') {
76308
76314
  let bInstance = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > ic.maxatomcnt) ? true : false;
76309
76315
  //var factor = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > 10 * ic.maxatomcnt) ? 1 : 2;
76310
76316
  //var factor = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > 10 * ic.maxatomcnt) ? 1 : 3;
@@ -76319,26 +76325,26 @@ class Camera {
76319
76325
  }
76320
76326
 
76321
76327
  if(window.cam_z > 0) {
76322
- window.cam.position.z = maxD * window.camMaxDFactor; // for perspective, the z position should be large enough to see the whole molecule
76328
+ window.cam.position.z = maxD * window.camMaxDFactor; // for perspective, the z position should be large enough to see the whole molecule
76323
76329
  }
76324
76330
  else {
76325
- window.cam.position.z = -maxD * window.camMaxDFactor; // for perspective, the z position should be large enough to see the whole molecule
76331
+ window.cam.position.z = -maxD * window.camMaxDFactor; // for perspective, the z position should be large enough to see the whole molecule
76326
76332
  }
76327
76333
 
76328
- if(ic.opts['slab'] === 'yes') {
76329
- if(bInstance) {
76330
- window.cam.near = 0.1;
76331
- }
76332
- else if(window.camMaxDFactorFog !== undefined) {
76333
- window.cam.near = maxD * window.camMaxDFactorFog - 10; // keep some surrounding residues
76334
- }
76335
- else {
76336
- window.cam.near = maxD * window.camMaxDFactor;
76337
- }
76338
- }
76339
- else {
76334
+ // if(ic.opts['slab'] === 'yes') {
76335
+ // if(bInstance) {
76336
+ // window.cam.near = 0.1;
76337
+ // }
76338
+ // else if(window.camMaxDFactorFog !== undefined) {
76339
+ // window.cam.near = maxD * window.camMaxDFactorFog - 10; // keep some surrounding residues
76340
+ // }
76341
+ // else {
76342
+ // window.cam.near = maxD * window.camMaxDFactor;
76343
+ // }
76344
+ // }
76345
+ // else {
76340
76346
  window.cam.near = 0.1;
76341
- }
76347
+ // }
76342
76348
  window.cam.far = 10000;
76343
76349
 
76344
76350
  if(ic.bControlGl && !me.bNode) {
@@ -76353,7 +76359,8 @@ class Camera {
76353
76359
  }
76354
76360
  }
76355
76361
  }
76356
- else if (window.cam === ic.orthographicCamera){
76362
+ // else if (window.cam === ic.orthographicCamera){
76363
+ else if(ic.opts.camera.toLowerCase() == 'orthographic') {
76357
76364
  if(ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > 10 * ic.maxatomcnt) {
76358
76365
  window.cam.right = ic.maxD/2 * 1.5;
76359
76366
  }
@@ -76365,12 +76372,12 @@ class Camera {
76365
76372
  window.cam.top = window.cam.right /ic.container.whratio;
76366
76373
  window.cam.bottom = -window.cam.right /ic.container.whratio;
76367
76374
 
76368
- if(ic.opts['slab'] === 'yes') {
76369
- window.cam.near = ic.maxD * 2;
76370
- }
76371
- else {
76375
+ // if(ic.opts['slab'] === 'yes') {
76376
+ // window.cam.near = ic.maxD * 2;
76377
+ // }
76378
+ // else {
76372
76379
  window.cam.near = 0;
76373
- }
76380
+ // }
76374
76381
 
76375
76382
  window.cam.far = 10000;
76376
76383
 
@@ -76396,7 +76403,8 @@ class Camera {
76396
76403
 
76397
76404
  let maxD = ic.maxD;
76398
76405
 
76399
- if(ic.cam === ic.perspectiveCamera) {
76406
+ // if(ic.cam === ic.perspectiveCamera) {
76407
+ if(ic.opts.camera.toLowerCase() == 'perspective') {
76400
76408
  let bInstance = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > ic.maxatomcnt) ? true : false;
76401
76409
  //var factor = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > 10 * ic.maxatomcnt) ? 1 : 2;
76402
76410
  //var factor = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > 10 * ic.maxatomcnt) ? 1 : 3;
@@ -76411,26 +76419,26 @@ class Camera {
76411
76419
  }
76412
76420
 
76413
76421
  if(ic.cam_z > 0) {
76414
- ic.cam.position.z = maxD * ic.camMaxDFactor; // forperspective, the z positionshould be large enough to see the whole molecule
76422
+ ic.cam.position.z = maxD * ic.camMaxDFactor; // forperspective, the z positionshould be large enough to see the whole molecule
76415
76423
  }
76416
76424
  else {
76417
- ic.cam.position.z = -maxD * ic.camMaxDFactor; // forperspective, the z positionshould be large enough to see the whole molecule
76425
+ ic.cam.position.z = -maxD * ic.camMaxDFactor; // forperspective, the z positionshould be large enough to see the whole molecule
76418
76426
  }
76419
76427
 
76420
- if(ic.opts['slab'] === 'yes') {
76421
- if(bInstance) {
76422
- ic.cam.near = 0.1;
76423
- }
76424
- else if(ic.camMaxDFactorFog !== undefined) {
76425
- ic.cam.near = maxD * ic.camMaxDFactorFog - 10; // keep some surrounding residues
76426
- }
76427
- else {
76428
- ic.cam.near = maxD * ic.camMaxDFactor;
76429
- }
76430
- }
76431
- else {
76428
+ // if(ic.opts['slab'] === 'yes') {
76429
+ // if(bInstance) {
76430
+ // ic.cam.near = 0.1;
76431
+ // }
76432
+ // else if(ic.camMaxDFactorFog !== undefined) {
76433
+ // ic.cam.near = maxD * ic.camMaxDFactorFog - 10; // keep some surrounding residues
76434
+ // }
76435
+ // else {
76436
+ // ic.cam.near = maxD * ic.camMaxDFactor;
76437
+ // }
76438
+ // }
76439
+ // else {
76432
76440
  ic.cam.near = 0.1;
76433
- }
76441
+ // }
76434
76442
  ic.cam.far = 10000;
76435
76443
 
76436
76444
  if(ic.bControlGl && !me.bNode) {
@@ -76445,7 +76453,8 @@ class Camera {
76445
76453
  }
76446
76454
  }
76447
76455
  }
76448
- else if (ic.cam === ic.orthographicCamera){
76456
+ // else if (ic.cam === ic.orthographicCamera){
76457
+ else if(ic.opts.camera.toLowerCase() == 'orthographic') {
76449
76458
  if(ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > 10 * ic.maxatomcnt) {
76450
76459
  ic.cam.right = ic.maxD/2 * 1.5;
76451
76460
  }
@@ -76457,12 +76466,12 @@ class Camera {
76457
76466
  ic.cam.top = ic.cam.right /ic.container.whratio;
76458
76467
  ic.cam.bottom = -ic.cam.right /ic.container.whratio;
76459
76468
 
76460
- if(ic.opts['slab'] === 'yes') {
76461
- ic.cam.near = ic.maxD * 2;
76462
- }
76463
- else {
76469
+ // if(ic.opts['slab'] === 'yes') {
76470
+ // ic.cam.near = ic.maxD * 2;
76471
+ // }
76472
+ // else {
76464
76473
  ic.cam.near = 0;
76465
- }
76474
+ // }
76466
76475
 
76467
76476
  ic.cam.far = 10000;
76468
76477
 
@@ -76484,6 +76493,85 @@ class Camera {
76484
76493
  ic.cam.updateProjectionMatrix();
76485
76494
  // }
76486
76495
  }
76496
+
76497
+ setSlab() { let ic = this.icn3d, me = ic.icn3dui;
76498
+ if(ic.bControlGl && !me.bNode) {
76499
+ let maxD = ic.maxD;
76500
+
76501
+ // if(window.cam === ic.perspectiveCamera) {
76502
+ if(ic.opts.camera.toLowerCase() == 'perspective') {
76503
+ let bInstance = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > ic.maxatomcnt) ? true : false;
76504
+
76505
+ if(ic.opts['slab'] === 'yes') {
76506
+ if(bInstance) {
76507
+ window.cam.near = 0.1;
76508
+ }
76509
+ else if(window.camMaxDFactorFog !== undefined) {
76510
+ window.cam.near = maxD * window.camMaxDFactorFog - 10; // keep some surrounding residues
76511
+ }
76512
+ else {
76513
+ window.cam.near = maxD * window.camMaxDFactor;
76514
+ }
76515
+ }
76516
+ else {
76517
+ window.cam.near = 0.1;
76518
+ }
76519
+ }
76520
+ // else if (window.cam === ic.orthographicCamera){
76521
+ else if(ic.opts.camera.toLowerCase() == 'orthographic') {
76522
+ if(ic.opts['slab'] === 'yes') {
76523
+ window.cam.near = ic.maxD * 2;
76524
+ }
76525
+ else {
76526
+ window.cam.near = 0;
76527
+ }
76528
+
76529
+ window.cam.far = 10000;
76530
+ }
76531
+
76532
+ window.cam.updateProjectionMatrix();
76533
+ }
76534
+ // else {
76535
+ // also set its own camera for picking purpose
76536
+
76537
+ let maxD = ic.maxD;
76538
+
76539
+ // if(ic.cam === ic.perspectiveCamera) {
76540
+ if(ic.opts.camera.toLowerCase() == 'perspective') {
76541
+ let bInstance = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > ic.maxatomcnt) ? true : false;
76542
+
76543
+ if(ic.opts['slab'] === 'yes') {
76544
+ if(bInstance) {
76545
+ ic.cam.near = 0.1;
76546
+ }
76547
+ else if(ic.camMaxDFactorFog !== undefined) {
76548
+ ic.cam.near = maxD * ic.camMaxDFactorFog - 10; // keep some surrounding residues
76549
+ }
76550
+ else {
76551
+ ic.cam.near = maxD * ic.camMaxDFactor;
76552
+ }
76553
+ }
76554
+ else {
76555
+ ic.cam.near = 0.1;
76556
+ }
76557
+ }
76558
+ // else if (ic.cam === ic.orthographicCamera){
76559
+ else if(ic.opts.camera.toLowerCase() == 'orthographic') {
76560
+ if(ic.opts['slab'] === 'yes') {
76561
+ ic.cam.near = ic.maxD * 2;
76562
+ }
76563
+ else {
76564
+ ic.cam.near = 0;
76565
+ }
76566
+
76567
+ ic.cam.far = 10000;
76568
+ }
76569
+
76570
+ // ic.cam.add(ic.directionalLight);
76571
+
76572
+ ic.cam.updateProjectionMatrix();
76573
+ // }
76574
+ }
76487
76575
  }
76488
76576
 
76489
76577
  /**
@@ -92620,7 +92708,7 @@ class AnnoSnpClinVar {
92620
92708
  let snpResn = snpStr.substr(posSymbol - 1, 1);
92621
92709
  let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[chnid + '_' + realResi]);
92622
92710
  let oneLetterRes = (atom) ? me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3)) : '';
92623
- if(!bFromClinVarDb) {
92711
+ if(!bFromClinVarDb && ic.chainsSeq[chnid][resi - 1]) {
92624
92712
  oneLetterRes = ic.chainsSeq[chnid][resi - 1].name;
92625
92713
  }
92626
92714
 
@@ -118752,19 +118840,7 @@ class LoadScript {
118752
118840
  updateTransformation(steps) { let ic = this.icn3d; ic.icn3dui;
118753
118841
  let commandTransformation = (ic.commands[steps-1]) ? ic.commands[steps-1].split('|||') : [];
118754
118842
 
118755
- if(commandTransformation.length == 2) {
118756
- let transformation = JSON.parse(commandTransformation[1]);
118757
-
118758
- ic._zoomFactor = transformation.factor;
118759
-
118760
- ic.mouseChange.x = transformation.mouseChange.x;
118761
- ic.mouseChange.y = transformation.mouseChange.y;
118762
-
118763
- ic.quaternion._x = transformation.quaternion._x;
118764
- ic.quaternion._y = transformation.quaternion._y;
118765
- ic.quaternion._z = transformation.quaternion._z;
118766
- ic.quaternion._w = transformation.quaternion._w;
118767
- }
118843
+ ic.transformCls.resetOrientation_base(commandTransformation);
118768
118844
 
118769
118845
  // ic.bRender = true;
118770
118846
  ic.drawCls.draw();
@@ -119546,19 +119622,17 @@ class LoadScript {
119546
119622
 
119547
119623
  let commandTransformation = (ic.commands[steps-1]) ? ic.commands[steps-1].split('|||') : [];
119548
119624
 
119549
- if(commandTransformation.length == 2) {
119550
- let transformation = JSON.parse(commandTransformation[1]);
119551
-
119552
- ic._zoomFactor = transformation.factor;
119625
+ // load a URL with trackball transformation, or no info after "|||"
119626
+ if(commandTransformation.length != 2 || (commandTransformation.length == 2 && commandTransformation[1].substr(0,1) == '{')) {
119627
+ ic.bSetCamera = true;
119628
+ }
119629
+ else {
119630
+ ic.bSetCamera = false;
119631
+ }
119553
119632
 
119554
- ic.mouseChange.x = transformation.mouseChange.x;
119555
- ic.mouseChange.y = transformation.mouseChange.y;
119633
+ if(commandTransformation.length == 2 && commandTransformation[1].substr(0,1) == '{') ic.bTransformation = true;
119556
119634
 
119557
- ic.quaternion._x = transformation.quaternion._x;
119558
- ic.quaternion._y = transformation.quaternion._y;
119559
- ic.quaternion._z = transformation.quaternion._z;
119560
- ic.quaternion._w = transformation.quaternion._w;
119561
- }
119635
+ ic.transformCls.resetOrientation_base(commandTransformation);
119562
119636
 
119563
119637
  ic.selectionCls.oneStructurePerWindow();
119564
119638
 
@@ -127960,13 +128034,9 @@ class Transform {
127960
128034
  this.icn3d = icn3d;
127961
128035
  }
127962
128036
 
127963
- //Set the orientation to the original one, but leave the style, color, etc alone.
127964
- resetOrientation() { let ic = this.icn3d; ic.icn3dui;
127965
- let bSet = false;
127966
- if(ic.commands.length > 0) {
127967
- let commandTransformation = ic.commands[0].split('|||');
127968
-
127969
- if(commandTransformation.length == 2) {
128037
+ resetOrientation_base(commandTransformation) { let ic = this.icn3d; ic.icn3dui;
128038
+ if(commandTransformation.length == 2 && commandTransformation[1].length > 0) {
128039
+ if(ic.bSetCamera) { // |||{"factor"...}
127970
128040
  let transformation = JSON.parse(commandTransformation[1]);
127971
128041
 
127972
128042
  ic._zoomFactor = transformation.factor;
@@ -127978,16 +128048,46 @@ class Transform {
127978
128048
  ic.quaternion._y = transformation.quaternion._y;
127979
128049
  ic.quaternion._z = transformation.quaternion._z;
127980
128050
  ic.quaternion._w = transformation.quaternion._w;
128051
+ bSet1 = true;
128052
+ }
128053
+ else { // |||pos:a,b,c|dir:a,b,c|up:a,b,c|fov:a
128054
+ let bcfArray = commandTransformation[1].split('|');
128055
+ bcfArray.forEach(item => {
128056
+ let itemArray = item.split(':');
128057
+ if(itemArray[0] == 'fov') {
128058
+ ic.cam.fov = parseFloat(itemArray[1]);
128059
+ }
128060
+ else {
128061
+ let abc = itemArray[1].split(',');
128062
+ if(itemArray[0] == 'pos') {
128063
+ ic.cam.position.set(parseFloat(abc[0]), parseFloat(abc[1]), parseFloat(abc[2]));
128064
+ }
128065
+ else if(itemArray[0] == 'dir') {
128066
+ ic.cam.quaternion.setFromUnitVectors(new Vector3$1(0, 0, -1), new Vector3$1(parseFloat(abc[0]), parseFloat(abc[1]), parseFloat(abc[2])));
128067
+ }
128068
+ else if(itemArray[0] == 'up') {
128069
+ ic.cam.up.set(parseFloat(abc[0]), parseFloat(abc[1]), parseFloat(abc[2]));
128070
+ }
128071
+ }
128072
+ });
128073
+
127981
128074
 
127982
- bSet = true;
127983
128075
  }
127984
128076
  }
127985
-
127986
- if(!bSet) {
128077
+ else {
127987
128078
  ic._zoomFactor = 1.0;
127988
128079
  ic.mouseChange = new Vector2$1(0,0);
127989
128080
  ic.quaternion = new Quaternion(0,0,0,1);
127990
128081
  }
128082
+ }
128083
+
128084
+ //Set the orientation to the original one, but leave the style, color, etc alone.
128085
+ resetOrientation() { let ic = this.icn3d; ic.icn3dui;
128086
+ if(ic.commands.length > 0) {
128087
+ let commandTransformation = ic.commands[0].split('|||');
128088
+
128089
+ this.resetOrientation_base(commandTransformation);
128090
+ }
127991
128091
 
127992
128092
  //reset ic.maxD
127993
128093
  ic.maxD = ic.oriMaxD;
@@ -128217,25 +128317,43 @@ class Transform {
128217
128317
  }
128218
128318
 
128219
128319
  getTransformationStr(transformation) {var ic = this.icn3d; ic.icn3dui;
128220
- let transformation2 = {"factor": 1.0, "mouseChange": {"x": 0, "y": 0}, "quaternion": {"_x": 0, "_y": 0, "_z": 0, "_w": 1} };
128221
- transformation2.factor = parseFloat(transformation.factor).toPrecision(4);
128222
- transformation2.mouseChange.x = parseFloat(transformation.mouseChange.x).toPrecision(4);
128223
- transformation2.mouseChange.y = parseFloat(transformation.mouseChange.y).toPrecision(4);
128224
- transformation2.quaternion._x = parseFloat(transformation.quaternion._x).toPrecision(4);
128225
- transformation2.quaternion._y = parseFloat(transformation.quaternion._y).toPrecision(4);
128226
- transformation2.quaternion._z = parseFloat(transformation.quaternion._z).toPrecision(4);
128227
- transformation2.quaternion._w = parseFloat(transformation.quaternion._w).toPrecision(4);
128228
-
128229
- if(transformation2.factor == '1.0000') transformation2.factor = 1;
128230
- if(transformation2.mouseChange.x == '0.0000') transformation2.mouseChange.x = 0;
128231
- if(transformation2.mouseChange.y == '0.0000') transformation2.mouseChange.y = 0;
128232
-
128233
- if(transformation2.quaternion._x == '0.0000') transformation2.quaternion._x = 0;
128234
- if(transformation2.quaternion._y == '0.0000') transformation2.quaternion._y = 0;
128235
- if(transformation2.quaternion._z == '0.0000') transformation2.quaternion._z = 0;
128236
- if(transformation2.quaternion._w == '1.0000') transformation2.quaternion._w = 1;
128237
-
128238
- return JSON.stringify(transformation2);
128320
+ if(ic.bTransformation) {
128321
+ let transformation2 = {"factor": 1.0, "mouseChange": {"x": 0, "y": 0}, "quaternion": {"_x": 0, "_y": 0, "_z": 0, "_w": 1} };
128322
+ transformation2.factor = parseFloat(transformation.factor).toPrecision(4);
128323
+ transformation2.mouseChange.x = parseFloat(transformation.mouseChange.x).toPrecision(4);
128324
+ transformation2.mouseChange.y = parseFloat(transformation.mouseChange.y).toPrecision(4);
128325
+ transformation2.quaternion._x = parseFloat(transformation.quaternion._x).toPrecision(4);
128326
+ transformation2.quaternion._y = parseFloat(transformation.quaternion._y).toPrecision(4);
128327
+ transformation2.quaternion._z = parseFloat(transformation.quaternion._z).toPrecision(4);
128328
+ transformation2.quaternion._w = parseFloat(transformation.quaternion._w).toPrecision(4);
128329
+
128330
+ if(transformation2.factor == '1.0000') transformation2.factor = 1;
128331
+ if(transformation2.mouseChange.x == '0.0000') transformation2.mouseChange.x = 0;
128332
+ if(transformation2.mouseChange.y == '0.0000') transformation2.mouseChange.y = 0;
128333
+
128334
+ if(transformation2.quaternion._x == '0.0000') transformation2.quaternion._x = 0;
128335
+ if(transformation2.quaternion._y == '0.0000') transformation2.quaternion._y = 0;
128336
+ if(transformation2.quaternion._z == '0.0000') transformation2.quaternion._z = 0;
128337
+ if(transformation2.quaternion._w == '1.0000') transformation2.quaternion._w = 1;
128338
+
128339
+ return JSON.stringify(transformation2);
128340
+ }
128341
+ else if(ic.cam) {
128342
+ // |||pos:a,b,c|dir:a,b,c|up:a,b,c|fov:a
128343
+ let str = '';
128344
+ str += 'pos:' + ic.cam.position.x.toPrecision(4) + ',' + ic.cam.position.y.toPrecision(4) + ',' + ic.cam.position.z.toPrecision(4);
128345
+
128346
+ let direction = (new Vector3$1(0, 0, -1)).applyQuaternion(ic.cam.quaternion);
128347
+ str += '|dir:' + direction.x.toPrecision(4) + ',' + direction.y.toPrecision(4) + ',' + direction.z.toPrecision(4);
128348
+
128349
+ str += '|up:' + ic.cam.up.x.toPrecision(4) + ',' + ic.cam.up.y.toPrecision(4) + ',' + ic.cam.up.z.toPrecision(4);
128350
+ str += '|fov:' + ic.cam.fov.toPrecision(4);
128351
+
128352
+ return str;
128353
+ }
128354
+ else {
128355
+ return '';
128356
+ }
128239
128357
  }
128240
128358
  }
128241
128359
 
@@ -131150,38 +131268,14 @@ class Picking {
131150
131268
  else {
131151
131269
  // highlight the sequence background
131152
131270
  ic.hlUpdateCls.updateHlAll();
131153
- let transformation = {};
131154
- transformation.factor = ic._zoomFactor;
131155
- transformation.mouseChange = ic.mouseChange;
131156
- //transformation.quaternion = ic.quaternion;
131157
- transformation.quaternion = {};
131158
- transformation.quaternion._x = parseFloat(ic.quaternion._x).toPrecision(5);
131159
- transformation.quaternion._y = parseFloat(ic.quaternion._y).toPrecision(5);
131160
- transformation.quaternion._z = parseFloat(ic.quaternion._z).toPrecision(5);
131161
- transformation.quaternion._w = parseFloat(ic.quaternion._w).toPrecision(5);
131162
-
131163
- /*
131164
- if(ic.bAddCommands) {
131165
- ic.commands.push('pickatom ' + atom.serial + '|||' + ic.transformCls.getTransformationStr(transformation));
131166
- ic.optsHistory.push(me.hashUtilsCls.cloneHash(ic.opts));
131167
- ic.optsHistory[ic.optsHistory.length - 1].hlatomcount = Object.keys(ic.hAtoms).length;
131168
- if(me.utilsCls.isSessionStorageSupported()) ic.setStyleCls.saveCommandsToSession();
131169
- ic.STATENUMBER = ic.commands.length;
131170
- }
131171
- ic.logs.push('pickatom ' + atom.serial + '(chain: ' + atom.structure + '_' + atom.chain + ', residue: ' + atom.resn + ', number: ' + atom.resi + ', atom: ' + atom.name + ')');
131172
- if( $( "#" + ic.pre + "logtext" ).length ) {
131173
- $("#" + ic.pre + "logtext").val("> " + ic.logs.join("\n> ") + "\n> ").scrollTop($("#" + ic.pre + "logtext")[0].scrollHeight);
131174
- }
131175
- */
131271
+
131176
131272
  me.htmlCls.clickMenuCls.setLogCmd('pickatom ' + atom.serial, true);
131177
131273
 
131178
131274
  ic.selectionCls.saveSelInCommand();
131179
131275
 
131180
131276
  // update the interaction flag
131181
131277
  ic.bSphereCalc = false;
131182
- //me.htmlCls.clickMenuCls.setLogCmd('set calculate sphere false', true);
131183
131278
  ic.bHbondCalc = false;
131184
- //me.htmlCls.clickMenuCls.setLogCmd('set calculate hbond false', true);
131185
131279
  }
131186
131280
  }
131187
131281
  }
@@ -131975,6 +132069,8 @@ class iCn3D {
131975
132069
 
131976
132070
  this.bUsePdbNum = true;
131977
132071
 
132072
+ this.bSetCamera = true;
132073
+
131978
132074
  let bWebGL, bWebGL2, bVR;
131979
132075
  if(!this.icn3dui.bNode) {
131980
132076
  let canvas = document.createElement( 'canvas' );
@@ -132674,10 +132770,10 @@ class iCn3DUI {
132674
132770
  //even when multiple iCn3D viewers are shown together.
132675
132771
  this.pre = this.cfg.divid + "_";
132676
132772
 
132677
- this.REVISION = '3.44.2';
132773
+ this.REVISION = '3.45.0';
132678
132774
 
132679
- // In nodejs, iCn3D defines "window = {navigator: {}}"
132680
- this.bNode = (Object.keys(window).length < 2) ? true : false;
132775
+ // In nodejs, iCn3D defines "window = {navigator: {}}", and added window = {navigator: {}, "__THREE__":"177"}
132776
+ this.bNode = (Object.keys(window).length < 3) ? true : false;
132681
132777
 
132682
132778
  if(this.cfg.command === undefined) this.cfg.command = '';
132683
132779
  if(this.cfg.width === undefined) this.cfg.width = '100%';