icn3d 3.25.0 → 3.25.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.js CHANGED
@@ -2302,7 +2302,7 @@ THREE.TrackballControls = function ( object, domElement, icn3d ) {
2302
2302
  this.screen.width = window.innerWidth;
2303
2303
  this.screen.height = window.innerHeight;
2304
2304
 
2305
- } else {
2305
+ } else if(this.domElement) {
2306
2306
 
2307
2307
  var box = this.domElement.getBoundingClientRect();
2308
2308
  // adjustments come from similar code in the jquery offset() function
@@ -2872,7 +2872,7 @@ THREE.TrackballControls = function ( object, domElement, icn3d ) {
2872
2872
 
2873
2873
  }
2874
2874
 
2875
- if(Object.keys(window).length >= 2) {
2875
+ if(Object.keys(window).length >= 2 && this.domElement) {
2876
2876
  this.domElement.addEventListener( 'contextmn', function ( event ) {
2877
2877
  //event.preventDefault();
2878
2878
  }, false );
@@ -2998,7 +2998,7 @@ THREE.OrthographicTrackballControls = function ( object, domElement, icn3d ) { v
2998
2998
  this.screen.width = window.innerWidth;
2999
2999
  this.screen.height = window.innerHeight;
3000
3000
 
3001
- } else {
3001
+ } else if(this.domElement) {
3002
3002
 
3003
3003
  var box = this.domElement.getBoundingClientRect();
3004
3004
  // adjustments come from similar code in the jquery offset() function
@@ -3548,7 +3548,7 @@ THREE.OrthographicTrackballControls = function ( object, domElement, icn3d ) { v
3548
3548
 
3549
3549
  }
3550
3550
 
3551
- if(Object.keys(window).length >= 2) {
3551
+ if(Object.keys(window).length >= 2 && this.domElement) {
3552
3552
  this.domElement.addEventListener( 'contextmn', function ( event ) {
3553
3553
  //event.preventDefault();
3554
3554
  }, false );
@@ -59121,9 +59121,10 @@ class LoadScript {
59121
59121
 
59122
59122
  // load pdb, mmcif, mmdb, cid
59123
59123
  let id = loadStr.substr(loadStr.lastIndexOf(' ') + 1);
59124
+ if(id.length == 4) id = id.toUpperCase();
59124
59125
 
59125
59126
  // skip loading the structure if it was loaded before
59126
- if(ic.structures.hasOwnProperty(id)) return;
59127
+ if(ic.structures && ic.structures.hasOwnProperty(id)) return;
59127
59128
 
59128
59129
  ic.inputid = id;
59129
59130
  if(command.indexOf('load mmtf') !== -1) {
@@ -66306,7 +66307,7 @@ class SaveFile {
66306
66307
  if(me.utilsCls.isIE()) {
66307
66308
  blob = ic.renderer.domElement.msToBlob();
66308
66309
 
66309
- if(bAddURL) {
66310
+ if(bAddURL && typeof(blob) == 'Blob') {
66310
66311
  let reader = new FileReader();
66311
66312
  reader.onload = function(e) {
66312
66313
  let arrayBuffer = e.target.result; // or = reader.result;
@@ -66332,7 +66333,7 @@ class SaveFile {
66332
66333
  }
66333
66334
  else {
66334
66335
  ic.renderer.domElement.toBlob(function(data) {
66335
- if(bAddURL) {
66336
+ if(bAddURL && typeof(blob) == 'data') {
66336
66337
  let reader = new FileReader();
66337
66338
  reader.onload = function(e) {
66338
66339
  let arrayBuffer = e.target.result; // or = reader.result;
@@ -66404,19 +66405,26 @@ class SaveFile {
66404
66405
 
66405
66406
  let url = ic.shareLinkCls.shareLinkUrl();
66406
66407
 
66408
+ url = url.replace(/imageonly=1/g, '');
66409
+
66407
66410
  let bTooLong =(url.length > 4000 || url.indexOf('http') !== 0) ? true : false;
66408
66411
 
66409
66412
  if(bTooLong || (ic.bInputfile && !ic.bInputUrlfile)) {
66410
- $("#" + ic.pre + "viewer").html("<img src='" + imageUrl + "'/>");
66413
+ // $("#" + ic.pre + "viewer").html("<img src='" + imageUrl + "'/>");
66414
+ $("#" + ic.pre + "mnlist").html("<img src='" + imageUrl + "'/>");
66411
66415
  }
66412
66416
  else {
66413
- $("#" + ic.pre + "viewer").html("<a href='" + url + "' target='_blank'><img src='" + imageUrl + "'/></a>");
66417
+ // $("#" + ic.pre + "viewer").html("<a href='" + url + "' target='_blank'><img src='" + imageUrl + "'/></a>");
66418
+ $("#" + ic.pre + "mnlist").html("<a href='" + url + "' target='_blank'><img src='" + imageUrl + "'/></a>");
66414
66419
  }
66415
66420
 
66416
66421
  $("#" + ic.pre + "viewer").height(height);
66417
- $("#" + ic.pre + "mnlist").hide();
66418
66422
  $("#" + ic.pre + "cmdlog").hide();
66419
66423
  $("#" + ic.pre + "title").hide();
66424
+ //$("#" + ic.pre + "mnlist").hide();
66425
+ $("#" + ic.pre + "canvas").hide(); // "load mmdbid ..." may cause problems if canvas was removed
66426
+
66427
+ if($("#" + ic.pre + "fullscreen").length > 0) $("#" + ic.pre + "fullscreen").hide();
66420
66428
 
66421
66429
  // clear memory
66422
66430
  ic = {};
@@ -67365,6 +67373,10 @@ class ShareLink {
67365
67373
  if(key_value.length == 2) paraHash[key_value[0]] = key_value[1];
67366
67374
  }
67367
67375
 
67376
+ if(me.cfg.notebook && me.cfg.idname && !paraHash[me.cfg.idname]) { // somehow it is not included
67377
+ url += me.cfg.idname + '=' + me.cfg.idvalue + '&';
67378
+ }
67379
+
67368
67380
  for(let key in paraHash) {
67369
67381
  if(key === 'v') continue;
67370
67382
 
@@ -67404,7 +67416,7 @@ class ShareLink {
67404
67416
  transformation.quaternion = ic.quaternion;
67405
67417
 
67406
67418
  let statefile = "";
67407
- let prevCommandStr = undefined;
67419
+ let prevCommandStr = "";
67408
67420
 
67409
67421
  let toggleStr = 'toggle highlight';
67410
67422
  let cntToggle = 0;