@avs/go 0.13.71740 → 0.13.71758
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 +299 -46
- 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
|
/**
|
|
@@ -74,7 +74,67 @@ 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
|
+
font-size: 10pt;
|
|
86
|
+
border-radius: 8px;
|
|
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);
|
|
91
|
+
}
|
|
92
|
+
#animationControlsTitle {
|
|
93
|
+
margin-bottom: 8px;
|
|
94
|
+
font-weight: 700;
|
|
95
|
+
}
|
|
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;
|
|
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;
|
|
124
|
+
}
|
|
125
|
+
#animationDelay:disabled {
|
|
126
|
+
pointer-events: none;
|
|
127
|
+
box-shadow: none;
|
|
128
|
+
background-color: darkgrey;
|
|
129
|
+
color: grey;
|
|
130
|
+
}
|
|
131
|
+
#animationSnapshotIcon {
|
|
132
|
+
height: 24px;
|
|
133
|
+
}
|
|
134
|
+
#animationSnapshotLabel {
|
|
135
|
+
margin-left: 4px;
|
|
136
|
+
height: 16px;
|
|
137
|
+
}
|
|
78
138
|
#sceneImage {
|
|
79
139
|
width:100%;
|
|
80
140
|
height:100%;
|
|
@@ -101,7 +161,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
101
161
|
font-weight:var(--avs-zoom-overlay-font-weight, bold);
|
|
102
162
|
font-style:var(--avs-zoom-overlay-font-style);
|
|
103
163
|
}
|
|
104
|
-
#tooltip {
|
|
164
|
+
#tooltip, #animationTooltip {
|
|
105
165
|
position:absolute;
|
|
106
166
|
opacity:0;
|
|
107
167
|
transition:opacity ease 0.3s;
|
|
@@ -140,6 +200,25 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
140
200
|
</style>
|
|
141
201
|
<div id="container">
|
|
142
202
|
<div id="dataVizDiv"></div>
|
|
203
|
+
<div id="animationControls">
|
|
204
|
+
<div id="animationControlsTitle">Animation Controls</div>
|
|
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>
|
|
211
|
+
</div>
|
|
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>
|
|
215
|
+
</div>
|
|
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>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
<div id="animationTooltip"></div>
|
|
143
222
|
<div id="zoomOverlay"></div>
|
|
144
223
|
<div id="spinnerDiv">
|
|
145
224
|
<div id="spinner"></div>
|
|
@@ -426,6 +505,13 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
426
505
|
type: Number,
|
|
427
506
|
observer: "_transformValueChanged"
|
|
428
507
|
},
|
|
508
|
+
/**
|
|
509
|
+
* Transform animation encoded string.
|
|
510
|
+
*/
|
|
511
|
+
transformAnimation: {
|
|
512
|
+
type: String,
|
|
513
|
+
observer: "_transformAnimationValueChanged"
|
|
514
|
+
},
|
|
429
515
|
/**
|
|
430
516
|
* Enable the zoom rectangle interactor. Only available when `renderer` is `THREEJS`
|
|
431
517
|
*
|
|
@@ -476,19 +562,26 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
476
562
|
observer: "_panMaximumZoomLevelChanged",
|
|
477
563
|
value: 1000
|
|
478
564
|
},
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
565
|
+
/**
|
|
566
|
+
* Show animated glyphs. Only available when `renderer` is `THREEJS`
|
|
567
|
+
*/
|
|
568
|
+
animatedGlyphsVisible: {
|
|
483
569
|
type: Boolean,
|
|
484
|
-
observer: "_animatedGlyphsVisibleChanged"
|
|
570
|
+
observer: "_animatedGlyphsVisibleChanged"
|
|
485
571
|
},
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
572
|
+
/**
|
|
573
|
+
* Enable animated glyphs. Only available when `renderer` is `THREEJS`
|
|
574
|
+
*/
|
|
575
|
+
animatedGlyphsEnable: {
|
|
490
576
|
type: Boolean,
|
|
491
|
-
observer: "_animatedGlyphsEnableChanged"
|
|
577
|
+
observer: "_animatedGlyphsEnableChanged"
|
|
578
|
+
},
|
|
579
|
+
/**
|
|
580
|
+
* Enable animation controls overlay. Only available when `renderer` is `THREEJS`
|
|
581
|
+
*/
|
|
582
|
+
animationControlsEnable: {
|
|
583
|
+
type: Boolean,
|
|
584
|
+
observer: "_animationControlsEnableChanged"
|
|
492
585
|
}
|
|
493
586
|
}
|
|
494
587
|
}
|
|
@@ -691,22 +784,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
691
784
|
this._addDataSourceProperties(model);
|
|
692
785
|
|
|
693
786
|
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);
|
|
787
|
+
this._addStreamProperties(rendererProperties);
|
|
710
788
|
}
|
|
711
789
|
|
|
712
790
|
return model;
|
|
@@ -901,30 +979,36 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
901
979
|
*/
|
|
902
980
|
this.dispatchEvent(new CustomEvent('avs-scene-info', sceneEvent));
|
|
903
981
|
|
|
904
|
-
// Set tooltip and zoom overlay style to reversed theme
|
|
982
|
+
// Set animation controls, tooltip and zoom overlay style to reversed theme
|
|
905
983
|
if (json.sceneInfo.backgroundColor) {
|
|
906
984
|
var col = json.sceneInfo.backgroundColor.match(/[0-9.]+/gi);
|
|
907
|
-
var bgCol =
|
|
985
|
+
var bgCol = this.getInheritedBackgroundCol(this.parentNode).trim().match(/[0-9.]+/gi);
|
|
908
986
|
var blendedR = (col[0] * col[3]);
|
|
909
987
|
var blendedG = (col[1] * col[3]);
|
|
910
988
|
var blendedB = (col[2] * col[3]);
|
|
911
|
-
|
|
912
|
-
// 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
|
|
913
991
|
blendedR += (bgCol[0] * (1 - col[3]));
|
|
914
992
|
blendedG += (bgCol[1] * (1 - col[3]));
|
|
915
993
|
blendedB += (bgCol[2] * (1 - col[3]));
|
|
916
|
-
|
|
994
|
+
}
|
|
995
|
+
this.$.animationControls.style.color = "var(--avs-animation-controls-color, rgb(" + blendedR + ", " + blendedG + ", " + blendedB + "))";
|
|
917
996
|
this.$.zoomOverlay.style.color = "var(--avs-zoom-overlay-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
|
|
918
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 + "))";
|
|
919
999
|
}
|
|
920
1000
|
if (json.sceneInfo.color) {
|
|
921
1001
|
var col = json.sceneInfo.color.match(/[0-9.]+/gi);
|
|
922
|
-
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))";
|
|
923
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] + "))";
|
|
924
1006
|
}
|
|
925
1007
|
if (json.sceneInfo.fontFamily) {
|
|
1008
|
+
this.$.animationControls.style.fontFamily = "var(--avs-animation-controls-font-family, " + json.sceneInfo.fontFamily + ")";
|
|
926
1009
|
this.$.zoomOverlay.style.fontFamily = "var(--avs-zoom-overlay-font-family, " + json.sceneInfo.fontFamily + ")";
|
|
927
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 + ")";
|
|
928
1012
|
}
|
|
929
1013
|
}
|
|
930
1014
|
|
|
@@ -988,6 +1072,30 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
988
1072
|
}
|
|
989
1073
|
}
|
|
990
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
|
+
|
|
991
1099
|
/**
|
|
992
1100
|
*
|
|
993
1101
|
*/
|
|
@@ -1422,7 +1530,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1422
1530
|
afterNextRender(this, function() {
|
|
1423
1531
|
if (this.initialized !== true) {
|
|
1424
1532
|
|
|
1425
|
-
|
|
1533
|
+
this._updateSize();
|
|
1426
1534
|
if (!this.manualUpdate) {
|
|
1427
1535
|
this.updateViewer(true);
|
|
1428
1536
|
}
|
|
@@ -1442,13 +1550,137 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1442
1550
|
}
|
|
1443
1551
|
});
|
|
1444
1552
|
|
|
1445
|
-
|
|
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));
|
|
1560
|
+
this.$.animationSnapshot.addEventListener('click', this._handleAnimationSnapshot.bind(this));
|
|
1561
|
+
this.$.animationPlay.addEventListener('click', this.runAnimation.bind(this));
|
|
1562
|
+
this.$.animationCopy.addEventListener('click', this._handleAnimationCopy.bind(this));
|
|
1563
|
+
this.$.animationReset.addEventListener('click', this.resetTransform.bind(this));
|
|
1564
|
+
this.$.animationClear.addEventListener('click', this._handleAnimationClear.bind(this));
|
|
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
|
+
|
|
1580
|
+
this.animationTime = 0;
|
|
1581
|
+
this.transformAnimationFrames ??= [];
|
|
1582
|
+
if (this.transformAnimationFrames.length > 0) {
|
|
1583
|
+
this.$.animationDelay.value = 2;
|
|
1584
|
+
this.$.animationDelay.disabled = false;
|
|
1585
|
+
this.$.animationSnapshotLabel.innerHTML = this.transformAnimationFrames.length;
|
|
1586
|
+
this.$.animationPlay.classList.remove("disabled");
|
|
1587
|
+
this.$.animationCopy.classList.remove("disabled");
|
|
1588
|
+
this.$.animationClear.classList.remove("disabled");
|
|
1589
|
+
this.animationTime = this.transformAnimationFrames[this.transformAnimationFrames.length - 1].time / 1000;
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
this._resetTimer();
|
|
1446
1593
|
|
|
1447
1594
|
this.initialized = true;
|
|
1448
1595
|
}
|
|
1449
1596
|
});
|
|
1450
1597
|
}
|
|
1451
1598
|
|
|
1599
|
+
_handlePointerEnterAnimationControl(e) {
|
|
1600
|
+
if (!this.showAnimationTooltip) {
|
|
1601
|
+
var adjustedCoords = this._getAdjustedCoords(e.clientX, e.clientY);
|
|
1602
|
+
var pos = this._calcTooltipPosition(adjustedCoords.x, adjustedCoords.y);
|
|
1603
|
+
this.$.animationTooltip.style.left = pos.x + "px";
|
|
1604
|
+
this.$.animationTooltip.style.top = pos.y + "px";
|
|
1605
|
+
this.$.animationTooltip.style.opacity = 1;
|
|
1606
|
+
this.$.animationTooltip.innerHTML = e.currentTarget.dataset.tooltip ?? e.currentTarget.id;
|
|
1607
|
+
this.showAnimationTooltip = true;
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
_handlePointerLeaveAnimationControl() {
|
|
1612
|
+
this.$.animationTooltip.style.opacity = 0;
|
|
1613
|
+
this.showAnimationTooltip = false;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
_round2dp(n) {
|
|
1617
|
+
return Math.round((n + Number.EPSILON) * 100) / 100;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
_handleAnimationDelayChange() {
|
|
1621
|
+
let delay = Number(this.$.animationDelay.value);
|
|
1622
|
+
if (delay < 1) {
|
|
1623
|
+
delay = 1;
|
|
1624
|
+
this.$.animationDelay.value = delay;
|
|
1625
|
+
}
|
|
1626
|
+
if (delay > 10) {
|
|
1627
|
+
delay = 10;
|
|
1628
|
+
this.$.animationDelay.value = delay;
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
_handleAnimationSnapshot() {
|
|
1633
|
+
const transform = this._getTransformComponents();
|
|
1634
|
+
const delay = Number(this.$.animationDelay.value);
|
|
1635
|
+
if (this.transformAnimationFrames.length > 0) {
|
|
1636
|
+
this.animationTime += delay;
|
|
1637
|
+
}
|
|
1638
|
+
const frame = {
|
|
1639
|
+
time: this.animationTime * 1000,
|
|
1640
|
+
scale: this._round2dp(transform.scale),
|
|
1641
|
+
position: [this._round2dp(transform.position[0]),
|
|
1642
|
+
this._round2dp(transform.position[1]),
|
|
1643
|
+
this._round2dp(transform.position[2])],
|
|
1644
|
+
rotation: [this._round2dp(transform.rotation[0]),
|
|
1645
|
+
this._round2dp(transform.rotation[1]),
|
|
1646
|
+
this._round2dp(transform.rotation[2]),
|
|
1647
|
+
transform.rotation[3]]
|
|
1648
|
+
};
|
|
1649
|
+
this.transformAnimationFrames.push(frame);
|
|
1650
|
+
|
|
1651
|
+
if (this.transformAnimationFrames.length == 1) {
|
|
1652
|
+
this.$.animationDelay.value = 2;
|
|
1653
|
+
this.$.animationDelay.disabled = false;
|
|
1654
|
+
this.$.animationPlay.classList.remove("disabled");
|
|
1655
|
+
this.$.animationCopy.classList.remove("disabled");
|
|
1656
|
+
this.$.animationClear.classList.remove("disabled");
|
|
1657
|
+
}
|
|
1658
|
+
this.$.animationSnapshotLabel.innerHTML = this.transformAnimationFrames.length;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
_handleAnimationClear() {
|
|
1662
|
+
this.transformAnimationFrames.length = 0;
|
|
1663
|
+
this.$.animationDelay.value = 0;
|
|
1664
|
+
this.$.animationDelay.disabled = true;
|
|
1665
|
+
this.$.animationSnapshotLabel.innerHTML = "0";
|
|
1666
|
+
this.$.animationPlay.classList.add("disabled");
|
|
1667
|
+
this.$.animationCopy.classList.add("disabled");
|
|
1668
|
+
this.$.animationClear.classList.add("disabled");
|
|
1669
|
+
this.animationTime = 0;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
_handleAnimationCopy() {
|
|
1673
|
+
const json = JSON.stringify(this.transformAnimationFrames);
|
|
1674
|
+
const encoded = btoa(json);
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* A transform animation share event occurred.
|
|
1678
|
+
* @event avs-transform-animation-share
|
|
1679
|
+
*/
|
|
1680
|
+
|
|
1681
|
+
this.dispatchEvent(new CustomEvent('avs-transform-animation-share', { detail: encoded }));
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1452
1684
|
_updatePixelRatio(change) {
|
|
1453
1685
|
const pr = window.devicePixelRatio;
|
|
1454
1686
|
matchMedia( `(resolution: ${pr}dppx)` ).addEventListener('change', this._updatePixelRatio.bind(this, true), { once: true } );
|
|
@@ -1457,6 +1689,18 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1457
1689
|
}
|
|
1458
1690
|
}
|
|
1459
1691
|
|
|
1692
|
+
/**
|
|
1693
|
+
* Change in 'animation-controls-enable' property.
|
|
1694
|
+
*/
|
|
1695
|
+
_animationControlsEnableChanged(newValue, oldValue) {
|
|
1696
|
+
if (newValue) {
|
|
1697
|
+
this.$.animationControls.style.display = "block";
|
|
1698
|
+
}
|
|
1699
|
+
else {
|
|
1700
|
+
this.$.animationControls.style.display = "none";
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1460
1704
|
/**
|
|
1461
1705
|
* Change in 'hidden' property.
|
|
1462
1706
|
*/
|
|
@@ -1479,7 +1723,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1479
1723
|
if (this.threeViewer) {
|
|
1480
1724
|
if (newValue) {
|
|
1481
1725
|
if (this.transformInteractor === undefined) {
|
|
1482
|
-
this.transformInteractor = new TransformInteractor( this );
|
|
1726
|
+
this.transformInteractor = new TransformInteractor( this.$.dataVizDiv );
|
|
1483
1727
|
}
|
|
1484
1728
|
this.threeViewer.addInteractor( this.transformInteractor );
|
|
1485
1729
|
|
|
@@ -1577,7 +1821,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1577
1821
|
}
|
|
1578
1822
|
}
|
|
1579
1823
|
|
|
1580
|
-
|
|
1824
|
+
_getTransformComponents() {
|
|
1581
1825
|
var pos = new Vector3();
|
|
1582
1826
|
var quat = new Quaternion();
|
|
1583
1827
|
var scale = new Vector3();
|
|
@@ -1602,10 +1846,8 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1602
1846
|
}
|
|
1603
1847
|
|
|
1604
1848
|
runAnimation() {
|
|
1605
|
-
|
|
1606
|
-
var style = window.getComputedStyle(this, null);
|
|
1607
|
-
|
|
1608
1849
|
if (this.renderer === 'THREEJS') {
|
|
1850
|
+
var style = window.getComputedStyle(this, null);
|
|
1609
1851
|
var styleMap = {};
|
|
1610
1852
|
this._applyCustomCssProperties(styleMap, style,
|
|
1611
1853
|
{
|
|
@@ -1616,11 +1858,12 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1616
1858
|
"axis": "--avs-axis-animations",
|
|
1617
1859
|
"legend": "--avs-legend-animations",
|
|
1618
1860
|
"legendTitle": "--avs-legend-title-animations",
|
|
1619
|
-
"glyph": "--avs-glyph-animations"
|
|
1620
|
-
|
|
1621
|
-
|
|
1861
|
+
"glyph": "--avs-glyph-animations"
|
|
1862
|
+
});
|
|
1863
|
+
styleMap.transform = this.transformAnimationFrames.length > 0 ? JSON.stringify(this.transformAnimationFrames) : null;
|
|
1864
|
+
|
|
1622
1865
|
this.animator.setStyleMap(styleMap);
|
|
1623
|
-
|
|
1866
|
+
this.threeViewer.runAnimation();
|
|
1624
1867
|
}
|
|
1625
1868
|
}
|
|
1626
1869
|
|
|
@@ -1666,6 +1909,16 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1666
1909
|
}
|
|
1667
1910
|
}
|
|
1668
1911
|
|
|
1912
|
+
/**
|
|
1913
|
+
* Change in 'transform-animation' property.
|
|
1914
|
+
*/
|
|
1915
|
+
_transformAnimationValueChanged(newValue, oldValue) {
|
|
1916
|
+
if (newValue) {
|
|
1917
|
+
const decoded = atob(newValue);
|
|
1918
|
+
this.transformAnimationFrames = JSON.parse(decoded);
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1669
1922
|
/**
|
|
1670
1923
|
* Change in 'zoom-rectangle-enable' property.
|
|
1671
1924
|
*/
|
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>";
|