@avs/go 0.13.71740 → 0.13.71745
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/package.json +1 -1
- package/src/avs-go-dataviz.js +195 -38
- package/src/constants.js +1 -1
package/package.json
CHANGED
package/src/avs-go-dataviz.js
CHANGED
|
@@ -74,7 +74,39 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
74
74
|
position:relative;
|
|
75
75
|
width:100%;
|
|
76
76
|
height:100%;
|
|
77
|
-
}
|
|
77
|
+
}
|
|
78
|
+
#animationControls {
|
|
79
|
+
display: none;
|
|
80
|
+
position:absolute;
|
|
81
|
+
top: 8px;
|
|
82
|
+
left: 8px;
|
|
83
|
+
padding: 8px;
|
|
84
|
+
background-color: rgba(128, 128, 128, 0.8);
|
|
85
|
+
color: white;
|
|
86
|
+
font-size: 10pt;
|
|
87
|
+
border-radius: 8px;
|
|
88
|
+
}
|
|
89
|
+
button {
|
|
90
|
+
padding: 4px 8px;
|
|
91
|
+
border-radius: 4px;
|
|
92
|
+
margin-top: 4px;
|
|
93
|
+
}
|
|
94
|
+
button:not([disabled]) {
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
}
|
|
97
|
+
#animationControlsTitle {
|
|
98
|
+
font-weight: bold;
|
|
99
|
+
margin-bottom: 8px;
|
|
100
|
+
}
|
|
101
|
+
#animationDelay:not([disabled]) {
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
}
|
|
104
|
+
#animationPlay {
|
|
105
|
+
margin-top: 12px;
|
|
106
|
+
}
|
|
107
|
+
#animationReset {
|
|
108
|
+
margin-top: 12px;
|
|
109
|
+
}
|
|
78
110
|
#sceneImage {
|
|
79
111
|
width:100%;
|
|
80
112
|
height:100%;
|
|
@@ -140,6 +172,28 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
140
172
|
</style>
|
|
141
173
|
<div id="container">
|
|
142
174
|
<div id="dataVizDiv"></div>
|
|
175
|
+
<div id="animationControls">
|
|
176
|
+
<div id="animationControlsTitle">Animation Controls</div>
|
|
177
|
+
<div id="animationDelayLabel">Snapshot Delay (0s)</div>
|
|
178
|
+
<div>
|
|
179
|
+
<input type="range" disabled min="0" max="5" value="0" class="slider" id="animationDelay">
|
|
180
|
+
</div>
|
|
181
|
+
<div>
|
|
182
|
+
<button type="button" id="animationSnapshot">Take Snapshot (0)</button>
|
|
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>
|
|
189
|
+
</div>
|
|
190
|
+
<div>
|
|
191
|
+
<button type="button" id="animationReset">Reset Transform</button>
|
|
192
|
+
</div>
|
|
193
|
+
<div>
|
|
194
|
+
<button type="button" disabled id="animationClear">Clear Animation</button>
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
143
197
|
<div id="zoomOverlay"></div>
|
|
144
198
|
<div id="spinnerDiv">
|
|
145
199
|
<div id="spinner"></div>
|
|
@@ -426,6 +480,13 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
426
480
|
type: Number,
|
|
427
481
|
observer: "_transformValueChanged"
|
|
428
482
|
},
|
|
483
|
+
/**
|
|
484
|
+
* Transform animation encoded string.
|
|
485
|
+
*/
|
|
486
|
+
transformAnimation: {
|
|
487
|
+
type: String,
|
|
488
|
+
observer: "_transformAnimationValueChanged"
|
|
489
|
+
},
|
|
429
490
|
/**
|
|
430
491
|
* Enable the zoom rectangle interactor. Only available when `renderer` is `THREEJS`
|
|
431
492
|
*
|
|
@@ -476,19 +537,26 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
476
537
|
observer: "_panMaximumZoomLevelChanged",
|
|
477
538
|
value: 1000
|
|
478
539
|
},
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
540
|
+
/**
|
|
541
|
+
* Show animated glyphs. Only available when `renderer` is `THREEJS`
|
|
542
|
+
*/
|
|
543
|
+
animatedGlyphsVisible: {
|
|
483
544
|
type: Boolean,
|
|
484
|
-
observer: "_animatedGlyphsVisibleChanged"
|
|
545
|
+
observer: "_animatedGlyphsVisibleChanged"
|
|
485
546
|
},
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
547
|
+
/**
|
|
548
|
+
* Enable animated glyphs. Only available when `renderer` is `THREEJS`
|
|
549
|
+
*/
|
|
550
|
+
animatedGlyphsEnable: {
|
|
490
551
|
type: Boolean,
|
|
491
|
-
observer: "_animatedGlyphsEnableChanged"
|
|
552
|
+
observer: "_animatedGlyphsEnableChanged"
|
|
553
|
+
},
|
|
554
|
+
/**
|
|
555
|
+
* Enable animation controls overlay. Only available when `renderer` is `THREEJS`
|
|
556
|
+
*/
|
|
557
|
+
animationControlsEnable: {
|
|
558
|
+
type: Boolean,
|
|
559
|
+
observer: "_animationControlsEnableChanged"
|
|
492
560
|
}
|
|
493
561
|
}
|
|
494
562
|
}
|
|
@@ -691,22 +759,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
691
759
|
this._addDataSourceProperties(model);
|
|
692
760
|
|
|
693
761
|
if (this.renderer === 'THREEJS') {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
var styleMap = {};
|
|
697
|
-
this._applyCustomCssProperties(styleMap, style,
|
|
698
|
-
{
|
|
699
|
-
"scene": "--avs-scene-animations",
|
|
700
|
-
"sceneTitle": "--avs-scene-title-animations",
|
|
701
|
-
"chart": "--avs-chart-animations",
|
|
702
|
-
"chartTitle": "--avs-chart-title-animations",
|
|
703
|
-
"axis": "--avs-axis-animations",
|
|
704
|
-
"legend": "--avs-legend-animations",
|
|
705
|
-
"legendTitle": "--avs-legend-title-animations",
|
|
706
|
-
"glyph": "--avs-glyph-animations",
|
|
707
|
-
"transform": "--avs-transform-animation"
|
|
708
|
-
} );
|
|
709
|
-
this.animator.setStyleMap(styleMap);
|
|
762
|
+
this._addStreamProperties(rendererProperties);
|
|
710
763
|
}
|
|
711
764
|
|
|
712
765
|
return model;
|
|
@@ -1422,7 +1475,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1422
1475
|
afterNextRender(this, function() {
|
|
1423
1476
|
if (this.initialized !== true) {
|
|
1424
1477
|
|
|
1425
|
-
|
|
1478
|
+
this._updateSize();
|
|
1426
1479
|
if (!this.manualUpdate) {
|
|
1427
1480
|
this.updateViewer(true);
|
|
1428
1481
|
}
|
|
@@ -1442,13 +1495,96 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1442
1495
|
}
|
|
1443
1496
|
});
|
|
1444
1497
|
|
|
1445
|
-
|
|
1498
|
+
this.$.animationDelay.addEventListener('input', this._handleAnimationDelayChange.bind(this));
|
|
1499
|
+
this.$.animationSnapshot.addEventListener('click', this._handleAnimationSnapshot.bind(this));
|
|
1500
|
+
this.$.animationPlay.addEventListener('click', this.runAnimation.bind(this));
|
|
1501
|
+
this.$.animationShare.addEventListener('click', this._handleAnimationShare.bind(this));
|
|
1502
|
+
this.$.animationReset.addEventListener('click', this.resetTransform.bind(this));
|
|
1503
|
+
this.$.animationClear.addEventListener('click', this._handleAnimationClear.bind(this));
|
|
1504
|
+
|
|
1505
|
+
this.animationTime = 0;
|
|
1506
|
+
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
|
+
|
|
1518
|
+
this._resetTimer();
|
|
1446
1519
|
|
|
1447
1520
|
this.initialized = true;
|
|
1448
1521
|
}
|
|
1449
1522
|
});
|
|
1450
1523
|
}
|
|
1451
1524
|
|
|
1525
|
+
_round2dp(n) {
|
|
1526
|
+
return Math.round((n + Number.EPSILON) * 100) / 100;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
_handleAnimationDelayChange() {
|
|
1530
|
+
const delay = this.$.animationDelay.value;
|
|
1531
|
+
this.$.animationDelayLabel.innerHTML = "Snapshot Delay (" + delay + "s)";
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
_handleAnimationSnapshot() {
|
|
1535
|
+
const transform = this._getTransformComponents();
|
|
1536
|
+
const delay = Number(this.$.animationDelay.value);
|
|
1537
|
+
if (this.transformAnimationFrames.length > 0) {
|
|
1538
|
+
this.animationTime += delay;
|
|
1539
|
+
}
|
|
1540
|
+
const frame = {
|
|
1541
|
+
time: this.animationTime * 1000,
|
|
1542
|
+
scale: this._round2dp(transform.scale),
|
|
1543
|
+
position: [this._round2dp(transform.position[0]),
|
|
1544
|
+
this._round2dp(transform.position[1]),
|
|
1545
|
+
this._round2dp(transform.position[2])],
|
|
1546
|
+
rotation: [this._round2dp(transform.rotation[0]),
|
|
1547
|
+
this._round2dp(transform.rotation[1]),
|
|
1548
|
+
this._round2dp(transform.rotation[2]),
|
|
1549
|
+
transform.rotation[3]]
|
|
1550
|
+
};
|
|
1551
|
+
this.transformAnimationFrames.push(frame);
|
|
1552
|
+
|
|
1553
|
+
if (this.transformAnimationFrames.length == 1) {
|
|
1554
|
+
this.$.animationDelayLabel.innerHTML = "Snapshot Delay (2s)";
|
|
1555
|
+
this.$.animationDelay.value = 2;
|
|
1556
|
+
this.$.animationDelay.disabled = false;
|
|
1557
|
+
this.$.animationPlay.disabled = false;
|
|
1558
|
+
this.$.animationShare.disabled = false;
|
|
1559
|
+
this.$.animationClear.disabled = false;
|
|
1560
|
+
}
|
|
1561
|
+
this.$.animationSnapshot.innerHTML = "Take Snapshot (" + this.transformAnimationFrames.length + ")";
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
_handleAnimationClear() {
|
|
1565
|
+
this.transformAnimationFrames.length = 0;
|
|
1566
|
+
this.$.animationDelayLabel.innerHTML = "Snapshot Delay (0s)";
|
|
1567
|
+
this.$.animationDelay.value = 0;
|
|
1568
|
+
this.$.animationDelay.disabled = true;
|
|
1569
|
+
this.$.animationSnapshot.innerHTML = "Take Snapshot (0)";
|
|
1570
|
+
this.$.animationPlay.disabled = true;
|
|
1571
|
+
this.$.animationShare.disabled = true;
|
|
1572
|
+
this.$.animationClear.disabled = true;
|
|
1573
|
+
this.animationTime = 0;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
_handleAnimationShare() {
|
|
1577
|
+
const json = JSON.stringify(this.transformAnimationFrames);
|
|
1578
|
+
const encoded = btoa(json);
|
|
1579
|
+
|
|
1580
|
+
/**
|
|
1581
|
+
* A transform animation share event occurred.
|
|
1582
|
+
* @event avs-transform-animation-share
|
|
1583
|
+
*/
|
|
1584
|
+
|
|
1585
|
+
this.dispatchEvent(new CustomEvent('avs-transform-animation-share', { detail: encoded }));
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1452
1588
|
_updatePixelRatio(change) {
|
|
1453
1589
|
const pr = window.devicePixelRatio;
|
|
1454
1590
|
matchMedia( `(resolution: ${pr}dppx)` ).addEventListener('change', this._updatePixelRatio.bind(this, true), { once: true } );
|
|
@@ -1457,6 +1593,18 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1457
1593
|
}
|
|
1458
1594
|
}
|
|
1459
1595
|
|
|
1596
|
+
/**
|
|
1597
|
+
* Change in 'animation-controls-enable' property.
|
|
1598
|
+
*/
|
|
1599
|
+
_animationControlsEnableChanged(newValue, oldValue) {
|
|
1600
|
+
if (newValue) {
|
|
1601
|
+
this.$.animationControls.style.display = "block";
|
|
1602
|
+
}
|
|
1603
|
+
else {
|
|
1604
|
+
this.$.animationControls.style.display = "none";
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1460
1608
|
/**
|
|
1461
1609
|
* Change in 'hidden' property.
|
|
1462
1610
|
*/
|
|
@@ -1479,7 +1627,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1479
1627
|
if (this.threeViewer) {
|
|
1480
1628
|
if (newValue) {
|
|
1481
1629
|
if (this.transformInteractor === undefined) {
|
|
1482
|
-
this.transformInteractor = new TransformInteractor( this );
|
|
1630
|
+
this.transformInteractor = new TransformInteractor( this.$.dataVizDiv );
|
|
1483
1631
|
}
|
|
1484
1632
|
this.threeViewer.addInteractor( this.transformInteractor );
|
|
1485
1633
|
|
|
@@ -1577,7 +1725,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1577
1725
|
}
|
|
1578
1726
|
}
|
|
1579
1727
|
|
|
1580
|
-
|
|
1728
|
+
_getTransformComponents() {
|
|
1581
1729
|
var pos = new Vector3();
|
|
1582
1730
|
var quat = new Quaternion();
|
|
1583
1731
|
var scale = new Vector3();
|
|
@@ -1602,10 +1750,8 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1602
1750
|
}
|
|
1603
1751
|
|
|
1604
1752
|
runAnimation() {
|
|
1605
|
-
|
|
1606
|
-
var style = window.getComputedStyle(this, null);
|
|
1607
|
-
|
|
1608
1753
|
if (this.renderer === 'THREEJS') {
|
|
1754
|
+
var style = window.getComputedStyle(this, null);
|
|
1609
1755
|
var styleMap = {};
|
|
1610
1756
|
this._applyCustomCssProperties(styleMap, style,
|
|
1611
1757
|
{
|
|
@@ -1616,11 +1762,12 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1616
1762
|
"axis": "--avs-axis-animations",
|
|
1617
1763
|
"legend": "--avs-legend-animations",
|
|
1618
1764
|
"legendTitle": "--avs-legend-title-animations",
|
|
1619
|
-
"glyph": "--avs-glyph-animations"
|
|
1620
|
-
|
|
1621
|
-
|
|
1765
|
+
"glyph": "--avs-glyph-animations"
|
|
1766
|
+
});
|
|
1767
|
+
styleMap.transform = this.transformAnimationFrames.length > 0 ? JSON.stringify(this.transformAnimationFrames) : null;
|
|
1768
|
+
|
|
1622
1769
|
this.animator.setStyleMap(styleMap);
|
|
1623
|
-
|
|
1770
|
+
this.threeViewer.runAnimation();
|
|
1624
1771
|
}
|
|
1625
1772
|
}
|
|
1626
1773
|
|
|
@@ -1666,6 +1813,16 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1666
1813
|
}
|
|
1667
1814
|
}
|
|
1668
1815
|
|
|
1816
|
+
/**
|
|
1817
|
+
* Change in 'transform-animation' property.
|
|
1818
|
+
*/
|
|
1819
|
+
_transformAnimationValueChanged(newValue, oldValue) {
|
|
1820
|
+
if (newValue) {
|
|
1821
|
+
const decoded = atob(newValue);
|
|
1822
|
+
this.transformAnimationFrames = JSON.parse(decoded);
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1669
1826
|
/**
|
|
1670
1827
|
* Change in 'zoom-rectangle-enable' property.
|
|
1671
1828
|
*/
|
package/src/constants.js
CHANGED