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.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 );
@@ -60022,9 +60022,10 @@ class LoadScript {
60022
60022
 
60023
60023
  // load pdb, mmcif, mmdb, cid
60024
60024
  let id = loadStr.substr(loadStr.lastIndexOf(' ') + 1);
60025
+ if(id.length == 4) id = id.toUpperCase();
60025
60026
 
60026
60027
  // skip loading the structure if it was loaded before
60027
- if(ic.structures.hasOwnProperty(id)) return;
60028
+ if(ic.structures && ic.structures.hasOwnProperty(id)) return;
60028
60029
 
60029
60030
  ic.inputid = id;
60030
60031
  if(command.indexOf('load mmtf') !== -1) {
@@ -67207,7 +67208,7 @@ class SaveFile {
67207
67208
  if(me.utilsCls.isIE()) {
67208
67209
  blob = ic.renderer.domElement.msToBlob();
67209
67210
 
67210
- if(bAddURL) {
67211
+ if(bAddURL && typeof(blob) == 'Blob') {
67211
67212
  let reader = new FileReader();
67212
67213
  reader.onload = function(e) {
67213
67214
  let arrayBuffer = e.target.result; // or = reader.result;
@@ -67233,7 +67234,7 @@ class SaveFile {
67233
67234
  }
67234
67235
  else {
67235
67236
  ic.renderer.domElement.toBlob(function(data) {
67236
- if(bAddURL) {
67237
+ if(bAddURL && typeof(blob) == 'data') {
67237
67238
  let reader = new FileReader();
67238
67239
  reader.onload = function(e) {
67239
67240
  let arrayBuffer = e.target.result; // or = reader.result;
@@ -67305,19 +67306,26 @@ class SaveFile {
67305
67306
 
67306
67307
  let url = ic.shareLinkCls.shareLinkUrl();
67307
67308
 
67309
+ url = url.replace(/imageonly=1/g, '');
67310
+
67308
67311
  let bTooLong =(url.length > 4000 || url.indexOf('http') !== 0) ? true : false;
67309
67312
 
67310
67313
  if(bTooLong || (ic.bInputfile && !ic.bInputUrlfile)) {
67311
- $("#" + ic.pre + "viewer").html("<img src='" + imageUrl + "'/>");
67314
+ // $("#" + ic.pre + "viewer").html("<img src='" + imageUrl + "'/>");
67315
+ $("#" + ic.pre + "mnlist").html("<img src='" + imageUrl + "'/>");
67312
67316
  }
67313
67317
  else {
67314
- $("#" + ic.pre + "viewer").html("<a href='" + url + "' target='_blank'><img src='" + imageUrl + "'/></a>");
67318
+ // $("#" + ic.pre + "viewer").html("<a href='" + url + "' target='_blank'><img src='" + imageUrl + "'/></a>");
67319
+ $("#" + ic.pre + "mnlist").html("<a href='" + url + "' target='_blank'><img src='" + imageUrl + "'/></a>");
67315
67320
  }
67316
67321
 
67317
67322
  $("#" + ic.pre + "viewer").height(height);
67318
- $("#" + ic.pre + "mnlist").hide();
67319
67323
  $("#" + ic.pre + "cmdlog").hide();
67320
67324
  $("#" + ic.pre + "title").hide();
67325
+ //$("#" + ic.pre + "mnlist").hide();
67326
+ $("#" + ic.pre + "canvas").hide(); // "load mmdbid ..." may cause problems if canvas was removed
67327
+
67328
+ if($("#" + ic.pre + "fullscreen").length > 0) $("#" + ic.pre + "fullscreen").hide();
67321
67329
 
67322
67330
  // clear memory
67323
67331
  ic = {};
@@ -68266,6 +68274,10 @@ class ShareLink {
68266
68274
  if(key_value.length == 2) paraHash[key_value[0]] = key_value[1];
68267
68275
  }
68268
68276
 
68277
+ if(me.cfg.notebook && me.cfg.idname && !paraHash[me.cfg.idname]) { // somehow it is not included
68278
+ url += me.cfg.idname + '=' + me.cfg.idvalue + '&';
68279
+ }
68280
+
68269
68281
  for(let key in paraHash) {
68270
68282
  if(key === 'v') continue;
68271
68283
 
@@ -68305,7 +68317,7 @@ class ShareLink {
68305
68317
  transformation.quaternion = ic.quaternion;
68306
68318
 
68307
68319
  let statefile = "";
68308
- let prevCommandStr = undefined;
68320
+ let prevCommandStr = "";
68309
68321
 
68310
68322
  let toggleStr = 'toggle highlight';
68311
68323
  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.1",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {