@avs/go 0.14.72000 → 0.14.72008

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.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/dist/avs-element-mixin.d.ts +28 -0
  3. package/dist/avs-element-mixin.d.ts.map +1 -0
  4. package/dist/avs-element-mixin.js +108 -0
  5. package/dist/avs-go-dataviz.d.ts +457 -0
  6. package/dist/avs-go-dataviz.d.ts.map +1 -0
  7. package/dist/avs-go-dataviz.js +2090 -0
  8. package/dist/avs-go-dynamic-html.d.ts +52 -0
  9. package/dist/avs-go-dynamic-html.d.ts.map +1 -0
  10. package/dist/avs-go-dynamic-html.js +124 -0
  11. package/dist/avs-go-info.d.ts +57 -0
  12. package/dist/avs-go-info.d.ts.map +1 -0
  13. package/dist/avs-go-info.js +127 -0
  14. package/dist/avs-go.min.js +211 -160
  15. package/dist/avs-renderer.d.ts +37 -0
  16. package/dist/avs-renderer.d.ts.map +1 -0
  17. package/dist/avs-renderer.js +33 -0
  18. package/dist/constants.d.ts +21 -0
  19. package/dist/constants.d.ts.map +1 -0
  20. package/dist/constants.js +20 -0
  21. package/dist/icons.d.ts +28 -0
  22. package/dist/icons.d.ts.map +1 -0
  23. package/dist/icons.js +27 -0
  24. package/dist/index.d.ts +23 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +22 -0
  27. package/dist/types.d.ts +142 -0
  28. package/dist/types.d.ts.map +1 -0
  29. package/dist/types.js +36 -0
  30. package/package.json +4 -3
  31. package/rollup.config.js +17 -7
  32. package/src/avs-element-mixin.ts +126 -0
  33. package/src/{avs-go-dataviz.js → avs-go-dataviz.ts} +518 -654
  34. package/src/{avs-go-dynamic-html.js → avs-go-dynamic-html.ts} +37 -50
  35. package/src/{avs-go-info.js → avs-go-info.ts} +36 -47
  36. package/src/{avs-renderer.js → avs-renderer.ts} +10 -2
  37. package/src/{constants.js → constants.ts} +1 -1
  38. package/src/icons.ts +29 -0
  39. package/src/{avs-go.js → index.ts} +3 -3
  40. package/src/types.ts +160 -0
  41. package/tsconfig.json +16 -0
  42. package/src/avs-element-base.js +0 -119
  43. package/src/logo.js +0 -29
@@ -18,13 +18,22 @@
18
18
  * Advanced Visual Systems Inc. (http://www.avs.com)
19
19
  */
20
20
 
21
- import { AvsElementBase } from './avs-element-base.js';
22
- import { html } from 'lit';
21
+ import { AvsElementMixin } from './avs-element-mixin.js';
22
+ import { LitElement, html, PropertyValues } from 'lit';
23
+ import { customElement, property } from 'lit/decorators.js';
23
24
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
24
25
  import { AvsRenderer } from './avs-renderer.js';
25
- import {Viewer, TransformInteractor, PanInteractor, ZoomRectangleInteractor, PickDepthEnum, Animator} from '../lib/avs-three.module.min.js';
26
- import {LOGO, PLAY, CAMERA, TIMELAPSE, HOME, DELETE, COPY, LINK} from './logo.js';
26
+ import { Viewer, TransformInteractor, PanInteractor, ZoomRectangleInteractor, PickDepthEnum, Animator } from '../lib/avs-three.module.min.js';
27
+ import { AVS, PLAY, CAMERA, TIMELAPSE, HOME, DELETE, COPY, LINK } from './icons.js';
27
28
  import { Euler, Vector3, Quaternion } from 'three';
29
+ import { DataVizModel, DataVizResponse, MotionCaptureFrame, PickDepth, PickDetail, PickLevel, PickProperties, Renderer, RendererProperties, SelectedInfo } from './types.js';
30
+
31
+ const ro = new ResizeObserver((entries: ResizeObserverEntry[], observer: ResizeObserver) => {
32
+ entries.forEach((entry: ResizeObserverEntry) => {
33
+ const target = entry.target as AvsGoDataViz;
34
+ target._onResize(entry.contentRect);
35
+ });
36
+ });
28
37
 
29
38
  /**
30
39
  * `avs-go-dataviz` is a Lit element which requests a data visualization
@@ -40,8 +49,10 @@ import { Euler, Vector3, Quaternion } from 'three';
40
49
  *
41
50
  * @customElement
42
51
  * @lit
52
+ * @applysMixin AvsElementMixin
43
53
  */
44
- export class AvsGoDataViz extends AvsElementBase {
54
+ @customElement('avs-go-dataviz')
55
+ export class AvsGoDataViz extends AvsElementMixin(LitElement) {
45
56
  render() {
46
57
  return html`
47
58
  <style>
@@ -226,415 +237,278 @@ export class AvsGoDataViz extends AvsElementBase {
226
237
  `;
227
238
  }
228
239
 
229
- static properties = {
230
- /**
231
- * Don't request a new scene upon initialization or resize.
232
- */
233
- manualUpdate: {
234
- type: Boolean,
235
- attribute: 'manual-update'
236
- },
237
- /**
238
- * Highlight canvas elements when using the `THREEJS` renderer.
239
- */
240
- displayCanvas: {
241
- type: Boolean,
242
- attribute: 'display-canvas'
243
- },
244
- /**
245
- * The URL to an instance of AVS/Go server application or file.
246
- */
247
- url: {
248
- type: String
249
- },
250
- /**
251
- * Enables loading JSON from a file.
252
- */
253
- urlLoadJsonFile: {
254
- type: Boolean,
255
- attribute: 'url-load-json-file'
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
- },
326
- /**
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`
328
- */
329
- themeName: {
330
- type: String,
331
- attribute: 'theme-name'
332
- },
333
- /**
334
- * Hide the data visualization.
335
- */
336
- hidden: {
337
- type: Boolean
338
- },
339
- /**
340
- * Resize threshold (percent) to determine when the update is performed on the client or the server.
341
- * Default is 10%. Set to zero to disable resize on the server.
342
- */
343
- resizeThreshold: {
344
- type: Number,
345
- attribute: 'resize-threshold'
346
- },
347
- /**
348
- * Aspect ratio (w/h) of the viewer if it is unable to determine the height of its parent element.
349
- */
350
- aspectRatio: {
351
- type: Number,
352
- attribute: 'aspect-ration'
353
- },
354
- /**
355
- * Number of seconds between pointer moves before an `avs-pointer-timeout` event is dispatched.
356
- */
357
- pointerTimeout: {
358
- type: Number,
359
- attribute: 'pointer-timeout'
360
- },
361
- /**
362
- * Enables the `avs-tap` event.
363
- */
364
- tapEnable: {
365
- type: Boolean,
366
- attribute: 'tap-enable'
367
- },
368
- /**
369
- * The level of geometry within the scene to be modified by the tap event: `CELL`, `CELL_SET` or `SCENE_NODE`
370
- */
371
- tapLevel: {
372
- type: String,
373
- attribute: 'tap-level'
374
- },
375
- /**
376
- * The depth at which an object is selected: `ALL` or `CLOSEST`
377
- */
378
- tapDepth: {
379
- type: String,
380
- attribute: 'tap-depth'
381
- },
382
- /**
383
- * Enables highlight of selected geometry in the scene.
384
- */
385
- tapHighlightEnable: {
386
- type: Boolean,
387
- attribute: 'tap-highlight-enable'
388
- },
389
- /**
390
- * The color to used to highlight the selected objects in the scene.
391
- */
392
- tapHighlightColor: {
393
- type: String,
394
- attribute: 'tap-highlight-color'
395
- },
396
- /**
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.
398
- */
399
- tapHighlightLayerEnable: {
400
- type: Boolean,
401
- attribute: 'tap-highlight-layer-enable'
402
- },
403
- /**
404
- * Enables the processing of tap events on the client. `THREEJS` only.
405
- */
406
- tapProcessEventOnClient: {
407
- type: Boolean,
408
- attribute: 'tap-process-event-on-client'
409
- },
410
- /**
411
- * Enables the `avs-track` event.
412
- */
413
- trackEnable: {
414
- type: Boolean,
415
- attribute: 'track-enable'
416
- },
417
- /**
418
- * The level of geometry within the scene to be modified by the track event: `CELL`, `CELL_SET` or `SCENE_NODE`
419
- */
420
- trackLevel: {
421
- type: String,
422
- attribute: 'track-level'
423
- },
424
- /**
425
- * The depth at which an object is selected: `ALL` or `CLOSEST`
426
- */
427
- trackDepth: {
428
- type: String,
429
- attribute: 'track-depth'
430
- },
431
- /**
432
- * Enables highlight of selected geometry in the scene.
433
- */
434
- trackHighlightEnable: {
435
- type: Boolean,
436
- attribute: 'track-highlight-enable'
437
- },
438
- /**
439
- * The color to used to highlight the selected objects in the scene.
440
- */
441
- trackHighlightColor: {
442
- type: String,
443
- attribute: 'track-highlight-color'
444
- },
445
- /**
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.
447
- */
448
- trackHighlightLayerEnable: {
449
- type: Boolean,
450
- attribute: 'track-highlight-layer-enable'
451
- },
452
- /**
453
- * Enables the processing of track events on the client. `THREEJS` only.
454
- */
455
- trackProcessEventOnClient: {
456
- type: Boolean,
457
- attribute: 'track-process-event-on-client'
458
- },
459
- /**
460
- * Enables the `avs-hover` event.
461
- */
462
- hoverEnable: {
463
- type: Boolean,
464
- attribute: 'hover-enable'
465
- },
466
- /**
467
- * The level of geometry within the scene to be modified by the hover event: `CELL`, `CELL_SET` or `SCENE_NODE`
468
- */
469
- hoverLevel: {
470
- type: String,
471
- attribute: 'hover-level'
472
- },
473
- /**
474
- * The depth at which an object is selected: `ALL` or `CLOSEST`
475
- */
476
- hoverDepth: {
477
- type: String,
478
- attribute: 'hover-depth'
479
- },
480
- /**
481
- * Enables highlight of selected geometry in the scene.
482
- */
483
- hoverHighlightEnable: {
484
- type: Boolean,
485
- attribute: 'hover-highlight-enable'
486
- },
487
- /**
488
- * The color to used to highlight the selected objects in the scene.
489
- */
490
- hoverHighlightColor: {
491
- type: String,
492
- attribute: 'hover-highlight-color'
493
- },
494
- /**
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.
496
- */
497
- hoverHighlightLayerEnable: {
498
- type: Boolean,
499
- attribute: 'hover-highlight-layer-enable'
500
- },
501
- /**
502
- * Enable the transform interactor. Only available when `renderer` is `THREEJS`
503
- *
504
- * Create an interactor for transforming a particular scene object on the client.
505
- * Use the IGoRenderer.addInteractor() method on the server to select which object to transform.
506
- */
507
- transformEnable: {
508
- type: Boolean,
509
- attribute: 'transform-enable'
510
- },
511
- /**
512
- * Transform on the client only, do not update the transform matrix on the server.
513
- */
514
- transformClientOnly: {
515
- type: Boolean,
516
- attribute: 'transform-client-only'
517
- },
518
- /**
519
- * Disables rotation of the object.
520
- */
521
- transformRotateDisable: {
522
- type: Boolean,
523
- attribute: 'transform-rotate-disable-changed'
524
- },
525
- /**
526
- * Disables zooming of the object.
527
- */
528
- transformZoomDisable: {
529
- type: Boolean,
530
- attribute: 'transform-zoom-disable'
531
- },
532
- /**
533
- * Disables panning of the object.
534
- */
535
- transformPanDisable: {
536
- type: Boolean,
537
- attribute: 'transform-pan-disable'
538
- },
539
- /**
540
- * The twist angle of the object in degrees.
541
- */
542
- transformTwistAngle: {
543
- type: Number,
544
- attribute: 'transform-twist-angle'
545
- },
546
- /**
547
- * The tilt angle of the object in degrees.
548
- */
549
- transformTiltAngle: {
550
- type: Number,
551
- attribute: 'transform-tilt-angle'
552
- },
553
- /**
554
- * The scale of the object in percent.
555
- */
556
- transformScale: {
557
- type: Number,
558
- attribute: 'transform-scale'
559
- },
560
- /**
561
- * Motion capture data or URL.
562
- */
563
- motionCapture: {
564
- type: String,
565
- attribute: 'motion-capture'
566
- },
567
- /**
568
- * Enable the zoom rectangle interactor. Only available when `renderer` is `THREEJS`
569
- *
570
- * Create an interactor for scaling an object by drawing a rectangle.
571
- * Use the IGoRenderer.addInteractor() method on the server to select which object to transform.
572
- */
573
- zoomRectangleEnable: {
574
- type: Boolean,
575
- attribute: 'zoom-rectangle-enable'
576
- },
577
- /**
578
- * Enable the pan interactor. Only available when `renderer` is `THREEJS`
579
- *
580
- * Create an interactor for panning an OpenViz domain (axes and charts) on the client.
581
- */
582
- panEnable: {
583
- type: Boolean,
584
- attribute: 'pan-enable'
585
- },
586
- /**
587
- * Use mousewheel or pinch zoom to adjust the pan interactor's zoom level.
588
- * Otherwise the zoom level must be set using `pan-width-zoom-level` and `pan-height-zoom-level`.
589
- */
590
- panZoomEnable: {
591
- type: Boolean,
592
- attribute: 'pan-zoom-enable'
593
- },
594
- /**
595
- * The width zoom level in percent of the original scene greater than 100%
596
- */
597
- panWidthZoomLevel: {
598
- type: Number,
599
- attribute: 'pan-width-zoom-level'
600
- },
601
- /**
602
- * The height zoom level in percent of the original scene greater than 100%
603
- */
604
- panHeightZoomLevel: {
605
- type: Number,
606
- attribute: 'pan-height-zoom-level'
607
- },
608
- /**
609
- * The maximum zoom level in percent of the original scene greater than 100%
610
- * Default is 1000%
611
- */
612
- panMaximumZoomLevel: {
613
- type: Number,
614
- attribute: 'pan-maximum-zoom-level'
615
- },
616
- /**
617
- * Show animated glyphs. Only available when `renderer` is `THREEJS`
618
- */
619
- animatedGlyphsVisible: {
620
- type: Boolean,
621
- attribute: 'animated-glyphs-visible'
622
- },
623
- /**
624
- * Enable animated glyphs. Only available when `renderer` is `THREEJS`
625
- */
626
- animatedGlyphsEnable: {
627
- type: Boolean,
628
- attribute: 'animated-glyphs-enable'
629
- },
630
- /**
631
- * Enable motion capture controls. Only available when `renderer` is `THREEJS`
632
- */
633
- motionCaptureControlsEnable: {
634
- type: Boolean,
635
- attribute: 'motion-capture-controls-enable'
636
- }
637
- }
240
+ /** Don't request a new scene upon initialization or resize. */
241
+ @property({ attribute: 'manual-update', type: Boolean })
242
+ manualUpdate?: boolean;
243
+
244
+ /** Highlight canvas elements when using the `THREEJS` renderer. */
245
+ @property({ attribute: 'display-canvas', type: Boolean })
246
+ displayCanvas: boolean;
247
+
248
+ /** The URL to an instance of AVS/Go server application or file. */
249
+ @property()
250
+ url: string;
251
+
252
+ /** Enables loading JSON from a file. */
253
+ @property({ attribute: 'url-load-json-file', type: Boolean })
254
+ urlLoadJsonFile?: boolean;
255
+
256
+ /** Name of the data source registered in the library map on the server. */
257
+ @property({ attribute: 'data-source-name' })
258
+ dataSourceName?: string;
259
+
260
+ /** User properties as JSON passed directly to the data source on the server. */
261
+ @property({ attribute: 'data-source-user-properties' })
262
+ dataSourceUserProperties?: string;
263
+
264
+ /** Name of the scene registered in the library map on the server. */
265
+ @property({ attribute: 'scene-name' })
266
+ sceneName?: string;
267
+
268
+ /** User properties as JSON passed directly to the scene on the server. */
269
+ @property({ attribute: 'scene-user-properties' })
270
+ sceneUserProperties?: string;
271
+
272
+ /** Name of the renderer registered in the library map on the server. */
273
+ @property({ attribute: 'renderer-name' })
274
+ rendererName?: string;
275
+
276
+ /** User properties as JSON passed directly to the renderer on the server. */
277
+ @property({ attribute: 'renderer-user-properties' })
278
+ rendererUserProperties?: string;
279
+
280
+ /** The type of renderer to be used to display a scene: `IMAGE`, `SVG` or `THREEJS` */
281
+ @property()
282
+ renderer: Renderer;
283
+
284
+ /** Enables streaming of objects from the server. Only available when `renderer` is `THREEJS` */
285
+ @property({ attribute: 'stream-enable', type: Boolean })
286
+ streamEnable?: boolean;
287
+
288
+ /** The number of objects streamed for the first chunk. */
289
+ @property({ attribute: 'stream-chunk-size-first' })
290
+ streamChunkSizeFirst?: number;
291
+
292
+ /** The number of objects streamed per chunk. */
293
+ @property({ attribute: 'stream-chunk-size' })
294
+ streamChunkSize?: number;
295
+
296
+ /** 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` */
297
+ @property({ attribute: 'theme-name' })
298
+ themeName?: string;
299
+
300
+ /** Resize threshold (percent) to determine when the update is performed on the client or the server.
301
+ Default is 10%. Set to zero to disable resize on the server. */
302
+ @property({ attribute: 'resize-threshold' })
303
+ resizeThreshold?: number;
304
+
305
+ /** Number of seconds between pointer moves before an `avs-pointer-timeout` event is dispatched. */
306
+ @property({ attribute: 'pointer-timeout' })
307
+ pointerTimeout?: number;
308
+
309
+ /** Enables the `avs-tap` event. */
310
+ @property({ attribute: 'tap-enable', type: Boolean })
311
+ tapEnable?: boolean;
312
+
313
+ /** The level of geometry within the scene to be modified by the tap event: `CELL`, `CELL_SET` or `SCENE_NODE` */
314
+ @property({ attribute: 'tap-level' })
315
+ tapLevel?: PickLevel;
316
+
317
+ /** The depth at which an object is selected: `ALL` or `CLOSEST` */
318
+ @property({ attribute: 'tap-depth' })
319
+ tapDepth?: PickDepth;
320
+
321
+ /** Enables highlight of selected geometry in the scene. */
322
+ @property({ attribute: 'tap-highlight-enable', type: Boolean })
323
+ tapHighlightEnable?: boolean;
324
+
325
+ /** The color to used to highlight the selected objects in the scene. */
326
+ @property({ attribute: 'tap-highlight-color' })
327
+ tapHighlightColor?: string;
328
+
329
+ /** 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. */
330
+ @property({ attribute: 'tap-highlight-layer-enable', type: Boolean })
331
+ tapHighlightLayerEnable?: boolean;
332
+
333
+ /** Enables the processing of tap events on the client. Only available when `renderer` is `THREEJS` */
334
+ @property({ attribute: 'tap-process-event-on-client', type: Boolean })
335
+ tapProcessEventOnClient?: boolean;
336
+
337
+ /** Enables the `avs-track` event. */
338
+ @property({ attribute: 'track-enable', type: Boolean })
339
+ trackEnable?: boolean;
340
+
341
+ /** The level of geometry within the scene to be modified by the track event: `CELL`, `CELL_SET` or `SCENE_NODE` */
342
+ @property({ attribute: 'track-level' })
343
+ trackLevel?: PickLevel;
344
+
345
+ /** The depth at which an object is selected: `ALL` or `CLOSEST` */
346
+ @property({ attribute: 'track-depth' })
347
+ trackDepth?: PickDepth;
348
+
349
+ /** Enables highlight of selected geometry in the scene. */
350
+ @property({ attribute: 'track-highlight-enable', type: Boolean })
351
+ trackHighlightEnable?: boolean;
352
+
353
+ /** The color to used to highlight the selected objects in the scene. */
354
+ @property({ attribute: 'track-highlight-color' })
355
+ trackHighlightColor?: string;
356
+
357
+ /** 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. */
358
+ @property({ attribute: 'track-highlight-layer-enable', type: Boolean })
359
+ trackHighlightLayerEnable?: boolean;
360
+
361
+ /** Enables the processing of track events on the client. Only available when `renderer` is `THREEJS` */
362
+ @property({ attribute: 'track-process-event-on-client', type: Boolean })
363
+ trackProcessEventOnClient?: boolean;
364
+
365
+ /** Enables the `avs-hover` event. */
366
+ @property({ attribute: 'hover-enable', type: Boolean })
367
+ hoverEnable?: boolean;
368
+
369
+ /** The level of geometry within the scene to be modified by the hover event: `CELL`, `CELL_SET` or `SCENE_NODE` */
370
+ @property({ attribute: 'hover-level' })
371
+ hoverLevel?: PickLevel;
372
+
373
+ /** The depth at which an object is selected: `ALL` or `CLOSEST` */
374
+ @property({ attribute: 'hover-depth' })
375
+ hoverDepth?: PickDepth;
376
+
377
+ /** Enables highlight of selected geometry in the scene. */
378
+ @property({ attribute: 'hover-highlight-enable', type: Boolean })
379
+ hoverHighlightEnable?: boolean;
380
+
381
+ /** The color to used to highlight the selected objects in the scene. */
382
+ @property({ attribute: 'hover-highlight-color' })
383
+ hoverHighlightColor?: string;
384
+
385
+ /** 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. */
386
+ @property({ attribute: 'hover-highlight-layer-enable', type: Boolean })
387
+ hoverHighlightLayerEnable?: boolean;
388
+
389
+ /**
390
+ * Enable the transform interactor. Only available when `renderer` is `THREEJS`
391
+ *
392
+ * Create an interactor for transforming a particular scene object on the client.
393
+ * Use the IGoRenderer.addInteractor() method on the server to select which object to transform.
394
+ */
395
+ @property({ attribute: 'transform-enable', type: Boolean })
396
+ transformEnable?: boolean;
397
+
398
+ /** Transform on the client only, do not update the transform matrix on the server. */
399
+ @property({ attribute: 'transform-client-only', type: Boolean })
400
+ transformClientOnly?: boolean;
401
+
402
+ /** Disables rotation of the object. */
403
+ @property({ attribute: 'transform-rotate-disable', type: Boolean })
404
+ transformRotateDisable?: boolean;
405
+
406
+ /** Disables zooming of the object. */
407
+ @property({ attribute: 'transform-zoom-disable', type: Boolean })
408
+ transformZoomDisable?: boolean;
409
+
410
+ /** Disables panning of the object. */
411
+ @property({ attribute: 'transform-pan-disable', type: Boolean })
412
+ transformPanDisable?: boolean;
413
+
414
+ /** The twist angle of the object in degrees. */
415
+ @property({ attribute: 'transform-twist-angle' })
416
+ transformTwistAngle?: number;
417
+
418
+ /** The tilt angle of the object in degrees. */
419
+ @property({ attribute: 'transform-tilt-angle' })
420
+ transformTiltAngle?: number;
421
+
422
+ /** The scale of the object in percent. */
423
+ @property({ attribute: 'transform-scale' })
424
+ transformScale?: number;
425
+
426
+ /** Motion capture data or URL. */
427
+ @property({ attribute: 'motion-capture' })
428
+ motionCapture?: string;
429
+
430
+ /**
431
+ * Enable the zoom rectangle interactor. Only available when `renderer` is `THREEJS`
432
+ *
433
+ * Create an interactor for scaling an object by drawing a rectangle.
434
+ * Use the IGoRenderer.addInteractor() method on the server to select which object to transform.
435
+ */
436
+ @property({ attribute: 'zoom-rectangle-enable', type: Boolean })
437
+ zoomRectangleEnable?: boolean;
438
+
439
+ /**
440
+ * Enable the pan interactor. Only available when `renderer` is `THREEJS`
441
+ *
442
+ * Create an interactor for panning an OpenViz domain (axes and charts) on the client.
443
+ */
444
+ @property({ attribute: 'pan-enable', type: Boolean })
445
+ panEnable?: boolean;
446
+
447
+ /**
448
+ * Use mousewheel or pinch zoom to adjust the pan interactor's zoom level.
449
+ * Otherwise the zoom level must be set using `pan-width-zoom-level` and `pan-height-zoom-level`.
450
+ */
451
+ @property({ attribute: 'pan-zoom-enable', type: Boolean })
452
+ panZoomEnable?: boolean;
453
+
454
+ /** The width zoom level in percent of the original scene greater than 100% */
455
+ @property({ attribute: 'pan-width-zoom-level' })
456
+ panWidthZoomLevel?: number;
457
+
458
+ /** The height zoom level in percent of the original scene greater than 100% */
459
+ @property({ attribute: 'pan-height-zoom-level' })
460
+ panHeightZoomLevel?: number;
461
+
462
+ /** The maximum zoom level in percent of the original scene greater than 100% Default is 1000% */
463
+ @property({ attribute: 'pan-maximum-zoom-level' })
464
+ panMaximumZoomLevel?: number;
465
+
466
+ /** Show animated glyphs. Only available when `renderer` is `THREEJS` */
467
+ @property({ attribute: 'animated-glyphs-visible', type: Boolean })
468
+ animatedGlyphsVisible?: boolean;
469
+
470
+ /** Enable animated glyphs. Only available when `renderer` is `THREEJS` */
471
+ @property({ attribute: 'animated-glyphs-enable', type: Boolean })
472
+ animatedGlyphsEnable?: boolean;
473
+
474
+ /** Enable motion capture controls. Only available when `renderer` is `THREEJS` */
475
+ @property({ attribute: 'motion-capture-controls-enable', type: Boolean })
476
+ motionCaptureControlsEnable?: boolean;
477
+
478
+ // Local variables
479
+ width: number;
480
+ height: number;
481
+ lowResizeWidth: number;
482
+ highResizeWidth: number;
483
+ lowResizeHeight: number;
484
+ highResizeHeight: number;
485
+ forceUpdate: boolean;
486
+ chunkFile: number;
487
+ model: DataVizModel;
488
+ tapping: boolean;
489
+ tracking: number;
490
+ threeViewer: Viewer;
491
+ transformInteractor: TransformInteractor;
492
+ transformMatrix: Array<number>;
493
+ animator: Animator;
494
+ panInteractor: PanInteractor;
495
+ zoomRectangleInteractor: ZoomRectangleInteractor;
496
+ highlightSvg: Array<any>;
497
+ pointerDown: boolean;
498
+ pointerDownX: number;
499
+ pointerDownY: number;
500
+ imageMapData: Array<any>;
501
+ rectCanvas: HTMLCanvasElement;
502
+ rectCtx: CanvasRenderingContext2D;
503
+ sceneImage: HTMLImageElement;
504
+ sceneImageMap: HTMLMapElement;
505
+ svgDiv: HTMLDivElement;
506
+ motionCaptureDelay: number;
507
+ motionCaptureTime: number;
508
+ motionCaptureFrames: Array<MotionCaptureFrame>;
509
+ showMotionCaptureTooltip: boolean;
510
+ zoomOverlayTimeoutId: number;
511
+ timer: number;
638
512
 
639
513
  /**
640
514
  * Default line style and color
@@ -647,7 +521,7 @@ export class AvsGoDataViz extends AvsElementBase {
647
521
  /**
648
522
  * Assemble the model from our properties to send to the server.
649
523
  */
650
- _assembleModel(fullReset) {
524
+ _assembleModel(fullReset?: boolean): DataVizModel {
651
525
  if (!this.sceneName) {
652
526
  this._dispatchErrorEvent("'scene-name' property must be set to the name of the scene registered in the library map on the AVS/Go server.");
653
527
  return undefined;
@@ -657,7 +531,7 @@ export class AvsGoDataViz extends AvsElementBase {
657
531
  }
658
532
 
659
533
  // Scene Properties
660
- const model = {
534
+ const model: DataVizModel = {
661
535
  sceneProperties: {
662
536
  name: this.sceneName
663
537
  }
@@ -675,7 +549,7 @@ export class AvsGoDataViz extends AvsElementBase {
675
549
  }
676
550
 
677
551
  // Renderer Properties
678
- const rendererProperties = {
552
+ const rendererProperties: RendererProperties = {
679
553
  width: this.width,
680
554
  height: this.height,
681
555
  name: this.rendererName,
@@ -914,7 +788,7 @@ export class AvsGoDataViz extends AvsElementBase {
914
788
  /**
915
789
  *
916
790
  */
917
- _onResize(contentRect) {
791
+ _onResize(contentRect: DOMRect) {
918
792
  // Get the width & height provided by our container
919
793
  this.width = Math.round(contentRect.width);
920
794
  this.height = Math.round(contentRect.height);
@@ -957,27 +831,28 @@ export class AvsGoDataViz extends AvsElementBase {
957
831
  if (spinner.length > 0) {
958
832
  fetch(spinner)
959
833
  .then((response) => {
960
- if (!response.ok) {
961
- throw new Error(response);
834
+ if (response.ok) {
835
+ return response.text();
962
836
  }
963
- return response.text();
964
837
  })
965
838
  .then((html) => {
966
839
  this.renderRoot.querySelector('#spinner').innerHTML = html;
967
840
  })
968
841
  .catch((error) => {
969
- this.renderRoot.querySelector('#spinner').innerHTML = '';
842
+ this.renderRoot.querySelector('#spinner').innerHTML = AVS;
970
843
  });
971
844
  }
972
845
  else {
973
- this.renderRoot.querySelector('#spinner').innerHTML = LOGO;
846
+ this.renderRoot.querySelector('#spinner').innerHTML = AVS;
974
847
  }
975
848
 
976
- this.renderRoot.querySelector('#spinner').style.display = 'block';
849
+ const spinnerEl = this.renderRoot.querySelector('#spinner') as HTMLDivElement;
850
+ spinnerEl.style.display = 'block';
977
851
  }
978
852
 
979
853
  hideSpinner() {
980
- this.renderRoot.querySelector('#spinner').style.display = 'none';
854
+ const spinnerEl = this.renderRoot.querySelector('#spinner') as HTMLDivElement;
855
+ spinnerEl.style.display = 'none';
981
856
  }
982
857
 
983
858
  startSpinner() {
@@ -991,7 +866,12 @@ export class AvsGoDataViz extends AvsElementBase {
991
866
  /**
992
867
  * At least one of the properties was changed.
993
868
  */
994
- updated(changedProperties) {
869
+ updated(changedProperties: PropertyValues<this>) {
870
+ if (!Object.values(Renderer)?.includes(this.renderer)) {
871
+ this._dispatchErrorEvent("'renderer' property must be 'IMAGE', 'SVG' or 'THREEJS'.");
872
+ return;
873
+ }
874
+
995
875
  if (changedProperties.has('renderer')) {
996
876
  this._rendererChanged(this.renderer, changedProperties['renderer']);
997
877
  }
@@ -1052,9 +932,6 @@ export class AvsGoDataViz extends AvsElementBase {
1052
932
  if (changedProperties.has('motionCapture')) {
1053
933
  this._motionCaptureValueChanged(this.motionCapture, changedProperties['motionCapture']);
1054
934
  }
1055
- if (changedProperties.has('hidden')) {
1056
- this._hiddenChanged(this.hidden, changedProperties['hidden']);
1057
- }
1058
935
 
1059
936
  if (!this.url) {
1060
937
  //this._dispatchErrorEvent(''url' property must point to an instance of AVS/Go server.');
@@ -1108,9 +985,8 @@ export class AvsGoDataViz extends AvsElementBase {
1108
985
 
1109
986
  /**
1110
987
  * HTTP error handler.
1111
- * @param event
1112
988
  */
1113
- _handleHttpError(event) {
989
+ _handleHttpError() {
1114
990
  this.hideSpinner();
1115
991
  }
1116
992
 
@@ -1143,60 +1019,64 @@ export class AvsGoDataViz extends AvsElementBase {
1143
1019
 
1144
1020
  /**
1145
1021
  * HTTP response handler.
1146
- * @param json JSON parsed from HTTP response.
1022
+ * @param response Response parsed from HTTP or file.
1147
1023
  */
1148
- _handleHttpResponse(json) {
1149
- if (json) {
1150
- if (json.selectionInfo) {
1151
- this._dispatchPickEvents(json.selectionInfo);
1024
+ _handleHttpResponse(response: DataVizResponse) {
1025
+ if (response) {
1026
+ if (response.selectionInfo) {
1027
+ this._dispatchPickEvents(response.selectionInfo);
1152
1028
  }
1153
1029
 
1154
- if (json.sceneInfo) {
1155
- var sceneEvent = {detail: json.sceneInfo};
1030
+ if (response.sceneInfo) {
1156
1031
  /**
1157
1032
  * Scene info from the server.
1158
1033
  * @event avs-scene-info
1159
1034
  */
1160
- this.dispatchEvent(new CustomEvent('avs-scene-info', sceneEvent));
1035
+ this.dispatchEvent(new CustomEvent('avs-scene-info', { detail: response.sceneInfo }));
1036
+
1037
+ const motionCapture = this.renderRoot.querySelector('#motionCapture') as HTMLDivElement;
1038
+ const zoomOverlay = this.renderRoot.querySelector('#zoomOverlay') as HTMLDivElement;
1039
+ const tooltip = this.renderRoot.querySelector('#tooltip') as HTMLDivElement;
1040
+ const motionCaptureTooltip = this.renderRoot.querySelector('#motionCaptureTooltip') as HTMLDivElement;
1161
1041
 
1162
1042
  // Set animation controls, tooltip and zoom overlay style to reversed theme
1163
- if (json.sceneInfo.backgroundColor) {
1164
- var col = json.sceneInfo.backgroundColor.match(/[0-9.]+/gi);
1165
- var bgCol = this.getInheritedBackgroundCol(this.parentNode).trim().match(/[0-9.]+/gi);
1166
- var blendedR = (col[0] * col[3]);
1167
- var blendedG = (col[1] * col[3]);
1168
- var blendedB = (col[2] * col[3]);
1169
- if (col[3] == 0) {
1043
+ if (response.sceneInfo.backgroundColor) {
1044
+ var col = response.sceneInfo.backgroundColor.match(/[0-9.]+/gi);
1045
+ var bgCol = this.getInheritedBackgroundCol(this).trim().match(/[0-9.]+/gi);
1046
+ var blendedR = (Number(col[0]) * Number(col[3]));
1047
+ var blendedG = (Number(col[1]) * Number(col[3]));
1048
+ var blendedB = (Number(col[2]) * Number(col[3]));
1049
+ if (Number(col[3]) == 0) {
1170
1050
  // In case sceneInfo.backgroundColor is transparent, blend with inherited background color
1171
- blendedR += (bgCol[0] * (1 - col[3]));
1172
- blendedG += (bgCol[1] * (1 - col[3]));
1173
- blendedB += (bgCol[2] * (1 - col[3]));
1051
+ blendedR += (bgCol[0] * (1 - Number(col[3])));
1052
+ blendedG += (bgCol[1] * (1 - Number(col[3])));
1053
+ blendedB += (bgCol[2] * (1 - Number(col[3])));
1174
1054
  }
1175
- this.renderRoot.querySelector('#motionCapture').style.color = "var(--avs-motion-capture-color, rgb(" + blendedR + ", " + blendedG + ", " + blendedB + "))";
1176
- this.renderRoot.querySelector('#zoomOverlay').style.color = "var(--avs-zoom-overlay-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
1177
- this.renderRoot.querySelector('#tooltip').style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
1178
- this.renderRoot.querySelector('#motionCaptureTooltip').style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
1055
+ motionCapture.style.color = "var(--avs-motion-capture-color, rgb(" + blendedR + ", " + blendedG + ", " + blendedB + "))";
1056
+ zoomOverlay.style.color = "var(--avs-zoom-overlay-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
1057
+ tooltip.style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
1058
+ motionCaptureTooltip.style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
1179
1059
  }
1180
- if (json.sceneInfo.color) {
1181
- var col = json.sceneInfo.color.match(/[0-9.]+/gi);
1182
- this.renderRoot.querySelector('#motionCapture').style.background = "var(--avs-motion-capture-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
1183
- this.renderRoot.querySelector('#zoomOverlay').style.background = "var(--avs-zoom-overlay-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
1184
- this.renderRoot.querySelector('#tooltip').style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
1185
- this.renderRoot.querySelector('#motionCaptureTooltip').style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
1060
+ if (response.sceneInfo.color) {
1061
+ var col = response.sceneInfo.color.match(/[0-9.]+/gi);
1062
+ motionCapture.style.background = "var(--avs-motion-capture-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
1063
+ zoomOverlay.style.background = "var(--avs-zoom-overlay-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
1064
+ tooltip.style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
1065
+ motionCaptureTooltip.style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
1186
1066
  }
1187
- if (json.sceneInfo.fontFamily) {
1188
- this.renderRoot.querySelector('#motionCapture').style.fontFamily = "var(--avs-motion-capture-font-family, " + json.sceneInfo.fontFamily + ")";
1189
- this.renderRoot.querySelector('#zoomOverlay').style.fontFamily = "var(--avs-zoom-overlay-font-family, " + json.sceneInfo.fontFamily + ")";
1190
- this.renderRoot.querySelector('#tooltip').style.fontFamily = "var(--avs-tooltip-font-family, " + json.sceneInfo.fontFamily + ")";
1191
- this.renderRoot.querySelector('#motionCaptureTooltip').style.fontFamily = "var(--avs-tooltip-font-family, " + json.sceneInfo.fontFamily + ")";
1067
+ if (response.sceneInfo.fontFamily) {
1068
+ motionCapture.style.fontFamily = "var(--avs-motion-capture-font-family, " + response.sceneInfo.fontFamily + ")";
1069
+ zoomOverlay.style.fontFamily = "var(--avs-zoom-overlay-font-family, " + response.sceneInfo.fontFamily + ")";
1070
+ tooltip.style.fontFamily = "var(--avs-tooltip-font-family, " + response.sceneInfo.fontFamily + ")";
1071
+ motionCaptureTooltip.style.fontFamily = "var(--avs-tooltip-font-family, " + response.sceneInfo.fontFamily + ")";
1192
1072
  }
1193
1073
  }
1194
1074
 
1195
- if (json.image) {
1196
- this.sceneImage.src = json.image;
1075
+ if (response.image) {
1076
+ this.sceneImage.src = response.image;
1197
1077
 
1198
- if (json.imagemap) {
1199
- this.sceneImageMap.innerHTML = decodeURIComponent(json.imagemap.replace(/\+/g, '%20'));
1078
+ if (response.imagemap) {
1079
+ this.sceneImageMap.innerHTML = decodeURIComponent(response.imagemap.replace(/\+/g, '%20'));
1200
1080
 
1201
1081
  this.imageMapData = Array.from(this.sceneImageMap.querySelectorAll('area')).map(area => {
1202
1082
  return {
@@ -1214,29 +1094,29 @@ export class AvsGoDataViz extends AvsElementBase {
1214
1094
  }
1215
1095
 
1216
1096
  if (!this.urlLoadJsonFile) {
1217
- this._dispatchSceneData(json);
1097
+ this._dispatchSceneData(response);
1218
1098
  }
1219
1099
 
1220
1100
  this._handleLoadComplete();
1221
1101
  }
1222
- else if (json.svg) {
1223
- this.svgDiv.innerHTML = decodeURIComponent(json.svg.replace(/\+/g, '%20'));
1102
+ else if (response.svg) {
1103
+ this.svgDiv.innerHTML = decodeURIComponent(response.svg.replace(/\+/g, '%20'));
1224
1104
 
1225
1105
  if (!this.urlLoadJsonFile) {
1226
- this._dispatchSceneData(json);
1106
+ this._dispatchSceneData(response);
1227
1107
  }
1228
1108
 
1229
1109
  this._handleLoadComplete();
1230
1110
  }
1231
- else if (json.threejs) {
1111
+ else if (response.threejs) {
1232
1112
  if (!this.urlLoadJsonFile) {
1233
- this._dispatchSceneData(json);
1113
+ this._dispatchSceneData(response);
1234
1114
  }
1235
1115
 
1236
- if (json.threejs.chunkId) {
1237
- this.threeViewer.loadGeometryAsEvents(json.threejs, this._handleLoadComplete.bind(this));
1116
+ if (response.threejs.chunkId) {
1117
+ this.threeViewer.loadGeometryAsEvents(response.threejs, this._handleLoadComplete.bind(this));
1238
1118
 
1239
- if (json.threejs.moreChunks === true) {
1119
+ if (response.threejs.moreChunks) {
1240
1120
  if (this.urlLoadJsonFile) {
1241
1121
  // Load the next chunk file
1242
1122
  this.chunkFile++;
@@ -1246,13 +1126,13 @@ export class AvsGoDataViz extends AvsElementBase {
1246
1126
  }
1247
1127
  else {
1248
1128
  // Get the next chunk from the server
1249
- this.model.rendererProperties.streamProperties.chunkId = json.threejs.chunkId;
1129
+ this.model.rendererProperties.streamProperties.chunkId = response.threejs.chunkId;
1250
1130
  this._httpRequest(this.url, this._handleHttpResponse.bind(this), this._handleHttpError.bind(this), this.model);
1251
1131
  }
1252
1132
  }
1253
1133
  }
1254
1134
  else {
1255
- this.threeViewer.loadGeometryAsJson(json.threejs, this._handleLoadComplete.bind(this));
1135
+ this.threeViewer.loadGeometryAsJson(response.threejs, this._handleLoadComplete.bind(this));
1256
1136
  }
1257
1137
  }
1258
1138
  else {
@@ -1262,7 +1142,7 @@ export class AvsGoDataViz extends AvsElementBase {
1262
1142
  }
1263
1143
  }
1264
1144
 
1265
- getInheritedBackgroundCol(el) {
1145
+ getInheritedBackgroundCol(el: HTMLElement) {
1266
1146
  var defaultStyle = this.getDefaultBackground();
1267
1147
 
1268
1148
  var bgCol = window.getComputedStyle(el).backgroundColor;
@@ -1304,40 +1184,40 @@ export class AvsGoDataViz extends AvsElementBase {
1304
1184
  /**
1305
1185
  *
1306
1186
  */
1307
- _dispatchSceneData(data) {
1308
- const event = { detail: data };
1309
-
1187
+ _dispatchSceneData(data: DataVizResponse) {
1310
1188
  /**
1311
1189
  * Scene data from server.
1312
1190
  * @event avs-scene-data
1313
1191
  */
1314
- this.dispatchEvent(new CustomEvent('avs-scene-data', event));
1192
+ this.dispatchEvent(new CustomEvent('avs-scene-data', { detail: data }));
1315
1193
  }
1316
1194
 
1317
1195
  /**
1318
1196
  * @param e
1319
1197
  */
1320
- _handleTap(e) {
1321
- var adjustedCoords = this._getAdjustedCoords(e.detail.x, e.detail.y);
1322
-
1323
- var pickProperties = {type:"TAP", x:adjustedCoords.x, y:adjustedCoords.y};
1324
-
1325
- if (this.tapLevel !== undefined) pickProperties.level = this.tapLevel;
1326
- if (this.tapDepth !== undefined) pickProperties.depth = this.tapDepth;
1327
- if (this.tapHighlightEnable) pickProperties.highlight = true;
1328
- if (this.tapHighlightColor !== undefined) pickProperties.highlightColor = this.tapHighlightColor;
1329
- if (this.tapHighlightLayerEnable) pickProperties.highlightLayer = true;
1198
+ _handleTap(x: number, y: number, currentTarget: EventTarget) {
1199
+ const adjustedCoords = this._getAdjustedCoords(x, y);
1200
+ const pickProperties: PickProperties = {
1201
+ type: "TAP",
1202
+ x: adjustedCoords.x,
1203
+ y: adjustedCoords.y,
1204
+ level: this.tapLevel,
1205
+ depth: this.tapDepth,
1206
+ highlight: this.tapHighlightEnable,
1207
+ highlightColor: this.tapHighlightColor,
1208
+ highlightLayer: this.tapHighlightLayerEnable
1209
+ };
1330
1210
 
1331
- this._processPick( pickProperties, this.tapProcessEventOnClient, e.originalTarget );
1211
+ this._processPick( pickProperties, this.tapProcessEventOnClient, currentTarget );
1332
1212
  }
1333
1213
 
1334
1214
  /**
1335
1215
  * @param e
1336
1216
  */
1337
- _handleTrack(e) {
1338
- var adjustedCoords = this._getAdjustedRectangleCoords(e);
1217
+ _handleTrack(state: string, x: number, y: number, dx: number, dy: number) {
1218
+ var adjustedCoords = this._getAdjustedRectangleCoords(x, y, dx, dy);
1339
1219
 
1340
- switch(e.detail.state) {
1220
+ switch(state) {
1341
1221
  case 'start':
1342
1222
  break;
1343
1223
 
@@ -1350,17 +1230,18 @@ export class AvsGoDataViz extends AvsElementBase {
1350
1230
  case 'end':
1351
1231
  this.rectCtx.clearRect(0,0,this.width,this.height);
1352
1232
 
1353
- var pickProperties = {type:"TRACK"};
1354
- pickProperties.left = adjustedCoords.left;
1355
- pickProperties.right = adjustedCoords.right;
1356
- pickProperties.top = adjustedCoords.top;
1357
- pickProperties.bottom = adjustedCoords.bottom;
1358
-
1359
- if (this.trackLevel !== undefined) pickProperties.level = this.trackLevel;
1360
- if (this.trackDepth !== undefined) pickProperties.depth = this.trackDepth;
1361
- if (this.trackHighlightEnable) pickProperties.highlight = true;
1362
- if (this.trackHighlightColor !== undefined) pickProperties.highlightColor = this.trackHighlightColor;
1363
- if (this.trackHighlightLayerEnable) pickProperties.highlightLayer = true;
1233
+ const pickProperties: PickProperties = {
1234
+ type: "TRACK",
1235
+ left: adjustedCoords.left,
1236
+ right: adjustedCoords.right,
1237
+ top: adjustedCoords.top,
1238
+ bottom: adjustedCoords.bottom,
1239
+ level: this.trackLevel,
1240
+ depth: this.trackDepth,
1241
+ highlight: this.trackHighlightEnable,
1242
+ highlightColor: this.trackHighlightColor,
1243
+ highlightLayer: this.trackHighlightLayerEnable
1244
+ };
1364
1245
 
1365
1246
  this._processPick( pickProperties, this.trackProcessEventOnClient );
1366
1247
  break;
@@ -1370,7 +1251,7 @@ export class AvsGoDataViz extends AvsElementBase {
1370
1251
  /**
1371
1252
  * @param e
1372
1253
  */
1373
- _handlePointerDown(e) {
1254
+ _handlePointerDown(e: PointerEvent) {
1374
1255
  this.pointerDownX = e.clientX;
1375
1256
  this.pointerDownY = e.clientY;
1376
1257
 
@@ -1388,27 +1269,31 @@ export class AvsGoDataViz extends AvsElementBase {
1388
1269
  /**
1389
1270
  * @param e
1390
1271
  */
1391
- _handlePointerMove(e) {
1272
+ _handlePointerMove(e: PointerEvent) {
1392
1273
  if (this.tracking >= 1) {
1393
1274
  if (this.tracking === 1) {
1394
1275
  var dx = Math.abs(e.clientX - this.pointerDownX);
1395
1276
  var dy = Math.abs(e.clientY - this.pointerDownY);
1396
1277
  if (dx*dx + dy*dy >= 5) {
1397
1278
  this.tracking = 2;
1398
- this._handleTrack({detail:{state:"start", x:e.clientX, y:e.clientY, dx:e.clientX-this.pointerDownX, dy:e.clientY-this.pointerDownY}});
1279
+ this._handleTrack("start", e.clientX, e.clientY, e.clientX-this.pointerDownX, e.clientY-this.pointerDownY);
1399
1280
  }
1400
1281
  }
1401
1282
  if (this.tracking === 2) {
1402
- this._handleTrack({detail:{state:"track", x:e.clientX, y:e.clientY, dx:e.clientX-this.pointerDownX, dy:e.clientY-this.pointerDownY}});
1283
+ this._handleTrack("track", e.clientX, e.clientY, e.clientX-this.pointerDownX, e.clientY-this.pointerDownY);
1403
1284
  }
1404
1285
  }
1405
1286
 
1406
1287
  if (this.hoverEnable) {
1407
1288
  var adjustedCoords = this._getAdjustedCoords(e.clientX, e.clientY);
1408
- var pickProperties = {type:"HOVER", x:adjustedCoords.x, y:adjustedCoords.y};
1289
+ const pickProperties: PickProperties = {
1290
+ type: "HOVER",
1291
+ x: adjustedCoords.x,
1292
+ y: adjustedCoords.y
1293
+ };
1409
1294
 
1410
1295
  if (this.pointerDown) {
1411
- pickProperties.selected = {};
1296
+ pickProperties.selected = [];
1412
1297
  this._dispatchPickEvents( pickProperties );
1413
1298
  }
1414
1299
  else {
@@ -1418,7 +1303,7 @@ export class AvsGoDataViz extends AvsElementBase {
1418
1303
  if (this.hoverHighlightColor !== undefined) pickProperties.highlightColor = this.hoverHighlightColor;
1419
1304
  if (this.hoverHighlightLayerEnable) pickProperties.highlightLayer = true;
1420
1305
 
1421
- this._processPick( pickProperties, true, e.originalTarget );
1306
+ this._processPick( pickProperties, true, e.target );
1422
1307
  }
1423
1308
  }
1424
1309
 
@@ -1428,7 +1313,7 @@ export class AvsGoDataViz extends AvsElementBase {
1428
1313
  /**
1429
1314
  * @param e
1430
1315
  */
1431
- _handlePointerUp(e) {
1316
+ _handlePointerUp(e: PointerEvent) {
1432
1317
  this.pointerDown = false;
1433
1318
 
1434
1319
  if (this.tapping) {
@@ -1436,34 +1321,34 @@ export class AvsGoDataViz extends AvsElementBase {
1436
1321
  var dx = Math.abs(e.clientX - this.pointerDownX);
1437
1322
  var dy = Math.abs(e.clientY - this.pointerDownY);
1438
1323
  if (dx*dx + dy*dy < 25) {
1439
- this._handleTap({detail:{x:e.clientX, y:e.clientY}});
1324
+ this._handleTap(e.clientX, e.clientY, e.currentTarget);
1440
1325
  }
1441
1326
  }
1442
1327
 
1443
1328
  if (this.tracking > 1) {
1444
1329
  this.tracking = 0;
1445
- this._handleTrack({detail:{state:"end", x:e.clientX, y:e.clientY, dx:e.clientX-this.pointerDownX, dy:e.clientY-this.pointerDownY}});
1330
+ this._handleTrack("end", e.clientX, e.clientY, e.clientX-this.pointerDownX, e.clientY-this.pointerDownY);
1446
1331
  }
1447
1332
  }
1448
1333
 
1449
- _getAdjustedCoords(x, y) {
1334
+ _getAdjustedCoords(x: number, y: number) {
1450
1335
  var rect = this.renderRoot.querySelector('#dataVizDiv').getBoundingClientRect();
1451
- var x = Math.round(x - rect.left);
1452
- var y = Math.round(y - rect.top);
1453
- var clampX = Math.max(0, Math.min(x, this.width));
1454
- var clampY = Math.max(0, Math.min(y, this.height));
1336
+ var adjustedX = Math.round(x - rect.left);
1337
+ var adjustedY = Math.round(y - rect.top);
1338
+ var clampX = Math.max(0, Math.min(adjustedX, this.width));
1339
+ var clampY = Math.max(0, Math.min(adjustedY, this.height));
1455
1340
 
1456
1341
  return {x:clampX, y:clampY};
1457
1342
  }
1458
1343
 
1459
- _getAdjustedRectangleCoords(e) {
1344
+ _getAdjustedRectangleCoords(x: number, y: number, dx: number, dy: number) {
1460
1345
  var rect = this.renderRoot.querySelector('#dataVizDiv').getBoundingClientRect();
1461
- var x = Math.round(e.detail.x - rect.left);
1462
- var y = Math.round(e.detail.y - rect.top);
1463
- var clampX = Math.max(0, Math.min(x, this.width));
1464
- var clampY = Math.max(0, Math.min(y, this.height));
1465
- var startX = x - e.detail.dx;
1466
- var startY = y - e.detail.dy;
1346
+ var adjustedX = Math.round(x - rect.left);
1347
+ var adjustedY = Math.round(y - rect.top);
1348
+ var clampX = Math.max(0, Math.min(adjustedX, this.width));
1349
+ var clampY = Math.max(0, Math.min(adjustedY, this.height));
1350
+ var startX = Math.max(0, Math.min(adjustedX - dx, this.width));
1351
+ var startY = Math.max(0, Math.min(adjustedY - dy, this.height));
1467
1352
 
1468
1353
  var left = Math.min(startX, clampX);
1469
1354
  var right = Math.max(startX, clampX);
@@ -1473,12 +1358,12 @@ export class AvsGoDataViz extends AvsElementBase {
1473
1358
  return {left: left, right: right, top: top, bottom: bottom};
1474
1359
  }
1475
1360
 
1476
- _processPick( pickProperties, processEventOnClient, originalTarget ) {
1361
+ _processPick( pickProperties: PickProperties, processEventOnClient?: boolean, originalTarget?: any ) {
1477
1362
  if (processEventOnClient) {
1478
1363
  if (this.threeViewer) {
1479
1364
  // ThreeJS client side pick processing
1480
1365
 
1481
- this.threeViewer.setPickDepth( this._getPickDepth(pickProperties.depth) );
1366
+ this.threeViewer.setPickDepth( pickProperties.depth === "ALL" ? PickDepthEnum.All : PickDepthEnum.Closest );
1482
1367
  if (pickProperties.type === 'TRACK') {
1483
1368
  this.threeViewer.setPickRectangle( pickProperties.left, pickProperties.top, pickProperties.right, pickProperties.bottom );
1484
1369
  }
@@ -1512,7 +1397,7 @@ export class AvsGoDataViz extends AvsElementBase {
1512
1397
  pickProperties.selected = [];
1513
1398
 
1514
1399
  if (pickProperties.type !== 'TRACK' && (originalTarget.nodeName === "polygon" || originalTarget.nodeName === "circle")) {
1515
- var selectedInfo = {};
1400
+ const selectedInfo: SelectedInfo = {};
1516
1401
 
1517
1402
  var seriesIndex = null;
1518
1403
  var element = originalTarget.parentElement;
@@ -1571,9 +1456,10 @@ export class AvsGoDataViz extends AvsElementBase {
1571
1456
  if (pickProperties.type !== 'TRACK' && this.imageMapData !== undefined) {
1572
1457
  for (var i = 0; i < this.imageMapData.length; i++) {
1573
1458
  var area = this.imageMapData[i];
1574
- if (area.shape === "poly" && this._pointInPoly(pickProperties.x, pickProperties.y, area.coords) !== false) {
1459
+ console.log(pickProperties.x + " " + pickProperties.y);
1460
+ if (area.shape === "poly" && this._pointInPoly(pickProperties.x, pickProperties.y, area.coords)) {
1575
1461
 
1576
- var selectedInfo = {};
1462
+ const selectedInfo: SelectedInfo = {};
1577
1463
  if (area.seriesIndex !== null) {
1578
1464
  selectedInfo.seriesIndex = parseInt(area.seriesIndex);
1579
1465
  }
@@ -1608,7 +1494,7 @@ export class AvsGoDataViz extends AvsElementBase {
1608
1494
  }
1609
1495
  }
1610
1496
 
1611
- _pointInPoly(x, y, coords) {
1497
+ _pointInPoly(x: number, y: number, coords: Array<number>): boolean {
1612
1498
  var dx1 = coords[0] - x;
1613
1499
  var dy1 = coords[1] - y;
1614
1500
  var dx2, dy2, f;
@@ -1629,27 +1515,27 @@ export class AvsGoDataViz extends AvsElementBase {
1629
1515
  if (dy2 > 0 && dy1 <= 0) {
1630
1516
  f = (dx1 * dy2) - (dx2 * dy1);
1631
1517
  if (f > 0) k++;
1632
- else if (f === 0) return 0;
1518
+ else if (f === 0) return false;
1633
1519
  }
1634
1520
  else if (dy1 > 0 && dy2 <= 0) {
1635
1521
  f = (dx1 * dy2) - (dx2 * dy1);
1636
1522
  if (f < 0) k++;
1637
- else if (f === 0) return 0;
1523
+ else if (f === 0) return false;
1638
1524
  }
1639
1525
  else if (dy2 === 0 && dy1 < 0) {
1640
1526
  f = (dx1 * dy2) - (dx2 * dy1);
1641
- if (f === 0) return 0;
1527
+ if (f === 0) return false;
1642
1528
  }
1643
1529
  else if (dy1 === 0 && dy2 < 0) {
1644
1530
  f = dx1 * dy2 - dx2 * dy1;
1645
- if (f === 0) return 0;
1531
+ if (f === 0) return false;
1646
1532
  }
1647
1533
  else if (dy1 === 0 && dy2 === 0) {
1648
1534
  if (dx2 <= 0 && dx1 >= 0) {
1649
- return 0;
1535
+ return false;
1650
1536
  }
1651
1537
  else if (dx1 <= 0 && dx2 >= 0) {
1652
- return 0;
1538
+ return false;
1653
1539
  }
1654
1540
  }
1655
1541
 
@@ -1661,75 +1547,65 @@ export class AvsGoDataViz extends AvsElementBase {
1661
1547
  return true;
1662
1548
  }
1663
1549
 
1664
- /**
1665
- * @param strValue
1666
- */
1667
- _getPickDepth( strValue ) {
1668
- if (strValue == "ALL") {
1669
- return PickDepthEnum.All;
1670
- }
1671
- else {
1672
- return PickDepthEnum.Closest;
1673
- }
1674
- }
1675
-
1676
1550
  /**
1677
1551
  * Dispatch the appropriate tap, track or hover event.
1678
1552
  */
1679
- _dispatchPickEvents(pickProperties) {
1553
+ _dispatchPickEvents(pickProperties: PickProperties) {
1554
+
1555
+ const pickDetail: PickDetail = {
1556
+ selected: pickProperties.selected
1557
+ };
1680
1558
 
1681
- var pickEvent = {detail: {selected: pickProperties.selected}};
1682
1559
  if (pickProperties.type === 'TRACK') {
1683
- pickEvent.detail.left = pickProperties.left;
1684
- pickEvent.detail.top = pickProperties.top;
1685
- pickEvent.detail.right = pickProperties.right;
1686
- pickEvent.detail.bottom = pickProperties.bottom;
1560
+ pickDetail.left = pickProperties.left;
1561
+ pickDetail.top = pickProperties.top;
1562
+ pickDetail.right = pickProperties.right;
1563
+ pickDetail.bottom = pickProperties.bottom;
1687
1564
 
1688
1565
  /**
1689
1566
  * A track event occurred.
1690
1567
  * @event avs-track
1691
1568
  */
1692
- this.dispatchEvent(new CustomEvent('avs-track', pickEvent));
1569
+ this.dispatchEvent(new CustomEvent('avs-track', { detail: pickDetail }));
1693
1570
  }
1694
1571
  else {
1695
- pickEvent.detail.x = pickProperties.x;
1696
- pickEvent.detail.y = pickProperties.y;
1572
+ pickDetail.x = pickProperties.x;
1573
+ pickDetail.y = pickProperties.y;
1697
1574
 
1698
1575
  if (pickProperties.type === 'HOVER') {
1699
1576
  /**
1700
1577
  * A hover event occurred.
1701
1578
  * @event avs-hover
1702
1579
  */
1703
- this.dispatchEvent(new CustomEvent('avs-hover', pickEvent));
1580
+ this.dispatchEvent(new CustomEvent('avs-hover', { detail: pickDetail }));
1704
1581
  }
1705
1582
  else {
1706
1583
  /**
1707
1584
  * A tap event occurred.
1708
1585
  * @event avs-tap
1709
1586
  */
1710
- this.dispatchEvent(new CustomEvent('avs-tap', pickEvent));
1587
+ this.dispatchEvent(new CustomEvent('avs-tap', { detail: pickDetail }));
1711
1588
  }
1712
1589
  }
1713
1590
  }
1714
1591
 
1715
1592
  _resetTimer() {
1716
- clearTimeout(this.timer);
1717
- this.timer = setTimeout(function() {
1593
+ window.clearTimeout(this.timer);
1594
+ this.timer = window.setTimeout(() => {
1718
1595
  /**
1719
1596
  * A pointer timeout event occurred.
1720
1597
  * @event avs-pointer-timeout
1721
1598
  */
1722
1599
  this.dispatchEvent(new Event('avs-pointer-timeout'));
1723
- }.bind(this), this.pointerTimeout * 1000);
1600
+ }, this.pointerTimeout * 1000);
1724
1601
  }
1725
1602
 
1726
1603
  constructor() {
1727
1604
  super();
1728
1605
 
1729
1606
  // Set default property values
1730
- this.renderer = 'THREEJS';
1607
+ this.renderer = Renderer.THREEJS;
1731
1608
  this.resizeThreshold = 10;
1732
- this.aspectRatio = 1.777777;
1733
1609
  this.pointerTimeout = 600;
1734
1610
  this.panWidthZoomLevel = 100;
1735
1611
  this.panHeightZoomLevel = 100;
@@ -1775,25 +1651,27 @@ export class AvsGoDataViz extends AvsElementBase {
1775
1651
  ro.unobserve(this);
1776
1652
  }
1777
1653
 
1778
- _handlePointerEnterMotionCaptureControl(e) {
1654
+ _handlePointerEnterMotionCaptureControl(e: PointerEvent) {
1779
1655
  if (!this.showMotionCaptureTooltip) {
1780
1656
  var adjustedCoords = this._getAdjustedCoords(e.clientX, e.clientY);
1781
- var motionCaptureTooltip = this.renderRoot.querySelector('#motionCaptureTooltip');
1657
+ var motionCaptureTooltip = this.renderRoot.querySelector('#motionCaptureTooltip') as HTMLDivElement;
1782
1658
  var pos = this._calcTooltipPosition(motionCaptureTooltip, adjustedCoords.x, adjustedCoords.y);
1783
1659
  motionCaptureTooltip.style.left = pos.x + "px";
1784
1660
  motionCaptureTooltip.style.top = pos.y + "px";
1785
- motionCaptureTooltip.style.opacity = 1;
1786
- motionCaptureTooltip.innerHTML = e.currentTarget.dataset.tooltip ?? e.currentTarget.id;
1661
+ motionCaptureTooltip.style.opacity = "1";
1662
+ const target = e.currentTarget as HTMLElement;
1663
+ motionCaptureTooltip.innerHTML = target.dataset.tooltip ?? target.id;
1787
1664
  this.showMotionCaptureTooltip = true;
1788
1665
  }
1789
1666
  }
1790
1667
 
1791
1668
  _handlePointerLeaveMotionCaptureControl() {
1792
- this.renderRoot.querySelector('#motionCaptureTooltip').style.opacity = 0;
1669
+ var motionCaptureTooltip = this.renderRoot.querySelector('#motionCaptureTooltip') as HTMLDivElement;
1670
+ motionCaptureTooltip.style.opacity = "0";
1793
1671
  this.showMotionCaptureTooltip = false;
1794
1672
  }
1795
1673
 
1796
- _round2dp(n) {
1674
+ _round2dp(n: number) {
1797
1675
  return Math.round((n + Number.EPSILON) * 100) / 100;
1798
1676
  }
1799
1677
 
@@ -1802,7 +1680,7 @@ export class AvsGoDataViz extends AvsElementBase {
1802
1680
  if (this.motionCaptureFrames.length > 0) {
1803
1681
  this.motionCaptureTime += this.motionCaptureDelay;
1804
1682
  }
1805
- const frame = {
1683
+ const frame: MotionCaptureFrame = {
1806
1684
  time: this.motionCaptureTime * 1000,
1807
1685
  scale: this._round2dp(transform.scale),
1808
1686
  position: [this._round2dp(transform.position[0]),
@@ -1818,13 +1696,13 @@ export class AvsGoDataViz extends AvsElementBase {
1818
1696
  if (this.motionCaptureFrames.length == 1) {
1819
1697
  this.renderRoot.querySelector('#motionCapturePlay').classList.remove("disabled");
1820
1698
  this.renderRoot.querySelector('#motionCaptureDelay').classList.remove("disabled");
1821
- this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = "2";
1699
+ this.renderRoot.querySelector('#motionCaptureDelayLabel').innerHTML = "2";
1822
1700
  this.renderRoot.querySelector('#motionCaptureClear').classList.remove("disabled");
1823
1701
  this.renderRoot.querySelector('#motionCaptureCopyData').classList.remove("disabled");
1824
1702
  this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.remove("disabled");
1825
1703
  this.motionCaptureDelay = 2;
1826
1704
  }
1827
- this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerText = this.motionCaptureFrames.length;
1705
+ this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerHTML = String(this.motionCaptureFrames.length);
1828
1706
  }
1829
1707
 
1830
1708
  _handleMotionCaptureDelayIncrease() {
@@ -1832,7 +1710,7 @@ export class AvsGoDataViz extends AvsElementBase {
1832
1710
  if (this.motionCaptureDelay > 9) {
1833
1711
  this.motionCaptureDelay = 9;
1834
1712
  }
1835
- this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = this.motionCaptureDelay;
1713
+ this.renderRoot.querySelector('#motionCaptureDelayLabel').innerHTML = String(this.motionCaptureDelay);
1836
1714
  }
1837
1715
 
1838
1716
  _handleMotionCaptureDelayDecrease() {
@@ -1840,7 +1718,7 @@ export class AvsGoDataViz extends AvsElementBase {
1840
1718
  if (this.motionCaptureDelay < 1) {
1841
1719
  this.motionCaptureDelay = 1;
1842
1720
  }
1843
- this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = this.motionCaptureDelay;
1721
+ this.renderRoot.querySelector('#motionCaptureDelayLabel').innerHTML = String(this.motionCaptureDelay);
1844
1722
  }
1845
1723
 
1846
1724
  _handleMotionCaptureCopyData() {
@@ -1849,29 +1727,31 @@ export class AvsGoDataViz extends AvsElementBase {
1849
1727
  navigator.clipboard.writeText(data);
1850
1728
 
1851
1729
  // Show alert
1852
- this.renderRoot.querySelector('#motionCaptureAlert').innerText = "Motion capture data copied to clipboard";
1853
- this.renderRoot.querySelector('#motionCaptureAlert').style.opacity = 1;
1854
- setTimeout(function () {
1855
- this.renderRoot.querySelector('#motionCaptureAlert').style.opacity = 0;
1856
- }.bind(this), 2000);
1730
+ const motionCaptureAlert = this.renderRoot.querySelector('#motionCaptureAlert') as HTMLDivElement;
1731
+ motionCaptureAlert.innerHTML = "Motion capture URL copied to clipboard";
1732
+ motionCaptureAlert.style.opacity = "1";
1733
+ setTimeout(() => {
1734
+ motionCaptureAlert.style.opacity = "0";
1735
+ }, 2000);
1857
1736
  }
1858
1737
 
1859
1738
  async _handleMotionCaptureCopyUrl() {
1860
1739
  // Convert to JSON, compress and base64url encode
1861
1740
  const json = JSON.stringify(this.motionCaptureFrames);
1862
1741
  const compressed = await this._compress(json);
1863
- const encoded = compressed.toBase64().replaceAll('/', '_').replaceAll('+', '-');
1742
+ const encoded = btoa(String.fromCharCode(...new Uint8Array(compressed))).replaceAll('/', '_').replaceAll('+', '-');
1864
1743
 
1865
1744
  // Create URL and copy to clipboard
1866
1745
  const url = window.location.origin + window.location.pathname + "?motionCapture=" + encoded;
1867
1746
  navigator.clipboard.writeText(url);
1868
1747
 
1869
1748
  // Show alert
1870
- this.renderRoot.querySelector('#motionCaptureAlert').innerText = "Motion capture URL copied to clipboard";
1871
- this.renderRoot.querySelector('#motionCaptureAlert').style.opacity = 1;
1872
- setTimeout(function () {
1873
- this.renderRoot.querySelector('#motionCaptureAlert').style.opacity = 0;
1874
- }.bind(this), 2000);
1749
+ const motionCaptureAlert = this.renderRoot.querySelector('#motionCaptureAlert') as HTMLDivElement;
1750
+ motionCaptureAlert.innerHTML = "Motion capture URL copied to clipboard";
1751
+ motionCaptureAlert.style.opacity = "1";
1752
+ setTimeout(() => {
1753
+ motionCaptureAlert.style.opacity = "0";
1754
+ }, 2000);
1875
1755
  }
1876
1756
 
1877
1757
  /**
@@ -1880,7 +1760,7 @@ export class AvsGoDataViz extends AvsElementBase {
1880
1760
  * @param {string} str
1881
1761
  * @returns {Promise<Uint8Array>}
1882
1762
  */
1883
- async _compress(str) {
1763
+ async _compress(str: string) {
1884
1764
  // Convert the string to a byte stream.
1885
1765
  const stream = new Blob([str]).stream();
1886
1766
 
@@ -1938,9 +1818,9 @@ export class AvsGoDataViz extends AvsElementBase {
1938
1818
  _handleMotionCaptureClear() {
1939
1819
  this.motionCaptureFrames.length = 0;
1940
1820
  this.renderRoot.querySelector('#motionCapturePlay').classList.add("disabled");
1941
- this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerText = "0";
1821
+ this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerHTML = "0";
1942
1822
  this.renderRoot.querySelector('#motionCaptureDelay').classList.add("disabled");
1943
- this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = "0";
1823
+ this.renderRoot.querySelector('#motionCaptureDelayLabel').innerHTML = "0";
1944
1824
  this.renderRoot.querySelector('#motionCaptureClear').classList.add("disabled");
1945
1825
  this.renderRoot.querySelector('#motionCaptureCopyData').classList.add("disabled");
1946
1826
  this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.add("disabled");
@@ -1948,7 +1828,7 @@ export class AvsGoDataViz extends AvsElementBase {
1948
1828
  this.motionCaptureTime = 0;
1949
1829
  }
1950
1830
 
1951
- _updatePixelRatio(change) {
1831
+ _updatePixelRatio(change?: boolean) {
1952
1832
  const pr = window.devicePixelRatio;
1953
1833
  matchMedia( `(resolution: ${pr}dppx)` ).addEventListener('change', this._updatePixelRatio.bind(this, true), { once: true } );
1954
1834
  if (change) {
@@ -1960,27 +1840,8 @@ export class AvsGoDataViz extends AvsElementBase {
1960
1840
  * Change in 'motion-capture-controls-enable' property.
1961
1841
  */
1962
1842
  _motionCaptureControlsEnableChanged(newValue, oldValue) {
1963
- if (newValue) {
1964
- this.renderRoot.querySelector('#motionCapture').style.display = "block";
1965
- }
1966
- else {
1967
- this.renderRoot.querySelector('#motionCapture').style.display = "none";
1968
- }
1969
- }
1970
-
1971
- /**
1972
- * Change in 'hidden' property.
1973
- */
1974
- _hiddenChanged(newValue, oldValue) {
1975
- if (newValue) {
1976
- this.renderRoot.querySelector('#dataVizDiv').style.display = 'none';
1977
- }
1978
- else {
1979
- this.renderRoot.querySelector('#dataVizDiv').style.display = '';
1980
- if (this.threeViewer) {
1981
- this.threeViewer.render();
1982
- }
1983
- }
1843
+ const el = this.renderRoot.querySelector('#motionCapture') as HTMLDivElement;
1844
+ el.style.display = newValue ? "block" : "none";
1984
1845
  }
1985
1846
 
1986
1847
  /**
@@ -2082,7 +1943,7 @@ export class AvsGoDataViz extends AvsElementBase {
2082
1943
  /**
2083
1944
  * Perform a pan to center the specified coordinate of the transformed object in the center of the scene.
2084
1945
  */
2085
- panTo(x, y, z) {
1946
+ panTo(x: number, y: number, z: number) {
2086
1947
  if (this.transformInteractor) {
2087
1948
  this.transformInteractor.panTo(x, y, z);
2088
1949
  }
@@ -2101,7 +1962,8 @@ export class AvsGoDataViz extends AvsElementBase {
2101
1962
  euler.setFromQuaternion(quat);
2102
1963
  return {
2103
1964
  position: pos.toArray(),
2104
- rotation: [euler.x * 180 / Math.PI, euler.y * 180 / Math.PI, euler.z * 180 / Math.PI, euler.order],
1965
+ rotation: [euler.x * 180 / Math.PI, euler.y * 180 / Math.PI, euler.z * 180 / Math.PI],
1966
+ rotationOrder: euler.order,
2105
1967
  scale: 100 * scale.x
2106
1968
  };
2107
1969
  }
@@ -2115,7 +1977,9 @@ export class AvsGoDataViz extends AvsElementBase {
2115
1977
  runAnimation() {
2116
1978
  if (this.threeViewer) {
2117
1979
  var style = window.getComputedStyle(this, null);
2118
- var styleMap = {};
1980
+ var styleMap = {
1981
+ transform: this.motionCaptureFrames.length > 0 ? JSON.stringify(this.motionCaptureFrames) : null
1982
+ };
2119
1983
  this._applyCustomCssProperties(styleMap, style,
2120
1984
  {
2121
1985
  "scene": "--avs-scene-animations",
@@ -2127,7 +1991,6 @@ export class AvsGoDataViz extends AvsElementBase {
2127
1991
  "legendTitle": "--avs-legend-title-animations",
2128
1992
  "glyph": "--avs-glyph-animations"
2129
1993
  });
2130
- styleMap.transform = this.motionCaptureFrames.length > 0 ? JSON.stringify(this.motionCaptureFrames) : null;
2131
1994
 
2132
1995
  this.animator.setStyleMap(styleMap);
2133
1996
  this.threeViewer.runAnimation();
@@ -2187,7 +2050,7 @@ export class AvsGoDataViz extends AvsElementBase {
2187
2050
  }
2188
2051
  catch {
2189
2052
  // Decode from base64url, decompress and parse JSON
2190
- const decoded = Uint8Array.fromBase64(newValue.replaceAll('_', '/').replaceAll('-', '+'));
2053
+ const decoded = atob(newValue).replaceAll('_', '/').replaceAll('-', '+');
2191
2054
  const decompressed = await this._decompress(decoded);
2192
2055
  this.motionCaptureFrames = JSON.parse(decompressed);
2193
2056
  }
@@ -2198,9 +2061,9 @@ export class AvsGoDataViz extends AvsElementBase {
2198
2061
 
2199
2062
  if (this.motionCaptureFrames.length > 0) {
2200
2063
  this.renderRoot.querySelector('#motionCapturePlay').classList.remove("disabled");
2201
- this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerText = this.motionCaptureFrames.length;
2064
+ this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerHTML = String(this.motionCaptureFrames.length);
2202
2065
  this.renderRoot.querySelector('#motionCaptureDelay').classList.remove("disabled");
2203
- this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = "2";
2066
+ this.renderRoot.querySelector('#motionCaptureDelayLabel').innerHTML = "2";
2204
2067
  this.renderRoot.querySelector('#motionCaptureClear').classList.remove("disabled");
2205
2068
  this.renderRoot.querySelector('#motionCaptureCopyData').classList.remove("disabled");
2206
2069
  this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.remove("disabled");
@@ -2209,9 +2072,9 @@ export class AvsGoDataViz extends AvsElementBase {
2209
2072
  }
2210
2073
  else {
2211
2074
  this.renderRoot.querySelector('#motionCapturePlay').classList.add("disabled");
2212
- this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerText = "0";
2075
+ this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerHTML = "0";
2213
2076
  this.renderRoot.querySelector('#motionCaptureDelay').classList.add("disabled");
2214
- this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = "0";
2077
+ this.renderRoot.querySelector('#motionCaptureDelayLabel').innerHTML = "0";
2215
2078
  this.renderRoot.querySelector('#motionCaptureClear').classList.add("disabled");
2216
2079
  this.renderRoot.querySelector('#motionCaptureCopyData').classList.add("disabled");
2217
2080
  this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.add("disabled");
@@ -2299,13 +2162,8 @@ export class AvsGoDataViz extends AvsElementBase {
2299
2162
  this.dispatchEvent(new CustomEvent('avs-pan-info', e));
2300
2163
  }
2301
2164
 
2302
- _zoomOverlayTimeout() {
2303
- this.renderRoot.querySelector('#zoomOverlay').style.opacity = 0;
2304
- this.pointerDown = false;
2305
- }
2306
-
2307
2165
  _handlePanZoom(e) {
2308
- clearTimeout(this.zoomOverlayTimeoutId);
2166
+ window.clearTimeout(this.zoomOverlayTimeoutId);
2309
2167
 
2310
2168
  var width = Math.round(e.detail.widthZoomLevel);
2311
2169
  var height = Math.round(e.detail.heightZoomLevel);
@@ -2317,14 +2175,19 @@ export class AvsGoDataViz extends AvsElementBase {
2317
2175
  }
2318
2176
 
2319
2177
  var coords = this._getAdjustedCoords(e.detail.clientX, e.detail.clientY);
2320
- this.renderRoot.querySelector('#zoomOverlay').style.left = coords.x + "px";
2321
- this.renderRoot.querySelector('#zoomOverlay').style.top = coords.y + "px";
2322
- this.renderRoot.querySelector('#zoomOverlay').style.opacity = 1;
2178
+ const zoomOverlay = this.renderRoot.querySelector('#zoomOverlay') as HTMLDivElement;
2179
+ zoomOverlay.style.left = coords.x + "px";
2180
+ zoomOverlay.style.top = coords.y + "px";
2181
+ zoomOverlay.style.opacity = "1";
2323
2182
 
2324
2183
  this.pointerDown = true;
2325
- this._dispatchPickEvents( {type:"HOVER",x:0,y:0,selected:{}} );
2184
+ this._dispatchPickEvents( {type:"HOVER",x:0,y:0,selected:[]} );
2326
2185
 
2327
- this.zoomOverlayTimeoutId = setTimeout(this._zoomOverlayTimeout.bind(this), 1000);
2186
+ this.zoomOverlayTimeoutId = window.setTimeout(() => {
2187
+ const el = this.renderRoot.querySelector('#zoomOverlay') as HTMLDivElement;
2188
+ el.style.opacity = "0";
2189
+ this.pointerDown = false;
2190
+ }, 1000);
2328
2191
  }
2329
2192
 
2330
2193
  _handlePanZoomEnd(e) {
@@ -2424,7 +2287,7 @@ export class AvsGoDataViz extends AvsElementBase {
2424
2287
  // }
2425
2288
 
2426
2289
  // Search for renderer, if not found create one and save to the DOM
2427
- var renderer = document.getElementById(rendererId);
2290
+ var renderer = document.getElementById(rendererId) as AvsRenderer;
2428
2291
  if (renderer === undefined || renderer === null) {
2429
2292
  renderer = new AvsRenderer();
2430
2293
  renderer.setAttribute('id', rendererId);
@@ -2470,28 +2333,29 @@ export class AvsGoDataViz extends AvsElementBase {
2470
2333
  }
2471
2334
  }
2472
2335
 
2473
- setTooltipHTML(html) {
2336
+ setTooltipHTML(html: string) {
2474
2337
  this.renderRoot.querySelector('#tooltip').innerHTML = html;
2475
2338
  }
2476
2339
 
2477
- showTooltip(clientX, clientY) {
2478
- var tooltip = this.renderRoot.querySelector('#tooltip');
2340
+ showTooltip(clientX: number, clientY: number) {
2341
+ var tooltip = this.renderRoot.querySelector('#tooltip') as HTMLDivElement;
2479
2342
  var pos = this._calcTooltipPosition(tooltip, clientX, clientY);
2480
2343
  tooltip.style.left = pos.x + "px";
2481
2344
  tooltip.style.top = pos.y + "px";
2482
- tooltip.style.opacity = 1;
2345
+ tooltip.style.opacity = "1";
2483
2346
  }
2484
2347
 
2485
2348
  hideTooltip() {
2486
- this.renderRoot.querySelector('#tooltip').style.opacity = 0;
2349
+ var tooltip = this.renderRoot.querySelector('#tooltip') as HTMLDivElement;
2350
+ tooltip.style.opacity = "0";
2487
2351
  }
2488
2352
 
2489
- _calcTooltipPosition(tooltip, clientX, clientY) {
2353
+ _calcTooltipPosition(tooltip: HTMLDivElement, clientX: number, clientY: number) {
2490
2354
 
2491
2355
  // Calculate the tooltip location based on 4 quadrants of the visible portion
2492
2356
  // of the visualization window
2493
2357
 
2494
- var dataVizDiv = this.renderRoot.querySelector('#dataVizDiv');
2358
+ var dataVizDiv = this.renderRoot.querySelector('#dataVizDiv') as HTMLDivElement;
2495
2359
 
2496
2360
  var offset = this._getOffset(dataVizDiv);
2497
2361
  var deltaTop = -Math.min(0, offset.top - window.pageYOffset);
@@ -2505,8 +2369,8 @@ export class AvsGoDataViz extends AvsElementBase {
2505
2369
 
2506
2370
  var toolPosition = { x: 0, y: 0 };
2507
2371
  if (clientX < vizHalfX) {
2508
- var offset = (clientY < vizHalfY) ? 15 : 5;
2509
- toolPosition.x = clientX + offset + dataVizDiv.offsetLeft;
2372
+ var offst = (clientY < vizHalfY) ? 15 : 5;
2373
+ toolPosition.x = clientX + offst + dataVizDiv.offsetLeft;
2510
2374
  }
2511
2375
  else {
2512
2376
  toolPosition.x = clientX - 10 + dataVizDiv.offsetLeft - tooltip.offsetWidth;
@@ -2521,7 +2385,7 @@ export class AvsGoDataViz extends AvsElementBase {
2521
2385
  return toolPosition;
2522
2386
  }
2523
2387
 
2524
- _getOffset(dataVizDiv) {
2388
+ _getOffset(dataVizDiv: HTMLDivElement) {
2525
2389
  var rect = dataVizDiv.getBoundingClientRect(),
2526
2390
  scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
2527
2391
  scrollTop = window.pageYOffset || document.documentElement.scrollTop;
@@ -2529,8 +2393,8 @@ export class AvsGoDataViz extends AvsElementBase {
2529
2393
  }
2530
2394
  }
2531
2395
 
2532
- const ro = new ResizeObserver(entries => {
2533
- entries.forEach(entry => entry.target._onResize(entry.contentRect));
2534
- });
2535
-
2536
- customElements.define('avs-go-dataviz', AvsGoDataViz);
2396
+ declare global {
2397
+ interface HTMLElementTagNameMap {
2398
+ 'avs-go-dataviz': AvsGoDataViz;
2399
+ }
2400
+ }