@avs/go 0.12.71730 → 0.12.71739

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.71730",
3
+ "version": "0.12.71739",
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,15 +948,18 @@ 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);
958
+ else if (json.threejs) {
959
+ this.threeViewer.loadGeometryAsJson(json.threejs, this._handleLoadComplete.bind(this));
966
960
  }
967
- else if (json.chunkId !== undefined) {
968
- this.threeViewer.loadGeometryAsEvents(json);
961
+ else if (json.chunkId) {
962
+ this.threeViewer.loadGeometryAsEvents(json, this._handleLoadComplete.bind(this));
969
963
 
970
964
  if (json.moreChunks === true) {
971
965
  if (this.urlLoadJsonFile) {
@@ -976,34 +970,32 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
976
970
  }
977
971
  else {
978
972
  var model = this._assembleModel();
979
- if (model !== undefined) {
973
+ if (model) {
980
974
  model.rendererProperties.streamProperties.chunkId = json.chunkId;
981
975
  this._httpRequest(this.url, this._handleHttpResponse.bind(this), undefined, this._handleHttpError.bind(this), model);
982
976
  }
983
977
  }
984
- loadComplete = false;
985
978
  }
986
979
  }
987
980
  else if (this.urlLoadJsonFile) {
988
- this.threeViewer.loadGeometryAsJson(json);
981
+ this.threeViewer.loadGeometryAsJson(json, this._handleLoadComplete.bind(this));
989
982
  }
990
983
  }
984
+ }
991
985
 
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
- }*/
986
+ /**
987
+ *
988
+ */
989
+ _handleLoadComplete() {
990
+ // Stop and hide the spinner
991
+ this.hideSpinner();
992
+ this.stopSpinner();
1000
993
 
1001
- /**
1002
- * Scene load has completed.
1003
- * @event avs-load-complete
1004
- */
1005
- this.dispatchEvent(new CustomEvent('avs-load-complete'));
1006
- }
994
+ /**
995
+ * Scene load has completed.
996
+ * @event avs-load-complete
997
+ */
998
+ this.dispatchEvent(new CustomEvent('avs-load-complete'));
1007
999
  }
1008
1000
 
1009
1001
  /**
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.71730';
21
+ export var VERSION = '0.12.71739';