@avs/go 0.13.71760 → 0.13.71762

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avs/go",
3
- "version": "0.13.71760",
3
+ "version": "0.13.71762",
4
4
  "description": "AVS Go",
5
5
  "keywords": [
6
6
  "polymer",
@@ -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, CAMERA, PLAY, COPY, RESET, DELETE} from './logo.js';
30
+ import {LOGO, PLAY, CAMERA, TIMELAPSE, HOME, DELETE, COPY, LINK} from './logo.js';
31
31
  import {Euler, Vector3, Quaternion} from 'three';
32
32
 
33
33
  /**
@@ -75,7 +75,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
75
75
  width:100%;
76
76
  height:100%;
77
77
  }
78
- #animationControls {
78
+ #motionCapture {
79
79
  display: none;
80
80
  position:absolute;
81
81
  top: 8px;
@@ -84,26 +84,28 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
84
84
  background-color: rgba(128, 128, 128, 0.8);
85
85
  font-size: 10pt;
86
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);
87
+ background:var(--avs-motion-capture-background, rgba(80,80,80,0.75));
88
+ color:var(--avs-motion-capture-color, #ffffff);
89
+ font-family:var(--avs-motion-capture-font-family);
90
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
+ user-select: none;
91
92
  }
92
- #animationControlsTitle {
93
- margin-bottom: 8px;
93
+ #motionCaptureTitle {
94
+ margin-bottom: 4px;
94
95
  font-weight: 700;
95
96
  }
96
97
  .btn {
97
98
  padding: 4px;
98
99
  border-radius: 4px;
99
- margin: 4px;
100
- background:var(--avs-animation-controls-button-background, white);
101
- color:var(--avs-animation-controls-button-color, black);
100
+ margin: 2px;
101
+ background:var(--avs-motion-capture-control-background, white);
102
+ color:var(--avs-motion-capture-control-color, black);
102
103
  display: inline-flex;
103
104
  align-items: center;
104
105
  box-shadow: 0 2px 2px #00000024,0 3px 1px -2px #0000001f,0 1px 5px #0003;
106
+ }
107
+ a.btn {
105
108
  cursor: pointer;
106
- user-select: none;
107
109
  }
108
110
  .btn.disabled {
109
111
  cursor: default;
@@ -112,28 +114,28 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
112
114
  background-color: darkgrey;
113
115
  color: grey;
114
116
  }
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;
117
+ #motionCaptureSnapshotIcon, #motionCaptureDelayIcon {
118
+ height: 24px;
124
119
  }
125
- #animationDelay:disabled {
126
- pointer-events: none;
127
- box-shadow: none;
128
- background-color: darkgrey;
129
- color: grey;
120
+ #motionCaptureSnapshotLabel, #motionCaptureDelayLabel {
121
+ margin-left: 4px;
122
+ height: 14px;
130
123
  }
131
- #animationSnapshotIcon {
124
+ #motionCaptureDelayWheel {
125
+ display: flex;
126
+ flex-direction: column;
127
+ margin: 0 4px;
132
128
  height: 24px;
129
+ gap: 2px;
133
130
  }
134
- #animationSnapshotLabel {
135
- margin-left: 4px;
136
- height: 16px;
131
+ #motionCaptureDelayIncrease, #motionCaptureDelayDecrease {
132
+ height: 8px;
133
+ text-align: center;
134
+ font-weight: 700;
135
+ cursor: pointer;
136
+ }
137
+ #motionCaptureReset, #motionCaptureCopyData {
138
+ margin-left: 12px;
137
139
  }
138
140
  #sceneImage {
139
141
  width:100%;
@@ -161,7 +163,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
161
163
  font-weight:var(--avs-zoom-overlay-font-weight, bold);
162
164
  font-style:var(--avs-zoom-overlay-font-style);
163
165
  }
164
- #tooltip, #animationTooltip {
166
+ #tooltip, #motionCaptureTooltip, #motionCaptureAlert {
165
167
  position:absolute;
166
168
  opacity:0;
167
169
  transition:opacity ease 0.3s;
@@ -176,6 +178,11 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
176
178
  font-weight:var(--avs-tooltip-font-weight);
177
179
  font-style:var(--avs-tooltip-font-style);
178
180
  }
181
+ #motionCaptureAlert {
182
+ left: 50%;
183
+ top: 50%;
184
+ transform: translate(-50%, -50%);
185
+ }
179
186
  #spinnerDiv {
180
187
  position:absolute;
181
188
  left:var(--avs-spinner-left, 50%);
@@ -200,25 +207,30 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
200
207
  </style>
201
208
  <div id="container">
202
209
  <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
+ <div id="motionCapture">
211
+ <div style="display: flex; justify-content: center" id="motionCaptureTitle">Motion Capture</div>
212
+ <div>
213
+ <a class="btn disabled" id="motionCapturePlay" data-tooltip="Play motion capture"></a>
214
+ <a class="btn" id="motionCaptureSnapshot" data-tooltip="Take snapshot">
215
+ <div id="motionCaptureSnapshotIcon"></div>
216
+ <div id="motionCaptureSnapshotLabel">0</div>
210
217
  </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>
218
+ <div class="btn disabled" id="motionCaptureDelay" data-tooltip="Frame delay (seconds)">
219
+ <div id="motionCaptureDelayIcon"></div>
220
+ <div id="motionCaptureDelayLabel">0</div>
221
+ <div id="motionCaptureDelayWheel">
222
+ <a id="motionCaptureDelayIncrease">+</a>
223
+ <a id="motionCaptureDelayDecrease">-</a>
224
+ </div>
225
+ </div>
226
+ <a class="btn" id="motionCaptureReset" data-tooltip="Reset transform"></a>
227
+ <a class="btn disabled" id="motionCaptureClear" data-tooltip="Clear motion capture frame"></a>
228
+ <a class="btn disabled" id="motionCaptureCopyData" data-tooltip="Copy motion capture data to clipboard"></a>
229
+ <a class="btn disabled" id="motionCaptureCopyUrl" data-tooltip="Copy motion capture URL to clipboard"></a>
219
230
  </div>
220
231
  </div>
221
- <div id="animationTooltip"></div>
232
+ <div id="motionCaptureTooltip"></div>
233
+ <div id="motionCaptureAlert"></div>
222
234
  <div id="zoomOverlay"></div>
223
235
  <div id="spinnerDiv">
224
236
  <div id="spinner"></div>
@@ -506,11 +518,11 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
506
518
  observer: "_transformValueChanged"
507
519
  },
508
520
  /**
509
- * Transform animation encoded string.
521
+ * Motion capture data or URL.
510
522
  */
511
- transformAnimation: {
523
+ motionCapture: {
512
524
  type: String,
513
- observer: "_transformAnimationValueChanged"
525
+ observer: "_motionCaptureValueChanged"
514
526
  },
515
527
  /**
516
528
  * Enable the zoom rectangle interactor. Only available when `renderer` is `THREEJS`
@@ -577,11 +589,11 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
577
589
  observer: "_animatedGlyphsEnableChanged"
578
590
  },
579
591
  /**
580
- * Enable animation controls overlay. Only available when `renderer` is `THREEJS`
592
+ * Enable motion capture controls. Only available when `renderer` is `THREEJS`
581
593
  */
582
- animationControlsEnable: {
594
+ motionCaptureControlsEnable: {
583
595
  type: Boolean,
584
- observer: "_animationControlsEnableChanged"
596
+ observer: "_motionCaptureControlsEnableChanged"
585
597
  }
586
598
  }
587
599
  }
@@ -992,23 +1004,23 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
992
1004
  blendedG += (bgCol[1] * (1 - col[3]));
993
1005
  blendedB += (bgCol[2] * (1 - col[3]));
994
1006
  }
995
- this.$.animationControls.style.color = "var(--avs-animation-controls-color, rgb(" + blendedR + ", " + blendedG + ", " + blendedB + "))";
1007
+ this.$.motionCapture.style.color = "var(--avs-motion-capture-color, rgb(" + blendedR + ", " + blendedG + ", " + blendedB + "))";
996
1008
  this.$.zoomOverlay.style.color = "var(--avs-zoom-overlay-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
997
1009
  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 + "))";
1010
+ this.$.motionCaptureTooltip.style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
999
1011
  }
1000
1012
  if (json.sceneInfo.color) {
1001
1013
  var col = json.sceneInfo.color.match(/[0-9.]+/gi);
1002
- this.$.animationControls.style.background = "var(--avs-animation-controls-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
1014
+ this.$.motionCapture.style.background = "var(--avs-motion-capture-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
1003
1015
  this.$.zoomOverlay.style.background = "var(--avs-zoom-overlay-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
1004
1016
  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] + "))";
1017
+ this.$.motionCaptureTooltip.style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
1006
1018
  }
1007
1019
  if (json.sceneInfo.fontFamily) {
1008
- this.$.animationControls.style.fontFamily = "var(--avs-animation-controls-font-family, " + json.sceneInfo.fontFamily + ")";
1020
+ this.$.motionCapture.style.fontFamily = "var(--avs-motion-capture-font-family, " + json.sceneInfo.fontFamily + ")";
1009
1021
  this.$.zoomOverlay.style.fontFamily = "var(--avs-zoom-overlay-font-family, " + json.sceneInfo.fontFamily + ")";
1010
1022
  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 + ")";
1023
+ this.$.motionCaptureTooltip.style.fontFamily = "var(--avs-tooltip-font-family, " + json.sceneInfo.fontFamily + ")";
1012
1024
  }
1013
1025
  }
1014
1026
 
@@ -1550,35 +1562,41 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1550
1562
  }
1551
1563
  });
1552
1564
 
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 ??= [];
1565
+ this.$.motionCapturePlay.innerHTML = PLAY;
1566
+ this.$.motionCaptureSnapshotIcon.innerHTML = CAMERA;
1567
+ this.$.motionCaptureDelayIcon.innerHTML = TIMELAPSE;
1568
+ this.$.motionCaptureReset.innerHTML = HOME;
1569
+ this.$.motionCaptureClear.innerHTML = DELETE;
1570
+ this.$.motionCaptureCopyData.innerHTML = COPY;
1571
+ this.$.motionCaptureCopyUrl.innerHTML = LINK;
1572
+
1573
+ this.$.motionCapturePlay.addEventListener('click', this.runAnimation.bind(this));
1574
+ this.$.motionCaptureSnapshot.addEventListener('click', this._handleMotionCaptureSnapshot.bind(this));
1575
+ this.$.motionCaptureDelayIncrease.addEventListener('click', this._handleMotionCaptureDelayIncrease.bind(this));
1576
+ this.$.motionCaptureDelayDecrease.addEventListener('click', this._handleMotionCaptureDelayDecrease.bind(this));
1577
+ this.$.motionCaptureReset.addEventListener('click', this.resetTransform.bind(this));
1578
+ this.$.motionCaptureClear.addEventListener('click', this._handleMotionCaptureClear.bind(this));
1579
+ this.$.motionCaptureCopyData.addEventListener('click', this._handleMotionCaptureCopyData.bind(this));
1580
+ this.$.motionCaptureCopyUrl.addEventListener('click', this._handleMotionCaptureCopyUrl.bind(this));
1581
+
1582
+ this.$.motionCapturePlay.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1583
+ this.$.motionCaptureSnapshot.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1584
+ this.$.motionCaptureDelay.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1585
+ this.$.motionCaptureReset.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1586
+ this.$.motionCaptureClear.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1587
+ this.$.motionCaptureCopyData.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1588
+ this.$.motionCaptureCopyUrl.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1589
+
1590
+ this.$.motionCapturePlay.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1591
+ this.$.motionCaptureSnapshot.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1592
+ this.$.motionCaptureDelay.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1593
+ this.$.motionCaptureReset.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1594
+ this.$.motionCaptureClear.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1595
+ this.$.motionCaptureCopyData.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1596
+ this.$.motionCaptureCopyUrl.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1597
+
1598
+ this.motionCaptureTime = 0;
1599
+ this.motionCaptureFrames ??= [];
1582
1600
 
1583
1601
  this._resetTimer();
1584
1602
 
@@ -1587,47 +1605,34 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1587
1605
  });
1588
1606
  }
1589
1607
 
1590
- _handlePointerEnterAnimationControl(e) {
1591
- if (!this.showAnimationTooltip) {
1608
+ _handlePointerEnterMotionCaptureControl(e) {
1609
+ if (!this.showMotionCaptureTooltip) {
1592
1610
  var adjustedCoords = this._getAdjustedCoords(e.clientX, e.clientY);
1593
1611
  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;
1612
+ this.$.motionCaptureTooltip.style.left = pos.x + "px";
1613
+ this.$.motionCaptureTooltip.style.top = pos.y + "px";
1614
+ this.$.motionCaptureTooltip.style.opacity = 1;
1615
+ this.$.motionCaptureTooltip.innerHTML = e.currentTarget.dataset.tooltip ?? e.currentTarget.id;
1616
+ this.showMotionCaptureTooltip = true;
1599
1617
  }
1600
1618
  }
1601
1619
 
1602
- _handlePointerLeaveAnimationControl() {
1603
- this.$.animationTooltip.style.opacity = 0;
1604
- this.showAnimationTooltip = false;
1620
+ _handlePointerLeaveMotionCaptureControl() {
1621
+ this.$.motionCaptureTooltip.style.opacity = 0;
1622
+ this.showMotionCaptureTooltip = false;
1605
1623
  }
1606
1624
 
1607
1625
  _round2dp(n) {
1608
1626
  return Math.round((n + Number.EPSILON) * 100) / 100;
1609
1627
  }
1610
1628
 
1611
- _handleAnimationDelayChange() {
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
- }
1621
- }
1622
-
1623
- _handleAnimationSnapshot() {
1629
+ _handleMotionCaptureSnapshot() {
1624
1630
  const transform = this._getTransformComponents();
1625
- const delay = Number(this.$.animationDelay.value);
1626
- if (this.transformAnimationFrames.length > 0) {
1627
- this.animationTime += delay;
1631
+ if (this.motionCaptureFrames.length > 0) {
1632
+ this.motionCaptureTime += this.motionCaptureDelay;
1628
1633
  }
1629
1634
  const frame = {
1630
- time: this.animationTime * 1000,
1635
+ time: this.motionCaptureTime * 1000,
1631
1636
  scale: this._round2dp(transform.scale),
1632
1637
  position: [this._round2dp(transform.position[0]),
1633
1638
  this._round2dp(transform.position[1]),
@@ -1637,40 +1642,65 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1637
1642
  this._round2dp(transform.rotation[2]),
1638
1643
  transform.rotation[3]]
1639
1644
  };
1640
- this.transformAnimationFrames.push(frame);
1645
+ this.motionCaptureFrames.push(frame);
1646
+
1647
+ if (this.motionCaptureFrames.length == 1) {
1648
+ this.$.motionCapturePlay.classList.remove("disabled");
1649
+ this.$.motionCaptureDelay.classList.remove("disabled");
1650
+ this.$.motionCaptureDelayLabel.innerText = "2";
1651
+ this.$.motionCaptureClear.classList.remove("disabled");
1652
+ this.$.motionCaptureCopyData.classList.remove("disabled");
1653
+ this.$.motionCaptureCopyUrl.classList.remove("disabled");
1654
+ this.motionCaptureDelay = 2;
1655
+ }
1656
+ this.$.motionCaptureSnapshotLabel.innerText = this.motionCaptureFrames.length;
1657
+ }
1658
+
1659
+ _handleMotionCaptureDelayIncrease() {
1660
+ this.motionCaptureDelay++;
1661
+ if (this.motionCaptureDelay > 9) {
1662
+ this.motionCaptureDelay = 9;
1663
+ }
1664
+ this.$.motionCaptureDelayLabel.innerText = this.motionCaptureDelay;
1665
+ }
1641
1666
 
1642
- if (this.transformAnimationFrames.length == 1) {
1643
- this.$.animationDelay.value = 2;
1644
- this.$.animationDelay.disabled = false;
1645
- this.$.animationPlay.classList.remove("disabled");
1646
- this.$.animationCopy.classList.remove("disabled");
1647
- this.$.animationClear.classList.remove("disabled");
1667
+ _handleMotionCaptureDelayDecrease() {
1668
+ this.motionCaptureDelay--;
1669
+ if (this.motionCaptureDelay < 1) {
1670
+ this.motionCaptureDelay = 1;
1648
1671
  }
1649
- this.$.animationSnapshotLabel.innerHTML = this.transformAnimationFrames.length;
1672
+ this.$.motionCaptureDelayLabel.innerText = this.motionCaptureDelay;
1650
1673
  }
1651
1674
 
1652
- _handleAnimationClear() {
1653
- this.transformAnimationFrames.length = 0;
1654
- this.$.animationDelay.value = 0;
1655
- this.$.animationDelay.disabled = true;
1656
- this.$.animationSnapshotLabel.innerHTML = "0";
1657
- this.$.animationPlay.classList.add("disabled");
1658
- this.$.animationCopy.classList.add("disabled");
1659
- this.$.animationClear.classList.add("disabled");
1660
- this.animationTime = 0;
1675
+ _handleMotionCaptureCopyData() {
1676
+ // Convert to JSON and copy to clipboard
1677
+ const data = JSON.stringify(this.motionCaptureFrames);
1678
+ navigator.clipboard.writeText(data);
1679
+
1680
+ // Show alert
1681
+ this.$.motionCaptureAlert.innerText = "Motion capture data copied to clipboard";
1682
+ this.$.motionCaptureAlert.style.opacity = 1;
1683
+ setTimeout(function () {
1684
+ this.$.motionCaptureAlert.style.opacity = 0;
1685
+ }.bind(this), 2000);
1661
1686
  }
1662
1687
 
1663
- async _handleAnimationCopy() {
1688
+ async _handleMotionCaptureCopyUrl() {
1664
1689
  // Convert to JSON, compress and base64url encode
1665
- const json = JSON.stringify(this.transformAnimationFrames);
1690
+ const json = JSON.stringify(this.motionCaptureFrames);
1666
1691
  const compressed = await this._compress(json);
1667
1692
  const encoded = compressed.toBase64().replace('/', '_').replace('+', '-');
1668
1693
 
1669
- /**
1670
- * A transform animation share event occurred.
1671
- * @event avs-transform-animation-share
1672
- */
1673
- this.dispatchEvent(new CustomEvent('avs-transform-animation-share', { detail: encoded }));
1694
+ // Create URL and copy to clipboard
1695
+ const url = window.location.origin + window.location.pathname + "?motionCapture=" + encoded;
1696
+ navigator.clipboard.writeText(url);
1697
+
1698
+ // Show alert
1699
+ this.$.motionCaptureAlert.innerText = "Motion capture URL copied to clipboard";
1700
+ this.$.motionCaptureAlert.style.opacity = 1;
1701
+ setTimeout(function () {
1702
+ this.$.motionCaptureAlert.style.opacity = 0;
1703
+ }.bind(this), 2000);
1674
1704
  }
1675
1705
 
1676
1706
  /**
@@ -1734,6 +1764,19 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1734
1764
  return new Uint8Array(buffer);
1735
1765
  }
1736
1766
 
1767
+ _handleMotionCaptureClear() {
1768
+ this.motionCaptureFrames.length = 0;
1769
+ this.$.motionCapturePlay.classList.add("disabled");
1770
+ this.$.motionCaptureSnapshotLabel.innerText = "0";
1771
+ this.$.motionCaptureDelay.classList.add("disabled");
1772
+ this.$.motionCaptureDelayLabel.innerText = "0";
1773
+ this.$.motionCaptureClear.classList.add("disabled");
1774
+ this.$.motionCaptureCopyData.classList.add("disabled");
1775
+ this.$.motionCaptureCopyUrl.classList.add("disabled");
1776
+ this.motionCaptureDelay = 0;
1777
+ this.motionCaptureTime = 0;
1778
+ }
1779
+
1737
1780
  _updatePixelRatio(change) {
1738
1781
  const pr = window.devicePixelRatio;
1739
1782
  matchMedia( `(resolution: ${pr}dppx)` ).addEventListener('change', this._updatePixelRatio.bind(this, true), { once: true } );
@@ -1743,14 +1786,14 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1743
1786
  }
1744
1787
 
1745
1788
  /**
1746
- * Change in 'animation-controls-enable' property.
1789
+ * Change in 'motion-capture-controls-enable' property.
1747
1790
  */
1748
- _animationControlsEnableChanged(newValue, oldValue) {
1791
+ _motionCaptureControlsEnableChanged(newValue, oldValue) {
1749
1792
  if (newValue) {
1750
- this.$.animationControls.style.display = "block";
1793
+ this.$.motionCapture.style.display = "block";
1751
1794
  }
1752
1795
  else {
1753
- this.$.animationControls.style.display = "none";
1796
+ this.$.motionCapture.style.display = "none";
1754
1797
  }
1755
1798
  }
1756
1799
 
@@ -1913,7 +1956,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1913
1956
  "legendTitle": "--avs-legend-title-animations",
1914
1957
  "glyph": "--avs-glyph-animations"
1915
1958
  });
1916
- styleMap.transform = this.transformAnimationFrames.length > 0 ? JSON.stringify(this.transformAnimationFrames) : null;
1959
+ styleMap.transform = this.motionCaptureFrames.length > 0 ? JSON.stringify(this.motionCaptureFrames) : null;
1917
1960
 
1918
1961
  this.animator.setStyleMap(styleMap);
1919
1962
  this.threeViewer.runAnimation();
@@ -1963,36 +2006,46 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1963
2006
  }
1964
2007
 
1965
2008
  /**
1966
- * Change in 'transform-animation' property.
2009
+ * Change in 'motion-capture' property.
1967
2010
  */
1968
- async _transformAnimationValueChanged(newValue, oldValue) {
2011
+ async _motionCaptureValueChanged(newValue, oldValue) {
1969
2012
  if (newValue) {
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);
2013
+ // Try parsing JSON first
2014
+ try {
2015
+ this.motionCaptureFrames = JSON.parse(newValue);
2016
+ }
2017
+ catch {
2018
+ // Decode from base64url, decompress and parse JSON
2019
+ const decoded = Uint8Array.fromBase64(newValue.replaceAll('_', '/').replaceAll('-', '+'));
2020
+ const decompressed = await this._decompress(decoded);
2021
+ this.motionCaptureFrames = JSON.parse(decompressed);
2022
+ }
1974
2023
 
1975
- if (!this.transformAnimationFrames) {
1976
- this.transformAnimationFrame = [];
2024
+ if (!this.motionCaptureFrames) {
2025
+ this.motionCaptureFrames = [];
1977
2026
  }
1978
2027
 
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;
2028
+ if (this.motionCaptureFrames.length > 0) {
2029
+ this.$.motionCapturePlay.classList.remove("disabled");
2030
+ this.$.motionCaptureSnapshotLabel.innerText = this.motionCaptureFrames.length;
2031
+ this.$.motionCaptureDelay.classList.remove("disabled");
2032
+ this.$.motionCaptureDelayLabel.innerText = "2";
2033
+ this.$.motionCaptureClear.classList.remove("disabled");
2034
+ this.$.motionCaptureCopyData.classList.remove("disabled");
2035
+ this.$.motionCaptureCopyUrl.classList.remove("disabled");
2036
+ this.motionCaptureDelay = 2;
2037
+ this.motionCaptureTime = this.motionCaptureFrames[this.motionCaptureFrames.length - 1].time / 1000;
1987
2038
  }
1988
2039
  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;
2040
+ this.$.motionCapturePlay.classList.add("disabled");
2041
+ this.$.motionCaptureSnapshotLabel.innerText = "0";
2042
+ this.$.motionCaptureDelay.classList.add("disabled");
2043
+ this.$.motionCaptureDelayLabel.innerText = "0";
2044
+ this.$.motionCaptureClear.classList.add("disabled");
2045
+ this.$.motionCaptureCopyData.classList.add("disabled");
2046
+ this.$.motionCaptureCopyUrl.classList.add("disabled");
2047
+ this.motionCaptureDelay = 0;
2048
+ this.motionCaptureTime = 0;
1996
2049
  }
1997
2050
  }
1998
2051
  }
package/src/constants.js CHANGED
@@ -18,4 +18,4 @@
18
18
  * Advanced Visual Systems Inc. (http://www.avs.com)
19
19
  */
20
20
 
21
- export var VERSION = '0.13.71760';
21
+ export var VERSION = '0.13.71762';
package/src/logo.js CHANGED
@@ -20,8 +20,10 @@
20
20
 
21
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
22
 
23
+ export var TIMELAPSE = "<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.24 7.75c-1.17-1.17-2.7-1.76-4.24-1.76v6l-4.24 4.24c2.34 2.34 6.14 2.34 8.49 0 2.34-2.34 2.34-6.14-.01-8.48zM12 1.99c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z\"/></svg>";
23
24
  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
25
  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>";
26
+ export var HOME = "<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=\"M12 5.69l5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3L2 12h3v8h6v-6h2v6h6v-8h3L12 3z\"/></svg>";
27
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>";
28
+ 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>";
29
+ export var LINK = "<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=\"M17 7h-4v2h4c1.65 0 3 1.35 3 3s-1.35 3-3 3h-4v2h4c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-6 8H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-2zm-3-4h8v2H8z\"/></svg>";