@avs/go 0.13.71745 → 0.13.71760
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/dist/avs-go.min.js +1 -1
- package/lib/avs-three.module.min.js +2 -2
- package/package.json +1 -1
- package/src/avs-go-dataviz.js +243 -69
- package/src/constants.js +1 -1
- package/src/logo.js +7 -1
package/src/avs-go-dataviz.js
CHANGED
|
@@ -27,7 +27,7 @@ import {Viewer, TransformInteractor, PanInteractor, ZoomRectangleInteractor, Pic
|
|
|
27
27
|
import {AvsHttpMixin} from './avs-http-mixin.js';
|
|
28
28
|
import {AvsStreamMixin} from './avs-stream-mixin.js';
|
|
29
29
|
import {AvsDataSourceMixin} from './avs-data-source-mixin.js';
|
|
30
|
-
import {LOGO} from './logo.js';
|
|
30
|
+
import {LOGO, CAMERA, PLAY, COPY, RESET, DELETE} from './logo.js';
|
|
31
31
|
import {Euler, Vector3, Quaternion} from 'three';
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -82,30 +82,58 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
82
82
|
left: 8px;
|
|
83
83
|
padding: 8px;
|
|
84
84
|
background-color: rgba(128, 128, 128, 0.8);
|
|
85
|
-
color: white;
|
|
86
85
|
font-size: 10pt;
|
|
87
86
|
border-radius: 8px;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
margin-top: 4px;
|
|
93
|
-
}
|
|
94
|
-
button:not([disabled]) {
|
|
95
|
-
cursor: pointer;
|
|
87
|
+
background:var(--avs-animation-controls-background, rgba(80,80,80,0.75));
|
|
88
|
+
color:var(--avs-animation-controls-color, #ffffff);
|
|
89
|
+
font-family:var(--avs-animation-controls-font-family);
|
|
90
|
+
box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);
|
|
96
91
|
}
|
|
97
92
|
#animationControlsTitle {
|
|
98
|
-
font-weight: bold;
|
|
99
93
|
margin-bottom: 8px;
|
|
94
|
+
font-weight: 700;
|
|
100
95
|
}
|
|
101
|
-
|
|
96
|
+
.btn {
|
|
97
|
+
padding: 4px;
|
|
98
|
+
border-radius: 4px;
|
|
99
|
+
margin: 4px;
|
|
100
|
+
background:var(--avs-animation-controls-button-background, white);
|
|
101
|
+
color:var(--avs-animation-controls-button-color, black);
|
|
102
|
+
display: inline-flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
box-shadow: 0 2px 2px #00000024,0 3px 1px -2px #0000001f,0 1px 5px #0003;
|
|
102
105
|
cursor: pointer;
|
|
106
|
+
user-select: none;
|
|
107
|
+
}
|
|
108
|
+
.btn.disabled {
|
|
109
|
+
cursor: default;
|
|
110
|
+
pointer-events: none;
|
|
111
|
+
box-shadow: none;
|
|
112
|
+
background-color: darkgrey;
|
|
113
|
+
color: grey;
|
|
114
|
+
}
|
|
115
|
+
#animationDelay {
|
|
116
|
+
width: 30px;
|
|
117
|
+
height: 29px;
|
|
118
|
+
background:var(--avs-animation-controls-button-background, white);
|
|
119
|
+
color:var(--avs-animation-controls-button-color, black);
|
|
120
|
+
border-width: 0;
|
|
121
|
+
border-radius: 4px;
|
|
122
|
+
box-shadow: 0 2px 2px #00000024,0 3px 1px -2px #0000001f,0 1px 5px #0003;
|
|
123
|
+
margin: 4px;
|
|
103
124
|
}
|
|
104
|
-
#
|
|
105
|
-
|
|
125
|
+
#animationDelay:disabled {
|
|
126
|
+
pointer-events: none;
|
|
127
|
+
box-shadow: none;
|
|
128
|
+
background-color: darkgrey;
|
|
129
|
+
color: grey;
|
|
106
130
|
}
|
|
107
|
-
#
|
|
108
|
-
|
|
131
|
+
#animationSnapshotIcon {
|
|
132
|
+
height: 24px;
|
|
133
|
+
}
|
|
134
|
+
#animationSnapshotLabel {
|
|
135
|
+
margin-left: 4px;
|
|
136
|
+
height: 16px;
|
|
109
137
|
}
|
|
110
138
|
#sceneImage {
|
|
111
139
|
width:100%;
|
|
@@ -133,7 +161,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
133
161
|
font-weight:var(--avs-zoom-overlay-font-weight, bold);
|
|
134
162
|
font-style:var(--avs-zoom-overlay-font-style);
|
|
135
163
|
}
|
|
136
|
-
#tooltip {
|
|
164
|
+
#tooltip, #animationTooltip {
|
|
137
165
|
position:absolute;
|
|
138
166
|
opacity:0;
|
|
139
167
|
transition:opacity ease 0.3s;
|
|
@@ -174,26 +202,23 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
174
202
|
<div id="dataVizDiv"></div>
|
|
175
203
|
<div id="animationControls">
|
|
176
204
|
<div id="animationControlsTitle">Animation Controls</div>
|
|
177
|
-
<div
|
|
178
|
-
|
|
179
|
-
<
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
</div>
|
|
184
|
-
<div>
|
|
185
|
-
<button type="button" disabled id="animationPlay">Play Animation</button>
|
|
186
|
-
</div>
|
|
187
|
-
<div>
|
|
188
|
-
<button type="button" disabled id="animationShare">Share Animation</button>
|
|
205
|
+
<div style="display: flex; justify-content: center">
|
|
206
|
+
<input type="number" disabled min="1" max="10" value="0" step="1" id="animationDelay" data-tooltip="Frame delay (seconds)">
|
|
207
|
+
<a class="btn" id="animationSnapshot" data-tooltip="Take snapshot">
|
|
208
|
+
<div id="animationSnapshotIcon"></div>
|
|
209
|
+
<div id="animationSnapshotLabel">0</div>
|
|
210
|
+
</a>
|
|
189
211
|
</div>
|
|
190
|
-
<div>
|
|
191
|
-
<
|
|
212
|
+
<div style="display: flex; justify-content: center">
|
|
213
|
+
<a class="btn disabled" id="animationPlay" data-tooltip="Play animation"></a>
|
|
214
|
+
<a class="btn disabled" id="animationCopy" data-tooltip="Copy animation URL to clipboard"></a>
|
|
192
215
|
</div>
|
|
193
|
-
<div>
|
|
194
|
-
<
|
|
216
|
+
<div style="display: flex; justify-content: center">
|
|
217
|
+
<a class="btn" id="animationReset" data-tooltip="Reset transform"></a>
|
|
218
|
+
<a class="btn disabled" id="animationClear" data-tooltip="Clear animation"></a>
|
|
195
219
|
</div>
|
|
196
220
|
</div>
|
|
221
|
+
<div id="animationTooltip"></div>
|
|
197
222
|
<div id="zoomOverlay"></div>
|
|
198
223
|
<div id="spinnerDiv">
|
|
199
224
|
<div id="spinner"></div>
|
|
@@ -954,30 +979,36 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
954
979
|
*/
|
|
955
980
|
this.dispatchEvent(new CustomEvent('avs-scene-info', sceneEvent));
|
|
956
981
|
|
|
957
|
-
// Set tooltip and zoom overlay style to reversed theme
|
|
982
|
+
// Set animation controls, tooltip and zoom overlay style to reversed theme
|
|
958
983
|
if (json.sceneInfo.backgroundColor) {
|
|
959
984
|
var col = json.sceneInfo.backgroundColor.match(/[0-9.]+/gi);
|
|
960
|
-
var bgCol =
|
|
985
|
+
var bgCol = this.getInheritedBackgroundCol(this.parentNode).trim().match(/[0-9.]+/gi);
|
|
961
986
|
var blendedR = (col[0] * col[3]);
|
|
962
987
|
var blendedG = (col[1] * col[3]);
|
|
963
988
|
var blendedB = (col[2] * col[3]);
|
|
964
|
-
|
|
965
|
-
// In case sceneInfo.backgroundColor is transparent, blend with
|
|
989
|
+
if (col[3] == 0) {
|
|
990
|
+
// In case sceneInfo.backgroundColor is transparent, blend with inherited background color
|
|
966
991
|
blendedR += (bgCol[0] * (1 - col[3]));
|
|
967
992
|
blendedG += (bgCol[1] * (1 - col[3]));
|
|
968
993
|
blendedB += (bgCol[2] * (1 - col[3]));
|
|
969
|
-
|
|
994
|
+
}
|
|
995
|
+
this.$.animationControls.style.color = "var(--avs-animation-controls-color, rgb(" + blendedR + ", " + blendedG + ", " + blendedB + "))";
|
|
970
996
|
this.$.zoomOverlay.style.color = "var(--avs-zoom-overlay-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
|
|
971
997
|
this.$.tooltip.style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
|
|
998
|
+
this.$.animationTooltip.style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
|
|
972
999
|
}
|
|
973
1000
|
if (json.sceneInfo.color) {
|
|
974
1001
|
var col = json.sceneInfo.color.match(/[0-9.]+/gi);
|
|
975
|
-
this.$.
|
|
1002
|
+
this.$.animationControls.style.background = "var(--avs-animation-controls-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
|
|
1003
|
+
this.$.zoomOverlay.style.background = "var(--avs-zoom-overlay-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
|
|
976
1004
|
this.$.tooltip.style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
|
|
1005
|
+
this.$.animationTooltip.style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
|
|
977
1006
|
}
|
|
978
1007
|
if (json.sceneInfo.fontFamily) {
|
|
1008
|
+
this.$.animationControls.style.fontFamily = "var(--avs-animation-controls-font-family, " + json.sceneInfo.fontFamily + ")";
|
|
979
1009
|
this.$.zoomOverlay.style.fontFamily = "var(--avs-zoom-overlay-font-family, " + json.sceneInfo.fontFamily + ")";
|
|
980
1010
|
this.$.tooltip.style.fontFamily = "var(--avs-tooltip-font-family, " + json.sceneInfo.fontFamily + ")";
|
|
1011
|
+
this.$.animationTooltip.style.fontFamily = "var(--avs-tooltip-font-family, " + json.sceneInfo.fontFamily + ")";
|
|
981
1012
|
}
|
|
982
1013
|
}
|
|
983
1014
|
|
|
@@ -1041,6 +1072,30 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1041
1072
|
}
|
|
1042
1073
|
}
|
|
1043
1074
|
|
|
1075
|
+
getInheritedBackgroundCol(el) {
|
|
1076
|
+
var defaultStyle = this.getDefaultBackground();
|
|
1077
|
+
|
|
1078
|
+
var bgCol = window.getComputedStyle(el).backgroundColor;
|
|
1079
|
+
if (bgCol != defaultStyle) {
|
|
1080
|
+
return bgCol;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
if (!el.parentElement) {
|
|
1084
|
+
return defaultStyle;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
return this.getInheritedBackgroundCol(el.parentElement);
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
getDefaultBackground() {
|
|
1091
|
+
// have to add to the document in order to use getComputedStyle
|
|
1092
|
+
var div = document.createElement("div");
|
|
1093
|
+
document.head.appendChild(div);
|
|
1094
|
+
var bg = window.getComputedStyle(div).backgroundColor;
|
|
1095
|
+
document.head.removeChild(div);
|
|
1096
|
+
return bg;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1044
1099
|
/**
|
|
1045
1100
|
*
|
|
1046
1101
|
*/
|
|
@@ -1495,25 +1550,35 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1495
1550
|
}
|
|
1496
1551
|
});
|
|
1497
1552
|
|
|
1498
|
-
this.$.
|
|
1553
|
+
this.$.animationSnapshotIcon.innerHTML = CAMERA;
|
|
1554
|
+
this.$.animationPlay.innerHTML = PLAY;
|
|
1555
|
+
this.$.animationCopy.innerHTML = COPY;
|
|
1556
|
+
this.$.animationReset.innerHTML = RESET;
|
|
1557
|
+
this.$.animationClear.innerHTML = DELETE;
|
|
1558
|
+
|
|
1559
|
+
this.$.animationDelay.addEventListener('change', this._handleAnimationDelayChange.bind(this));
|
|
1499
1560
|
this.$.animationSnapshot.addEventListener('click', this._handleAnimationSnapshot.bind(this));
|
|
1500
1561
|
this.$.animationPlay.addEventListener('click', this.runAnimation.bind(this));
|
|
1501
|
-
this.$.
|
|
1562
|
+
this.$.animationCopy.addEventListener('click', this._handleAnimationCopy.bind(this));
|
|
1502
1563
|
this.$.animationReset.addEventListener('click', this.resetTransform.bind(this));
|
|
1503
1564
|
this.$.animationClear.addEventListener('click', this._handleAnimationClear.bind(this));
|
|
1504
1565
|
|
|
1566
|
+
this.$.animationDelay.addEventListener('pointermove', this._handlePointerEnterAnimationControl.bind(this));
|
|
1567
|
+
this.$.animationSnapshot.addEventListener('pointermove', this._handlePointerEnterAnimationControl.bind(this));
|
|
1568
|
+
this.$.animationPlay.addEventListener('pointermove', this._handlePointerEnterAnimationControl.bind(this));
|
|
1569
|
+
this.$.animationCopy.addEventListener('pointermove', this._handlePointerEnterAnimationControl.bind(this));
|
|
1570
|
+
this.$.animationReset.addEventListener('pointermove', this._handlePointerEnterAnimationControl.bind(this));
|
|
1571
|
+
this.$.animationClear.addEventListener('pointermove', this._handlePointerEnterAnimationControl.bind(this));
|
|
1572
|
+
|
|
1573
|
+
this.$.animationDelay.addEventListener('pointerout', this._handlePointerLeaveAnimationControl.bind(this));
|
|
1574
|
+
this.$.animationSnapshot.addEventListener('pointerout', this._handlePointerLeaveAnimationControl.bind(this));
|
|
1575
|
+
this.$.animationPlay.addEventListener('pointerout', this._handlePointerLeaveAnimationControl.bind(this));
|
|
1576
|
+
this.$.animationCopy.addEventListener('pointerout', this._handlePointerLeaveAnimationControl.bind(this));
|
|
1577
|
+
this.$.animationReset.addEventListener('pointerout', this._handlePointerLeaveAnimationControl.bind(this));
|
|
1578
|
+
this.$.animationClear.addEventListener('pointerout', this._handlePointerLeaveAnimationControl.bind(this));
|
|
1579
|
+
|
|
1505
1580
|
this.animationTime = 0;
|
|
1506
1581
|
this.transformAnimationFrames ??= [];
|
|
1507
|
-
if (this.transformAnimationFrames.length > 0) {
|
|
1508
|
-
this.$.animationDelayLabel.innerHTML = "Snapshot Delay (2s)";
|
|
1509
|
-
this.$.animationDelay.value = 2;
|
|
1510
|
-
this.$.animationDelay.disabled = false;
|
|
1511
|
-
this.$.animationSnapshot.innerHTML = "Take Snapshot (" + this.transformAnimationFrames.length + ")";
|
|
1512
|
-
this.$.animationPlay.disabled = false;
|
|
1513
|
-
this.$.animationShare.disabled = false;
|
|
1514
|
-
this.$.animationClear.disabled = false;
|
|
1515
|
-
this.animationTime = this.transformAnimationFrames[this.transformAnimationFrames.length - 1].time / 1000;
|
|
1516
|
-
}
|
|
1517
1582
|
|
|
1518
1583
|
this._resetTimer();
|
|
1519
1584
|
|
|
@@ -1522,13 +1587,37 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1522
1587
|
});
|
|
1523
1588
|
}
|
|
1524
1589
|
|
|
1590
|
+
_handlePointerEnterAnimationControl(e) {
|
|
1591
|
+
if (!this.showAnimationTooltip) {
|
|
1592
|
+
var adjustedCoords = this._getAdjustedCoords(e.clientX, e.clientY);
|
|
1593
|
+
var pos = this._calcTooltipPosition(adjustedCoords.x, adjustedCoords.y);
|
|
1594
|
+
this.$.animationTooltip.style.left = pos.x + "px";
|
|
1595
|
+
this.$.animationTooltip.style.top = pos.y + "px";
|
|
1596
|
+
this.$.animationTooltip.style.opacity = 1;
|
|
1597
|
+
this.$.animationTooltip.innerHTML = e.currentTarget.dataset.tooltip ?? e.currentTarget.id;
|
|
1598
|
+
this.showAnimationTooltip = true;
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
_handlePointerLeaveAnimationControl() {
|
|
1603
|
+
this.$.animationTooltip.style.opacity = 0;
|
|
1604
|
+
this.showAnimationTooltip = false;
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1525
1607
|
_round2dp(n) {
|
|
1526
1608
|
return Math.round((n + Number.EPSILON) * 100) / 100;
|
|
1527
1609
|
}
|
|
1528
1610
|
|
|
1529
1611
|
_handleAnimationDelayChange() {
|
|
1530
|
-
|
|
1531
|
-
|
|
1612
|
+
let delay = Number(this.$.animationDelay.value);
|
|
1613
|
+
if (delay < 1) {
|
|
1614
|
+
delay = 1;
|
|
1615
|
+
this.$.animationDelay.value = delay;
|
|
1616
|
+
}
|
|
1617
|
+
if (delay > 10) {
|
|
1618
|
+
delay = 10;
|
|
1619
|
+
this.$.animationDelay.value = delay;
|
|
1620
|
+
}
|
|
1532
1621
|
}
|
|
1533
1622
|
|
|
1534
1623
|
_handleAnimationSnapshot() {
|
|
@@ -1551,40 +1640,100 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1551
1640
|
this.transformAnimationFrames.push(frame);
|
|
1552
1641
|
|
|
1553
1642
|
if (this.transformAnimationFrames.length == 1) {
|
|
1554
|
-
this.$.animationDelayLabel.innerHTML = "Snapshot Delay (2s)";
|
|
1555
1643
|
this.$.animationDelay.value = 2;
|
|
1556
1644
|
this.$.animationDelay.disabled = false;
|
|
1557
|
-
this.$.animationPlay.disabled
|
|
1558
|
-
this.$.
|
|
1559
|
-
this.$.animationClear.disabled
|
|
1645
|
+
this.$.animationPlay.classList.remove("disabled");
|
|
1646
|
+
this.$.animationCopy.classList.remove("disabled");
|
|
1647
|
+
this.$.animationClear.classList.remove("disabled");
|
|
1560
1648
|
}
|
|
1561
|
-
this.$.
|
|
1649
|
+
this.$.animationSnapshotLabel.innerHTML = this.transformAnimationFrames.length;
|
|
1562
1650
|
}
|
|
1563
1651
|
|
|
1564
1652
|
_handleAnimationClear() {
|
|
1565
1653
|
this.transformAnimationFrames.length = 0;
|
|
1566
|
-
this.$.animationDelayLabel.innerHTML = "Snapshot Delay (0s)";
|
|
1567
1654
|
this.$.animationDelay.value = 0;
|
|
1568
1655
|
this.$.animationDelay.disabled = true;
|
|
1569
|
-
this.$.
|
|
1570
|
-
this.$.animationPlay.disabled
|
|
1571
|
-
this.$.
|
|
1572
|
-
this.$.animationClear.disabled
|
|
1656
|
+
this.$.animationSnapshotLabel.innerHTML = "0";
|
|
1657
|
+
this.$.animationPlay.classList.add("disabled");
|
|
1658
|
+
this.$.animationCopy.classList.add("disabled");
|
|
1659
|
+
this.$.animationClear.classList.add("disabled");
|
|
1573
1660
|
this.animationTime = 0;
|
|
1574
1661
|
}
|
|
1575
1662
|
|
|
1576
|
-
|
|
1663
|
+
async _handleAnimationCopy() {
|
|
1664
|
+
// Convert to JSON, compress and base64url encode
|
|
1577
1665
|
const json = JSON.stringify(this.transformAnimationFrames);
|
|
1578
|
-
const
|
|
1666
|
+
const compressed = await this._compress(json);
|
|
1667
|
+
const encoded = compressed.toBase64().replace('/', '_').replace('+', '-');
|
|
1579
1668
|
|
|
1580
1669
|
/**
|
|
1581
1670
|
* A transform animation share event occurred.
|
|
1582
1671
|
* @event avs-transform-animation-share
|
|
1583
1672
|
*/
|
|
1584
|
-
|
|
1585
1673
|
this.dispatchEvent(new CustomEvent('avs-transform-animation-share', { detail: encoded }));
|
|
1586
1674
|
}
|
|
1587
1675
|
|
|
1676
|
+
/**
|
|
1677
|
+
* Convert a string to its UTF-8 bytes and compress it.
|
|
1678
|
+
*
|
|
1679
|
+
* @param {string} str
|
|
1680
|
+
* @returns {Promise<Uint8Array>}
|
|
1681
|
+
*/
|
|
1682
|
+
async _compress(str) {
|
|
1683
|
+
// Convert the string to a byte stream.
|
|
1684
|
+
const stream = new Blob([str]).stream();
|
|
1685
|
+
|
|
1686
|
+
// Create a compressed stream.
|
|
1687
|
+
const compressedStream = stream.pipeThrough(
|
|
1688
|
+
new CompressionStream("gzip")
|
|
1689
|
+
);
|
|
1690
|
+
|
|
1691
|
+
// Read all the bytes from this stream.
|
|
1692
|
+
const chunks = [];
|
|
1693
|
+
for await (const chunk of compressedStream) {
|
|
1694
|
+
chunks.push(chunk);
|
|
1695
|
+
}
|
|
1696
|
+
return this._concatUint8Arrays(chunks);
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
/**
|
|
1700
|
+
* Decompress bytes into a UTF-8 string.
|
|
1701
|
+
*
|
|
1702
|
+
* @param {Uint8Array} compressedBytes
|
|
1703
|
+
* @returns {Promise<string>}
|
|
1704
|
+
*/
|
|
1705
|
+
async _decompress(compressedBytes) {
|
|
1706
|
+
// Convert the bytes to a stream.
|
|
1707
|
+
const stream = new Blob([compressedBytes]).stream();
|
|
1708
|
+
|
|
1709
|
+
// Create a decompressed stream.
|
|
1710
|
+
const decompressedStream = stream.pipeThrough(
|
|
1711
|
+
new DecompressionStream("gzip")
|
|
1712
|
+
);
|
|
1713
|
+
|
|
1714
|
+
// Read all the bytes from this stream.
|
|
1715
|
+
const chunks = [];
|
|
1716
|
+
for await (const chunk of decompressedStream) {
|
|
1717
|
+
chunks.push(chunk);
|
|
1718
|
+
}
|
|
1719
|
+
const stringBytes = await this._concatUint8Arrays(chunks);
|
|
1720
|
+
|
|
1721
|
+
// Convert the bytes to a string.
|
|
1722
|
+
return new TextDecoder().decode(stringBytes);
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
* Combine multiple Uint8Arrays into one.
|
|
1727
|
+
*
|
|
1728
|
+
* @param {ReadonlyArray<Uint8Array>} uint8arrays
|
|
1729
|
+
* @returns {Promise<Uint8Array>}
|
|
1730
|
+
*/
|
|
1731
|
+
async _concatUint8Arrays(uint8arrays) {
|
|
1732
|
+
const blob = new Blob(uint8arrays);
|
|
1733
|
+
const buffer = await blob.arrayBuffer();
|
|
1734
|
+
return new Uint8Array(buffer);
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1588
1737
|
_updatePixelRatio(change) {
|
|
1589
1738
|
const pr = window.devicePixelRatio;
|
|
1590
1739
|
matchMedia( `(resolution: ${pr}dppx)` ).addEventListener('change', this._updatePixelRatio.bind(this, true), { once: true } );
|
|
@@ -1816,10 +1965,35 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1816
1965
|
/**
|
|
1817
1966
|
* Change in 'transform-animation' property.
|
|
1818
1967
|
*/
|
|
1819
|
-
_transformAnimationValueChanged(newValue, oldValue) {
|
|
1968
|
+
async _transformAnimationValueChanged(newValue, oldValue) {
|
|
1820
1969
|
if (newValue) {
|
|
1821
|
-
|
|
1822
|
-
|
|
1970
|
+
// Decode from base64url, decompress and parse JSON
|
|
1971
|
+
const decoded = Uint8Array.fromBase64(newValue.replaceAll('_', '/').replaceAll('-', '+'));
|
|
1972
|
+
const decompressed = await this._decompress(decoded);
|
|
1973
|
+
this.transformAnimationFrames = JSON.parse(decompressed);
|
|
1974
|
+
|
|
1975
|
+
if (!this.transformAnimationFrames) {
|
|
1976
|
+
this.transformAnimationFrame = [];
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
if (this.transformAnimationFrames.length > 0) {
|
|
1980
|
+
this.$.animationDelay.value = 2;
|
|
1981
|
+
this.$.animationDelay.disabled = false;
|
|
1982
|
+
this.$.animationSnapshotLabel.innerHTML = this.transformAnimationFrames.length;
|
|
1983
|
+
this.$.animationPlay.classList.remove("disabled");
|
|
1984
|
+
this.$.animationCopy.classList.remove("disabled");
|
|
1985
|
+
this.$.animationClear.classList.remove("disabled");
|
|
1986
|
+
this.animationTime = this.transformAnimationFrames[this.transformAnimationFrames.length - 1].time / 1000;
|
|
1987
|
+
}
|
|
1988
|
+
else {
|
|
1989
|
+
this.$.animationDelay.value = 0;
|
|
1990
|
+
this.$.animationDelay.disabled = true;
|
|
1991
|
+
this.$.animationSnapshotLabel.innerHTML = "0";
|
|
1992
|
+
this.$.animationPlay.classList.add("disabled");
|
|
1993
|
+
this.$.animationCopy.classList.add("disabled");
|
|
1994
|
+
this.$.animationClear.classList.add("disabled");
|
|
1995
|
+
this.animationTime = 0;
|
|
1996
|
+
}
|
|
1823
1997
|
}
|
|
1824
1998
|
}
|
|
1825
1999
|
|
package/src/constants.js
CHANGED
package/src/logo.js
CHANGED
|
@@ -18,4 +18,10 @@
|
|
|
18
18
|
* Advanced Visual Systems Inc. (http://www.avs.com)
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
export var LOGO = "<svg viewBox=\"0 0 12.170833 12.170834\"
|
|
21
|
+
export var LOGO = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"46px\" viewBox=\"0 0 12.170833 12.170834\" width=\"46px\"><path d=\"M 7.2486073,9.9076469 H 5.2849946 L 8.4704866,6.123394 6.2360101,3.4130208 7.1885217,2.271515 10.424524,6.122616 Z M 6.0677825,8.6164059 3.9785527,6.1181874 6.0843599,3.5947138 8.1676051,6.1217782 Z M 1.7215741,6.1177086 6.5503222,0.33124232 H 8.5047186 L 3.6754319,6.1184268 5.9155339,8.7972611 4.958833,9.9337997 Z M 7.3399924,2.0900614 9.0019205,0.09856041 H 6.441462 L 1.4175556,6.1188457 4.7994028,10.140329 H 7.3569887 L 10.728423,6.122616 Z\" style=\"display:inline;fill:#2e8cbd;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.0598462\" id=\"path22\" /><path d=\"M 7.2486073,9.9076469 H 5.2849946 L 8.4704866,6.123394 6.2360101,3.4130208 7.1885217,2.271515 10.424524,6.122616 Z M 6.0677825,8.6164059 3.9785527,6.1181874 6.0843599,3.5947138 8.1676051,6.1217782 Z M 1.7215741,6.1177086 6.5503222,0.33124232 H 8.5047186 L 3.6754319,6.1184268 5.9155339,8.7972611 4.958833,9.9337997 Z M 7.3399924,2.0900614 9.0019205,0.09856041 H 6.441462 L 1.4175556,6.1188457 4.7994028,10.140329 H 7.3569887 L 10.728423,6.122616 Z\" style=\"fill:none;stroke:#2e8cbd;stroke-width:0.179539;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" id=\"path26\" /><g id=\"g78\" class=\"spinnerBackground\"><path d=\"M 5.0916012,7.2951741 C 4.5581951,6.6568 4.1217726,6.1273448 4.1217726,6.1186069 c 0,-0.022412 1.9511841,-2.3603376 1.9654853,-2.3550616 0.00645,0.00237 0.4481639,0.5337638 0.981573,1.1808488 L 8.0386633,6.1209126 7.7794202,6.4289493 C 7.6368389,6.5983701 7.1955674,7.1235887 6.7988191,7.5961017 6.4020707,8.0686158 6.0738528,8.4553619 6.0694438,8.4555369 6.0650388,8.4557059 5.6250056,7.9335497 5.0916012,7.2951741 Z\" id=\"path39\" /><path d=\"M 5.5264617,9.7764122 C 5.5385577,9.7616559 6.2319291,8.9374956 7.0672769,7.9449584 7.9026265,6.9524246 8.5861155,6.1329723 8.5861409,6.1239554 8.5861681,6.1149485 8.0879549,5.5032753 7.4789997,4.7647 6.8700453,4.0261248 6.3741103,3.4156149 6.3769213,3.4080117 6.3797713,3.4004117 6.562373,3.1774787 6.7827896,2.9126121 7.164399,2.4540426 7.1848936,2.4323657 7.2117806,2.4588741 7.2273026,2.4741751 7.9274525,3.3048587 8.767655,4.3048177 L 10.295296,6.1229243 9.4136171,7.1736012 C 8.9286921,7.751474 8.2336861,8.5795488 7.8691565,9.0137659 L 7.2063776,9.8032561 H 6.3554188 c -0.7939025,0 -0.8494825,-0.00179 -0.8289571,-0.026839 z\" id=\"path41\" /><path d=\"M 3.4382986,7.9881037 C 2.6063322,7.0074024 1.9089456,6.1852746 1.8885531,6.1611518 L 1.8514763,6.1172937 4.2262773,3.2714352 6.6010789,0.42557499 H 7.4490822 8.2970851 L 7.0763447,1.8883334 c -3.0218884,3.6209928 -3.5158893,4.2139972 -3.519859,4.2252855 -0.00231,0.00662 0.4954141,0.6094855 1.1060858,1.3397178 0.6106728,0.7302338 1.1103133,1.3348316 1.1103133,1.3435515 0,0.017734 -0.7956667,0.9718373 -0.8117152,0.9733472 -0.00562,5.108e-4 -0.6909038,-0.80143 -1.522871,-1.7821306 z\" id=\"path43\" /></g></svg>";
|
|
22
|
+
|
|
23
|
+
export var CAMERA = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"currentColor\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M20 4h-3.17L15 2H9L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V6h4.05l1.83-2h4.24l1.83 2H20v12zM12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0 8c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z\"/></svg>";
|
|
24
|
+
export var PLAY = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"currentColor\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M10 8.64L15.27 12 10 15.36V8.64M8 5v14l11-7L8 5z\"/></svg>";
|
|
25
|
+
export var COPY = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"currentColor\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z\"/></svg>";
|
|
26
|
+
export var RESET = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"currentColor\"><path d=\"M12,5V1L7,6l5,5V7c3.31,0,6,2.69,6,6s-2.69,6-6,6s-6-2.69-6-6H4c0,4.42,3.58,8,8,8s8-3.58,8-8S16.42,5,12,5z\"/></g></svg>";
|
|
27
|
+
export var DELETE = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"currentColor\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z\"/></svg>";
|