@avs/go 0.13.71874 → 0.14.71999

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.
@@ -18,20 +18,16 @@
18
18
  * Advanced Visual Systems Inc. (http://www.avs.com)
19
19
  */
20
20
 
21
- import {PolymerElement, html} from '@polymer/polymer/polymer-element.js';
22
- import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
23
- import {IronResizableBehavior} from '@polymer/iron-resizable-behavior/iron-resizable-behavior.js';
24
- import {afterNextRender} from '@polymer/polymer/lib/utils/render-status.js';
25
- import {AvsRenderer} from './avs-renderer.js';
21
+ import { AvsElementBase } from './avs-element-base.js';
22
+ import { html } from 'lit';
23
+ import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
24
+ import { AvsRenderer } from './avs-renderer.js';
26
25
  import {Viewer, TransformInteractor, PanInteractor, ZoomRectangleInteractor, PickDepthEnum, Animator} from '../lib/avs-three.module.min.js';
27
- import {AvsHttpMixin} from './avs-http-mixin.js';
28
- import {AvsStreamMixin} from './avs-stream-mixin.js';
29
- import {AvsDataSourceMixin} from './avs-data-source-mixin.js';
30
26
  import {LOGO, PLAY, CAMERA, TIMELAPSE, HOME, DELETE, COPY, LINK} from './logo.js';
31
- import {Euler, Vector3, Quaternion} from 'three';
27
+ import { Euler, Vector3, Quaternion } from 'three';
32
28
 
33
29
  /**
34
- * `avs-go-dataviz` is a Polymer 3.0 element which requests a data visualization
30
+ * `avs-go-dataviz` is a Lit element which requests a data visualization
35
31
  * from either the `sceneName` class on the AVS/Go server application running at `url`,
36
32
  * or from a JSON file at `url` when `urlLoadJsonFile` is set.
37
33
  *
@@ -43,14 +39,10 @@ import {Euler, Vector3, Quaternion} from 'three';
43
39
  * * * This element is resized outside of the `resizeThresold` percentage
44
40
  *
45
41
  * @customElement
46
- * @polymer
47
- * @appliesMixin AvsDataSourceMixin
48
- * @appliesMixin AvsStreamMixin
49
- * @appliesMixin AvsHttpMixin
42
+ * @lit
50
43
  */
51
- export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin(mixinBehaviors([IronResizableBehavior], PolymerElement)))) {
52
-
53
- static get template() {
44
+ export class AvsGoDataViz extends AvsElementBase {
45
+ render() {
54
46
  return html`
55
47
  <style>
56
48
  :host {
@@ -58,11 +50,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
58
50
  width:100%;
59
51
  height:100%;
60
52
  overflow:hidden;
61
- }
62
- #container {
63
53
  position:relative;
64
- width:100%;
65
- height:100%;
66
54
  letter-spacing:normal;
67
55
  word-spacing:normal;
68
56
  line-height:normal;
@@ -205,28 +193,27 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
205
193
  @-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
206
194
  @keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
207
195
  </style>
208
- <div id="container">
209
196
  <div id="dataVizDiv"></div>
210
197
  <div id="motionCapture">
211
198
  <div style="display: flex; justify-content: center" id="motionCaptureTitle">Motion Capture</div>
212
199
  <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>
200
+ <a class="btn disabled" id="motionCapturePlay" data-tooltip="Play motion capture" @click="${this.runAnimation}" @pointermove="${this._handlePointerEnterMotionCaptureControl}" @pointerout="${this._handlePointerLeaveMotionCaptureControl}">${unsafeSVG(PLAY)}</a>
201
+ <a class="btn" id="motionCaptureSnapshot" data-tooltip="Take snapshot" @click="${this._handleMotionCaptureSnapshot}" @pointermove="${this._handlePointerEnterMotionCaptureControl}" @pointerout="${this._handlePointerLeaveMotionCaptureControl}">
202
+ <div id="motionCaptureSnapshotIcon">${unsafeSVG(CAMERA)}</div>
216
203
  <div id="motionCaptureSnapshotLabel">0</div>
217
204
  </a>
218
- <div class="btn disabled" id="motionCaptureDelay" data-tooltip="Frame delay (seconds)">
219
- <div id="motionCaptureDelayIcon"></div>
205
+ <div class="btn disabled" id="motionCaptureDelay" data-tooltip="Frame delay (seconds)" @pointermove="${this._handlePointerEnterMotionCaptureControl}" @pointerout="${this._handlePointerLeaveMotionCaptureControl}">
206
+ <div id="motionCaptureDelayIcon">${unsafeSVG(TIMELAPSE)}</div>
220
207
  <div id="motionCaptureDelayLabel">0</div>
221
208
  <div id="motionCaptureDelayWheel">
222
- <a id="motionCaptureDelayIncrease">+</a>
223
- <a id="motionCaptureDelayDecrease">-</a>
209
+ <a id="motionCaptureDelayIncrease" @click="${this._handleMotionCaptureDelayIncrease}">+</a>
210
+ <a id="motionCaptureDelayDecrease" @click="${this._handleMotionCaptureDelayDecrease}">-</a>
224
211
  </div>
225
212
  </div>
226
- <a class="btn" id="motionCaptureReset" data-tooltip="Reset transform"></a>
227
- <a class="btn disabled" id="motionCaptureClear" data-tooltip="Clear motion capture frames"></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>
213
+ <a class="btn" id="motionCaptureReset" data-tooltip="Reset transform" @click="${this.resetTransform}" @pointermove="${this._handlePointerEnterMotionCaptureControl}" @pointerout="${this._handlePointerLeaveMotionCaptureControl}">${unsafeSVG(HOME)}</a>
214
+ <a class="btn disabled" id="motionCaptureClear" data-tooltip="Clear motion capture frames" @click="${this._handleMotionCaptureClear}" @pointermove="${this._handlePointerEnterMotionCaptureControl}" @pointerout="${this._handlePointerLeaveMotionCaptureControl}">${unsafeSVG(DELETE)}</a>
215
+ <a class="btn disabled" id="motionCaptureCopyData" data-tooltip="Copy motion capture data to clipboard" @click="${this._handleMotionCaptureCopyData}" @pointermove="${this._handlePointerEnterMotionCaptureControl}" @pointerout="${this._handlePointerLeaveMotionCaptureControl}">${unsafeSVG(COPY)}</a>
216
+ <a class="btn disabled" id="motionCaptureCopyUrl" data-tooltip="Copy motion capture URL to clipboard" @click="${this._handleMotionCaptureCopyUrl}" @pointermove="${this._handlePointerEnterMotionCaptureControl}" @pointerout="${this._handlePointerLeaveMotionCaptureControl}">${unsafeSVG(LINK)}</a>
230
217
  </div>
231
218
  </div>
232
219
  <div id="motionCaptureTooltip"></div>
@@ -236,25 +223,23 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
236
223
  <div id="spinner"></div>
237
224
  </div>
238
225
  <div id="tooltip"></div>
239
- </div>
240
226
  `;
241
227
  }
242
228
 
243
- static get properties() {
244
- return {
245
-
229
+ static properties = {
246
230
  /**
247
231
  * Don't request a new scene upon initialization or resize.
248
232
  */
249
233
  manualUpdate: {
250
- type: Boolean
234
+ type: Boolean,
235
+ attribute: 'manual-update'
251
236
  },
252
237
  /**
253
238
  * Highlight canvas elements when using the `THREEJS` renderer.
254
239
  */
255
240
  displayCanvas: {
256
241
  type: Boolean,
257
- observer: "_displayCanvasChanged"
242
+ attribute: 'display-canvas'
258
243
  },
259
244
  /**
260
245
  * The URL to an instance of AVS/Go server application or file.
@@ -266,54 +251,90 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
266
251
  * Enables loading JSON from a file.
267
252
  */
268
253
  urlLoadJsonFile: {
269
- type: Boolean
270
- },
271
- /**
272
- * The name of the scene registered in the library map on the server.
273
- */
274
- sceneName: {
275
- type: String
276
- },
277
- /**
278
- * User properties for the scene passed directly to the server.
279
- */
280
- sceneUserProperties: {
281
- type: Object,
282
- value: {}
283
- },
284
- /**
285
- * The name of the renderer registered in the library map on the server.
286
- */
287
- rendererName: {
288
- type: String
289
- },
290
- /**
291
- * User properties for the renderer passed directly to the server.
292
- */
293
- rendererUserProperties: {
294
- type: Object,
295
- value: {}
296
- },
297
- /**
298
- * The type of renderer to be used to display a scene: `IMAGE`, `SVG` or `THREEJS`
299
- */
300
- renderer: {
301
- type: String,
302
- value: "IMAGE",
303
- observer: "_rendererChanged"
254
+ type: Boolean,
255
+ attribute: 'url-load-json-file'
304
256
  },
257
+ /**
258
+ * Name of the data source registered in the library map on the server.
259
+ */
260
+ dataSourceName: {
261
+ type: String,
262
+ attribute: 'data-source-name'
263
+ },
264
+ /**
265
+ * User properties as JSON passed directly to the data source on the server.
266
+ */
267
+ dataSourceUserProperties: {
268
+ type: String,
269
+ attribute: 'data-source-user-properties'
270
+ },
271
+ /**
272
+ * The name of the scene registered in the library map on the server.
273
+ */
274
+ sceneName: {
275
+ type: String,
276
+ attribute: 'scene-name'
277
+ },
278
+ /**
279
+ * User properties as JSON passed directly to the scene on the server.
280
+ */
281
+ sceneUserProperties: {
282
+ type: String,
283
+ attribute: 'scene-user-properties'
284
+ },
285
+ /**
286
+ * The name of the renderer registered in the library map on the server.
287
+ */
288
+ rendererName: {
289
+ type: String,
290
+ attribute: 'renderer-name'
291
+ },
292
+ /**
293
+ * User properties as JSON passed directly to the renderer on the server.
294
+ */
295
+ rendererUserProperties: {
296
+ type: String,
297
+ attribute: 'renderer-user-properties'
298
+ },
299
+ /**
300
+ * The type of renderer to be used to display a scene: `IMAGE`, `SVG` or `THREEJS`
301
+ */
302
+ renderer: {
303
+ type: String
304
+ },
305
+ /**
306
+ * Enables streaming of objects from the server.
307
+ */
308
+ streamEnable: {
309
+ type: Boolean,
310
+ attribute: 'stream-enable'
311
+ },
312
+ /**
313
+ * The number of objects streamed for the first chunk.
314
+ */
315
+ streamChunkSizeFirst: {
316
+ type: Number,
317
+ attribute: 'stream-chunk-size-first'
318
+ },
319
+ /**
320
+ * The number of objects streamed per chunk.
321
+ */
322
+ streamChunkSize: {
323
+ type: Number,
324
+ attribute: 'stream-chunk-size'
325
+ },
305
326
  /**
306
327
  * The name of the theme registered in the library map on the server, or undefined to use CSS, or one of the branded themes: `DEFAULT`, `AVS_LIGHT`, `AVS_DARK` or `AVS_BLACK`
307
328
  */
308
329
  themeName: {
309
- type: String
330
+ type: String,
331
+ attribute: 'theme-name'
310
332
  },
311
333
  /**
312
334
  * Hide the data visualization.
313
335
  */
314
336
  hidden: {
315
- type: Boolean,
316
- observer: "_hiddenChanged"
337
+ type: Boolean
317
338
  },
318
339
  /**
319
340
  * Resize threshold (percent) to determine when the update is performed on the client or the server.
@@ -321,142 +342,161 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
321
342
  */
322
343
  resizeThreshold: {
323
344
  type: Number,
324
- value: 10
345
+ attribute: 'resize-threshold'
325
346
  },
326
347
  /**
327
348
  * Aspect ratio (w/h) of the viewer if it is unable to determine the height of its parent element.
328
349
  */
329
350
  aspectRatio: {
330
351
  type: Number,
331
- value: 1.777777
352
+ attribute: 'aspect-ration'
332
353
  },
333
354
  /**
334
355
  * Number of seconds between pointer moves before an `avs-pointer-timeout` event is dispatched.
335
356
  */
336
357
  pointerTimeout: {
337
358
  type: Number,
338
- value: 600
359
+ attribute: 'pointer-timeout'
339
360
  },
340
361
  /**
341
362
  * Enables the `avs-tap` event.
342
363
  */
343
364
  tapEnable: {
344
- type: Boolean
365
+ type: Boolean,
366
+ attribute: 'tap-enable'
345
367
  },
346
368
  /**
347
369
  * The level of geometry within the scene to be modified by the tap event: `CELL`, `CELL_SET` or `SCENE_NODE`
348
370
  */
349
371
  tapLevel: {
350
- type: String
372
+ type: String,
373
+ attribute: 'tap-level'
351
374
  },
352
375
  /**
353
376
  * The depth at which an object is selected: `ALL` or `CLOSEST`
354
377
  */
355
378
  tapDepth: {
356
- type: String
379
+ type: String,
380
+ attribute: 'tap-depth'
357
381
  },
358
382
  /**
359
383
  * Enables highlight of selected geometry in the scene.
360
384
  */
361
385
  tapHighlightEnable: {
362
- type: Boolean
386
+ type: Boolean,
387
+ attribute: 'tap-highlight-enable'
363
388
  },
364
389
  /**
365
390
  * The color to used to highlight the selected objects in the scene.
366
391
  */
367
392
  tapHighlightColor: {
368
- type: String
393
+ type: String,
394
+ attribute: 'tap-highlight-color'
369
395
  },
370
396
  /**
371
397
  * Enables drawing highlighted objects in front of all objects in the scene. This results in faster rendering in a 2D viewport when using the `THREEJS` renderer.
372
398
  */
373
399
  tapHighlightLayerEnable: {
374
- type: Boolean
400
+ type: Boolean,
401
+ attribute: 'tap-highlight-layer-enable'
375
402
  },
376
403
  /**
377
404
  * Enables the processing of tap events on the client. `THREEJS` only.
378
405
  */
379
406
  tapProcessEventOnClient: {
380
- type: Boolean
407
+ type: Boolean,
408
+ attribute: 'tap-process-event-on-client'
381
409
  },
382
410
  /**
383
411
  * Enables the `avs-track` event.
384
412
  */
385
413
  trackEnable: {
386
414
  type: Boolean,
387
- observer: "_trackEnableChanged"
415
+ attribute: 'track-enable'
388
416
  },
389
417
  /**
390
418
  * The level of geometry within the scene to be modified by the track event: `CELL`, `CELL_SET` or `SCENE_NODE`
391
419
  */
392
420
  trackLevel: {
393
- type: String
421
+ type: String,
422
+ attribute: 'track-level'
394
423
  },
395
424
  /**
396
425
  * The depth at which an object is selected: `ALL` or `CLOSEST`
397
426
  */
398
427
  trackDepth: {
399
- type: String
428
+ type: String,
429
+ attribute: 'track-depth'
400
430
  },
401
431
  /**
402
432
  * Enables highlight of selected geometry in the scene.
403
433
  */
404
434
  trackHighlightEnable: {
405
- type: Boolean
435
+ type: Boolean,
436
+ attribute: 'track-highlight-enable'
406
437
  },
407
438
  /**
408
439
  * The color to used to highlight the selected objects in the scene.
409
440
  */
410
441
  trackHighlightColor: {
411
- type: String
442
+ type: String,
443
+ attribute: 'track-highlight-color'
412
444
  },
413
445
  /**
414
446
  * Enables drawing highlighted objects in front of all objects in the scene. This results in faster rendering in a 2D viewport when using the `THREEJS` renderer.
415
447
  */
416
448
  trackHighlightLayerEnable: {
417
- type: Boolean
449
+ type: Boolean,
450
+ attribute: 'track-highlight-layer-enable'
418
451
  },
419
452
  /**
420
453
  * Enables the processing of track events on the client. `THREEJS` only.
421
454
  */
422
455
  trackProcessEventOnClient: {
423
- type: Boolean
456
+ type: Boolean,
457
+ attribute: 'track-process-event-on-client'
424
458
  },
425
459
  /**
426
460
  * Enables the `avs-hover` event.
427
461
  */
428
462
  hoverEnable: {
429
- type: Boolean
463
+ type: Boolean,
464
+ attribute: 'hover-enable'
430
465
  },
431
466
  /**
432
467
  * The level of geometry within the scene to be modified by the hover event: `CELL`, `CELL_SET` or `SCENE_NODE`
433
468
  */
434
469
  hoverLevel: {
435
- type: String
470
+ type: String,
471
+ attribute: 'hover-level'
436
472
  },
437
473
  /**
438
474
  * The depth at which an object is selected: `ALL` or `CLOSEST`
439
475
  */
440
476
  hoverDepth: {
441
- type: String
477
+ type: String,
478
+ attribute: 'hover-depth'
442
479
  },
443
480
  /**
444
481
  * Enables highlight of selected geometry in the scene.
445
482
  */
446
483
  hoverHighlightEnable: {
447
- type: Boolean
484
+ type: Boolean,
485
+ attribute: 'hover-highlight-enable'
448
486
  },
449
487
  /**
450
488
  * The color to used to highlight the selected objects in the scene.
451
489
  */
452
490
  hoverHighlightColor: {
453
- type: String
491
+ type: String,
492
+ attribute: 'hover-highlight-color'
454
493
  },
455
494
  /**
456
495
  * Enables drawing highlighted objects in front of all objects in the scene. This results in faster rendering in a 2D viewport when using the `THREEJS` renderer.
457
496
  */
458
497
  hoverHighlightLayerEnable: {
459
- type: Boolean
498
+ type: Boolean,
499
+ attribute: 'hover-highlight-layer-enable'
460
500
  },
461
501
  /**
462
502
  * Enable the transform interactor. Only available when `renderer` is `THREEJS`
@@ -466,63 +506,63 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
466
506
  */
467
507
  transformEnable: {
468
508
  type: Boolean,
469
- observer: "_transformEnableChanged"
509
+ attribute: 'transform-enable'
470
510
  },
471
511
  /**
472
512
  * Transform on the client only, do not update the transform matrix on the server.
473
513
  */
474
514
  transformClientOnly: {
475
515
  type: Boolean,
476
- observer: "_transformClientOnlyChanged"
516
+ attribute: 'transform-client-only'
477
517
  },
478
518
  /**
479
519
  * Disables rotation of the object.
480
520
  */
481
521
  transformRotateDisable: {
482
522
  type: Boolean,
483
- observer: "_transformRotateDisableChanged"
523
+ attribute: 'transform-rotate-disable-changed'
484
524
  },
485
525
  /**
486
526
  * Disables zooming of the object.
487
527
  */
488
528
  transformZoomDisable: {
489
529
  type: Boolean,
490
- observer: "_transformZoomDisableChanged"
530
+ attribute: 'transform-zoom-disable'
491
531
  },
492
532
  /**
493
533
  * Disables panning of the object.
494
534
  */
495
535
  transformPanDisable: {
496
536
  type: Boolean,
497
- observer: "_transformPanDisableChanged"
537
+ attribute: 'transform-pan-disable'
498
538
  },
499
539
  /**
500
540
  * The twist angle of the object in degrees.
501
541
  */
502
542
  transformTwistAngle: {
503
543
  type: Number,
504
- observer: "_transformValueChanged"
544
+ attribute: 'transform-twist-angle'
505
545
  },
506
546
  /**
507
547
  * The tilt angle of the object in degrees.
508
548
  */
509
549
  transformTiltAngle: {
510
550
  type: Number,
511
- observer: "_transformValueChanged"
551
+ attribute: 'transform-tilt-angle'
512
552
  },
513
553
  /**
514
554
  * The scale of the object in percent.
515
555
  */
516
556
  transformScale: {
517
557
  type: Number,
518
- observer: "_transformValueChanged"
558
+ attribute: 'transform-scale'
519
559
  },
520
560
  /**
521
561
  * Motion capture data or URL.
522
562
  */
523
563
  motionCapture: {
524
564
  type: String,
525
- observer: "_motionCaptureValueChanged"
565
+ attribute: 'motion-capture'
526
566
  },
527
567
  /**
528
568
  * Enable the zoom rectangle interactor. Only available when `renderer` is `THREEJS`
@@ -532,7 +572,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
532
572
  */
533
573
  zoomRectangleEnable: {
534
574
  type: Boolean,
535
- observer: "_zoomRectangleEnableChanged"
575
+ attribute: 'zoom-rectangle-enable'
536
576
  },
537
577
  /**
538
578
  * Enable the pan interactor. Only available when `renderer` is `THREEJS`
@@ -541,7 +581,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
541
581
  */
542
582
  panEnable: {
543
583
  type: Boolean,
544
- observer: "_panEnableChanged"
584
+ attribute: 'pan-enable'
545
585
  },
546
586
  /**
547
587
  * Use mousewheel or pinch zoom to adjust the pan interactor's zoom level.
@@ -549,21 +589,21 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
549
589
  */
550
590
  panZoomEnable: {
551
591
  type: Boolean,
552
- observer: "_panZoomEnableChanged"
592
+ attribute: 'pan-zoom-enable'
553
593
  },
554
594
  /**
555
595
  * The width zoom level in percent of the original scene greater than 100%
556
596
  */
557
597
  panWidthZoomLevel: {
558
598
  type: Number,
559
- observer: "_panWidthZoomLevelChanged"
599
+ attribute: 'pan-width-zoom-level'
560
600
  },
561
601
  /**
562
602
  * The height zoom level in percent of the original scene greater than 100%
563
603
  */
564
604
  panHeightZoomLevel: {
565
605
  type: Number,
566
- observer: "_panHeightZoomLevelChanged"
606
+ attribute: 'pan-height-zoom-level'
567
607
  },
568
608
  /**
569
609
  * The maximum zoom level in percent of the original scene greater than 100%
@@ -571,31 +611,29 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
571
611
  */
572
612
  panMaximumZoomLevel: {
573
613
  type: Number,
574
- observer: "_panMaximumZoomLevelChanged",
575
- value: 1000
614
+ attribute: 'pan-maximum-zoom-level'
576
615
  },
577
616
  /**
578
617
  * Show animated glyphs. Only available when `renderer` is `THREEJS`
579
618
  */
580
619
  animatedGlyphsVisible: {
581
620
  type: Boolean,
582
- observer: "_animatedGlyphsVisibleChanged"
621
+ attribute: 'animated-glyphs-visible'
583
622
  },
584
623
  /**
585
624
  * Enable animated glyphs. Only available when `renderer` is `THREEJS`
586
625
  */
587
626
  animatedGlyphsEnable: {
588
627
  type: Boolean,
589
- observer: "_animatedGlyphsEnableChanged"
628
+ attribute: 'animated-glyphs-enable'
590
629
  },
591
630
  /**
592
631
  * Enable motion capture controls. Only available when `renderer` is `THREEJS`
593
632
  */
594
633
  motionCaptureControlsEnable: {
595
634
  type: Boolean,
596
- observer: "_motionCaptureControlsEnableChanged"
635
+ attribute: 'motion-capture-controls-enable'
597
636
  }
598
- }
599
637
  }
600
638
 
601
639
  /**
@@ -611,23 +649,45 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
611
649
  */
612
650
  _assembleModel(fullReset) {
613
651
  if (!this.sceneName) {
614
- this._logError( JSON.stringify( {"GoType":1, "error":"\'scene-name\' property must be set to the name of the scene registered in the library map on the server."} ) );
652
+ this._dispatchErrorEvent("'scene-name' property must be set to the name of the scene registered in the library map on the AVS/Go server.");
615
653
  return undefined;
616
654
  }
617
655
 
618
- var model = {};
619
-
620
656
  // Scene Properties
621
- var sceneProperties = {name:this.sceneName};
657
+ const model = {
658
+ sceneProperties: {
659
+ name: this.sceneName
660
+ }
661
+ };
622
662
  if (this.sceneUserProperties) {
623
- sceneProperties.userProperties = this.sceneUserProperties;
663
+ let sceneUserProperties;
664
+ try {
665
+ sceneUserProperties = JSON.parse(this.sceneUserProperties);
666
+ }
667
+ catch (error) {
668
+ this._dispatchErrorEvent("Can't parse 'scene-user-properties'. " + error.message);
669
+ return undefined;
670
+ }
671
+ model.sceneProperties.userProperties = sceneUserProperties;
624
672
  }
625
- model.sceneProperties = sceneProperties;
626
673
 
627
674
  // Renderer Properties
628
- var rendererProperties = {width:this.width, height:this.height, name:this.rendererName, type:this.renderer};
675
+ const rendererProperties = {
676
+ width: this.width,
677
+ height: this.height,
678
+ name: this.rendererName,
679
+ type: this.renderer
680
+ };
629
681
  if (this.rendererUserProperties) {
630
- rendererProperties.userProperties = this.rendererUserProperties;
682
+ let rendererUserProperties;
683
+ try {
684
+ rendererUserProperties = JSON.parse(this.rendererUserProperties);
685
+ }
686
+ catch (error) {
687
+ this._dispatchErrorEvent("Can't parse 'renderer-user-properties'. " + error.message);
688
+ return undefined;
689
+ }
690
+ rendererProperties.userProperties = rendererUserProperties;
631
691
  }
632
692
  model.rendererProperties = rendererProperties;
633
693
 
@@ -635,7 +695,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
635
695
  if (this.transformInteractor) {
636
696
  // Update the local transform matrix from the transform interactor, we may have transformed since the last request
637
697
  this.transformMatrix = this.transformInteractor.object.matrix.elements.slice();
638
- this.transformClientOnly = this.transformInteractor.clientOnly;
698
+ // this.transformClientOnly = this.transformInteractor.clientOnly;
639
699
  }
640
700
  if (this.transformMatrix && !this.transformClientOnly) {
641
701
  rendererProperties.transformMatrix = this.transformMatrix;
@@ -651,7 +711,10 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
651
711
 
652
712
  // PanInteractor
653
713
  if (this.panEnable) {
654
- rendererProperties.panProperties = {widthZoomLevel: this.panWidthZoomLevel, heightZoomLevel: this.panHeightZoomLevel};
714
+ rendererProperties.panProperties = {
715
+ widthZoomLevel: Math.min(this.panWidthZoomLevel, this.panMaximumZoomLevel),
716
+ heightZoomLevel: Math.min(this.panHeightZoomLevel, this.panMaximumZoomLevel)
717
+ };
655
718
  }
656
719
 
657
720
  // Base theme to use from themeName property
@@ -685,7 +748,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
685
748
  "sceneBackgroundGradientColorRepeat": "--avs-scene-background-gradient-color-repeat",
686
749
  "sceneHighlightColor": "--avs-scene-highlight-color",
687
750
  "sceneSurfaceColor": "--avs-scene-surface-color",
688
- "scenePointColor": "--avs-scene-point-color",
751
+ "scenePointColor": "--avs-scene-point-color",
689
752
  "sceneLineColor": "--avs-scene-line-color",
690
753
  "sceneLineWidth": "--avs-scene-line-width",
691
754
  "sceneTextColor": "--avs-scene-text-color",
@@ -711,7 +774,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
711
774
  "chartBackgroundGradientColorRepeat": "--avs-chart-background-gradient-color-repeat",
712
775
  "chartHighlightColor": "--avs-chart-highlight-color",
713
776
  "chartSurfaceColor": "--avs-chart-surface-color",
714
- "chartPointColor": "--avs-chart-point-color",
777
+ "chartPointColor": "--avs-chart-point-color",
715
778
  "chartLineColor": "--avs-chart-line-color",
716
779
  "chartLineWidth": "--avs-chart-line-width",
717
780
  "chartLinePattern": "--avs-chart-line-pattern",
@@ -790,24 +853,42 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
790
853
  "legendFontStyle": "--avs-legend-font-style",
791
854
  "legendFontWeight": "--avs-legend-font-weight",
792
855
  "legendFontSize": "--avs-legend-font-size",
856
+ "legendPointColor": "--avs-legend-point-color",
793
857
  // Legend title
794
858
  "legendTitleTextColor": "--avs-legend-title-text-color",
795
859
  "legendTitleTextRotation": "--avs-legend-title-text-rotation",
796
860
  "legendTitleFontFamily": "--avs-legend-title-font-family",
797
861
  "legendTitleFontStyle": "--avs-legend-title-font-style",
798
862
  "legendTitleFontWeight": "--avs-legend-title-font-weight",
799
- "legendTitleFontSize": "--avs-legend-title-font-size",
800
- // Defaults
801
- "defaultPointSize": "--avs-default-point-size",
802
- "defaultGlyphSize": "--avs-default-glyph-size",
803
- "minGlyphSize": "--avs-min-glyph-size",
804
- "maxGlyphSize": "--avs-max-glyph-size"
863
+ "legendTitleFontSize": "--avs-legend-title-font-size"
805
864
  } );
806
865
 
807
- this._addDataSourceProperties(model);
808
-
809
- if (this.renderer === 'THREEJS') {
810
- this._addStreamProperties(rendererProperties);
866
+ // Data source properties
867
+ if (this.dataSourceName) {
868
+ model.dataSourceProperties = {
869
+ name: this.dataSourceName
870
+ }
871
+ if (this.dataSourceUserProperties) {
872
+ let dataSourceUserProperties;
873
+ try {
874
+ dataSourceUserProperties = JSON.parse(this.dataSourceUserProperties);
875
+ }
876
+ catch (error) {
877
+ this._dispatchErrorEvent("Can't parse 'data-source-user-properties'. " + error.message);
878
+ return undefined;
879
+ }
880
+ model.dataSourceProperties.userProperties = dataSourceUserProperties;
881
+ }
882
+ }
883
+
884
+ // Stream properties
885
+ if (this.threeViewer) {
886
+ if (this.streamEnable) {
887
+ rendererProperties.streamProperties = {
888
+ chunkSizeFirst: this.streamChunkSizeFirst,
889
+ chunkSize: this.streamChunkSize
890
+ };
891
+ }
811
892
  }
812
893
 
813
894
  return model;
@@ -854,11 +935,11 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
854
935
  this.width = this.clientWidth;
855
936
  if (this.width <= 0) {
856
937
  this.width = 200; // fallback if clientWidth fails
857
- this.$.container.style.width = this.width + "px";
938
+ this.style.width = this.width + "px";
939
+ }
940
+ else {
941
+ this.style.width = "100%";
858
942
  }
859
- else {
860
- this.$.container.style.width = "100%";
861
- }
862
943
 
863
944
  // Get the height provided by our container
864
945
  this.height = this.clientHeight;
@@ -870,11 +951,11 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
870
951
  else {
871
952
  this.height = 200; // fallback if clientHeight fails
872
953
  }
873
- this.$.container.style.height = this.height + "px";
954
+ this.style.height = this.height + "px";
955
+ }
956
+ else {
957
+ this.style.height = "100%";
874
958
  }
875
- else {
876
- this.$.container.style.height = "100%";
877
- }
878
959
 
879
960
  if (this.rectCanvas) {
880
961
  this.rectCanvas.width = this.width;
@@ -893,35 +974,35 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
893
974
  return response.text();
894
975
  })
895
976
  .then((html) => {
896
- this.$.spinner.innerHTML = html;
977
+ this.renderRoot.querySelector('#spinner').innerHTML = html;
897
978
  })
898
979
  .catch((error) => {
899
- this.$.spinner.innerHTML = '';
980
+ this.renderRoot.querySelector('#spinner').innerHTML = '';
900
981
  });
901
982
  }
902
983
  else {
903
- this.$.spinner.innerHTML = LOGO;
984
+ this.renderRoot.querySelector('#spinner').innerHTML = LOGO;
904
985
  }
905
986
 
906
- this.$.spinner.style.display = 'block';
987
+ this.renderRoot.querySelector('#spinner').style.display = 'block';
907
988
  }
908
989
 
909
990
  hideSpinner() {
910
- this.$.spinner.style.display = 'none';
991
+ this.renderRoot.querySelector('#spinner').style.display = 'none';
911
992
  }
912
993
 
913
994
  startSpinner() {
914
- this.$.spinner.className = 'spin';
995
+ this.renderRoot.querySelector('#spinner').className = 'spin';
915
996
  }
916
997
 
917
998
  stopSpinner() {
918
- this.$.spinner.className = '';
999
+ this.renderRoot.querySelector('#spinner').className = '';
919
1000
  }
920
1001
 
921
1002
  /**
922
- * Send the request to the server.
1003
+ * At least one of the properties was changed.
923
1004
  */
924
- updateViewer(fullReset) {
1005
+ updated(changedProperties) {
925
1006
  this._updateSize();
926
1007
 
927
1008
  this.lowResizeWidth = (100 - this.resizeThreshold) / 100 * this.width;
@@ -929,19 +1010,115 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
929
1010
  this.lowResizeHeight = (100 - this.resizeThreshold) / 100 * this.height;
930
1011
  this.highResizeHeight = (100 + this.resizeThreshold) / 100 * this.height;
931
1012
 
932
- this.showSpinner();
933
- if (this.url !== undefined && this.url !== null) {
934
- this.startSpinner();
1013
+ if (changedProperties.has('renderer')) {
1014
+ this._rendererChanged(this.renderer, changedProperties['renderer']);
1015
+ }
1016
+ if (changedProperties.has('transformEnable')) {
1017
+ this._transformEnableChanged(this.transformEnable, changedProperties['transformEnable']);
1018
+ }
1019
+ if (changedProperties.has('transformClientOnly')) {
1020
+ this._transformClientOnlyChanged(this.transformClientOnly, changedProperties['transformClientOnly']);
1021
+ }
1022
+ if (changedProperties.has('transformRotateDisable')) {
1023
+ this._transformRotateDisableChanged(this.transformRotateDisable, changedProperties['transformRotateDisable']);
1024
+ }
1025
+ if (changedProperties.has('transformZoomDisable')) {
1026
+ this._transformZoomDisableChanged(this.transformZoomDisable, changedProperties['transformZoomDisable']);
1027
+ }
1028
+ if (changedProperties.has('transformPanDisable')) {
1029
+ this._transformPanDisableChanged(this.transformPanDisable, changedProperties['transformPanDisable']);
1030
+ }
1031
+ if (changedProperties.has('animatedGlyphsVisible')) {
1032
+ this._animatedGlyphsVisibleChanged(this.animatedGlyphsVisible, changedProperties['animatedGlyphsVisible']);
1033
+ }
1034
+ if (changedProperties.has('animatedGlyphsEnable')) {
1035
+ this._animatedGlyphsEnableChanged(this.animatedGlyphsEnable, changedProperties['animatedGlyphsEnable']);
1036
+ }
1037
+ if (changedProperties.has('transformTwistAngle') || changedProperties.has('transformTiltAngle') || changedProperties.has('transformScale')) {
1038
+ this._transformValueChanged();
1039
+ }
1040
+ if (changedProperties.has('animatedGlyphsEnable')) {
1041
+ this._animatedGlyphsEnableChanged(this.animatedGlyphsEnable, changedProperties['animatedGlyphsEnable']);
1042
+ }
1043
+ if (changedProperties.has('zoomRectangleEnable')) {
1044
+ this._zoomRectangleEnableChanged(this.zoomRectangleEnable, changedProperties['zoomRectangleEnable']);
1045
+ }
1046
+ if (changedProperties.has('panEnable')) {
1047
+ this._panEnableChanged(this.panEnable, changedProperties['panEnable']);
1048
+ }
1049
+ if (changedProperties.has('panZoomEnable')) {
1050
+ this._panZoomEnableChanged(this.panZoomEnable, changedProperties['panZoomEnable']);
1051
+ }
1052
+ if (changedProperties.has('panWidthZoomLevel')) {
1053
+ this._panWidthZoomLevelChanged(this.panWidthZoomLevel, changedProperties['panWidthZoomLevel']);
1054
+ }
1055
+ if (changedProperties.has('panHeightZoomLevel')) {
1056
+ this._panHeightZoomLevelChanged(this.panHeightZoomLevel, changedProperties['panHeightZoomLevel']);
1057
+ }
1058
+ if (changedProperties.has('panMaximumZoomLevel')) {
1059
+ this._panMaximumZoomLevelChanged(this.panMaximumZoomLevel, changedProperties['panMaximumZoomLevel']);
1060
+ }
1061
+ if (changedProperties.has('trackEnable')) {
1062
+ this._trackEnableChanged(this.trackEnable, changedProperties['trackEnable']);
1063
+ }
1064
+ if (changedProperties.has('displayCanvas')) {
1065
+ this._displayCanvasChanged(this.displayCanvas, changedProperties['displayCanvas']);
1066
+ }
1067
+ if (changedProperties.has('motionCaptureControlsEnable')) {
1068
+ this._motionCaptureControlsEnableChanged(this.motionCaptureControlsEnable, changedProperties['motionCaptureControlsEnable']);
1069
+ }
1070
+ if (changedProperties.has('motionCapture')) {
1071
+ this._motionCaptureValueChanged(this.motionCapture, changedProperties['motionCapture']);
1072
+ }
1073
+ if (changedProperties.has('hidden')) {
1074
+ this._hiddenChanged(this.hidden, changedProperties['hidden']);
1075
+ }
1076
+
1077
+ if (!this.url) {
1078
+ //this._dispatchErrorEvent(''url' property must point to an instance of AVS/Go server.');
1079
+ return;
1080
+ }
1081
+
1082
+ let doUpdate = false;
1083
+ if (this.manualUpdate) {
1084
+ if (this.forceUpdate) {
1085
+ doUpdate = true;
1086
+ }
1087
+ }
1088
+ else {
1089
+ if (this.forceUpdate ||
1090
+ changedProperties.has('url') ||
1091
+ changedProperties.has('renderer') ||
1092
+ changedProperties.has('urlLoadJsonFile') ||
1093
+ changedProperties.has('sceneName') ||
1094
+ changedProperties.has('sceneUserProperties') ||
1095
+ changedProperties.has('dataSourceName') ||
1096
+ changedProperties.has('dataSourceUserProperties') ||
1097
+ changedProperties.has('rendererName') ||
1098
+ changedProperties.has('rendererUserProperties') ||
1099
+ changedProperties.has('streamEnable') ||
1100
+ (this.panEnable && changedProperties.has('panWidthZoomLevel')) ||
1101
+ (this.panEnable && changedProperties.has('panHeightZoomLevel'))) {
1102
+ doUpdate = true;
1103
+ }
1104
+ }
935
1105
 
936
- // Use avs-http-mixin to send the model to the server
1106
+ if (doUpdate) {
1107
+ this.forceUpdate = false;
1108
+
1109
+ // Send the model to the server
937
1110
  if (this.urlLoadJsonFile) {
938
1111
  this.chunkFile = 0;
939
- this._httpRequest(this.url, this._handleHttpResponse.bind(this), undefined, this._handleHttpError.bind(this));
1112
+ this.showSpinner();
1113
+ this.startSpinner();
1114
+ this._httpRequest(this.url, this._handleHttpResponse.bind(this), this._handleHttpError.bind(this));
940
1115
  }
941
1116
  else {
942
- this.model = this._assembleModel(fullReset);
1117
+ this.model = this._assembleModel(/*fullReset*/);
943
1118
  if (this.model) {
944
- this._httpRequest(this.url, this._handleHttpResponse.bind(this), undefined, this._handleHttpError.bind(this), this.model);
1119
+ this.showSpinner();
1120
+ this.startSpinner();
1121
+ this._httpRequest(this.url, this._handleHttpResponse.bind(this), this._handleHttpError.bind(this), this.model);
945
1122
  }
946
1123
  }
947
1124
  }
@@ -955,12 +1132,20 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
955
1132
  this.hideSpinner();
956
1133
  }
957
1134
 
1135
+ /**
1136
+ *
1137
+ */
1138
+ updateViewer() {
1139
+ this.forceUpdate = true;
1140
+ this.requestUpdate();
1141
+ }
1142
+
958
1143
  /**
959
1144
  *
960
1145
  */
961
1146
  _updateViewerClient() {
962
1147
  this._updateSize();
963
- if (this.renderer === 'THREEJS') {
1148
+ if (this.threeViewer) {
964
1149
  this.threeViewer.render(true);
965
1150
  }
966
1151
  }
@@ -969,7 +1154,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
969
1154
  *
970
1155
  */
971
1156
  clear() {
972
- if (this.renderer === 'THREEJS') {
1157
+ if (this.threeViewer) {
973
1158
  this.threeViewer.clearGeometry();
974
1159
  this.threeViewer.render();
975
1160
  }
@@ -992,7 +1177,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
992
1177
  if (json) {
993
1178
  if (json.selectionInfo) {
994
1179
  this._dispatchPickEvents(json.selectionInfo);
995
- }
1180
+ }
996
1181
 
997
1182
  if (json.sceneInfo) {
998
1183
  var sceneEvent = {detail: json.sceneInfo};
@@ -1015,31 +1200,31 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1015
1200
  blendedG += (bgCol[1] * (1 - col[3]));
1016
1201
  blendedB += (bgCol[2] * (1 - col[3]));
1017
1202
  }
1018
- this.$.motionCapture.style.color = "var(--avs-motion-capture-color, rgb(" + blendedR + ", " + blendedG + ", " + blendedB + "))";
1019
- this.$.zoomOverlay.style.color = "var(--avs-zoom-overlay-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
1020
- this.$.tooltip.style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
1021
- this.$.motionCaptureTooltip.style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
1203
+ this.renderRoot.querySelector('#motionCapture').style.color = "var(--avs-motion-capture-color, rgb(" + blendedR + ", " + blendedG + ", " + blendedB + "))";
1204
+ this.renderRoot.querySelector('#zoomOverlay').style.color = "var(--avs-zoom-overlay-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
1205
+ this.renderRoot.querySelector('#tooltip').style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
1206
+ this.renderRoot.querySelector('#motionCaptureTooltip').style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
1022
1207
  }
1023
1208
  if (json.sceneInfo.color) {
1024
1209
  var col = json.sceneInfo.color.match(/[0-9.]+/gi);
1025
- this.$.motionCapture.style.background = "var(--avs-motion-capture-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
1026
- this.$.zoomOverlay.style.background = "var(--avs-zoom-overlay-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
1027
- this.$.tooltip.style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
1028
- this.$.motionCaptureTooltip.style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
1210
+ this.renderRoot.querySelector('#motionCapture').style.background = "var(--avs-motion-capture-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
1211
+ this.renderRoot.querySelector('#zoomOverlay').style.background = "var(--avs-zoom-overlay-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
1212
+ this.renderRoot.querySelector('#tooltip').style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
1213
+ this.renderRoot.querySelector('#motionCaptureTooltip').style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
1029
1214
  }
1030
1215
  if (json.sceneInfo.fontFamily) {
1031
- this.$.motionCapture.style.fontFamily = "var(--avs-motion-capture-font-family, " + json.sceneInfo.fontFamily + ")";
1032
- this.$.zoomOverlay.style.fontFamily = "var(--avs-zoom-overlay-font-family, " + json.sceneInfo.fontFamily + ")";
1033
- this.$.tooltip.style.fontFamily = "var(--avs-tooltip-font-family, " + json.sceneInfo.fontFamily + ")";
1034
- this.$.motionCaptureTooltip.style.fontFamily = "var(--avs-tooltip-font-family, " + json.sceneInfo.fontFamily + ")";
1216
+ this.renderRoot.querySelector('#motionCapture').style.fontFamily = "var(--avs-motion-capture-font-family, " + json.sceneInfo.fontFamily + ")";
1217
+ this.renderRoot.querySelector('#zoomOverlay').style.fontFamily = "var(--avs-zoom-overlay-font-family, " + json.sceneInfo.fontFamily + ")";
1218
+ this.renderRoot.querySelector('#tooltip').style.fontFamily = "var(--avs-tooltip-font-family, " + json.sceneInfo.fontFamily + ")";
1219
+ this.renderRoot.querySelector('#motionCaptureTooltip').style.fontFamily = "var(--avs-tooltip-font-family, " + json.sceneInfo.fontFamily + ")";
1035
1220
  }
1036
1221
  }
1037
1222
 
1038
1223
  if (json.image) {
1039
1224
  this.sceneImage.src = json.image;
1040
1225
 
1041
- if (json.imagemap) {
1042
- this.sceneImageMap.innerHTML = decodeURIComponent(json.imagemap.replace(/\+/g, '%20'));
1226
+ if (json.imagemap) {
1227
+ this.sceneImageMap.innerHTML = decodeURIComponent(json.imagemap.replace(/\+/g, '%20'));
1043
1228
 
1044
1229
  this.imageMapData = Array.from(this.sceneImageMap.querySelectorAll('area')).map(area => {
1045
1230
  return {
@@ -1050,7 +1235,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1050
1235
  componentInfo: area.getAttribute('component-info')
1051
1236
  };
1052
1237
  });
1053
- }
1238
+ }
1054
1239
  else {
1055
1240
  this.sceneImageMap.innerHTML = "";
1056
1241
  this.imageMapData = undefined;
@@ -1060,17 +1245,17 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1060
1245
  this._dispatchSceneData(json);
1061
1246
  }
1062
1247
 
1063
- this._handleLoadComplete();
1064
- }
1065
- else if (json.svg) {
1066
- this.svgDiv.innerHTML = decodeURIComponent(json.svg.replace(/\+/g, '%20'));
1248
+ this._handleLoadComplete();
1249
+ }
1250
+ else if (json.svg) {
1251
+ this.svgDiv.innerHTML = decodeURIComponent(json.svg.replace(/\+/g, '%20'));
1067
1252
 
1068
1253
  if (!this.urlLoadJsonFile) {
1069
1254
  this._dispatchSceneData(json);
1070
1255
  }
1071
1256
 
1072
- this._handleLoadComplete();
1073
- }
1257
+ this._handleLoadComplete();
1258
+ }
1074
1259
  else if (json.threejs) {
1075
1260
  if (!this.urlLoadJsonFile) {
1076
1261
  this._dispatchSceneData(json);
@@ -1083,14 +1268,14 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1083
1268
  if (this.urlLoadJsonFile) {
1084
1269
  // Load the next chunk file
1085
1270
  this.chunkFile++;
1086
- const urlBase = this.url.substring(0, this.url.lastIndexOf('.')) || this.url;
1087
- const ext = this.url.split('.').pop();
1088
- this._httpRequest(urlBase + '-' + this.chunkFile + '.' + ext, this._handleHttpResponse.bind(this), undefined, this._handleHttpError.bind(this));
1271
+ const urlBase = this.url.substring(0, this.url.lastIndexOf('.')) || this.url;
1272
+ const ext = this.url.split('.').pop();
1273
+ this._httpRequest(urlBase + '-' + this.chunkFile + '.' + ext, this._handleHttpResponse.bind(this), this._handleHttpError.bind(this));
1089
1274
  }
1090
1275
  else {
1091
1276
  // Get the next chunk from the server
1092
1277
  this.model.rendererProperties.streamProperties.chunkId = json.threejs.chunkId;
1093
- this._httpRequest(this.url, this._handleHttpResponse.bind(this), undefined, this._handleHttpError.bind(this), this.model);
1278
+ this._httpRequest(this.url, this._handleHttpResponse.bind(this), this._handleHttpError.bind(this), this.model);
1094
1279
  }
1095
1280
  }
1096
1281
  }
@@ -1099,7 +1284,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1099
1284
  }
1100
1285
  }
1101
1286
  else {
1102
- console.log("ERROR: No image, SVG, or ThreeJS found in response.");
1287
+ this._dispatchErrorEvent("No image, SVG, or ThreeJS found in response.");
1103
1288
  this._handleLoadComplete();
1104
1289
  }
1105
1290
  }
@@ -1161,15 +1346,15 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1161
1346
  * @param e
1162
1347
  */
1163
1348
  _handleTap(e) {
1164
- var adjustedCoords = this._getAdjustedCoords(e.detail.x, e.detail.y);
1349
+ var adjustedCoords = this._getAdjustedCoords(e.detail.x, e.detail.y);
1165
1350
 
1166
1351
  var pickProperties = {type:"TAP", x:adjustedCoords.x, y:adjustedCoords.y};
1167
1352
 
1168
- if (this.tapLevel !== undefined) pickProperties.level = this.tapLevel;
1169
- if (this.tapDepth !== undefined) pickProperties.depth = this.tapDepth;
1170
- if (this.tapHighlightEnable) pickProperties.highlight = true;
1171
- if (this.tapHighlightColor !== undefined) pickProperties.highlightColor = this.tapHighlightColor;
1172
- if (this.tapHighlightLayerEnable) pickProperties.highlightLayer = true;
1353
+ if (this.tapLevel !== undefined) pickProperties.level = this.tapLevel;
1354
+ if (this.tapDepth !== undefined) pickProperties.depth = this.tapDepth;
1355
+ if (this.tapHighlightEnable) pickProperties.highlight = true;
1356
+ if (this.tapHighlightColor !== undefined) pickProperties.highlightColor = this.tapHighlightColor;
1357
+ if (this.tapHighlightLayerEnable) pickProperties.highlightLayer = true;
1173
1358
 
1174
1359
  this._processPick( pickProperties, this.tapProcessEventOnClient, e.originalTarget );
1175
1360
  }
@@ -1178,7 +1363,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1178
1363
  * @param e
1179
1364
  */
1180
1365
  _handleTrack(e) {
1181
- var adjustedCoords = this._getAdjustedRectangleCoords(e);
1366
+ var adjustedCoords = this._getAdjustedRectangleCoords(e);
1182
1367
 
1183
1368
  switch(e.detail.state) {
1184
1369
  case 'start':
@@ -1290,17 +1475,17 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1290
1475
  }
1291
1476
 
1292
1477
  _getAdjustedCoords(x, y) {
1293
- var rect = this.$.dataVizDiv.getBoundingClientRect();
1294
- var x = Math.round(x - rect.left);
1295
- var y = Math.round(y - rect.top);
1296
- var clampX = Math.max(0, Math.min(x, this.width));
1297
- var clampY = Math.max(0, Math.min(y, this.height));
1478
+ var rect = this.renderRoot.querySelector('#dataVizDiv').getBoundingClientRect();
1479
+ var x = Math.round(x - rect.left);
1480
+ var y = Math.round(y - rect.top);
1481
+ var clampX = Math.max(0, Math.min(x, this.width));
1482
+ var clampY = Math.max(0, Math.min(y, this.height));
1298
1483
 
1299
- return {x:clampX, y:clampY};
1484
+ return {x:clampX, y:clampY};
1300
1485
  }
1301
1486
 
1302
1487
  _getAdjustedRectangleCoords(e) {
1303
- var rect = this.$.dataVizDiv.getBoundingClientRect();
1488
+ var rect = this.renderRoot.querySelector('#dataVizDiv').getBoundingClientRect();
1304
1489
  var x = Math.round(e.detail.x - rect.left);
1305
1490
  var y = Math.round(e.detail.y - rect.top);
1306
1491
  var clampX = Math.max(0, Math.min(x, this.width));
@@ -1313,12 +1498,12 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1313
1498
  var top = Math.min(startY, clampY);
1314
1499
  var bottom = Math.max(startY, clampY);
1315
1500
 
1316
- return {left: left, right: right, top: top, bottom: bottom};
1501
+ return {left: left, right: right, top: top, bottom: bottom};
1317
1502
  }
1318
1503
 
1319
1504
  _processPick( pickProperties, processEventOnClient, originalTarget ) {
1320
1505
  if (processEventOnClient) {
1321
- if (this.renderer === 'THREEJS') {
1506
+ if (this.threeViewer) {
1322
1507
  // ThreeJS client side pick processing
1323
1508
 
1324
1509
  this.threeViewer.setPickDepth( this._getPickDepth(pickProperties.depth) );
@@ -1441,11 +1626,11 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1441
1626
  if (this.url) {
1442
1627
  this.startSpinner();
1443
1628
 
1444
- // Use avs-http-mixin to send the model to the server
1629
+ // Send the model to the server
1445
1630
  this.model = this._assembleModel();
1446
1631
  if (this.model) {
1447
1632
  this.model.rendererProperties.pickProperties = pickProperties;
1448
- this._httpRequest(this.url, this._handleHttpResponse.bind(this), undefined, this._handleHttpError.bind(this), this.model);
1633
+ this._httpRequest(this.url, this._handleHttpResponse.bind(this), this._handleHttpError.bind(this), this.model);
1449
1634
  }
1450
1635
  }
1451
1636
  }
@@ -1566,93 +1751,70 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1566
1751
  }.bind(this), this.pointerTimeout * 1000);
1567
1752
  }
1568
1753
 
1754
+ constructor() {
1755
+ super();
1756
+
1757
+ // Set default property values
1758
+ this.renderer = 'THREEJS';
1759
+ this.resizeThreshold = 10;
1760
+ this.aspectRatio = 1.777777;
1761
+ this.pointerTimeout = 600;
1762
+ this.panWidthZoomLevel = 100;
1763
+ this.panHeightZoomLevel = 100;
1764
+ this.panMaximumZoomLevel = 1000;
1765
+
1766
+ this.motionCaptureTime = 0;
1767
+ this.motionCaptureFrames ??= [];
1768
+
1769
+ this._resetTimer();
1770
+ this._updatePixelRatio();
1771
+ }
1772
+
1569
1773
  /**
1570
- *
1774
+ * Element connected to the DOM
1571
1775
  */
1572
1776
  connectedCallback() {
1573
1777
  super.connectedCallback();
1574
1778
 
1575
- // Make sure all CSS and layout has been processed
1576
- afterNextRender(this, function() {
1577
- if (this.initialized !== true) {
1578
-
1579
- this._updateSize();
1580
- if (!this.manualUpdate) {
1581
- this.updateViewer(true);
1582
- }
1583
-
1584
- this.addEventListener('iron-resize', this._onResize);
1585
- this._updatePixelRatio();
1779
+ ro.observe(this);
1586
1780
 
1587
- this.addEventListener('pointerdown', this._handlePointerDown);
1588
- this.addEventListener('pointerup', this._handlePointerUp);
1589
- this.addEventListener('pointermove', this._handlePointerMove);
1590
- this.addEventListener('pointerout', this._handlePointerMove);
1781
+ this.addEventListener('pointerdown', this._handlePointerDown);
1782
+ this.addEventListener('pointerup', this._handlePointerUp);
1783
+ this.addEventListener('pointermove', this._handlePointerMove);
1784
+ this.addEventListener('pointerout', this._handlePointerMove);
1591
1785
 
1592
- var scope = this;
1593
- this.addEventListener('contextmenu', function(e) {
1594
- if (scope.trackEnable) {
1595
- e.preventDefault();
1596
- }
1597
- });
1598
-
1599
- this.$.motionCapturePlay.innerHTML = PLAY;
1600
- this.$.motionCaptureSnapshotIcon.innerHTML = CAMERA;
1601
- this.$.motionCaptureDelayIcon.innerHTML = TIMELAPSE;
1602
- this.$.motionCaptureReset.innerHTML = HOME;
1603
- this.$.motionCaptureClear.innerHTML = DELETE;
1604
- this.$.motionCaptureCopyData.innerHTML = COPY;
1605
- this.$.motionCaptureCopyUrl.innerHTML = LINK;
1606
-
1607
- this.$.motionCapturePlay.addEventListener('click', this.runAnimation.bind(this));
1608
- this.$.motionCaptureSnapshot.addEventListener('click', this._handleMotionCaptureSnapshot.bind(this));
1609
- this.$.motionCaptureDelayIncrease.addEventListener('click', this._handleMotionCaptureDelayIncrease.bind(this));
1610
- this.$.motionCaptureDelayDecrease.addEventListener('click', this._handleMotionCaptureDelayDecrease.bind(this));
1611
- this.$.motionCaptureReset.addEventListener('click', this.resetTransform.bind(this));
1612
- this.$.motionCaptureClear.addEventListener('click', this._handleMotionCaptureClear.bind(this));
1613
- this.$.motionCaptureCopyData.addEventListener('click', this._handleMotionCaptureCopyData.bind(this));
1614
- this.$.motionCaptureCopyUrl.addEventListener('click', this._handleMotionCaptureCopyUrl.bind(this));
1615
-
1616
- this.$.motionCapturePlay.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1617
- this.$.motionCaptureSnapshot.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1618
- this.$.motionCaptureDelay.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1619
- this.$.motionCaptureReset.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1620
- this.$.motionCaptureClear.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1621
- this.$.motionCaptureCopyData.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1622
- this.$.motionCaptureCopyUrl.addEventListener('pointermove', this._handlePointerEnterMotionCaptureControl.bind(this));
1623
-
1624
- this.$.motionCapturePlay.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1625
- this.$.motionCaptureSnapshot.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1626
- this.$.motionCaptureDelay.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1627
- this.$.motionCaptureReset.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1628
- this.$.motionCaptureClear.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1629
- this.$.motionCaptureCopyData.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1630
- this.$.motionCaptureCopyUrl.addEventListener('pointerout', this._handlePointerLeaveMotionCaptureControl.bind(this));
1631
-
1632
- this.motionCaptureTime = 0;
1633
- this.motionCaptureFrames ??= [];
1786
+ var scope = this;
1787
+ this.addEventListener('contextmenu', function(e) {
1788
+ if (scope.trackEnable) {
1789
+ e.preventDefault();
1790
+ }
1791
+ });
1792
+ }
1634
1793
 
1635
- this._resetTimer();
1794
+ /**
1795
+ * Element disconnected from the DOM
1796
+ */
1797
+ disconnectedCallback() {
1798
+ super.disconnectedCallback();
1636
1799
 
1637
- this.initialized = true;
1638
- }
1639
- });
1800
+ ro.unobserve(this);
1640
1801
  }
1641
1802
 
1642
1803
  _handlePointerEnterMotionCaptureControl(e) {
1643
1804
  if (!this.showMotionCaptureTooltip) {
1644
1805
  var adjustedCoords = this._getAdjustedCoords(e.clientX, e.clientY);
1645
- var pos = this._calcTooltipPosition(adjustedCoords.x, adjustedCoords.y);
1646
- this.$.motionCaptureTooltip.style.left = pos.x + "px";
1647
- this.$.motionCaptureTooltip.style.top = pos.y + "px";
1648
- this.$.motionCaptureTooltip.style.opacity = 1;
1649
- this.$.motionCaptureTooltip.innerHTML = e.currentTarget.dataset.tooltip ?? e.currentTarget.id;
1806
+ var motionCaptureTooltip = this.renderRoot.querySelector('#motionCaptureTooltip');
1807
+ var pos = this._calcTooltipPosition(motionCaptureTooltip, adjustedCoords.x, adjustedCoords.y);
1808
+ motionCaptureTooltip.style.left = pos.x + "px";
1809
+ motionCaptureTooltip.style.top = pos.y + "px";
1810
+ motionCaptureTooltip.style.opacity = 1;
1811
+ motionCaptureTooltip.innerHTML = e.currentTarget.dataset.tooltip ?? e.currentTarget.id;
1650
1812
  this.showMotionCaptureTooltip = true;
1651
1813
  }
1652
1814
  }
1653
1815
 
1654
1816
  _handlePointerLeaveMotionCaptureControl() {
1655
- this.$.motionCaptureTooltip.style.opacity = 0;
1817
+ this.renderRoot.querySelector('#motionCaptureTooltip').style.opacity = 0;
1656
1818
  this.showMotionCaptureTooltip = false;
1657
1819
  }
1658
1820
 
@@ -1679,15 +1841,15 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1679
1841
  this.motionCaptureFrames.push(frame);
1680
1842
 
1681
1843
  if (this.motionCaptureFrames.length == 1) {
1682
- this.$.motionCapturePlay.classList.remove("disabled");
1683
- this.$.motionCaptureDelay.classList.remove("disabled");
1684
- this.$.motionCaptureDelayLabel.innerText = "2";
1685
- this.$.motionCaptureClear.classList.remove("disabled");
1686
- this.$.motionCaptureCopyData.classList.remove("disabled");
1687
- this.$.motionCaptureCopyUrl.classList.remove("disabled");
1844
+ this.renderRoot.querySelector('#motionCapturePlay').classList.remove("disabled");
1845
+ this.renderRoot.querySelector('#motionCaptureDelay').classList.remove("disabled");
1846
+ this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = "2";
1847
+ this.renderRoot.querySelector('#motionCaptureClear').classList.remove("disabled");
1848
+ this.renderRoot.querySelector('#motionCaptureCopyData').classList.remove("disabled");
1849
+ this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.remove("disabled");
1688
1850
  this.motionCaptureDelay = 2;
1689
1851
  }
1690
- this.$.motionCaptureSnapshotLabel.innerText = this.motionCaptureFrames.length;
1852
+ this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerText = this.motionCaptureFrames.length;
1691
1853
  }
1692
1854
 
1693
1855
  _handleMotionCaptureDelayIncrease() {
@@ -1695,7 +1857,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1695
1857
  if (this.motionCaptureDelay > 9) {
1696
1858
  this.motionCaptureDelay = 9;
1697
1859
  }
1698
- this.$.motionCaptureDelayLabel.innerText = this.motionCaptureDelay;
1860
+ this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = this.motionCaptureDelay;
1699
1861
  }
1700
1862
 
1701
1863
  _handleMotionCaptureDelayDecrease() {
@@ -1703,7 +1865,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1703
1865
  if (this.motionCaptureDelay < 1) {
1704
1866
  this.motionCaptureDelay = 1;
1705
1867
  }
1706
- this.$.motionCaptureDelayLabel.innerText = this.motionCaptureDelay;
1868
+ this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = this.motionCaptureDelay;
1707
1869
  }
1708
1870
 
1709
1871
  _handleMotionCaptureCopyData() {
@@ -1712,10 +1874,10 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1712
1874
  navigator.clipboard.writeText(data);
1713
1875
 
1714
1876
  // Show alert
1715
- this.$.motionCaptureAlert.innerText = "Motion capture data copied to clipboard";
1716
- this.$.motionCaptureAlert.style.opacity = 1;
1877
+ this.renderRoot.querySelector('#motionCaptureAlert').innerText = "Motion capture data copied to clipboard";
1878
+ this.renderRoot.querySelector('#motionCaptureAlert').style.opacity = 1;
1717
1879
  setTimeout(function () {
1718
- this.$.motionCaptureAlert.style.opacity = 0;
1880
+ this.renderRoot.querySelector('#motionCaptureAlert').style.opacity = 0;
1719
1881
  }.bind(this), 2000);
1720
1882
  }
1721
1883
 
@@ -1730,10 +1892,10 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1730
1892
  navigator.clipboard.writeText(url);
1731
1893
 
1732
1894
  // Show alert
1733
- this.$.motionCaptureAlert.innerText = "Motion capture URL copied to clipboard";
1734
- this.$.motionCaptureAlert.style.opacity = 1;
1895
+ this.renderRoot.querySelector('#motionCaptureAlert').innerText = "Motion capture URL copied to clipboard";
1896
+ this.renderRoot.querySelector('#motionCaptureAlert').style.opacity = 1;
1735
1897
  setTimeout(function () {
1736
- this.$.motionCaptureAlert.style.opacity = 0;
1898
+ this.renderRoot.querySelector('#motionCaptureAlert').style.opacity = 0;
1737
1899
  }.bind(this), 2000);
1738
1900
  }
1739
1901
 
@@ -1800,13 +1962,13 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1800
1962
 
1801
1963
  _handleMotionCaptureClear() {
1802
1964
  this.motionCaptureFrames.length = 0;
1803
- this.$.motionCapturePlay.classList.add("disabled");
1804
- this.$.motionCaptureSnapshotLabel.innerText = "0";
1805
- this.$.motionCaptureDelay.classList.add("disabled");
1806
- this.$.motionCaptureDelayLabel.innerText = "0";
1807
- this.$.motionCaptureClear.classList.add("disabled");
1808
- this.$.motionCaptureCopyData.classList.add("disabled");
1809
- this.$.motionCaptureCopyUrl.classList.add("disabled");
1965
+ this.renderRoot.querySelector('#motionCapturePlay').classList.add("disabled");
1966
+ this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerText = "0";
1967
+ this.renderRoot.querySelector('#motionCaptureDelay').classList.add("disabled");
1968
+ this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = "0";
1969
+ this.renderRoot.querySelector('#motionCaptureClear').classList.add("disabled");
1970
+ this.renderRoot.querySelector('#motionCaptureCopyData').classList.add("disabled");
1971
+ this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.add("disabled");
1810
1972
  this.motionCaptureDelay = 0;
1811
1973
  this.motionCaptureTime = 0;
1812
1974
  }
@@ -1824,10 +1986,10 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1824
1986
  */
1825
1987
  _motionCaptureControlsEnableChanged(newValue, oldValue) {
1826
1988
  if (newValue) {
1827
- this.$.motionCapture.style.display = "block";
1989
+ this.renderRoot.querySelector('#motionCapture').style.display = "block";
1828
1990
  }
1829
1991
  else {
1830
- this.$.motionCapture.style.display = "none";
1992
+ this.renderRoot.querySelector('#motionCapture').style.display = "none";
1831
1993
  }
1832
1994
  }
1833
1995
 
@@ -1836,10 +1998,10 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1836
1998
  */
1837
1999
  _hiddenChanged(newValue, oldValue) {
1838
2000
  if (newValue) {
1839
- this.$.dataVizDiv.style.display = 'none';
2001
+ this.renderRoot.querySelector('#dataVizDiv').style.display = 'none';
1840
2002
  }
1841
2003
  else {
1842
- this.$.dataVizDiv.style.display = '';
2004
+ this.renderRoot.querySelector('#dataVizDiv').style.display = '';
1843
2005
  if (this.threeViewer) {
1844
2006
  this.threeViewer.render();
1845
2007
  }
@@ -1853,7 +2015,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1853
2015
  if (this.threeViewer) {
1854
2016
  if (newValue) {
1855
2017
  if (this.transformInteractor === undefined) {
1856
- this.transformInteractor = new TransformInteractor( this.$.dataVizDiv );
2018
+ this.transformInteractor = new TransformInteractor(this.renderRoot.querySelector('#dataVizDiv'));
1857
2019
  }
1858
2020
  this.threeViewer.addInteractor( this.transformInteractor );
1859
2021
 
@@ -1976,7 +2138,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
1976
2138
  }
1977
2139
 
1978
2140
  runAnimation() {
1979
- if (this.renderer === 'THREEJS') {
2141
+ if (this.threeViewer) {
1980
2142
  var style = window.getComputedStyle(this, null);
1981
2143
  var styleMap = {};
1982
2144
  this._applyCustomCssProperties(styleMap, style,
@@ -2001,7 +2163,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
2001
2163
  * Change in 'animated-glyphs-visible' property.
2002
2164
  */
2003
2165
  _animatedGlyphsVisibleChanged(newValue, oldValue) {
2004
- if (this.renderer === 'THREEJS') {
2166
+ if (this.threeViewer) {
2005
2167
  this.threeViewer.setVisibleAnimatedGlyphs(newValue);
2006
2168
  }
2007
2169
  }
@@ -2010,7 +2172,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
2010
2172
  * Change in 'animated-glyphs-enable' property.
2011
2173
  */
2012
2174
  _animatedGlyphsEnableChanged(newValue, oldValue) {
2013
- if (this.renderer === 'THREEJS') {
2175
+ if (this.threeViewer) {
2014
2176
  this.threeViewer.setEnableAnimatedGlyphs(newValue);
2015
2177
  }
2016
2178
  }
@@ -2018,7 +2180,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
2018
2180
  /**
2019
2181
  * Change in 'transform-twist-angle', 'transform-tilt-angle' or 'transform-scale' properties.
2020
2182
  */
2021
- _transformValueChanged(newValue, oldValue) {
2183
+ _transformValueChanged() {
2022
2184
  var twist = this.transformTwistAngle !== undefined ? this.transformTwistAngle * Math.PI / 180 : 0;
2023
2185
  var tilt = this.transformTiltAngle !== undefined ? this.transformTiltAngle * Math.PI / 180 : 0;
2024
2186
  var scale = this.transformScale !== undefined ? this.transformScale / 100.0 : 1.0;
@@ -2060,24 +2222,24 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
2060
2222
  }
2061
2223
 
2062
2224
  if (this.motionCaptureFrames.length > 0) {
2063
- this.$.motionCapturePlay.classList.remove("disabled");
2064
- this.$.motionCaptureSnapshotLabel.innerText = this.motionCaptureFrames.length;
2065
- this.$.motionCaptureDelay.classList.remove("disabled");
2066
- this.$.motionCaptureDelayLabel.innerText = "2";
2067
- this.$.motionCaptureClear.classList.remove("disabled");
2068
- this.$.motionCaptureCopyData.classList.remove("disabled");
2069
- this.$.motionCaptureCopyUrl.classList.remove("disabled");
2225
+ this.renderRoot.querySelector('#motionCapturePlay').classList.remove("disabled");
2226
+ this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerText = this.motionCaptureFrames.length;
2227
+ this.renderRoot.querySelector('#motionCaptureDelay').classList.remove("disabled");
2228
+ this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = "2";
2229
+ this.renderRoot.querySelector('#motionCaptureClear').classList.remove("disabled");
2230
+ this.renderRoot.querySelector('#motionCaptureCopyData').classList.remove("disabled");
2231
+ this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.remove("disabled");
2070
2232
  this.motionCaptureDelay = 2;
2071
2233
  this.motionCaptureTime = this.motionCaptureFrames[this.motionCaptureFrames.length - 1].time / 1000;
2072
2234
  }
2073
2235
  else {
2074
- this.$.motionCapturePlay.classList.add("disabled");
2075
- this.$.motionCaptureSnapshotLabel.innerText = "0";
2076
- this.$.motionCaptureDelay.classList.add("disabled");
2077
- this.$.motionCaptureDelayLabel.innerText = "0";
2078
- this.$.motionCaptureClear.classList.add("disabled");
2079
- this.$.motionCaptureCopyData.classList.add("disabled");
2080
- this.$.motionCaptureCopyUrl.classList.add("disabled");
2236
+ this.renderRoot.querySelector('#motionCapturePlay').classList.add("disabled");
2237
+ this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerText = "0";
2238
+ this.renderRoot.querySelector('#motionCaptureDelay').classList.add("disabled");
2239
+ this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = "0";
2240
+ this.renderRoot.querySelector('#motionCaptureClear').classList.add("disabled");
2241
+ this.renderRoot.querySelector('#motionCaptureCopyData').classList.add("disabled");
2242
+ this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.add("disabled");
2081
2243
  this.motionCaptureDelay = 0;
2082
2244
  this.motionCaptureTime = 0;
2083
2245
  }
@@ -2163,7 +2325,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
2163
2325
  }
2164
2326
 
2165
2327
  _zoomOverlayTimeout() {
2166
- this.$.zoomOverlay.style.opacity = 0;
2328
+ this.renderRoot.querySelector('#zoomOverlay').style.opacity = 0;
2167
2329
  this.pointerDown = false;
2168
2330
  }
2169
2331
 
@@ -2173,16 +2335,16 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
2173
2335
  var width = Math.round(e.detail.widthZoomLevel);
2174
2336
  var height = Math.round(e.detail.heightZoomLevel);
2175
2337
  if (width === height) {
2176
- this.$.zoomOverlay.innerHTML = width + "%";
2338
+ this.renderRoot.querySelector('#zoomOverlay').innerHTML = width + "%";
2177
2339
  }
2178
2340
  else {
2179
- this.$.zoomOverlay.innerHTML = width + "%," + height + "%";
2341
+ this.renderRoot.querySelector('#zoomOverlay').innerHTML = width + "%," + height + "%";
2180
2342
  }
2181
2343
 
2182
2344
  var coords = this._getAdjustedCoords(e.detail.clientX, e.detail.clientY);
2183
- this.$.zoomOverlay.style.left = coords.x + "px";
2184
- this.$.zoomOverlay.style.top = coords.y + "px";
2185
- this.$.zoomOverlay.style.opacity = 1;
2345
+ this.renderRoot.querySelector('#zoomOverlay').style.left = coords.x + "px";
2346
+ this.renderRoot.querySelector('#zoomOverlay').style.top = coords.y + "px";
2347
+ this.renderRoot.querySelector('#zoomOverlay').style.opacity = 1;
2186
2348
 
2187
2349
  this.pointerDown = true;
2188
2350
  this._dispatchPickEvents( {type:"HOVER",x:0,y:0,selected:{}} );
@@ -2191,11 +2353,8 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
2191
2353
  }
2192
2354
 
2193
2355
  _handlePanZoomEnd(e) {
2194
- if (this.initialized) {
2195
- this.panWidthZoomLevel = e.detail.widthZoomLevel;
2196
- this.panHeightZoomLevel = e.detail.heightZoomLevel;
2197
- this.updateViewer();
2198
- }
2356
+ this.panWidthZoomLevel = e.detail.widthZoomLevel;
2357
+ this.panHeightZoomLevel = e.detail.heightZoomLevel;
2199
2358
  }
2200
2359
 
2201
2360
  /**
@@ -2238,23 +2397,23 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
2238
2397
  * Change in 'renderer' property.
2239
2398
  */
2240
2399
  _rendererChanged(newValue, oldValue) {
2241
- if (oldValue === 'IMAGE' || oldValue === 'IMAGEURL') {
2400
+ if (oldValue === 'IMAGE') {
2242
2401
  this.sceneImage.src = 'data:,';
2243
- this.$.dataVizDiv.removeChild(this.sceneImage);
2244
- this.$.dataVizDiv.removeChild(this.sceneImageMap);
2402
+ this.renderRoot.querySelector('#dataVizDiv').removeChild(this.sceneImage);
2403
+ this.renderRoot.querySelector('#dataVizDiv').removeChild(this.sceneImageMap);
2245
2404
  }
2246
2405
  else if (oldValue === 'SVG') {
2247
2406
  var el = this.svgDiv;
2248
2407
  while (el.firstChild) el.removeChild(el.firstChild);
2249
- this.$.dataVizDiv.removeChild(this.svgDiv);
2408
+ this.renderRoot.querySelector('#dataVizDiv').removeChild(this.svgDiv);
2250
2409
  }
2251
- else if (oldValue === 'THREEJS') {
2410
+ else if (this.threeViewer) {
2252
2411
  this.threeViewer.clearGeometry();
2253
2412
  this.threeViewer.render();
2254
- this.$.dataVizDiv.removeChild(this.threeViewer.domElement);
2413
+ this.renderRoot.querySelector('#dataVizDiv').removeChild(this.threeViewer.domElement);
2255
2414
  }
2256
2415
 
2257
- if (newValue === 'IMAGE' || newValue === 'IMAGEURL') {
2416
+ if (newValue === 'IMAGE') {
2258
2417
  if (this.sceneImage === undefined) {
2259
2418
  this.sceneImage = document.createElement("img");
2260
2419
  this.sceneImage.setAttribute("id", "sceneImage");
@@ -2265,8 +2424,9 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
2265
2424
  this.sceneImageMap.setAttribute("name", "sceneImageMap");
2266
2425
  }
2267
2426
 
2268
- this.$.dataVizDiv.appendChild(this.sceneImage);
2269
- this.$.dataVizDiv.appendChild(this.sceneImageMap);
2427
+ this.renderRoot.querySelector('#dataVizDiv').appendChild(this.sceneImage);
2428
+ this.renderRoot.querySelector('#dataVizDiv').appendChild(this.sceneImageMap);
2429
+ this.threeViewer = null;
2270
2430
  }
2271
2431
  else if (newValue === 'SVG') {
2272
2432
  if (this.svgDiv === undefined) {
@@ -2274,10 +2434,11 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
2274
2434
  this.svgDiv.setAttribute("id", "svgDiv");
2275
2435
  }
2276
2436
 
2277
- this.$.dataVizDiv.appendChild(this.svgDiv);
2437
+ this.renderRoot.querySelector('#dataVizDiv').appendChild(this.svgDiv);
2438
+ this.threeViewer = null;
2278
2439
  }
2279
- else if (newValue === 'THREEJS') {
2280
- if (this.threeViewer === undefined) {
2440
+ else {
2441
+ if (!this.threeViewer) {
2281
2442
  // Create ThreeJS viewer
2282
2443
  this.threeViewer = new Viewer();
2283
2444
 
@@ -2300,15 +2461,11 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
2300
2461
  }
2301
2462
  this.threeViewer.setWebGLRenderer(renderer.webGLRenderer);
2302
2463
 
2303
- this.animator = new Animator();
2304
- this.threeViewer.setAnimator(this.animator);
2464
+ this.animator = new Animator();
2465
+ this.threeViewer.setAnimator(this.animator);
2305
2466
  }
2306
2467
 
2307
- this.$.dataVizDiv.appendChild(this.threeViewer.domElement);
2308
- }
2309
-
2310
- if (this.initialized && !this.manualUpdate) {
2311
- this.updateViewer();
2468
+ this.renderRoot.querySelector('#dataVizDiv').appendChild(this.threeViewer.domElement);
2312
2469
  }
2313
2470
  }
2314
2471
 
@@ -2322,10 +2479,10 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
2322
2479
  this.rectCanvas.setAttribute("id", "rectCanvas");
2323
2480
  this.rectCtx = this.rectCanvas.getContext('2d');
2324
2481
  }
2325
- this.$.container.appendChild(this.rectCanvas);
2482
+ this.renderRoot.appendChild(this.rectCanvas);
2326
2483
  }
2327
2484
  else {
2328
- this.$.container.removeChild(this.rectCanvas);
2485
+ this.renderRoot.removeChild(this.rectCanvas);
2329
2486
  }
2330
2487
  }
2331
2488
 
@@ -2339,59 +2496,66 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
2339
2496
  }
2340
2497
 
2341
2498
  setTooltipHTML(html) {
2342
- this.$.tooltip.innerHTML = html;
2499
+ this.renderRoot.querySelector('#tooltip').innerHTML = html;
2343
2500
  }
2344
2501
 
2345
2502
  showTooltip(clientX, clientY) {
2346
- var pos = this._calcTooltipPosition(clientX, clientY);
2347
- this.$.tooltip.style.left = pos.x + "px";
2348
- this.$.tooltip.style.top = pos.y + "px";
2349
- this.$.tooltip.style.opacity = 1;
2503
+ var tooltip = this.renderRoot.querySelector('#tooltip');
2504
+ var pos = this._calcTooltipPosition(tooltip, clientX, clientY);
2505
+ tooltip.style.left = pos.x + "px";
2506
+ tooltip.style.top = pos.y + "px";
2507
+ tooltip.style.opacity = 1;
2350
2508
  }
2351
2509
 
2352
2510
  hideTooltip() {
2353
- this.$.tooltip.style.opacity = 0;
2511
+ this.renderRoot.querySelector('#tooltip').style.opacity = 0;
2354
2512
  }
2355
2513
 
2356
- _calcTooltipPosition(clientX, clientY) {
2514
+ _calcTooltipPosition(tooltip, clientX, clientY) {
2357
2515
 
2358
- // Calculate the tooltip location based on 4 quadrants of the visible portion
2516
+ // Calculate the tooltip location based on 4 quadrants of the visible portion
2359
2517
  // of the visualization window
2360
2518
 
2361
- var offset = this._getOffset();
2519
+ var dataVizDiv = this.renderRoot.querySelector('#dataVizDiv');
2520
+
2521
+ var offset = this._getOffset(dataVizDiv);
2362
2522
  var deltaTop = -Math.min(0, offset.top - window.pageYOffset);
2363
2523
  var deltaLeft = -Math.min(0, offset.left - window.pageXOffset);
2364
- var deltaBottom = -Math.min(0, window.innerHeight - (this.$.dataVizDiv.offsetHeight + offset.top - window.pageYOffset));
2365
- var deltaRight = -Math.min(0, window.innerWidth - (this.$.dataVizDiv.offsetWidth + offset.left - window.pageXOffset));
2366
- var vizHeight = this.$.dataVizDiv.offsetHeight - deltaTop - deltaBottom;
2367
- var vizWidth = this.$.dataVizDiv.offsetWidth - deltaLeft - deltaRight;
2524
+ var deltaBottom = -Math.min(0, window.innerHeight - (dataVizDiv.offsetHeight + offset.top - window.pageYOffset));
2525
+ var deltaRight = -Math.min(0, window.innerWidth - (dataVizDiv.offsetWidth + offset.left - window.pageXOffset));
2526
+ var vizHeight = dataVizDiv.offsetHeight - deltaTop - deltaBottom;
2527
+ var vizWidth = dataVizDiv.offsetWidth - deltaLeft - deltaRight;
2368
2528
  var vizHalfX = vizWidth / 2 + deltaLeft;
2369
2529
  var vizHalfY = vizHeight / 2 + deltaTop;
2370
2530
 
2371
2531
  var toolPosition = { x: 0, y: 0 };
2372
2532
  if (clientX < vizHalfX) {
2373
2533
  var offset = (clientY < vizHalfY) ? 15 : 5;
2374
- toolPosition.x = clientX + offset + this.$.dataVizDiv.offsetLeft;
2534
+ toolPosition.x = clientX + offset + dataVizDiv.offsetLeft;
2375
2535
  }
2376
2536
  else {
2377
- toolPosition.x = clientX - 10 + this.$.dataVizDiv.offsetLeft - this.$.tooltip.offsetWidth;
2537
+ toolPosition.x = clientX - 10 + dataVizDiv.offsetLeft - tooltip.offsetWidth;
2378
2538
  }
2379
2539
  if (clientY < vizHalfY) {
2380
- toolPosition.y = clientY + 5 + this.$.dataVizDiv.offsetTop;
2540
+ toolPosition.y = clientY + 5 + dataVizDiv.offsetTop;
2381
2541
  }
2382
2542
  else {
2383
- toolPosition.y = clientY - 10 + this.$.dataVizDiv.offsetTop - this.$.tooltip.offsetHeight;
2543
+ toolPosition.y = clientY - 10 + dataVizDiv.offsetTop - tooltip.offsetHeight;
2384
2544
  }
2385
2545
 
2386
2546
  return toolPosition;
2387
2547
  }
2388
2548
 
2389
- _getOffset() {
2390
- var rect = this.$.dataVizDiv.getBoundingClientRect(),
2549
+ _getOffset(dataVizDiv) {
2550
+ var rect = dataVizDiv.getBoundingClientRect(),
2391
2551
  scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
2392
2552
  scrollTop = window.pageYOffset || document.documentElement.scrollTop;
2393
2553
  return { top: rect.top + scrollTop, left: rect.left + scrollLeft }
2394
2554
  }
2395
2555
  }
2396
2556
 
2397
- window.customElements.define('avs-go-dataviz', AvsGoDataViz);
2557
+ const ro = new ResizeObserver(entries => {
2558
+ entries.forEach(entry => entry.target._onResize(entry.contentRect));
2559
+ });
2560
+
2561
+ customElements.define('avs-go-dataviz', AvsGoDataViz);