@avs/go-react 0.13.71745 → 0.13.71754
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/demo/src/App.tsx +7 -38
- package/package.json +1 -1
- package/src/AvsGoDataViz.jsx +12 -10
package/demo/src/App.tsx
CHANGED
|
@@ -1,46 +1,15 @@
|
|
|
1
1
|
import './App.css'
|
|
2
2
|
import { AvsGoDataViz } from '@avs/go-react/src/AvsGoDataViz';
|
|
3
|
-
import { useRef } from 'react';
|
|
4
|
-
|
|
5
|
-
const startupAnimation = null; // btoa('[{"time":0,"rotation":[-75,0,0,"XYZ"],"position":[0,0,0],"scale":100},{"time":2000,"rotation":[-75,0,-90,"XYZ"],"position":[0,0,0],"scale":100},{"time":4000,"rotation":[-75,0,-90,"XYZ"],"position":[0,0,0],"scale":200},{"time":6000,"rotation":[0,0,-90,"XYZ"],"position":[0,0,0],"scale":200}]');
|
|
6
|
-
const params = new URLSearchParams(window.location.search);
|
|
7
|
-
const param = params.get('animation');
|
|
8
3
|
|
|
9
4
|
function App() {
|
|
10
|
-
const dataVizRef = useRef(null);
|
|
11
|
-
|
|
12
|
-
function handleLoadComplete() {
|
|
13
|
-
if (dataVizRef.current) {
|
|
14
|
-
dataVizRef.current.runAnimation();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function handleTransformAnimationShare(animation: string) {
|
|
19
|
-
const url = window.location.origin + window.location.pathname + "?animation=" + animation;
|
|
20
|
-
navigator.clipboard.writeText(url);
|
|
21
|
-
|
|
22
|
-
const dialog = document.createElement("dialog");
|
|
23
|
-
document.body.appendChild(dialog);
|
|
24
|
-
dialog.innerText = "URL copied to clipboard";
|
|
25
|
-
dialog.show();
|
|
26
|
-
setTimeout(function () {
|
|
27
|
-
dialog.close();
|
|
28
|
-
}, 1000);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
5
|
return (
|
|
32
|
-
<div style={{width: '100vw', height: '100vh'
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
transformAnimation={param ?? startupAnimation}
|
|
40
|
-
animationControlsEnable
|
|
41
|
-
onLoadComplete={handleLoadComplete}
|
|
42
|
-
onTransformAnimationShare={handleTransformAnimationShare}
|
|
43
|
-
/>
|
|
6
|
+
<div style={{width: '100vw', height: '100vh'}}>
|
|
7
|
+
<AvsGoDataViz
|
|
8
|
+
url='hydrogen.json'
|
|
9
|
+
urlLoadJsonFile
|
|
10
|
+
renderer='THREEJS'
|
|
11
|
+
transformEnable
|
|
12
|
+
/>
|
|
44
13
|
</div>
|
|
45
14
|
)
|
|
46
15
|
}
|
package/package.json
CHANGED
package/src/AvsGoDataViz.jsx
CHANGED
|
@@ -22,6 +22,7 @@ import { forwardRef, useRef, useEffect, useImperativeHandle } from 'react';
|
|
|
22
22
|
import { AvsGoDataViz as AvsGoDataVizPolymer } from '@avs/go/src/avs-go-dataviz';
|
|
23
23
|
|
|
24
24
|
export const AvsGoDataViz = forwardRef(({
|
|
25
|
+
children,
|
|
25
26
|
style,
|
|
26
27
|
manualUpdate,
|
|
27
28
|
displayCanvas,
|
|
@@ -99,49 +100,49 @@ export const AvsGoDataViz = forwardRef(({
|
|
|
99
100
|
|
|
100
101
|
function handleTap(e) {
|
|
101
102
|
if (onTap) {
|
|
102
|
-
onTap(e
|
|
103
|
+
onTap(e);
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
function handleTrack(e) {
|
|
107
108
|
if (onTrack) {
|
|
108
|
-
onTrack(e
|
|
109
|
+
onTrack(e);
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
function handleHover(e) {
|
|
113
114
|
if (onHover) {
|
|
114
|
-
onHover(e
|
|
115
|
+
onHover(e);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
function handleSceneInfo(e) {
|
|
119
120
|
if (onSceneInfo) {
|
|
120
|
-
onSceneInfo(e
|
|
121
|
+
onSceneInfo(e);
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
function handleLoadComplete(e) {
|
|
125
126
|
if (onLoadComplete) {
|
|
126
|
-
onLoadComplete();
|
|
127
|
+
onLoadComplete(e);
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
function handlePanInfo(e) {
|
|
131
132
|
if (onPanInfo) {
|
|
132
|
-
onPanInfo(e
|
|
133
|
+
onPanInfo(e);
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
function handleTransformAnimationShare(e) {
|
|
137
138
|
if (onTransformAnimationShare) {
|
|
138
|
-
onTransformAnimationShare(e
|
|
139
|
+
onTransformAnimationShare(e);
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
function handleError(e) {
|
|
143
144
|
if (onError) {
|
|
144
|
-
onError(e
|
|
145
|
+
onError(e);
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
|
|
@@ -267,7 +268,8 @@ export const AvsGoDataViz = forwardRef(({
|
|
|
267
268
|
animated-glyphs-visible={animatedGlyphsVisible}
|
|
268
269
|
animated-glyphs-enable={animatedGlyphsEnable}
|
|
269
270
|
animation-controls-enable={animationControlsEnable}
|
|
270
|
-
|
|
271
|
-
|
|
271
|
+
>
|
|
272
|
+
{children}
|
|
273
|
+
</avs-go-dataviz>
|
|
272
274
|
);
|
|
273
275
|
});
|