@avs/go 0.12.71731 → 0.13.71740

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avs/go",
3
- "version": "0.12.71731",
3
+ "version": "0.13.71740",
4
4
  "description": "AVS Go",
5
5
  "keywords": [
6
6
  "polymer",
@@ -23,6 +23,7 @@
23
23
  "scripts": {
24
24
  "build": "webpack --mode production",
25
25
  "dev": "webpack --mode development --watch",
26
+ "start": "http-server -o demo/jsonView.html",
26
27
  "type-check": "echo 'No TypeScript in core package'"
27
28
  },
28
29
  "license": "Apache-2.0",
@@ -888,15 +888,12 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
888
888
  * @param json JSON parsed from HTTP response.
889
889
  */
890
890
  _handleHttpResponse(json) {
891
- var loadComplete = true;
892
-
893
- if (json !== undefined) {
894
-
895
- if (json.selectionInfo !== undefined) {
891
+ if (json) {
892
+ if (json.selectionInfo) {
896
893
  this._dispatchPickEvents(json.selectionInfo);
897
894
  }
898
895
 
899
- if (json.sceneInfo !== undefined) {
896
+ if (json.sceneInfo) {
900
897
  var sceneEvent = {detail: json.sceneInfo};
901
898
  /**
902
899
  * Scene info from the server.
@@ -905,7 +902,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
905
902
  this.dispatchEvent(new CustomEvent('avs-scene-info', sceneEvent));
906
903
 
907
904
  // Set tooltip and zoom overlay style to reversed theme
908
- if (json.sceneInfo.backgroundColor !== undefined) {
905
+ if (json.sceneInfo.backgroundColor) {
909
906
  var col = json.sceneInfo.backgroundColor.match(/[0-9.]+/gi);
910
907
  var bgCol = window.getComputedStyle(this.parentNode, null).getPropertyValue("background-color").trim().match(/[0-9.]+/gi);
911
908
  var blendedR = (col[0] * col[3]);
@@ -920,27 +917,21 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
920
917
  this.$.zoomOverlay.style.color = "var(--avs-zoom-overlay-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
921
918
  this.$.tooltip.style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
922
919
  }
923
- if (json.sceneInfo.color !== undefined) {
920
+ if (json.sceneInfo.color) {
924
921
  var col = json.sceneInfo.color.match(/[0-9.]+/gi);
925
922
  this.$.zoomOverlay.style.background = "var(--avs-zoom-overlay-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + "))";
926
923
  this.$.tooltip.style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
927
924
  }
928
- if (json.sceneInfo.fontFamily !== undefined) {
925
+ if (json.sceneInfo.fontFamily) {
929
926
  this.$.zoomOverlay.style.fontFamily = "var(--avs-zoom-overlay-font-family, " + json.sceneInfo.fontFamily + ")";
930
927
  this.$.tooltip.style.fontFamily = "var(--avs-tooltip-font-family, " + json.sceneInfo.fontFamily + ")";
931
928
  }
932
929
  }
933
930
 
934
- if (json.image !== undefined) {
935
-
936
- if (json.image.startsWith("?app=image")) {
937
- this.sceneImage.src = this.url + json.image;
938
- }
939
- else {
940
- this.sceneImage.src = json.image;
941
- }
931
+ if (json.image) {
932
+ this.sceneImage.src = json.image;
942
933
 
943
- if (json.imagemap !== undefined) {
934
+ if (json.imagemap) {
944
935
  this.sceneImageMap.innerHTML = decodeURIComponent(json.imagemap.replace(/\+/g, '%20'));
945
936
 
946
937
  this.imageMapData = Array.from(this.sceneImageMap.querySelectorAll('area')).map(area => {
@@ -957,53 +948,59 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
957
948
  this.sceneImageMap.innerHTML = "";
958
949
  this.imageMapData = undefined;
959
950
  }
951
+
952
+ this._handleLoadComplete();
960
953
  }
961
- else if (json.svg !== undefined) {
954
+ else if (json.svg) {
962
955
  this.svgDiv.innerHTML = decodeURIComponent(json.svg.replace(/\+/g, '%20'));
956
+ this._handleLoadComplete();
963
957
  }
964
- else if (json.threejs !== undefined) {
965
- this.threeViewer.loadGeometryAsJson(json.threejs);
966
- }
967
- else if (json.chunkId !== undefined) {
968
- this.threeViewer.loadGeometryAsEvents(json);
969
-
970
- if (json.moreChunks === true) {
971
- if (this.urlLoadJsonFile) {
972
- this.chunkFile++;
973
- const urlBase = this.url.substring(0, this.url.lastIndexOf('.')) || this.url;
974
- const ext = this.url.split('.').pop();
975
- this._httpRequest(urlBase + '-' + this.chunkFile + '.' + ext, this._handleHttpResponse.bind(this), undefined, this._handleHttpError.bind(this));
976
- }
977
- else {
978
- var model = this._assembleModel();
979
- if (model !== undefined) {
980
- model.rendererProperties.streamProperties.chunkId = json.chunkId;
981
- this._httpRequest(this.url, this._handleHttpResponse.bind(this), undefined, this._handleHttpError.bind(this), model);
958
+ else if (json.threejs) {
959
+ if (json.threejs.chunkId) {
960
+ this.threeViewer.loadGeometryAsEvents(json.threejs, this._handleLoadComplete.bind(this));
961
+
962
+ if (json.threejs.moreChunks === true) {
963
+ if (this.urlLoadJsonFile) {
964
+ // Load the next chunk file
965
+ this.chunkFile++;
966
+ const urlBase = this.url.substring(0, this.url.lastIndexOf('.')) || this.url;
967
+ const ext = this.url.split('.').pop();
968
+ this._httpRequest(urlBase + '-' + this.chunkFile + '.' + ext, this._handleHttpResponse.bind(this), undefined, this._handleHttpError.bind(this));
969
+ }
970
+ else {
971
+ // Get the next chunk from the server
972
+ var model = this._assembleModel();
973
+ if (model) {
974
+ model.rendererProperties.streamProperties.chunkId = json.threejs.chunkId;
975
+ this._httpRequest(this.url, this._handleHttpResponse.bind(this), undefined, this._handleHttpError.bind(this), model);
976
+ }
982
977
  }
983
978
  }
984
- loadComplete = false;
979
+ }
980
+ else {
981
+ this.threeViewer.loadGeometryAsJson(json.threejs, this._handleLoadComplete.bind(this));
985
982
  }
986
983
  }
987
- else if (this.urlLoadJsonFile) {
988
- this.threeViewer.loadGeometryAsJson(json);
984
+ else {
985
+ console.log("ERROR: No image, SVG, or ThreeJS found in response.");
986
+ this._handleLoadComplete();
989
987
  }
990
988
  }
989
+ }
991
990
 
992
- if (loadComplete) {
993
- // Hide the spinner and grab the scene background color for next time
994
- // Disable background temporarily
995
- this.hideSpinner();
996
- this.stopSpinner();
997
- /* if (json.backgroundColor !== undefined) {
998
- this.updateStyles({'--avs-spinner-background-color': json.backgroundColor});
999
- }*/
991
+ /**
992
+ *
993
+ */
994
+ _handleLoadComplete() {
995
+ // Stop and hide the spinner
996
+ this.hideSpinner();
997
+ this.stopSpinner();
1000
998
 
1001
- /**
1002
- * Scene load has completed.
1003
- * @event avs-load-complete
1004
- */
1005
- this.dispatchEvent(new CustomEvent('avs-load-complete'));
1006
- }
999
+ /**
1000
+ * Scene load has completed.
1001
+ * @event avs-load-complete
1002
+ */
1003
+ this.dispatchEvent(new CustomEvent('avs-load-complete'));
1007
1004
  }
1008
1005
 
1009
1006
  /**
package/src/constants.js CHANGED
@@ -18,4 +18,4 @@
18
18
  * Advanced Visual Systems Inc. (http://www.avs.com)
19
19
  */
20
20
 
21
- export var VERSION = '0.12.71731';
21
+ export var VERSION = '0.13.71740';