@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/README.md +33 -0
- package/demo/data/hydrogen.json +1 -0
- package/demo/jsonView.html +31 -0
- package/dist/avs-go.min.js +1 -1
- package/lib/avs-three.module.min.js +2 -2
- package/package.json +2 -1
- package/src/avs-go-dataviz.js +32 -40
- package/src/constants.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avs/go",
|
|
3
|
-
"version": "0.12.
|
|
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",
|
package/src/avs-go-dataviz.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
}*/
|
|
986
|
+
/**
|
|
987
|
+
*
|
|
988
|
+
*/
|
|
989
|
+
_handleLoadComplete() {
|
|
990
|
+
// Stop and hide the spinner
|
|
991
|
+
this.hideSpinner();
|
|
992
|
+
this.stopSpinner();
|
|
1000
993
|
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
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