icn3d 3.25.0 → 3.25.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
@@ -2295,7 +2295,7 @@ THREE.TrackballControls = function ( object, domElement, icn3d ) {
2295
2295
  this.screen.width = window.innerWidth;
2296
2296
  this.screen.height = window.innerHeight;
2297
2297
 
2298
- } else {
2298
+ } else if(this.domElement) {
2299
2299
 
2300
2300
  var box = this.domElement.getBoundingClientRect();
2301
2301
  // adjustments come from similar code in the jquery offset() function
@@ -2865,7 +2865,7 @@ THREE.TrackballControls = function ( object, domElement, icn3d ) {
2865
2865
 
2866
2866
  }
2867
2867
 
2868
- if(Object.keys(window).length >= 2) {
2868
+ if(Object.keys(window).length >= 2 && this.domElement) {
2869
2869
  this.domElement.addEventListener( 'contextmn', function ( event ) {
2870
2870
  //event.preventDefault();
2871
2871
  }, false );
@@ -2991,7 +2991,7 @@ THREE.OrthographicTrackballControls = function ( object, domElement, icn3d ) { v
2991
2991
  this.screen.width = window.innerWidth;
2992
2992
  this.screen.height = window.innerHeight;
2993
2993
 
2994
- } else {
2994
+ } else if(this.domElement) {
2995
2995
 
2996
2996
  var box = this.domElement.getBoundingClientRect();
2997
2997
  // adjustments come from similar code in the jquery offset() function
@@ -3541,7 +3541,7 @@ THREE.OrthographicTrackballControls = function ( object, domElement, icn3d ) { v
3541
3541
 
3542
3542
  }
3543
3543
 
3544
- if(Object.keys(window).length >= 2) {
3544
+ if(Object.keys(window).length >= 2 && this.domElement) {
3545
3545
  this.domElement.addEventListener( 'contextmn', function ( event ) {
3546
3546
  //event.preventDefault();
3547
3547
  }, false );
@@ -22822,7 +22822,7 @@ class Scene {
22822
22822
 
22823
22823
  //This core function sets up the scene and display the structure according to the input
22824
22824
  //options (shown above), which is a hash containing values for different keys.
22825
- rebuildScene(options) { let ic = this.icn3d; ic.icn3dui;
22825
+ rebuildScene(options) { let ic = this.icn3d, me = ic.icn3dui;
22826
22826
  if(options === undefined) options = ic.opts;
22827
22827
 
22828
22828
  this.rebuildSceneBase(options);
@@ -22834,7 +22834,7 @@ class Scene {
22834
22834
  // }
22835
22835
 
22836
22836
  // if(!ic.bSetVrArButtons) { // call once
22837
- this.setVrArButtons();
22837
+ if(!me.cfg.imageonly) this.setVrArButtons();
22838
22838
  // }
22839
22839
 
22840
22840
  // if((ic.bVr || ic.bAr) && !ic.bSetVrAr) { // call once
@@ -42921,71 +42921,79 @@ class ShowSeq {
42921
42921
  }
42922
42922
  }
42923
42923
 
42924
- if(parseInt(currResi) < parseInt(strandArray[strandCnt].startResi)) {
42925
- ic.residIgLoop[residueid] = 1;
42924
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[residueid]);
42926
42925
 
42927
- if(bNterminal) { // make it continuous to the 1st strand
42928
- if(bStart) {
42929
- currRefnum = strandArray[strandCnt].startRefnum - strandArray[strandCnt].loopResCnt + loopCnt;
42930
- refnumLabelNoPostfix = strandArray[strandCnt].strand + currRefnum;
42931
- refnumLabel = refnumLabelNoPostfix + strandArray[strandCnt].strandPostfix;
42932
- }
42933
- }
42934
- else {
42935
- //currStrand = strandArray[prevStrandCnt].strand;
42926
+ // skip non-protein residues
42927
+ if(!atom || !ic.proteins.hasOwnProperty(atom.serial)) {
42928
+ refnumLabel = undefined;
42929
+ }
42930
+ else {
42931
+ if(parseInt(currResi) < parseInt(strandArray[strandCnt].startResi)) {
42932
+ ic.residIgLoop[residueid] = 1;
42936
42933
 
42937
- if(prevStrandCnt >= 0 && strandArray[prevStrandCnt].strand.substr(0, 1) == 'G') {
42938
- if(bStart && ic.resid2refnum[residueid]) {
42939
- currRefnum = strandArray[prevStrandCnt].endRefnum + loopCnt;
42940
- refnumLabelNoPostfix = strandArray[prevStrandCnt].strand + currRefnum;
42941
- refnumLabel = refnumLabelNoPostfix + strandArray[prevStrandCnt].strandPostfix;
42942
- }
42943
- else {
42944
- bStart = false;
42945
- bNterminal = true;
42946
- loopCnt = 0;
42947
- }
42934
+ if(bNterminal) { // make it continuous to the 1st strand
42935
+ if(bStart) {
42936
+ currRefnum = strandArray[strandCnt].startRefnum - strandArray[strandCnt].loopResCnt + loopCnt;
42937
+ refnumLabelNoPostfix = strandArray[strandCnt].strand + currRefnum;
42938
+ refnumLabel = refnumLabelNoPostfix + strandArray[strandCnt].strandPostfix;
42939
+ }
42948
42940
  }
42949
42941
  else {
42950
- let len = strandArray[strandCnt].loopResCnt;
42951
- let halfLen = parseInt(len / 2.0 + 0.5);
42952
-
42953
- if(loopCnt <= halfLen) {
42954
- currRefnum = strandArray[prevStrandCnt].endRefnum + loopCnt;
42955
- refnumLabelNoPostfix = strandArray[prevStrandCnt].strand + currRefnum;
42956
- refnumLabel = refnumLabelNoPostfix + strandArray[prevStrandCnt].strandPostfix;
42942
+ //currStrand = strandArray[prevStrandCnt].strand;
42943
+
42944
+ if(prevStrandCnt >= 0 && strandArray[prevStrandCnt].strand.substr(0, 1) == 'G') {
42945
+ if(bStart && ic.resid2refnum[residueid]) {
42946
+ currRefnum = strandArray[prevStrandCnt].endRefnum + loopCnt;
42947
+ refnumLabelNoPostfix = strandArray[prevStrandCnt].strand + currRefnum;
42948
+ refnumLabel = refnumLabelNoPostfix + strandArray[prevStrandCnt].strandPostfix;
42949
+ }
42950
+ else {
42951
+ bStart = false;
42952
+ bNterminal = true;
42953
+ loopCnt = 0;
42954
+ }
42957
42955
  }
42958
42956
  else {
42959
- currRefnum = strandArray[strandCnt].startRefnum - len + loopCnt - 1;
42960
- refnumLabelNoPostfix = strandArray[strandCnt].strand + currRefnum;
42961
- refnumLabel = refnumLabelNoPostfix + strandArray[strandCnt].strandPostfix;
42957
+ let len = strandArray[strandCnt].loopResCnt;
42958
+ let halfLen = parseInt(len / 2.0 + 0.5);
42959
+
42960
+ if(loopCnt <= halfLen) {
42961
+ currRefnum = strandArray[prevStrandCnt].endRefnum + loopCnt;
42962
+ refnumLabelNoPostfix = strandArray[prevStrandCnt].strand + currRefnum;
42963
+ refnumLabel = refnumLabelNoPostfix + strandArray[prevStrandCnt].strandPostfix;
42964
+ }
42965
+ else {
42966
+ currRefnum = strandArray[strandCnt].startRefnum - len + loopCnt - 1;
42967
+ refnumLabelNoPostfix = strandArray[strandCnt].strand + currRefnum;
42968
+ refnumLabel = refnumLabelNoPostfix + strandArray[strandCnt].strandPostfix;
42969
+ }
42962
42970
  }
42963
42971
  }
42964
42972
  }
42965
- }
42966
- else if(parseInt(currResi) >= parseInt(strandArray[strandCnt].startResi) && parseInt(currResi) <= parseInt(strandArray[strandCnt].endResi)) {
42967
- bNterminal = false;
42973
+ else if(parseInt(currResi) >= parseInt(strandArray[strandCnt].startResi) && parseInt(currResi) <= parseInt(strandArray[strandCnt].endResi)) {
42974
+ bNterminal = false;
42968
42975
 
42969
- if(currResi == strandArray[strandCnt].endResi) {
42970
- ++strandCnt; // next strand
42971
- loopCnt = 0;
42976
+ if(currResi == strandArray[strandCnt].endResi) {
42977
+ ++strandCnt; // next strand
42978
+ loopCnt = 0;
42972
42979
 
42973
- if(!strandArray[strandCnt]) { // last strand
42974
- --strandCnt;
42980
+ if(!strandArray[strandCnt]) { // last strand
42981
+ --strandCnt;
42982
+ }
42975
42983
  }
42976
42984
  }
42977
- }
42978
- else if(parseInt(currResi) > parseInt(strandArray[strandCnt].endResi)) {
42979
- ic.residIgLoop[residueid] = 1;
42985
+ else if(parseInt(currResi) > parseInt(strandArray[strandCnt].endResi)) {
42986
+ ic.residIgLoop[residueid] = 1;
42980
42987
 
42981
- // C-terminal
42982
- if(!ic.resid2refnum[residueid]) {
42983
- break;
42984
- }
42985
- else {
42986
- currRefnum = strandArray[strandCnt].endRefnum + loopCnt;
42987
- refnumLabelNoPostfix = strandArray[strandCnt].strand + currRefnum;
42988
- refnumLabel = refnumLabelNoPostfix + strandArray[strandCnt].strandPostfix;
42988
+ // C-terminal
42989
+ if(!ic.resid2refnum[residueid]) {
42990
+ break;
42991
+ }
42992
+ else {
42993
+ currRefnum = strandArray[strandCnt].endRefnum + loopCnt;
42994
+ refnumLabelNoPostfix = strandArray[strandCnt].strand + currRefnum;
42995
+ refnumLabel = refnumLabelNoPostfix + strandArray[strandCnt].strandPostfix;
42996
+ }
42989
42997
  }
42990
42998
  }
42991
42999
 
@@ -60022,9 +60030,10 @@ class LoadScript {
60022
60030
 
60023
60031
  // load pdb, mmcif, mmdb, cid
60024
60032
  let id = loadStr.substr(loadStr.lastIndexOf(' ') + 1);
60033
+ if(id.length == 4) id = id.toUpperCase();
60025
60034
 
60026
60035
  // skip loading the structure if it was loaded before
60027
- if(ic.structures.hasOwnProperty(id)) return;
60036
+ if(ic.structures && ic.structures.hasOwnProperty(id)) return;
60028
60037
 
60029
60038
  ic.inputid = id;
60030
60039
  if(command.indexOf('load mmtf') !== -1) {
@@ -67207,7 +67216,7 @@ class SaveFile {
67207
67216
  if(me.utilsCls.isIE()) {
67208
67217
  blob = ic.renderer.domElement.msToBlob();
67209
67218
 
67210
- if(bAddURL) {
67219
+ if(bAddURL && typeof(blob) == 'Blob') {
67211
67220
  let reader = new FileReader();
67212
67221
  reader.onload = function(e) {
67213
67222
  let arrayBuffer = e.target.result; // or = reader.result;
@@ -67233,7 +67242,7 @@ class SaveFile {
67233
67242
  }
67234
67243
  else {
67235
67244
  ic.renderer.domElement.toBlob(function(data) {
67236
- if(bAddURL) {
67245
+ if(bAddURL && typeof(blob) == 'data') {
67237
67246
  let reader = new FileReader();
67238
67247
  reader.onload = function(e) {
67239
67248
  let arrayBuffer = e.target.result; // or = reader.result;
@@ -67305,7 +67314,30 @@ class SaveFile {
67305
67314
 
67306
67315
  let url = ic.shareLinkCls.shareLinkUrl();
67307
67316
 
67317
+ url = url.replace(/imageonly=1/g, '');
67318
+
67308
67319
  let bTooLong =(url.length > 4000 || url.indexOf('http') !== 0) ? true : false;
67320
+ /*
67321
+ if(bTooLong || (ic.bInputfile && !ic.bInputUrlfile)) {
67322
+ // $("#" + ic.pre + "viewer").html("<img src='" + imageUrl + "'/>");
67323
+ $("#" + ic.pre + "mnlist").html("<img src='" + imageUrl + "'/>");
67324
+ }
67325
+ else {
67326
+ // $("#" + ic.pre + "viewer").html("<a href='" + url + "' target='_blank'><img src='" + imageUrl + "'/></a>");
67327
+ $("#" + ic.pre + "mnlist").html("<a href='" + url + "' target='_blank'><img src='" + imageUrl + "'/></a>");
67328
+ }
67329
+
67330
+ // $("#" + ic.pre + "viewer").width(width);
67331
+ // $("#" + ic.pre + "viewer").height(height);
67332
+ $("#" + ic.pre + "mnlist").width(width);
67333
+ $("#" + ic.pre + "mnlist").height(height);
67334
+
67335
+ $("#" + ic.pre + "cmdlog").hide();
67336
+ $("#" + ic.pre + "title").hide();
67337
+
67338
+ //$("#" + ic.pre + "mnlist").hide();
67339
+ $("#" + ic.pre + "canvas").hide(); // "load mmdbid ..." may cause problems if canvas was removed
67340
+ */
67309
67341
 
67310
67342
  if(bTooLong || (ic.bInputfile && !ic.bInputUrlfile)) {
67311
67343
  $("#" + ic.pre + "viewer").html("<img src='" + imageUrl + "'/>");
@@ -67313,11 +67345,15 @@ class SaveFile {
67313
67345
  else {
67314
67346
  $("#" + ic.pre + "viewer").html("<a href='" + url + "' target='_blank'><img src='" + imageUrl + "'/></a>");
67315
67347
  }
67316
-
67348
+
67349
+ $("#" + ic.pre + "viewer").width(width);
67317
67350
  $("#" + ic.pre + "viewer").height(height);
67318
- $("#" + ic.pre + "mnlist").hide();
67351
+
67319
67352
  $("#" + ic.pre + "cmdlog").hide();
67320
67353
  $("#" + ic.pre + "title").hide();
67354
+ $("#" + ic.pre + "mnlist").hide();
67355
+
67356
+ if($("#" + ic.pre + "fullscreen").length > 0) $("#" + ic.pre + "fullscreen").hide();
67321
67357
 
67322
67358
  // clear memory
67323
67359
  ic = {};
@@ -68266,6 +68302,10 @@ class ShareLink {
68266
68302
  if(key_value.length == 2) paraHash[key_value[0]] = key_value[1];
68267
68303
  }
68268
68304
 
68305
+ if(me.cfg.idname && !paraHash[me.cfg.idname]) { // somehow it is not included
68306
+ url += me.cfg.idname + '=' + me.cfg.idvalue + '&';
68307
+ }
68308
+
68269
68309
  for(let key in paraHash) {
68270
68310
  if(key === 'v') continue;
68271
68311
 
@@ -68305,7 +68345,7 @@ class ShareLink {
68305
68345
  transformation.quaternion = ic.quaternion;
68306
68346
 
68307
68347
  let statefile = "";
68308
- let prevCommandStr = undefined;
68348
+ let prevCommandStr = "";
68309
68349
 
68310
68350
  let toggleStr = 'toggle highlight';
68311
68351
  let cntToggle = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.25.0",
3
+ "version": "3.25.2",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {