icn3d 3.44.3 → 3.45.1

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
@@ -56015,7 +56015,7 @@ class MyEventCls {
56015
56015
  }
56016
56016
 
56017
56017
  onId(id, eventName, myFunction) { this.icn3dui;
56018
- if(Object.keys(window).length < 2) return;
56018
+ if(Object.keys(window).length < 3) return;
56019
56019
 
56020
56020
  if(id.substr(0, 1) == '#') id = id.substr(1);
56021
56021
  if(document.getElementById(id)) {
@@ -75048,13 +75048,18 @@ class Scene {
75048
75048
  rebuildScene(options) { let ic = this.icn3d, me = ic.icn3dui;
75049
75049
  if(options === undefined) options = ic.opts;
75050
75050
 
75051
+ // whether camera was set
75052
+ me.bCamera = (ic.cam) ? true : false;
75053
+
75051
75054
  this.rebuildSceneBase(options);
75052
75055
 
75053
75056
  ic.fogCls.setFog();
75054
75057
 
75055
- // if(!ic.bVr && !ic.bAr) { // first time
75058
+ if(ic.bSetCamera) { // load a URL with trackball transformation, or no info after "|||"
75056
75059
  ic.cameraCls.setCamera();
75057
- // }
75060
+ }
75061
+
75062
+ if(ic.opts['slab'] === 'yes') ic.cameraCls.setSlab();
75058
75063
 
75059
75064
  // if(!ic.bSetVrArButtons) { // call once
75060
75065
  if(!me.cfg.imageonly) this.setVrArButtons();
@@ -76254,7 +76259,7 @@ function TrackballControls( object, domElement, icn3d ) {
76254
76259
  function keydown( event ) {
76255
76260
  //console.log("keydown");
76256
76261
 
76257
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76262
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76258
76263
 
76259
76264
  window.removeEventListener( 'keydown', keydown );
76260
76265
 
@@ -76285,7 +76290,7 @@ function TrackballControls( object, domElement, icn3d ) {
76285
76290
  function keyup( event ) {
76286
76291
  //console.log("keyup");
76287
76292
 
76288
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76293
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76289
76294
 
76290
76295
  _this._state = _prevState;
76291
76296
 
@@ -76295,7 +76300,7 @@ function TrackballControls( object, domElement, icn3d ) {
76295
76300
 
76296
76301
  function mousedown( event ) {
76297
76302
 
76298
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76303
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76299
76304
 
76300
76305
  //event.preventDefault();
76301
76306
  event.stopPropagation();
@@ -76332,7 +76337,7 @@ function TrackballControls( object, domElement, icn3d ) {
76332
76337
 
76333
76338
  function mousemove( event ) {
76334
76339
 
76335
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76340
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76336
76341
 
76337
76342
  //event.preventDefault();
76338
76343
  event.stopPropagation();
@@ -76355,7 +76360,7 @@ function TrackballControls( object, domElement, icn3d ) {
76355
76360
  }
76356
76361
 
76357
76362
  function mouseup( event ) {
76358
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76363
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76359
76364
 
76360
76365
  //event.preventDefault();
76361
76366
  event.stopPropagation();
@@ -76370,7 +76375,7 @@ function TrackballControls( object, domElement, icn3d ) {
76370
76375
 
76371
76376
  function mousewheel( event ) {
76372
76377
 
76373
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76378
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76374
76379
 
76375
76380
  //event.preventDefault();
76376
76381
  event.stopPropagation();
@@ -76397,7 +76402,7 @@ function TrackballControls( object, domElement, icn3d ) {
76397
76402
 
76398
76403
  function touchstart( event ) {
76399
76404
 
76400
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76405
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76401
76406
 
76402
76407
  switch ( event.touches.length ) {
76403
76408
  case 1:
@@ -76429,7 +76434,7 @@ function TrackballControls( object, domElement, icn3d ) {
76429
76434
 
76430
76435
  function touchmove( event ) {
76431
76436
 
76432
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76437
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76433
76438
 
76434
76439
  //event.preventDefault();
76435
76440
  event.stopPropagation();
@@ -76459,7 +76464,7 @@ function TrackballControls( object, domElement, icn3d ) {
76459
76464
 
76460
76465
  function touchend( event ) {
76461
76466
 
76462
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76467
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76463
76468
 
76464
76469
  switch ( event.touches.length ) {
76465
76470
 
@@ -76484,7 +76489,7 @@ function TrackballControls( object, domElement, icn3d ) {
76484
76489
 
76485
76490
  }
76486
76491
 
76487
- if(Object.keys(window).length >= 2 && this.domElement) {
76492
+ if(Object.keys(window).length >= 3 && this.domElement) {
76488
76493
  this.domElement.addEventListener( 'contextmn', function ( event ) {
76489
76494
  //event.preventDefault();
76490
76495
  }, false );
@@ -76498,8 +76503,8 @@ function TrackballControls( object, domElement, icn3d ) {
76498
76503
  this.domElement.addEventListener( 'touchend', touchend, false );
76499
76504
  this.domElement.addEventListener( 'touchmove', touchmove, false );
76500
76505
 
76501
- if(Object.keys(window).length >= 2) window.addEventListener( 'keydown', keydown, false );
76502
- if(Object.keys(window).length >= 2) window.addEventListener( 'keyup', keyup, false );
76506
+ if(Object.keys(window).length >= 3) window.addEventListener( 'keydown', keydown, false );
76507
+ if(Object.keys(window).length >= 3) window.addEventListener( 'keyup', keyup, false );
76503
76508
  }
76504
76509
 
76505
76510
  this.handleResize();
@@ -76932,7 +76937,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
76932
76937
 
76933
76938
  function keydown( event ) {
76934
76939
 
76935
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76940
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76936
76941
 
76937
76942
  window.removeEventListener( 'keydown', keydown );
76938
76943
 
@@ -76960,7 +76965,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
76960
76965
 
76961
76966
  function keyup( event ) {
76962
76967
 
76963
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76968
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76964
76969
 
76965
76970
  _this._state = _prevState;
76966
76971
 
@@ -76970,7 +76975,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
76970
76975
 
76971
76976
  function mousedown( event ) {
76972
76977
 
76973
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
76978
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
76974
76979
 
76975
76980
  //event.preventDefault();
76976
76981
  event.stopPropagation();
@@ -77007,7 +77012,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
77007
77012
 
77008
77013
  function mousemove( event ) {
77009
77014
 
77010
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
77015
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
77011
77016
 
77012
77017
  //event.preventDefault();
77013
77018
  event.stopPropagation();
@@ -77030,7 +77035,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
77030
77035
 
77031
77036
  function mouseup( event ) {
77032
77037
 
77033
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
77038
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
77034
77039
 
77035
77040
  //event.preventDefault();
77036
77041
  event.stopPropagation();
@@ -77045,7 +77050,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
77045
77050
 
77046
77051
  function mousewheel( event ) {
77047
77052
 
77048
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
77053
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
77049
77054
 
77050
77055
  //event.preventDefault();
77051
77056
  event.stopPropagation();
@@ -77071,7 +77076,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
77071
77076
 
77072
77077
  function touchstart( event ) {
77073
77078
 
77074
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
77079
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
77075
77080
 
77076
77081
  switch ( event.touches.length ) {
77077
77082
 
@@ -77104,7 +77109,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
77104
77109
 
77105
77110
  function touchmove( event ) {
77106
77111
 
77107
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
77112
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
77108
77113
 
77109
77114
  //event.preventDefault();
77110
77115
  event.stopPropagation();
@@ -77134,7 +77139,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
77134
77139
 
77135
77140
  function touchend( event ) {
77136
77141
 
77137
- if ( _this.enabled === false || Object.keys(window).length < 2) return;
77142
+ if ( _this.enabled === false || Object.keys(window).length < 3) return;
77138
77143
 
77139
77144
  switch ( event.touches.length ) {
77140
77145
 
@@ -77159,7 +77164,7 @@ function OrthographicTrackballControls( object, domElement, icn3d ) { var me = t
77159
77164
 
77160
77165
  }
77161
77166
 
77162
- if(Object.keys(window).length >= 2 && this.domElement) {
77167
+ if(Object.keys(window).length >= 3 && this.domElement) {
77163
77168
  this.domElement.addEventListener( 'contextmn', function ( event ) {
77164
77169
  //event.preventDefault();
77165
77170
  }, false );
@@ -77205,7 +77210,8 @@ class Camera {
77205
77210
 
77206
77211
  let maxD = ic.maxD;
77207
77212
 
77208
- if(window.cam === ic.perspectiveCamera) {
77213
+ // if(window.cam === ic.perspectiveCamera) {
77214
+ if(ic.opts.camera.toLowerCase() == 'perspective') {
77209
77215
  let bInstance = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > ic.maxatomcnt) ? true : false;
77210
77216
  //var factor = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > 10 * ic.maxatomcnt) ? 1 : 2;
77211
77217
  //var factor = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > 10 * ic.maxatomcnt) ? 1 : 3;
@@ -77220,26 +77226,26 @@ class Camera {
77220
77226
  }
77221
77227
 
77222
77228
  if(window.cam_z > 0) {
77223
- window.cam.position.z = maxD * window.camMaxDFactor; // for perspective, the z position should be large enough to see the whole molecule
77229
+ window.cam.position.z = maxD * window.camMaxDFactor; // for perspective, the z position should be large enough to see the whole molecule
77224
77230
  }
77225
77231
  else {
77226
- window.cam.position.z = -maxD * window.camMaxDFactor; // for perspective, the z position should be large enough to see the whole molecule
77232
+ window.cam.position.z = -maxD * window.camMaxDFactor; // for perspective, the z position should be large enough to see the whole molecule
77227
77233
  }
77228
77234
 
77229
- if(ic.opts['slab'] === 'yes') {
77230
- if(bInstance) {
77231
- window.cam.near = 0.1;
77232
- }
77233
- else if(window.camMaxDFactorFog !== undefined) {
77234
- window.cam.near = maxD * window.camMaxDFactorFog - 10; // keep some surrounding residues
77235
- }
77236
- else {
77237
- window.cam.near = maxD * window.camMaxDFactor;
77238
- }
77239
- }
77240
- else {
77235
+ // if(ic.opts['slab'] === 'yes') {
77236
+ // if(bInstance) {
77237
+ // window.cam.near = 0.1;
77238
+ // }
77239
+ // else if(window.camMaxDFactorFog !== undefined) {
77240
+ // window.cam.near = maxD * window.camMaxDFactorFog - 10; // keep some surrounding residues
77241
+ // }
77242
+ // else {
77243
+ // window.cam.near = maxD * window.camMaxDFactor;
77244
+ // }
77245
+ // }
77246
+ // else {
77241
77247
  window.cam.near = 0.1;
77242
- }
77248
+ // }
77243
77249
  window.cam.far = 10000;
77244
77250
 
77245
77251
  if(ic.bControlGl && !me.bNode) {
@@ -77254,7 +77260,8 @@ class Camera {
77254
77260
  }
77255
77261
  }
77256
77262
  }
77257
- else if (window.cam === ic.orthographicCamera){
77263
+ // else if (window.cam === ic.orthographicCamera){
77264
+ else if(ic.opts.camera.toLowerCase() == 'orthographic') {
77258
77265
  if(ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > 10 * ic.maxatomcnt) {
77259
77266
  window.cam.right = ic.maxD/2 * 1.5;
77260
77267
  }
@@ -77266,12 +77273,12 @@ class Camera {
77266
77273
  window.cam.top = window.cam.right /ic.container.whratio;
77267
77274
  window.cam.bottom = -window.cam.right /ic.container.whratio;
77268
77275
 
77269
- if(ic.opts['slab'] === 'yes') {
77270
- window.cam.near = ic.maxD * 2;
77271
- }
77272
- else {
77276
+ // if(ic.opts['slab'] === 'yes') {
77277
+ // window.cam.near = ic.maxD * 2;
77278
+ // }
77279
+ // else {
77273
77280
  window.cam.near = 0;
77274
- }
77281
+ // }
77275
77282
 
77276
77283
  window.cam.far = 10000;
77277
77284
 
@@ -77297,7 +77304,8 @@ class Camera {
77297
77304
 
77298
77305
  let maxD = ic.maxD;
77299
77306
 
77300
- if(ic.cam === ic.perspectiveCamera) {
77307
+ // if(ic.cam === ic.perspectiveCamera) {
77308
+ if(ic.opts.camera.toLowerCase() == 'perspective') {
77301
77309
  let bInstance = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > ic.maxatomcnt) ? true : false;
77302
77310
  //var factor = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > 10 * ic.maxatomcnt) ? 1 : 2;
77303
77311
  //var factor = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > 10 * ic.maxatomcnt) ? 1 : 3;
@@ -77312,26 +77320,26 @@ class Camera {
77312
77320
  }
77313
77321
 
77314
77322
  if(ic.cam_z > 0) {
77315
- ic.cam.position.z = maxD * ic.camMaxDFactor; // forperspective, the z positionshould be large enough to see the whole molecule
77323
+ ic.cam.position.z = maxD * ic.camMaxDFactor; // forperspective, the z positionshould be large enough to see the whole molecule
77316
77324
  }
77317
77325
  else {
77318
- ic.cam.position.z = -maxD * ic.camMaxDFactor; // forperspective, the z positionshould be large enough to see the whole molecule
77326
+ ic.cam.position.z = -maxD * ic.camMaxDFactor; // forperspective, the z positionshould be large enough to see the whole molecule
77319
77327
  }
77320
77328
 
77321
- if(ic.opts['slab'] === 'yes') {
77322
- if(bInstance) {
77323
- ic.cam.near = 0.1;
77324
- }
77325
- else if(ic.camMaxDFactorFog !== undefined) {
77326
- ic.cam.near = maxD * ic.camMaxDFactorFog - 10; // keep some surrounding residues
77327
- }
77328
- else {
77329
- ic.cam.near = maxD * ic.camMaxDFactor;
77330
- }
77331
- }
77332
- else {
77329
+ // if(ic.opts['slab'] === 'yes') {
77330
+ // if(bInstance) {
77331
+ // ic.cam.near = 0.1;
77332
+ // }
77333
+ // else if(ic.camMaxDFactorFog !== undefined) {
77334
+ // ic.cam.near = maxD * ic.camMaxDFactorFog - 10; // keep some surrounding residues
77335
+ // }
77336
+ // else {
77337
+ // ic.cam.near = maxD * ic.camMaxDFactor;
77338
+ // }
77339
+ // }
77340
+ // else {
77333
77341
  ic.cam.near = 0.1;
77334
- }
77342
+ // }
77335
77343
  ic.cam.far = 10000;
77336
77344
 
77337
77345
  if(ic.bControlGl && !me.bNode) {
@@ -77346,7 +77354,8 @@ class Camera {
77346
77354
  }
77347
77355
  }
77348
77356
  }
77349
- else if (ic.cam === ic.orthographicCamera){
77357
+ // else if (ic.cam === ic.orthographicCamera){
77358
+ else if(ic.opts.camera.toLowerCase() == 'orthographic') {
77350
77359
  if(ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > 10 * ic.maxatomcnt) {
77351
77360
  ic.cam.right = ic.maxD/2 * 1.5;
77352
77361
  }
@@ -77358,12 +77367,12 @@ class Camera {
77358
77367
  ic.cam.top = ic.cam.right /ic.container.whratio;
77359
77368
  ic.cam.bottom = -ic.cam.right /ic.container.whratio;
77360
77369
 
77361
- if(ic.opts['slab'] === 'yes') {
77362
- ic.cam.near = ic.maxD * 2;
77363
- }
77364
- else {
77370
+ // if(ic.opts['slab'] === 'yes') {
77371
+ // ic.cam.near = ic.maxD * 2;
77372
+ // }
77373
+ // else {
77365
77374
  ic.cam.near = 0;
77366
- }
77375
+ // }
77367
77376
 
77368
77377
  ic.cam.far = 10000;
77369
77378
 
@@ -77385,6 +77394,85 @@ class Camera {
77385
77394
  ic.cam.updateProjectionMatrix();
77386
77395
  // }
77387
77396
  }
77397
+
77398
+ setSlab() { let ic = this.icn3d, me = ic.icn3dui;
77399
+ if(ic.bControlGl && !me.bNode) {
77400
+ let maxD = ic.maxD;
77401
+
77402
+ // if(window.cam === ic.perspectiveCamera) {
77403
+ if(ic.opts.camera.toLowerCase() == 'perspective') {
77404
+ let bInstance = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > ic.maxatomcnt) ? true : false;
77405
+
77406
+ if(ic.opts['slab'] === 'yes') {
77407
+ if(bInstance) {
77408
+ window.cam.near = 0.1;
77409
+ }
77410
+ else if(window.camMaxDFactorFog !== undefined) {
77411
+ window.cam.near = maxD * window.camMaxDFactorFog - 10; // keep some surrounding residues
77412
+ }
77413
+ else {
77414
+ window.cam.near = maxD * window.camMaxDFactor;
77415
+ }
77416
+ }
77417
+ else {
77418
+ window.cam.near = 0.1;
77419
+ }
77420
+ }
77421
+ // else if (window.cam === ic.orthographicCamera){
77422
+ else if(ic.opts.camera.toLowerCase() == 'orthographic') {
77423
+ if(ic.opts['slab'] === 'yes') {
77424
+ window.cam.near = ic.maxD * 2;
77425
+ }
77426
+ else {
77427
+ window.cam.near = 0;
77428
+ }
77429
+
77430
+ window.cam.far = 10000;
77431
+ }
77432
+
77433
+ window.cam.updateProjectionMatrix();
77434
+ }
77435
+ // else {
77436
+ // also set its own camera for picking purpose
77437
+
77438
+ let maxD = ic.maxD;
77439
+
77440
+ // if(ic.cam === ic.perspectiveCamera) {
77441
+ if(ic.opts.camera.toLowerCase() == 'perspective') {
77442
+ let bInstance = (ic.biomtMatrices !== undefined && ic.biomtMatrices.length * ic.cnt > ic.maxatomcnt) ? true : false;
77443
+
77444
+ if(ic.opts['slab'] === 'yes') {
77445
+ if(bInstance) {
77446
+ ic.cam.near = 0.1;
77447
+ }
77448
+ else if(ic.camMaxDFactorFog !== undefined) {
77449
+ ic.cam.near = maxD * ic.camMaxDFactorFog - 10; // keep some surrounding residues
77450
+ }
77451
+ else {
77452
+ ic.cam.near = maxD * ic.camMaxDFactor;
77453
+ }
77454
+ }
77455
+ else {
77456
+ ic.cam.near = 0.1;
77457
+ }
77458
+ }
77459
+ // else if (ic.cam === ic.orthographicCamera){
77460
+ else if(ic.opts.camera.toLowerCase() == 'orthographic') {
77461
+ if(ic.opts['slab'] === 'yes') {
77462
+ ic.cam.near = ic.maxD * 2;
77463
+ }
77464
+ else {
77465
+ ic.cam.near = 0;
77466
+ }
77467
+
77468
+ ic.cam.far = 10000;
77469
+ }
77470
+
77471
+ // ic.cam.add(ic.directionalLight);
77472
+
77473
+ ic.cam.updateProjectionMatrix();
77474
+ // }
77475
+ }
77388
77476
  }
77389
77477
 
77390
77478
  /**
@@ -93521,7 +93609,7 @@ class AnnoSnpClinVar {
93521
93609
  let snpResn = snpStr.substr(posSymbol - 1, 1);
93522
93610
  let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[chnid + '_' + realResi]);
93523
93611
  let oneLetterRes = (atom) ? me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3)) : '';
93524
- if(!bFromClinVarDb) {
93612
+ if(!bFromClinVarDb && ic.chainsSeq[chnid][resi - 1]) {
93525
93613
  oneLetterRes = ic.chainsSeq[chnid][resi - 1].name;
93526
93614
  }
93527
93615
 
@@ -119653,19 +119741,7 @@ class LoadScript {
119653
119741
  updateTransformation(steps) { let ic = this.icn3d; ic.icn3dui;
119654
119742
  let commandTransformation = (ic.commands[steps-1]) ? ic.commands[steps-1].split('|||') : [];
119655
119743
 
119656
- if(commandTransformation.length == 2) {
119657
- let transformation = JSON.parse(commandTransformation[1]);
119658
-
119659
- ic._zoomFactor = transformation.factor;
119660
-
119661
- ic.mouseChange.x = transformation.mouseChange.x;
119662
- ic.mouseChange.y = transformation.mouseChange.y;
119663
-
119664
- ic.quaternion._x = transformation.quaternion._x;
119665
- ic.quaternion._y = transformation.quaternion._y;
119666
- ic.quaternion._z = transformation.quaternion._z;
119667
- ic.quaternion._w = transformation.quaternion._w;
119668
- }
119744
+ ic.transformCls.resetOrientation_base(commandTransformation);
119669
119745
 
119670
119746
  // ic.bRender = true;
119671
119747
  ic.drawCls.draw();
@@ -120447,19 +120523,17 @@ class LoadScript {
120447
120523
 
120448
120524
  let commandTransformation = (ic.commands[steps-1]) ? ic.commands[steps-1].split('|||') : [];
120449
120525
 
120450
- if(commandTransformation.length == 2) {
120451
- let transformation = JSON.parse(commandTransformation[1]);
120452
-
120453
- ic._zoomFactor = transformation.factor;
120526
+ // load a URL with trackball transformation, or no info after "|||"
120527
+ if(commandTransformation.length != 2 || (commandTransformation.length == 2 && commandTransformation[1].substr(0,1) == '{')) {
120528
+ ic.bSetCamera = true;
120529
+ }
120530
+ else {
120531
+ ic.bSetCamera = false;
120532
+ }
120454
120533
 
120455
- ic.mouseChange.x = transformation.mouseChange.x;
120456
- ic.mouseChange.y = transformation.mouseChange.y;
120534
+ if(commandTransformation.length == 2 && commandTransformation[1].substr(0,1) == '{') ic.bTransformation = true;
120457
120535
 
120458
- ic.quaternion._x = transformation.quaternion._x;
120459
- ic.quaternion._y = transformation.quaternion._y;
120460
- ic.quaternion._z = transformation.quaternion._z;
120461
- ic.quaternion._w = transformation.quaternion._w;
120462
- }
120536
+ ic.transformCls.resetOrientation_base(commandTransformation);
120463
120537
 
120464
120538
  ic.selectionCls.oneStructurePerWindow();
120465
120539
 
@@ -128861,13 +128935,9 @@ class Transform {
128861
128935
  this.icn3d = icn3d;
128862
128936
  }
128863
128937
 
128864
- //Set the orientation to the original one, but leave the style, color, etc alone.
128865
- resetOrientation() { let ic = this.icn3d; ic.icn3dui;
128866
- let bSet = false;
128867
- if(ic.commands.length > 0) {
128868
- let commandTransformation = ic.commands[0].split('|||');
128869
-
128870
- if(commandTransformation.length == 2) {
128938
+ resetOrientation_base(commandTransformation) { let ic = this.icn3d; ic.icn3dui;
128939
+ if(commandTransformation.length == 2 && commandTransformation[1].length > 0) {
128940
+ if(ic.bSetCamera) { // |||{"factor"...}
128871
128941
  let transformation = JSON.parse(commandTransformation[1]);
128872
128942
 
128873
128943
  ic._zoomFactor = transformation.factor;
@@ -128879,16 +128949,43 @@ class Transform {
128879
128949
  ic.quaternion._y = transformation.quaternion._y;
128880
128950
  ic.quaternion._z = transformation.quaternion._z;
128881
128951
  ic.quaternion._w = transformation.quaternion._w;
128882
-
128883
- bSet = true;
128952
+ }
128953
+ else { // |||pos:a,b,c|dir:a,b,c|up:a,b,c|fov:a
128954
+ let bcfArray = commandTransformation[1].split('|');
128955
+ bcfArray.forEach(item => {
128956
+ let itemArray = item.split(':');
128957
+ if(itemArray[0] == 'fov') {
128958
+ ic.cam.fov = parseFloat(itemArray[1]);
128959
+ }
128960
+ else {
128961
+ let abc = itemArray[1].split(',');
128962
+ if(itemArray[0] == 'pos') {
128963
+ ic.cam.position.set(parseFloat(abc[0]), parseFloat(abc[1]), parseFloat(abc[2]));
128964
+ }
128965
+ else if(itemArray[0] == 'dir') {
128966
+ ic.cam.quaternion.setFromUnitVectors(new Vector3$1(0, 0, -1), new Vector3$1(parseFloat(abc[0]), parseFloat(abc[1]), parseFloat(abc[2])));
128967
+ }
128968
+ else if(itemArray[0] == 'up') {
128969
+ ic.cam.up.set(parseFloat(abc[0]), parseFloat(abc[1]), parseFloat(abc[2]));
128970
+ }
128971
+ }
128972
+ });
128884
128973
  }
128885
128974
  }
128886
-
128887
- if(!bSet) {
128975
+ else {
128888
128976
  ic._zoomFactor = 1.0;
128889
128977
  ic.mouseChange = new Vector2$1(0,0);
128890
128978
  ic.quaternion = new Quaternion(0,0,0,1);
128891
128979
  }
128980
+ }
128981
+
128982
+ //Set the orientation to the original one, but leave the style, color, etc alone.
128983
+ resetOrientation() { let ic = this.icn3d; ic.icn3dui;
128984
+ if(ic.commands.length > 0) {
128985
+ let commandTransformation = ic.commands[0].split('|||');
128986
+
128987
+ this.resetOrientation_base(commandTransformation);
128988
+ }
128892
128989
 
128893
128990
  //reset ic.maxD
128894
128991
  ic.maxD = ic.oriMaxD;
@@ -129118,25 +129215,43 @@ class Transform {
129118
129215
  }
129119
129216
 
129120
129217
  getTransformationStr(transformation) {var ic = this.icn3d; ic.icn3dui;
129121
- let transformation2 = {"factor": 1.0, "mouseChange": {"x": 0, "y": 0}, "quaternion": {"_x": 0, "_y": 0, "_z": 0, "_w": 1} };
129122
- transformation2.factor = parseFloat(transformation.factor).toPrecision(4);
129123
- transformation2.mouseChange.x = parseFloat(transformation.mouseChange.x).toPrecision(4);
129124
- transformation2.mouseChange.y = parseFloat(transformation.mouseChange.y).toPrecision(4);
129125
- transformation2.quaternion._x = parseFloat(transformation.quaternion._x).toPrecision(4);
129126
- transformation2.quaternion._y = parseFloat(transformation.quaternion._y).toPrecision(4);
129127
- transformation2.quaternion._z = parseFloat(transformation.quaternion._z).toPrecision(4);
129128
- transformation2.quaternion._w = parseFloat(transformation.quaternion._w).toPrecision(4);
129129
-
129130
- if(transformation2.factor == '1.0000') transformation2.factor = 1;
129131
- if(transformation2.mouseChange.x == '0.0000') transformation2.mouseChange.x = 0;
129132
- if(transformation2.mouseChange.y == '0.0000') transformation2.mouseChange.y = 0;
129133
-
129134
- if(transformation2.quaternion._x == '0.0000') transformation2.quaternion._x = 0;
129135
- if(transformation2.quaternion._y == '0.0000') transformation2.quaternion._y = 0;
129136
- if(transformation2.quaternion._z == '0.0000') transformation2.quaternion._z = 0;
129137
- if(transformation2.quaternion._w == '1.0000') transformation2.quaternion._w = 1;
129138
-
129139
- return JSON.stringify(transformation2);
129218
+ if(ic.bTransformation) {
129219
+ let transformation2 = {"factor": 1.0, "mouseChange": {"x": 0, "y": 0}, "quaternion": {"_x": 0, "_y": 0, "_z": 0, "_w": 1} };
129220
+ transformation2.factor = parseFloat(transformation.factor).toPrecision(4);
129221
+ transformation2.mouseChange.x = parseFloat(transformation.mouseChange.x).toPrecision(4);
129222
+ transformation2.mouseChange.y = parseFloat(transformation.mouseChange.y).toPrecision(4);
129223
+ transformation2.quaternion._x = parseFloat(transformation.quaternion._x).toPrecision(4);
129224
+ transformation2.quaternion._y = parseFloat(transformation.quaternion._y).toPrecision(4);
129225
+ transformation2.quaternion._z = parseFloat(transformation.quaternion._z).toPrecision(4);
129226
+ transformation2.quaternion._w = parseFloat(transformation.quaternion._w).toPrecision(4);
129227
+
129228
+ if(transformation2.factor == '1.0000') transformation2.factor = 1;
129229
+ if(transformation2.mouseChange.x == '0.0000') transformation2.mouseChange.x = 0;
129230
+ if(transformation2.mouseChange.y == '0.0000') transformation2.mouseChange.y = 0;
129231
+
129232
+ if(transformation2.quaternion._x == '0.0000') transformation2.quaternion._x = 0;
129233
+ if(transformation2.quaternion._y == '0.0000') transformation2.quaternion._y = 0;
129234
+ if(transformation2.quaternion._z == '0.0000') transformation2.quaternion._z = 0;
129235
+ if(transformation2.quaternion._w == '1.0000') transformation2.quaternion._w = 1;
129236
+
129237
+ return JSON.stringify(transformation2);
129238
+ }
129239
+ else if(ic.cam) {
129240
+ // |||pos:a,b,c|dir:a,b,c|up:a,b,c|fov:a
129241
+ let str = '';
129242
+ str += 'pos:' + ic.cam.position.x.toPrecision(4) + ',' + ic.cam.position.y.toPrecision(4) + ',' + ic.cam.position.z.toPrecision(4);
129243
+
129244
+ let direction = (new Vector3$1(0, 0, -1)).applyQuaternion(ic.cam.quaternion);
129245
+ str += '|dir:' + direction.x.toPrecision(4) + ',' + direction.y.toPrecision(4) + ',' + direction.z.toPrecision(4);
129246
+
129247
+ str += '|up:' + ic.cam.up.x.toPrecision(4) + ',' + ic.cam.up.y.toPrecision(4) + ',' + ic.cam.up.z.toPrecision(4);
129248
+ str += '|fov:' + ic.cam.fov.toPrecision(4);
129249
+
129250
+ return str;
129251
+ }
129252
+ else {
129253
+ return '';
129254
+ }
129140
129255
  }
129141
129256
  }
129142
129257
 
@@ -132051,38 +132166,14 @@ class Picking {
132051
132166
  else {
132052
132167
  // highlight the sequence background
132053
132168
  ic.hlUpdateCls.updateHlAll();
132054
- let transformation = {};
132055
- transformation.factor = ic._zoomFactor;
132056
- transformation.mouseChange = ic.mouseChange;
132057
- //transformation.quaternion = ic.quaternion;
132058
- transformation.quaternion = {};
132059
- transformation.quaternion._x = parseFloat(ic.quaternion._x).toPrecision(5);
132060
- transformation.quaternion._y = parseFloat(ic.quaternion._y).toPrecision(5);
132061
- transformation.quaternion._z = parseFloat(ic.quaternion._z).toPrecision(5);
132062
- transformation.quaternion._w = parseFloat(ic.quaternion._w).toPrecision(5);
132063
-
132064
- /*
132065
- if(ic.bAddCommands) {
132066
- ic.commands.push('pickatom ' + atom.serial + '|||' + ic.transformCls.getTransformationStr(transformation));
132067
- ic.optsHistory.push(me.hashUtilsCls.cloneHash(ic.opts));
132068
- ic.optsHistory[ic.optsHistory.length - 1].hlatomcount = Object.keys(ic.hAtoms).length;
132069
- if(me.utilsCls.isSessionStorageSupported()) ic.setStyleCls.saveCommandsToSession();
132070
- ic.STATENUMBER = ic.commands.length;
132071
- }
132072
- ic.logs.push('pickatom ' + atom.serial + '(chain: ' + atom.structure + '_' + atom.chain + ', residue: ' + atom.resn + ', number: ' + atom.resi + ', atom: ' + atom.name + ')');
132073
- if( $( "#" + ic.pre + "logtext" ).length ) {
132074
- $("#" + ic.pre + "logtext").val("> " + ic.logs.join("\n> ") + "\n> ").scrollTop($("#" + ic.pre + "logtext")[0].scrollHeight);
132075
- }
132076
- */
132169
+
132077
132170
  me.htmlCls.clickMenuCls.setLogCmd('pickatom ' + atom.serial, true);
132078
132171
 
132079
132172
  ic.selectionCls.saveSelInCommand();
132080
132173
 
132081
132174
  // update the interaction flag
132082
132175
  ic.bSphereCalc = false;
132083
- //me.htmlCls.clickMenuCls.setLogCmd('set calculate sphere false', true);
132084
132176
  ic.bHbondCalc = false;
132085
- //me.htmlCls.clickMenuCls.setLogCmd('set calculate hbond false', true);
132086
132177
  }
132087
132178
  }
132088
132179
  }
@@ -132876,6 +132967,8 @@ class iCn3D {
132876
132967
 
132877
132968
  this.bUsePdbNum = true;
132878
132969
 
132970
+ this.bSetCamera = true;
132971
+
132879
132972
  let bWebGL, bWebGL2, bVR;
132880
132973
  if(!this.icn3dui.bNode) {
132881
132974
  let canvas = document.createElement( 'canvas' );
@@ -133575,10 +133668,10 @@ class iCn3DUI {
133575
133668
  //even when multiple iCn3D viewers are shown together.
133576
133669
  this.pre = this.cfg.divid + "_";
133577
133670
 
133578
- this.REVISION = '3.44.2';
133671
+ this.REVISION = '3.45.0';
133579
133672
 
133580
- // In nodejs, iCn3D defines "window = {navigator: {}}"
133581
- this.bNode = (Object.keys(window).length < 2) ? true : false;
133673
+ // In nodejs, iCn3D defines "window = {navigator: {}}", and added window = {navigator: {}, "__THREE__":"177"}
133674
+ this.bNode = (Object.keys(window).length < 3) ? true : false;
133582
133675
 
133583
133676
  if(this.cfg.command === undefined) this.cfg.command = '';
133584
133677
  if(this.cfg.width === undefined) this.cfg.width = '100%';