@avs/go 0.14.71999 → 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.
- package/README.md +1 -1
- package/dist/avs-element-mixin.d.ts +28 -0
- package/dist/avs-element-mixin.d.ts.map +1 -0
- package/dist/avs-element-mixin.js +108 -0
- package/dist/avs-go-dataviz.d.ts +457 -0
- package/dist/avs-go-dataviz.d.ts.map +1 -0
- package/dist/avs-go-dataviz.js +2090 -0
- package/dist/avs-go-dynamic-html.d.ts +52 -0
- package/dist/avs-go-dynamic-html.d.ts.map +1 -0
- package/dist/avs-go-dynamic-html.js +124 -0
- package/dist/avs-go-info.d.ts +57 -0
- package/dist/avs-go-info.d.ts.map +1 -0
- package/dist/avs-go-info.js +127 -0
- package/dist/avs-go.min.js +211 -160
- package/dist/avs-renderer.d.ts +37 -0
- package/dist/avs-renderer.d.ts.map +1 -0
- package/dist/avs-renderer.js +33 -0
- package/dist/constants.d.ts +21 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +20 -0
- package/dist/icons.d.ts +28 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +27 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/types.d.ts +142 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +36 -0
- package/package.json +4 -3
- package/rollup.config.js +17 -7
- package/src/avs-element-mixin.ts +126 -0
- package/src/{avs-go-dataviz.js → avs-go-dataviz.ts} +549 -710
- package/src/{avs-go-dynamic-html.js → avs-go-dynamic-html.ts} +37 -50
- package/src/{avs-go-info.js → avs-go-info.ts} +36 -47
- package/src/{avs-renderer.js → avs-renderer.ts} +10 -2
- package/src/{constants.js → constants.ts} +1 -1
- package/src/icons.ts +29 -0
- package/src/{avs-go.js → index.ts} +3 -3
- package/src/types.ts +160 -0
- package/tsconfig.json +16 -0
- package/src/avs-element-base.js +0 -119
- 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 {
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
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,14 +521,17 @@ 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;
|
|
654
528
|
}
|
|
529
|
+
if (!this.width || !this.height) {
|
|
530
|
+
return undefined;
|
|
531
|
+
}
|
|
655
532
|
|
|
656
533
|
// Scene Properties
|
|
657
|
-
const model = {
|
|
534
|
+
const model: DataVizModel = {
|
|
658
535
|
sceneProperties: {
|
|
659
536
|
name: this.sceneName
|
|
660
537
|
}
|
|
@@ -672,7 +549,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
672
549
|
}
|
|
673
550
|
|
|
674
551
|
// Renderer Properties
|
|
675
|
-
const rendererProperties = {
|
|
552
|
+
const rendererProperties: RendererProperties = {
|
|
676
553
|
width: this.width,
|
|
677
554
|
height: this.height,
|
|
678
555
|
name: this.rendererName,
|
|
@@ -911,84 +788,71 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
911
788
|
/**
|
|
912
789
|
*
|
|
913
790
|
*/
|
|
914
|
-
_onResize() {
|
|
791
|
+
_onResize(contentRect: DOMRect) {
|
|
792
|
+
// Get the width & height provided by our container
|
|
793
|
+
this.width = Math.round(contentRect.width);
|
|
794
|
+
this.height = Math.round(contentRect.height);
|
|
795
|
+
|
|
796
|
+
if (this.rectCanvas) {
|
|
797
|
+
this.rectCanvas.width = this.width;
|
|
798
|
+
this.rectCanvas.height = this.height;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// Check if we need to acquire a new scene due to
|
|
802
|
+
// the size change and other properties
|
|
915
803
|
if (!this.urlLoadJsonFile &&
|
|
916
804
|
!this.manualUpdate &&
|
|
917
805
|
this.resizeThreshold > 0 &&
|
|
918
|
-
(this.
|
|
919
|
-
this.
|
|
920
|
-
this.
|
|
921
|
-
this.
|
|
806
|
+
(!this.lowResizeWidth ||
|
|
807
|
+
this.width < this.lowResizeWidth ||
|
|
808
|
+
this.width > this.highResizeWidth ||
|
|
809
|
+
this.height < this.lowResizeHeight ||
|
|
810
|
+
this.height > this.highResizeHeight)) {
|
|
922
811
|
|
|
812
|
+
this._updateResizeLimits();
|
|
923
813
|
this.updateViewer();
|
|
924
814
|
}
|
|
925
815
|
else {
|
|
926
|
-
this.
|
|
927
|
-
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
/**
|
|
931
|
-
*
|
|
932
|
-
*/
|
|
933
|
-
_updateSize() {
|
|
934
|
-
// Get the width provided by our container
|
|
935
|
-
this.width = this.clientWidth;
|
|
936
|
-
if (this.width <= 0) {
|
|
937
|
-
this.width = 200; // fallback if clientWidth fails
|
|
938
|
-
this.style.width = this.width + "px";
|
|
939
|
-
}
|
|
940
|
-
else {
|
|
941
|
-
this.style.width = "100%";
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
// Get the height provided by our container
|
|
945
|
-
this.height = this.clientHeight;
|
|
946
|
-
if (this.height <= 0) {
|
|
947
|
-
if (this.aspectRatio > 0.1) {
|
|
948
|
-
// Use the aspect ratio if one is set
|
|
949
|
-
this.height = this.width / this.aspectRatio;
|
|
950
|
-
}
|
|
951
|
-
else {
|
|
952
|
-
this.height = 200; // fallback if clientHeight fails
|
|
816
|
+
if (this.threeViewer) {
|
|
817
|
+
this.threeViewer.render(true);
|
|
953
818
|
}
|
|
954
|
-
this.style.height = this.height + "px";
|
|
955
|
-
}
|
|
956
|
-
else {
|
|
957
|
-
this.style.height = "100%";
|
|
958
819
|
}
|
|
820
|
+
}
|
|
959
821
|
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
822
|
+
_updateResizeLimits() {
|
|
823
|
+
this.lowResizeWidth = (100 - this.resizeThreshold) / 100 * this.width;
|
|
824
|
+
this.highResizeWidth = (100 + this.resizeThreshold) / 100 * this.width;
|
|
825
|
+
this.lowResizeHeight = (100 - this.resizeThreshold) / 100 * this.height;
|
|
826
|
+
this.highResizeHeight = (100 + this.resizeThreshold) / 100 * this.height;
|
|
827
|
+
}
|
|
965
828
|
|
|
966
829
|
showSpinner() {
|
|
967
830
|
var spinner = window.getComputedStyle(this, null).getPropertyValue("--avs-spinner").trim().replace(/['"]+/g, '');
|
|
968
831
|
if (spinner.length > 0) {
|
|
969
832
|
fetch(spinner)
|
|
970
833
|
.then((response) => {
|
|
971
|
-
if (
|
|
972
|
-
|
|
834
|
+
if (response.ok) {
|
|
835
|
+
return response.text();
|
|
973
836
|
}
|
|
974
|
-
return response.text();
|
|
975
837
|
})
|
|
976
838
|
.then((html) => {
|
|
977
839
|
this.renderRoot.querySelector('#spinner').innerHTML = html;
|
|
978
840
|
})
|
|
979
841
|
.catch((error) => {
|
|
980
|
-
this.renderRoot.querySelector('#spinner').innerHTML =
|
|
842
|
+
this.renderRoot.querySelector('#spinner').innerHTML = AVS;
|
|
981
843
|
});
|
|
982
844
|
}
|
|
983
845
|
else {
|
|
984
|
-
this.renderRoot.querySelector('#spinner').innerHTML =
|
|
846
|
+
this.renderRoot.querySelector('#spinner').innerHTML = AVS;
|
|
985
847
|
}
|
|
986
848
|
|
|
987
|
-
this.renderRoot.querySelector('#spinner')
|
|
849
|
+
const spinnerEl = this.renderRoot.querySelector('#spinner') as HTMLDivElement;
|
|
850
|
+
spinnerEl.style.display = 'block';
|
|
988
851
|
}
|
|
989
852
|
|
|
990
853
|
hideSpinner() {
|
|
991
|
-
this.renderRoot.querySelector('#spinner')
|
|
854
|
+
const spinnerEl = this.renderRoot.querySelector('#spinner') as HTMLDivElement;
|
|
855
|
+
spinnerEl.style.display = 'none';
|
|
992
856
|
}
|
|
993
857
|
|
|
994
858
|
startSpinner() {
|
|
@@ -1002,13 +866,11 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1002
866
|
/**
|
|
1003
867
|
* At least one of the properties was changed.
|
|
1004
868
|
*/
|
|
1005
|
-
updated(changedProperties) {
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
this.lowResizeHeight = (100 - this.resizeThreshold) / 100 * this.height;
|
|
1011
|
-
this.highResizeHeight = (100 + this.resizeThreshold) / 100 * this.height;
|
|
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
|
+
}
|
|
1012
874
|
|
|
1013
875
|
if (changedProperties.has('renderer')) {
|
|
1014
876
|
this._rendererChanged(this.renderer, changedProperties['renderer']);
|
|
@@ -1070,9 +932,6 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1070
932
|
if (changedProperties.has('motionCapture')) {
|
|
1071
933
|
this._motionCaptureValueChanged(this.motionCapture, changedProperties['motionCapture']);
|
|
1072
934
|
}
|
|
1073
|
-
if (changedProperties.has('hidden')) {
|
|
1074
|
-
this._hiddenChanged(this.hidden, changedProperties['hidden']);
|
|
1075
|
-
}
|
|
1076
935
|
|
|
1077
936
|
if (!this.url) {
|
|
1078
937
|
//this._dispatchErrorEvent(''url' property must point to an instance of AVS/Go server.');
|
|
@@ -1126,9 +985,8 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1126
985
|
|
|
1127
986
|
/**
|
|
1128
987
|
* HTTP error handler.
|
|
1129
|
-
* @param event
|
|
1130
988
|
*/
|
|
1131
|
-
_handleHttpError(
|
|
989
|
+
_handleHttpError() {
|
|
1132
990
|
this.hideSpinner();
|
|
1133
991
|
}
|
|
1134
992
|
|
|
@@ -1140,16 +998,6 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1140
998
|
this.requestUpdate();
|
|
1141
999
|
}
|
|
1142
1000
|
|
|
1143
|
-
/**
|
|
1144
|
-
*
|
|
1145
|
-
*/
|
|
1146
|
-
_updateViewerClient() {
|
|
1147
|
-
this._updateSize();
|
|
1148
|
-
if (this.threeViewer) {
|
|
1149
|
-
this.threeViewer.render(true);
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
1001
|
/**
|
|
1154
1002
|
*
|
|
1155
1003
|
*/
|
|
@@ -1171,60 +1019,64 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1171
1019
|
|
|
1172
1020
|
/**
|
|
1173
1021
|
* HTTP response handler.
|
|
1174
|
-
* @param
|
|
1022
|
+
* @param response Response parsed from HTTP or file.
|
|
1175
1023
|
*/
|
|
1176
|
-
_handleHttpResponse(
|
|
1177
|
-
if (
|
|
1178
|
-
if (
|
|
1179
|
-
this._dispatchPickEvents(
|
|
1024
|
+
_handleHttpResponse(response: DataVizResponse) {
|
|
1025
|
+
if (response) {
|
|
1026
|
+
if (response.selectionInfo) {
|
|
1027
|
+
this._dispatchPickEvents(response.selectionInfo);
|
|
1180
1028
|
}
|
|
1181
1029
|
|
|
1182
|
-
if (
|
|
1183
|
-
var sceneEvent = {detail: json.sceneInfo};
|
|
1030
|
+
if (response.sceneInfo) {
|
|
1184
1031
|
/**
|
|
1185
1032
|
* Scene info from the server.
|
|
1186
1033
|
* @event avs-scene-info
|
|
1187
1034
|
*/
|
|
1188
|
-
this.dispatchEvent(new CustomEvent('avs-scene-info',
|
|
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;
|
|
1189
1041
|
|
|
1190
1042
|
// Set animation controls, tooltip and zoom overlay style to reversed theme
|
|
1191
|
-
if (
|
|
1192
|
-
var col =
|
|
1193
|
-
var bgCol = this.getInheritedBackgroundCol(this
|
|
1194
|
-
var blendedR = (col[0] * col[3]);
|
|
1195
|
-
var blendedG = (col[1] * col[3]);
|
|
1196
|
-
var blendedB = (col[2] * col[3]);
|
|
1197
|
-
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) {
|
|
1198
1050
|
// In case sceneInfo.backgroundColor is transparent, blend with inherited background color
|
|
1199
|
-
blendedR += (bgCol[0] * (1 - col[3]));
|
|
1200
|
-
blendedG += (bgCol[1] * (1 - col[3]));
|
|
1201
|
-
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])));
|
|
1202
1054
|
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
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 + "))";
|
|
1207
1059
|
}
|
|
1208
|
-
if (
|
|
1209
|
-
var col =
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
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] + "))";
|
|
1214
1066
|
}
|
|
1215
|
-
if (
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
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 + ")";
|
|
1220
1072
|
}
|
|
1221
1073
|
}
|
|
1222
1074
|
|
|
1223
|
-
|
|
1224
|
-
this.sceneImage.src =
|
|
1075
|
+
if (response.image) {
|
|
1076
|
+
this.sceneImage.src = response.image;
|
|
1225
1077
|
|
|
1226
|
-
if (
|
|
1227
|
-
this.sceneImageMap.innerHTML = decodeURIComponent(
|
|
1078
|
+
if (response.imagemap) {
|
|
1079
|
+
this.sceneImageMap.innerHTML = decodeURIComponent(response.imagemap.replace(/\+/g, '%20'));
|
|
1228
1080
|
|
|
1229
1081
|
this.imageMapData = Array.from(this.sceneImageMap.querySelectorAll('area')).map(area => {
|
|
1230
1082
|
return {
|
|
@@ -1242,29 +1094,29 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1242
1094
|
}
|
|
1243
1095
|
|
|
1244
1096
|
if (!this.urlLoadJsonFile) {
|
|
1245
|
-
this._dispatchSceneData(
|
|
1097
|
+
this._dispatchSceneData(response);
|
|
1246
1098
|
}
|
|
1247
1099
|
|
|
1248
1100
|
this._handleLoadComplete();
|
|
1249
1101
|
}
|
|
1250
|
-
else if (
|
|
1251
|
-
this.svgDiv.innerHTML = decodeURIComponent(
|
|
1102
|
+
else if (response.svg) {
|
|
1103
|
+
this.svgDiv.innerHTML = decodeURIComponent(response.svg.replace(/\+/g, '%20'));
|
|
1252
1104
|
|
|
1253
1105
|
if (!this.urlLoadJsonFile) {
|
|
1254
|
-
this._dispatchSceneData(
|
|
1106
|
+
this._dispatchSceneData(response);
|
|
1255
1107
|
}
|
|
1256
1108
|
|
|
1257
1109
|
this._handleLoadComplete();
|
|
1258
1110
|
}
|
|
1259
|
-
else if (
|
|
1111
|
+
else if (response.threejs) {
|
|
1260
1112
|
if (!this.urlLoadJsonFile) {
|
|
1261
|
-
this._dispatchSceneData(
|
|
1113
|
+
this._dispatchSceneData(response);
|
|
1262
1114
|
}
|
|
1263
1115
|
|
|
1264
|
-
if (
|
|
1265
|
-
this.threeViewer.loadGeometryAsEvents(
|
|
1116
|
+
if (response.threejs.chunkId) {
|
|
1117
|
+
this.threeViewer.loadGeometryAsEvents(response.threejs, this._handleLoadComplete.bind(this));
|
|
1266
1118
|
|
|
1267
|
-
if (
|
|
1119
|
+
if (response.threejs.moreChunks) {
|
|
1268
1120
|
if (this.urlLoadJsonFile) {
|
|
1269
1121
|
// Load the next chunk file
|
|
1270
1122
|
this.chunkFile++;
|
|
@@ -1274,13 +1126,13 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1274
1126
|
}
|
|
1275
1127
|
else {
|
|
1276
1128
|
// Get the next chunk from the server
|
|
1277
|
-
this.model.rendererProperties.streamProperties.chunkId =
|
|
1129
|
+
this.model.rendererProperties.streamProperties.chunkId = response.threejs.chunkId;
|
|
1278
1130
|
this._httpRequest(this.url, this._handleHttpResponse.bind(this), this._handleHttpError.bind(this), this.model);
|
|
1279
1131
|
}
|
|
1280
1132
|
}
|
|
1281
1133
|
}
|
|
1282
1134
|
else {
|
|
1283
|
-
this.threeViewer.loadGeometryAsJson(
|
|
1135
|
+
this.threeViewer.loadGeometryAsJson(response.threejs, this._handleLoadComplete.bind(this));
|
|
1284
1136
|
}
|
|
1285
1137
|
}
|
|
1286
1138
|
else {
|
|
@@ -1290,7 +1142,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1290
1142
|
}
|
|
1291
1143
|
}
|
|
1292
1144
|
|
|
1293
|
-
getInheritedBackgroundCol(el) {
|
|
1145
|
+
getInheritedBackgroundCol(el: HTMLElement) {
|
|
1294
1146
|
var defaultStyle = this.getDefaultBackground();
|
|
1295
1147
|
|
|
1296
1148
|
var bgCol = window.getComputedStyle(el).backgroundColor;
|
|
@@ -1332,40 +1184,40 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1332
1184
|
/**
|
|
1333
1185
|
*
|
|
1334
1186
|
*/
|
|
1335
|
-
_dispatchSceneData(data) {
|
|
1336
|
-
const event = { detail: data };
|
|
1337
|
-
|
|
1187
|
+
_dispatchSceneData(data: DataVizResponse) {
|
|
1338
1188
|
/**
|
|
1339
1189
|
* Scene data from server.
|
|
1340
1190
|
* @event avs-scene-data
|
|
1341
1191
|
*/
|
|
1342
|
-
this.dispatchEvent(new CustomEvent('avs-scene-data',
|
|
1192
|
+
this.dispatchEvent(new CustomEvent('avs-scene-data', { detail: data }));
|
|
1343
1193
|
}
|
|
1344
1194
|
|
|
1345
1195
|
/**
|
|
1346
1196
|
* @param e
|
|
1347
1197
|
*/
|
|
1348
|
-
_handleTap(
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
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
|
+
};
|
|
1358
1210
|
|
|
1359
|
-
this._processPick( pickProperties, this.tapProcessEventOnClient,
|
|
1211
|
+
this._processPick( pickProperties, this.tapProcessEventOnClient, currentTarget );
|
|
1360
1212
|
}
|
|
1361
1213
|
|
|
1362
1214
|
/**
|
|
1363
1215
|
* @param e
|
|
1364
1216
|
*/
|
|
1365
|
-
_handleTrack(
|
|
1366
|
-
var adjustedCoords = this._getAdjustedRectangleCoords(
|
|
1217
|
+
_handleTrack(state: string, x: number, y: number, dx: number, dy: number) {
|
|
1218
|
+
var adjustedCoords = this._getAdjustedRectangleCoords(x, y, dx, dy);
|
|
1367
1219
|
|
|
1368
|
-
switch(
|
|
1220
|
+
switch(state) {
|
|
1369
1221
|
case 'start':
|
|
1370
1222
|
break;
|
|
1371
1223
|
|
|
@@ -1378,17 +1230,18 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1378
1230
|
case 'end':
|
|
1379
1231
|
this.rectCtx.clearRect(0,0,this.width,this.height);
|
|
1380
1232
|
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
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
|
+
};
|
|
1392
1245
|
|
|
1393
1246
|
this._processPick( pickProperties, this.trackProcessEventOnClient );
|
|
1394
1247
|
break;
|
|
@@ -1398,7 +1251,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1398
1251
|
/**
|
|
1399
1252
|
* @param e
|
|
1400
1253
|
*/
|
|
1401
|
-
_handlePointerDown(e) {
|
|
1254
|
+
_handlePointerDown(e: PointerEvent) {
|
|
1402
1255
|
this.pointerDownX = e.clientX;
|
|
1403
1256
|
this.pointerDownY = e.clientY;
|
|
1404
1257
|
|
|
@@ -1416,27 +1269,31 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1416
1269
|
/**
|
|
1417
1270
|
* @param e
|
|
1418
1271
|
*/
|
|
1419
|
-
_handlePointerMove(e) {
|
|
1272
|
+
_handlePointerMove(e: PointerEvent) {
|
|
1420
1273
|
if (this.tracking >= 1) {
|
|
1421
1274
|
if (this.tracking === 1) {
|
|
1422
1275
|
var dx = Math.abs(e.clientX - this.pointerDownX);
|
|
1423
1276
|
var dy = Math.abs(e.clientY - this.pointerDownY);
|
|
1424
1277
|
if (dx*dx + dy*dy >= 5) {
|
|
1425
1278
|
this.tracking = 2;
|
|
1426
|
-
this._handleTrack(
|
|
1279
|
+
this._handleTrack("start", e.clientX, e.clientY, e.clientX-this.pointerDownX, e.clientY-this.pointerDownY);
|
|
1427
1280
|
}
|
|
1428
1281
|
}
|
|
1429
1282
|
if (this.tracking === 2) {
|
|
1430
|
-
this._handleTrack(
|
|
1283
|
+
this._handleTrack("track", e.clientX, e.clientY, e.clientX-this.pointerDownX, e.clientY-this.pointerDownY);
|
|
1431
1284
|
}
|
|
1432
1285
|
}
|
|
1433
1286
|
|
|
1434
1287
|
if (this.hoverEnable) {
|
|
1435
1288
|
var adjustedCoords = this._getAdjustedCoords(e.clientX, e.clientY);
|
|
1436
|
-
|
|
1289
|
+
const pickProperties: PickProperties = {
|
|
1290
|
+
type: "HOVER",
|
|
1291
|
+
x: adjustedCoords.x,
|
|
1292
|
+
y: adjustedCoords.y
|
|
1293
|
+
};
|
|
1437
1294
|
|
|
1438
1295
|
if (this.pointerDown) {
|
|
1439
|
-
pickProperties.selected =
|
|
1296
|
+
pickProperties.selected = [];
|
|
1440
1297
|
this._dispatchPickEvents( pickProperties );
|
|
1441
1298
|
}
|
|
1442
1299
|
else {
|
|
@@ -1446,7 +1303,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1446
1303
|
if (this.hoverHighlightColor !== undefined) pickProperties.highlightColor = this.hoverHighlightColor;
|
|
1447
1304
|
if (this.hoverHighlightLayerEnable) pickProperties.highlightLayer = true;
|
|
1448
1305
|
|
|
1449
|
-
this._processPick( pickProperties, true, e.
|
|
1306
|
+
this._processPick( pickProperties, true, e.target );
|
|
1450
1307
|
}
|
|
1451
1308
|
}
|
|
1452
1309
|
|
|
@@ -1456,7 +1313,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1456
1313
|
/**
|
|
1457
1314
|
* @param e
|
|
1458
1315
|
*/
|
|
1459
|
-
_handlePointerUp(e) {
|
|
1316
|
+
_handlePointerUp(e: PointerEvent) {
|
|
1460
1317
|
this.pointerDown = false;
|
|
1461
1318
|
|
|
1462
1319
|
if (this.tapping) {
|
|
@@ -1464,34 +1321,34 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1464
1321
|
var dx = Math.abs(e.clientX - this.pointerDownX);
|
|
1465
1322
|
var dy = Math.abs(e.clientY - this.pointerDownY);
|
|
1466
1323
|
if (dx*dx + dy*dy < 25) {
|
|
1467
|
-
this._handleTap(
|
|
1324
|
+
this._handleTap(e.clientX, e.clientY, e.currentTarget);
|
|
1468
1325
|
}
|
|
1469
1326
|
}
|
|
1470
1327
|
|
|
1471
1328
|
if (this.tracking > 1) {
|
|
1472
1329
|
this.tracking = 0;
|
|
1473
|
-
this._handleTrack(
|
|
1330
|
+
this._handleTrack("end", e.clientX, e.clientY, e.clientX-this.pointerDownX, e.clientY-this.pointerDownY);
|
|
1474
1331
|
}
|
|
1475
1332
|
}
|
|
1476
1333
|
|
|
1477
|
-
_getAdjustedCoords(x, y) {
|
|
1334
|
+
_getAdjustedCoords(x: number, y: number) {
|
|
1478
1335
|
var rect = this.renderRoot.querySelector('#dataVizDiv').getBoundingClientRect();
|
|
1479
|
-
var
|
|
1480
|
-
var
|
|
1481
|
-
var clampX = Math.max(0, Math.min(
|
|
1482
|
-
var clampY = Math.max(0, Math.min(
|
|
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));
|
|
1483
1340
|
|
|
1484
1341
|
return {x:clampX, y:clampY};
|
|
1485
1342
|
}
|
|
1486
1343
|
|
|
1487
|
-
_getAdjustedRectangleCoords(
|
|
1344
|
+
_getAdjustedRectangleCoords(x: number, y: number, dx: number, dy: number) {
|
|
1488
1345
|
var rect = this.renderRoot.querySelector('#dataVizDiv').getBoundingClientRect();
|
|
1489
|
-
var
|
|
1490
|
-
var
|
|
1491
|
-
var clampX = Math.max(0, Math.min(
|
|
1492
|
-
var clampY = Math.max(0, Math.min(
|
|
1493
|
-
var startX =
|
|
1494
|
-
var startY =
|
|
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));
|
|
1495
1352
|
|
|
1496
1353
|
var left = Math.min(startX, clampX);
|
|
1497
1354
|
var right = Math.max(startX, clampX);
|
|
@@ -1501,12 +1358,12 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1501
1358
|
return {left: left, right: right, top: top, bottom: bottom};
|
|
1502
1359
|
}
|
|
1503
1360
|
|
|
1504
|
-
_processPick( pickProperties, processEventOnClient, originalTarget ) {
|
|
1361
|
+
_processPick( pickProperties: PickProperties, processEventOnClient?: boolean, originalTarget?: any ) {
|
|
1505
1362
|
if (processEventOnClient) {
|
|
1506
1363
|
if (this.threeViewer) {
|
|
1507
1364
|
// ThreeJS client side pick processing
|
|
1508
1365
|
|
|
1509
|
-
this.threeViewer.setPickDepth(
|
|
1366
|
+
this.threeViewer.setPickDepth( pickProperties.depth === "ALL" ? PickDepthEnum.All : PickDepthEnum.Closest );
|
|
1510
1367
|
if (pickProperties.type === 'TRACK') {
|
|
1511
1368
|
this.threeViewer.setPickRectangle( pickProperties.left, pickProperties.top, pickProperties.right, pickProperties.bottom );
|
|
1512
1369
|
}
|
|
@@ -1540,7 +1397,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1540
1397
|
pickProperties.selected = [];
|
|
1541
1398
|
|
|
1542
1399
|
if (pickProperties.type !== 'TRACK' && (originalTarget.nodeName === "polygon" || originalTarget.nodeName === "circle")) {
|
|
1543
|
-
|
|
1400
|
+
const selectedInfo: SelectedInfo = {};
|
|
1544
1401
|
|
|
1545
1402
|
var seriesIndex = null;
|
|
1546
1403
|
var element = originalTarget.parentElement;
|
|
@@ -1599,9 +1456,10 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1599
1456
|
if (pickProperties.type !== 'TRACK' && this.imageMapData !== undefined) {
|
|
1600
1457
|
for (var i = 0; i < this.imageMapData.length; i++) {
|
|
1601
1458
|
var area = this.imageMapData[i];
|
|
1602
|
-
|
|
1459
|
+
console.log(pickProperties.x + " " + pickProperties.y);
|
|
1460
|
+
if (area.shape === "poly" && this._pointInPoly(pickProperties.x, pickProperties.y, area.coords)) {
|
|
1603
1461
|
|
|
1604
|
-
|
|
1462
|
+
const selectedInfo: SelectedInfo = {};
|
|
1605
1463
|
if (area.seriesIndex !== null) {
|
|
1606
1464
|
selectedInfo.seriesIndex = parseInt(area.seriesIndex);
|
|
1607
1465
|
}
|
|
@@ -1636,7 +1494,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1636
1494
|
}
|
|
1637
1495
|
}
|
|
1638
1496
|
|
|
1639
|
-
_pointInPoly(x, y, coords) {
|
|
1497
|
+
_pointInPoly(x: number, y: number, coords: Array<number>): boolean {
|
|
1640
1498
|
var dx1 = coords[0] - x;
|
|
1641
1499
|
var dy1 = coords[1] - y;
|
|
1642
1500
|
var dx2, dy2, f;
|
|
@@ -1657,27 +1515,27 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1657
1515
|
if (dy2 > 0 && dy1 <= 0) {
|
|
1658
1516
|
f = (dx1 * dy2) - (dx2 * dy1);
|
|
1659
1517
|
if (f > 0) k++;
|
|
1660
|
-
else if (f === 0) return
|
|
1518
|
+
else if (f === 0) return false;
|
|
1661
1519
|
}
|
|
1662
1520
|
else if (dy1 > 0 && dy2 <= 0) {
|
|
1663
1521
|
f = (dx1 * dy2) - (dx2 * dy1);
|
|
1664
1522
|
if (f < 0) k++;
|
|
1665
|
-
else if (f === 0) return
|
|
1523
|
+
else if (f === 0) return false;
|
|
1666
1524
|
}
|
|
1667
1525
|
else if (dy2 === 0 && dy1 < 0) {
|
|
1668
1526
|
f = (dx1 * dy2) - (dx2 * dy1);
|
|
1669
|
-
if (f === 0) return
|
|
1527
|
+
if (f === 0) return false;
|
|
1670
1528
|
}
|
|
1671
1529
|
else if (dy1 === 0 && dy2 < 0) {
|
|
1672
1530
|
f = dx1 * dy2 - dx2 * dy1;
|
|
1673
|
-
if (f === 0) return
|
|
1531
|
+
if (f === 0) return false;
|
|
1674
1532
|
}
|
|
1675
1533
|
else if (dy1 === 0 && dy2 === 0) {
|
|
1676
1534
|
if (dx2 <= 0 && dx1 >= 0) {
|
|
1677
|
-
return
|
|
1535
|
+
return false;
|
|
1678
1536
|
}
|
|
1679
1537
|
else if (dx1 <= 0 && dx2 >= 0) {
|
|
1680
|
-
return
|
|
1538
|
+
return false;
|
|
1681
1539
|
}
|
|
1682
1540
|
}
|
|
1683
1541
|
|
|
@@ -1689,80 +1547,73 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1689
1547
|
return true;
|
|
1690
1548
|
}
|
|
1691
1549
|
|
|
1692
|
-
/**
|
|
1693
|
-
* @param strValue
|
|
1694
|
-
*/
|
|
1695
|
-
_getPickDepth( strValue ) {
|
|
1696
|
-
if (strValue == "ALL") {
|
|
1697
|
-
return PickDepthEnum.All;
|
|
1698
|
-
}
|
|
1699
|
-
else {
|
|
1700
|
-
return PickDepthEnum.Closest;
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
|
|
1704
1550
|
/**
|
|
1705
1551
|
* Dispatch the appropriate tap, track or hover event.
|
|
1706
1552
|
*/
|
|
1707
|
-
_dispatchPickEvents(pickProperties) {
|
|
1553
|
+
_dispatchPickEvents(pickProperties: PickProperties) {
|
|
1554
|
+
|
|
1555
|
+
const pickDetail: PickDetail = {
|
|
1556
|
+
selected: pickProperties.selected
|
|
1557
|
+
};
|
|
1708
1558
|
|
|
1709
|
-
var pickEvent = {detail: {selected: pickProperties.selected}};
|
|
1710
1559
|
if (pickProperties.type === 'TRACK') {
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1560
|
+
pickDetail.left = pickProperties.left;
|
|
1561
|
+
pickDetail.top = pickProperties.top;
|
|
1562
|
+
pickDetail.right = pickProperties.right;
|
|
1563
|
+
pickDetail.bottom = pickProperties.bottom;
|
|
1715
1564
|
|
|
1716
1565
|
/**
|
|
1717
1566
|
* A track event occurred.
|
|
1718
1567
|
* @event avs-track
|
|
1719
1568
|
*/
|
|
1720
|
-
this.dispatchEvent(new CustomEvent('avs-track',
|
|
1569
|
+
this.dispatchEvent(new CustomEvent('avs-track', { detail: pickDetail }));
|
|
1721
1570
|
}
|
|
1722
1571
|
else {
|
|
1723
|
-
|
|
1724
|
-
|
|
1572
|
+
pickDetail.x = pickProperties.x;
|
|
1573
|
+
pickDetail.y = pickProperties.y;
|
|
1725
1574
|
|
|
1726
1575
|
if (pickProperties.type === 'HOVER') {
|
|
1727
1576
|
/**
|
|
1728
1577
|
* A hover event occurred.
|
|
1729
1578
|
* @event avs-hover
|
|
1730
1579
|
*/
|
|
1731
|
-
this.dispatchEvent(new CustomEvent('avs-hover',
|
|
1580
|
+
this.dispatchEvent(new CustomEvent('avs-hover', { detail: pickDetail }));
|
|
1732
1581
|
}
|
|
1733
1582
|
else {
|
|
1734
1583
|
/**
|
|
1735
1584
|
* A tap event occurred.
|
|
1736
1585
|
* @event avs-tap
|
|
1737
1586
|
*/
|
|
1738
|
-
this.dispatchEvent(new CustomEvent('avs-tap',
|
|
1587
|
+
this.dispatchEvent(new CustomEvent('avs-tap', { detail: pickDetail }));
|
|
1739
1588
|
}
|
|
1740
1589
|
}
|
|
1741
1590
|
}
|
|
1742
1591
|
|
|
1743
1592
|
_resetTimer() {
|
|
1744
|
-
clearTimeout(this.timer);
|
|
1745
|
-
this.timer = setTimeout(
|
|
1593
|
+
window.clearTimeout(this.timer);
|
|
1594
|
+
this.timer = window.setTimeout(() => {
|
|
1746
1595
|
/**
|
|
1747
1596
|
* A pointer timeout event occurred.
|
|
1748
1597
|
* @event avs-pointer-timeout
|
|
1749
1598
|
*/
|
|
1750
1599
|
this.dispatchEvent(new Event('avs-pointer-timeout'));
|
|
1751
|
-
}
|
|
1600
|
+
}, this.pointerTimeout * 1000);
|
|
1752
1601
|
}
|
|
1753
1602
|
|
|
1754
1603
|
constructor() {
|
|
1755
1604
|
super();
|
|
1756
1605
|
|
|
1757
1606
|
// Set default property values
|
|
1758
|
-
this.renderer =
|
|
1607
|
+
this.renderer = Renderer.THREEJS;
|
|
1759
1608
|
this.resizeThreshold = 10;
|
|
1760
|
-
this.aspectRatio = 1.777777;
|
|
1761
1609
|
this.pointerTimeout = 600;
|
|
1762
1610
|
this.panWidthZoomLevel = 100;
|
|
1763
1611
|
this.panHeightZoomLevel = 100;
|
|
1764
1612
|
this.panMaximumZoomLevel = 1000;
|
|
1765
1613
|
|
|
1614
|
+
this.lowResizeWidth = this.highResizeWidth = 0;
|
|
1615
|
+
this.highResizeWidth = this.highResizeHeight = 0;
|
|
1616
|
+
|
|
1766
1617
|
this.motionCaptureTime = 0;
|
|
1767
1618
|
this.motionCaptureFrames ??= [];
|
|
1768
1619
|
|
|
@@ -1800,25 +1651,27 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1800
1651
|
ro.unobserve(this);
|
|
1801
1652
|
}
|
|
1802
1653
|
|
|
1803
|
-
_handlePointerEnterMotionCaptureControl(e) {
|
|
1654
|
+
_handlePointerEnterMotionCaptureControl(e: PointerEvent) {
|
|
1804
1655
|
if (!this.showMotionCaptureTooltip) {
|
|
1805
1656
|
var adjustedCoords = this._getAdjustedCoords(e.clientX, e.clientY);
|
|
1806
|
-
var motionCaptureTooltip = this.renderRoot.querySelector('#motionCaptureTooltip');
|
|
1657
|
+
var motionCaptureTooltip = this.renderRoot.querySelector('#motionCaptureTooltip') as HTMLDivElement;
|
|
1807
1658
|
var pos = this._calcTooltipPosition(motionCaptureTooltip, adjustedCoords.x, adjustedCoords.y);
|
|
1808
1659
|
motionCaptureTooltip.style.left = pos.x + "px";
|
|
1809
1660
|
motionCaptureTooltip.style.top = pos.y + "px";
|
|
1810
|
-
motionCaptureTooltip.style.opacity = 1;
|
|
1811
|
-
|
|
1661
|
+
motionCaptureTooltip.style.opacity = "1";
|
|
1662
|
+
const target = e.currentTarget as HTMLElement;
|
|
1663
|
+
motionCaptureTooltip.innerHTML = target.dataset.tooltip ?? target.id;
|
|
1812
1664
|
this.showMotionCaptureTooltip = true;
|
|
1813
1665
|
}
|
|
1814
1666
|
}
|
|
1815
1667
|
|
|
1816
1668
|
_handlePointerLeaveMotionCaptureControl() {
|
|
1817
|
-
this.renderRoot.querySelector('#motionCaptureTooltip')
|
|
1669
|
+
var motionCaptureTooltip = this.renderRoot.querySelector('#motionCaptureTooltip') as HTMLDivElement;
|
|
1670
|
+
motionCaptureTooltip.style.opacity = "0";
|
|
1818
1671
|
this.showMotionCaptureTooltip = false;
|
|
1819
1672
|
}
|
|
1820
1673
|
|
|
1821
|
-
_round2dp(n) {
|
|
1674
|
+
_round2dp(n: number) {
|
|
1822
1675
|
return Math.round((n + Number.EPSILON) * 100) / 100;
|
|
1823
1676
|
}
|
|
1824
1677
|
|
|
@@ -1827,7 +1680,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1827
1680
|
if (this.motionCaptureFrames.length > 0) {
|
|
1828
1681
|
this.motionCaptureTime += this.motionCaptureDelay;
|
|
1829
1682
|
}
|
|
1830
|
-
const frame = {
|
|
1683
|
+
const frame: MotionCaptureFrame = {
|
|
1831
1684
|
time: this.motionCaptureTime * 1000,
|
|
1832
1685
|
scale: this._round2dp(transform.scale),
|
|
1833
1686
|
position: [this._round2dp(transform.position[0]),
|
|
@@ -1843,13 +1696,13 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1843
1696
|
if (this.motionCaptureFrames.length == 1) {
|
|
1844
1697
|
this.renderRoot.querySelector('#motionCapturePlay').classList.remove("disabled");
|
|
1845
1698
|
this.renderRoot.querySelector('#motionCaptureDelay').classList.remove("disabled");
|
|
1846
|
-
this.renderRoot.querySelector('#motionCaptureDelayLabel').
|
|
1699
|
+
this.renderRoot.querySelector('#motionCaptureDelayLabel').innerHTML = "2";
|
|
1847
1700
|
this.renderRoot.querySelector('#motionCaptureClear').classList.remove("disabled");
|
|
1848
1701
|
this.renderRoot.querySelector('#motionCaptureCopyData').classList.remove("disabled");
|
|
1849
1702
|
this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.remove("disabled");
|
|
1850
1703
|
this.motionCaptureDelay = 2;
|
|
1851
1704
|
}
|
|
1852
|
-
this.renderRoot.querySelector('#motionCaptureSnapshotLabel').
|
|
1705
|
+
this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerHTML = String(this.motionCaptureFrames.length);
|
|
1853
1706
|
}
|
|
1854
1707
|
|
|
1855
1708
|
_handleMotionCaptureDelayIncrease() {
|
|
@@ -1857,7 +1710,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1857
1710
|
if (this.motionCaptureDelay > 9) {
|
|
1858
1711
|
this.motionCaptureDelay = 9;
|
|
1859
1712
|
}
|
|
1860
|
-
this.renderRoot.querySelector('#motionCaptureDelayLabel').
|
|
1713
|
+
this.renderRoot.querySelector('#motionCaptureDelayLabel').innerHTML = String(this.motionCaptureDelay);
|
|
1861
1714
|
}
|
|
1862
1715
|
|
|
1863
1716
|
_handleMotionCaptureDelayDecrease() {
|
|
@@ -1865,7 +1718,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1865
1718
|
if (this.motionCaptureDelay < 1) {
|
|
1866
1719
|
this.motionCaptureDelay = 1;
|
|
1867
1720
|
}
|
|
1868
|
-
this.renderRoot.querySelector('#motionCaptureDelayLabel').
|
|
1721
|
+
this.renderRoot.querySelector('#motionCaptureDelayLabel').innerHTML = String(this.motionCaptureDelay);
|
|
1869
1722
|
}
|
|
1870
1723
|
|
|
1871
1724
|
_handleMotionCaptureCopyData() {
|
|
@@ -1874,29 +1727,31 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1874
1727
|
navigator.clipboard.writeText(data);
|
|
1875
1728
|
|
|
1876
1729
|
// Show alert
|
|
1877
|
-
this.renderRoot.querySelector('#motionCaptureAlert')
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
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);
|
|
1882
1736
|
}
|
|
1883
1737
|
|
|
1884
1738
|
async _handleMotionCaptureCopyUrl() {
|
|
1885
1739
|
// Convert to JSON, compress and base64url encode
|
|
1886
1740
|
const json = JSON.stringify(this.motionCaptureFrames);
|
|
1887
1741
|
const compressed = await this._compress(json);
|
|
1888
|
-
const encoded =
|
|
1742
|
+
const encoded = btoa(String.fromCharCode(...new Uint8Array(compressed))).replaceAll('/', '_').replaceAll('+', '-');
|
|
1889
1743
|
|
|
1890
1744
|
// Create URL and copy to clipboard
|
|
1891
1745
|
const url = window.location.origin + window.location.pathname + "?motionCapture=" + encoded;
|
|
1892
1746
|
navigator.clipboard.writeText(url);
|
|
1893
1747
|
|
|
1894
1748
|
// Show alert
|
|
1895
|
-
this.renderRoot.querySelector('#motionCaptureAlert')
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
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);
|
|
1900
1755
|
}
|
|
1901
1756
|
|
|
1902
1757
|
/**
|
|
@@ -1905,7 +1760,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1905
1760
|
* @param {string} str
|
|
1906
1761
|
* @returns {Promise<Uint8Array>}
|
|
1907
1762
|
*/
|
|
1908
|
-
async _compress(str) {
|
|
1763
|
+
async _compress(str: string) {
|
|
1909
1764
|
// Convert the string to a byte stream.
|
|
1910
1765
|
const stream = new Blob([str]).stream();
|
|
1911
1766
|
|
|
@@ -1963,9 +1818,9 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1963
1818
|
_handleMotionCaptureClear() {
|
|
1964
1819
|
this.motionCaptureFrames.length = 0;
|
|
1965
1820
|
this.renderRoot.querySelector('#motionCapturePlay').classList.add("disabled");
|
|
1966
|
-
this.renderRoot.querySelector('#motionCaptureSnapshotLabel').
|
|
1821
|
+
this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerHTML = "0";
|
|
1967
1822
|
this.renderRoot.querySelector('#motionCaptureDelay').classList.add("disabled");
|
|
1968
|
-
this.renderRoot.querySelector('#motionCaptureDelayLabel').
|
|
1823
|
+
this.renderRoot.querySelector('#motionCaptureDelayLabel').innerHTML = "0";
|
|
1969
1824
|
this.renderRoot.querySelector('#motionCaptureClear').classList.add("disabled");
|
|
1970
1825
|
this.renderRoot.querySelector('#motionCaptureCopyData').classList.add("disabled");
|
|
1971
1826
|
this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.add("disabled");
|
|
@@ -1973,7 +1828,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1973
1828
|
this.motionCaptureTime = 0;
|
|
1974
1829
|
}
|
|
1975
1830
|
|
|
1976
|
-
_updatePixelRatio(change) {
|
|
1831
|
+
_updatePixelRatio(change?: boolean) {
|
|
1977
1832
|
const pr = window.devicePixelRatio;
|
|
1978
1833
|
matchMedia( `(resolution: ${pr}dppx)` ).addEventListener('change', this._updatePixelRatio.bind(this, true), { once: true } );
|
|
1979
1834
|
if (change) {
|
|
@@ -1985,27 +1840,8 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
1985
1840
|
* Change in 'motion-capture-controls-enable' property.
|
|
1986
1841
|
*/
|
|
1987
1842
|
_motionCaptureControlsEnableChanged(newValue, oldValue) {
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
}
|
|
1991
|
-
else {
|
|
1992
|
-
this.renderRoot.querySelector('#motionCapture').style.display = "none";
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
|
-
/**
|
|
1997
|
-
* Change in 'hidden' property.
|
|
1998
|
-
*/
|
|
1999
|
-
_hiddenChanged(newValue, oldValue) {
|
|
2000
|
-
if (newValue) {
|
|
2001
|
-
this.renderRoot.querySelector('#dataVizDiv').style.display = 'none';
|
|
2002
|
-
}
|
|
2003
|
-
else {
|
|
2004
|
-
this.renderRoot.querySelector('#dataVizDiv').style.display = '';
|
|
2005
|
-
if (this.threeViewer) {
|
|
2006
|
-
this.threeViewer.render();
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
1843
|
+
const el = this.renderRoot.querySelector('#motionCapture') as HTMLDivElement;
|
|
1844
|
+
el.style.display = newValue ? "block" : "none";
|
|
2009
1845
|
}
|
|
2010
1846
|
|
|
2011
1847
|
/**
|
|
@@ -2107,7 +1943,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2107
1943
|
/**
|
|
2108
1944
|
* Perform a pan to center the specified coordinate of the transformed object in the center of the scene.
|
|
2109
1945
|
*/
|
|
2110
|
-
panTo(x, y, z) {
|
|
1946
|
+
panTo(x: number, y: number, z: number) {
|
|
2111
1947
|
if (this.transformInteractor) {
|
|
2112
1948
|
this.transformInteractor.panTo(x, y, z);
|
|
2113
1949
|
}
|
|
@@ -2126,7 +1962,8 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2126
1962
|
euler.setFromQuaternion(quat);
|
|
2127
1963
|
return {
|
|
2128
1964
|
position: pos.toArray(),
|
|
2129
|
-
rotation: [euler.x * 180 / Math.PI, euler.y * 180 / Math.PI, euler.z * 180 / Math.PI
|
|
1965
|
+
rotation: [euler.x * 180 / Math.PI, euler.y * 180 / Math.PI, euler.z * 180 / Math.PI],
|
|
1966
|
+
rotationOrder: euler.order,
|
|
2130
1967
|
scale: 100 * scale.x
|
|
2131
1968
|
};
|
|
2132
1969
|
}
|
|
@@ -2140,7 +1977,9 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2140
1977
|
runAnimation() {
|
|
2141
1978
|
if (this.threeViewer) {
|
|
2142
1979
|
var style = window.getComputedStyle(this, null);
|
|
2143
|
-
var styleMap = {
|
|
1980
|
+
var styleMap = {
|
|
1981
|
+
transform: this.motionCaptureFrames.length > 0 ? JSON.stringify(this.motionCaptureFrames) : null
|
|
1982
|
+
};
|
|
2144
1983
|
this._applyCustomCssProperties(styleMap, style,
|
|
2145
1984
|
{
|
|
2146
1985
|
"scene": "--avs-scene-animations",
|
|
@@ -2152,7 +1991,6 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2152
1991
|
"legendTitle": "--avs-legend-title-animations",
|
|
2153
1992
|
"glyph": "--avs-glyph-animations"
|
|
2154
1993
|
});
|
|
2155
|
-
styleMap.transform = this.motionCaptureFrames.length > 0 ? JSON.stringify(this.motionCaptureFrames) : null;
|
|
2156
1994
|
|
|
2157
1995
|
this.animator.setStyleMap(styleMap);
|
|
2158
1996
|
this.threeViewer.runAnimation();
|
|
@@ -2212,7 +2050,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2212
2050
|
}
|
|
2213
2051
|
catch {
|
|
2214
2052
|
// Decode from base64url, decompress and parse JSON
|
|
2215
|
-
const decoded =
|
|
2053
|
+
const decoded = atob(newValue).replaceAll('_', '/').replaceAll('-', '+');
|
|
2216
2054
|
const decompressed = await this._decompress(decoded);
|
|
2217
2055
|
this.motionCaptureFrames = JSON.parse(decompressed);
|
|
2218
2056
|
}
|
|
@@ -2223,9 +2061,9 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2223
2061
|
|
|
2224
2062
|
if (this.motionCaptureFrames.length > 0) {
|
|
2225
2063
|
this.renderRoot.querySelector('#motionCapturePlay').classList.remove("disabled");
|
|
2226
|
-
this.renderRoot.querySelector('#motionCaptureSnapshotLabel').
|
|
2064
|
+
this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerHTML = String(this.motionCaptureFrames.length);
|
|
2227
2065
|
this.renderRoot.querySelector('#motionCaptureDelay').classList.remove("disabled");
|
|
2228
|
-
this.renderRoot.querySelector('#motionCaptureDelayLabel').
|
|
2066
|
+
this.renderRoot.querySelector('#motionCaptureDelayLabel').innerHTML = "2";
|
|
2229
2067
|
this.renderRoot.querySelector('#motionCaptureClear').classList.remove("disabled");
|
|
2230
2068
|
this.renderRoot.querySelector('#motionCaptureCopyData').classList.remove("disabled");
|
|
2231
2069
|
this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.remove("disabled");
|
|
@@ -2234,9 +2072,9 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2234
2072
|
}
|
|
2235
2073
|
else {
|
|
2236
2074
|
this.renderRoot.querySelector('#motionCapturePlay').classList.add("disabled");
|
|
2237
|
-
this.renderRoot.querySelector('#motionCaptureSnapshotLabel').
|
|
2075
|
+
this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerHTML = "0";
|
|
2238
2076
|
this.renderRoot.querySelector('#motionCaptureDelay').classList.add("disabled");
|
|
2239
|
-
this.renderRoot.querySelector('#motionCaptureDelayLabel').
|
|
2077
|
+
this.renderRoot.querySelector('#motionCaptureDelayLabel').innerHTML = "0";
|
|
2240
2078
|
this.renderRoot.querySelector('#motionCaptureClear').classList.add("disabled");
|
|
2241
2079
|
this.renderRoot.querySelector('#motionCaptureCopyData').classList.add("disabled");
|
|
2242
2080
|
this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.add("disabled");
|
|
@@ -2324,13 +2162,8 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2324
2162
|
this.dispatchEvent(new CustomEvent('avs-pan-info', e));
|
|
2325
2163
|
}
|
|
2326
2164
|
|
|
2327
|
-
_zoomOverlayTimeout() {
|
|
2328
|
-
this.renderRoot.querySelector('#zoomOverlay').style.opacity = 0;
|
|
2329
|
-
this.pointerDown = false;
|
|
2330
|
-
}
|
|
2331
|
-
|
|
2332
2165
|
_handlePanZoom(e) {
|
|
2333
|
-
clearTimeout(this.zoomOverlayTimeoutId);
|
|
2166
|
+
window.clearTimeout(this.zoomOverlayTimeoutId);
|
|
2334
2167
|
|
|
2335
2168
|
var width = Math.round(e.detail.widthZoomLevel);
|
|
2336
2169
|
var height = Math.round(e.detail.heightZoomLevel);
|
|
@@ -2342,14 +2175,19 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2342
2175
|
}
|
|
2343
2176
|
|
|
2344
2177
|
var coords = this._getAdjustedCoords(e.detail.clientX, e.detail.clientY);
|
|
2345
|
-
this.renderRoot.querySelector('#zoomOverlay')
|
|
2346
|
-
|
|
2347
|
-
|
|
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";
|
|
2348
2182
|
|
|
2349
2183
|
this.pointerDown = true;
|
|
2350
|
-
this._dispatchPickEvents( {type:"HOVER",x:0,y:0,selected:
|
|
2184
|
+
this._dispatchPickEvents( {type:"HOVER",x:0,y:0,selected:[]} );
|
|
2351
2185
|
|
|
2352
|
-
this.zoomOverlayTimeoutId = setTimeout(
|
|
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);
|
|
2353
2191
|
}
|
|
2354
2192
|
|
|
2355
2193
|
_handlePanZoomEnd(e) {
|
|
@@ -2449,7 +2287,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2449
2287
|
// }
|
|
2450
2288
|
|
|
2451
2289
|
// Search for renderer, if not found create one and save to the DOM
|
|
2452
|
-
var renderer = document.getElementById(rendererId);
|
|
2290
|
+
var renderer = document.getElementById(rendererId) as AvsRenderer;
|
|
2453
2291
|
if (renderer === undefined || renderer === null) {
|
|
2454
2292
|
renderer = new AvsRenderer();
|
|
2455
2293
|
renderer.setAttribute('id', rendererId);
|
|
@@ -2495,28 +2333,29 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2495
2333
|
}
|
|
2496
2334
|
}
|
|
2497
2335
|
|
|
2498
|
-
setTooltipHTML(html) {
|
|
2336
|
+
setTooltipHTML(html: string) {
|
|
2499
2337
|
this.renderRoot.querySelector('#tooltip').innerHTML = html;
|
|
2500
2338
|
}
|
|
2501
2339
|
|
|
2502
|
-
showTooltip(clientX, clientY) {
|
|
2503
|
-
var tooltip = this.renderRoot.querySelector('#tooltip');
|
|
2340
|
+
showTooltip(clientX: number, clientY: number) {
|
|
2341
|
+
var tooltip = this.renderRoot.querySelector('#tooltip') as HTMLDivElement;
|
|
2504
2342
|
var pos = this._calcTooltipPosition(tooltip, clientX, clientY);
|
|
2505
2343
|
tooltip.style.left = pos.x + "px";
|
|
2506
2344
|
tooltip.style.top = pos.y + "px";
|
|
2507
|
-
tooltip.style.opacity = 1;
|
|
2345
|
+
tooltip.style.opacity = "1";
|
|
2508
2346
|
}
|
|
2509
2347
|
|
|
2510
2348
|
hideTooltip() {
|
|
2511
|
-
this.renderRoot.querySelector('#tooltip')
|
|
2349
|
+
var tooltip = this.renderRoot.querySelector('#tooltip') as HTMLDivElement;
|
|
2350
|
+
tooltip.style.opacity = "0";
|
|
2512
2351
|
}
|
|
2513
2352
|
|
|
2514
|
-
_calcTooltipPosition(tooltip, clientX, clientY) {
|
|
2353
|
+
_calcTooltipPosition(tooltip: HTMLDivElement, clientX: number, clientY: number) {
|
|
2515
2354
|
|
|
2516
2355
|
// Calculate the tooltip location based on 4 quadrants of the visible portion
|
|
2517
2356
|
// of the visualization window
|
|
2518
2357
|
|
|
2519
|
-
var dataVizDiv = this.renderRoot.querySelector('#dataVizDiv');
|
|
2358
|
+
var dataVizDiv = this.renderRoot.querySelector('#dataVizDiv') as HTMLDivElement;
|
|
2520
2359
|
|
|
2521
2360
|
var offset = this._getOffset(dataVizDiv);
|
|
2522
2361
|
var deltaTop = -Math.min(0, offset.top - window.pageYOffset);
|
|
@@ -2530,8 +2369,8 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2530
2369
|
|
|
2531
2370
|
var toolPosition = { x: 0, y: 0 };
|
|
2532
2371
|
if (clientX < vizHalfX) {
|
|
2533
|
-
var
|
|
2534
|
-
toolPosition.x = clientX +
|
|
2372
|
+
var offst = (clientY < vizHalfY) ? 15 : 5;
|
|
2373
|
+
toolPosition.x = clientX + offst + dataVizDiv.offsetLeft;
|
|
2535
2374
|
}
|
|
2536
2375
|
else {
|
|
2537
2376
|
toolPosition.x = clientX - 10 + dataVizDiv.offsetLeft - tooltip.offsetWidth;
|
|
@@ -2546,7 +2385,7 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2546
2385
|
return toolPosition;
|
|
2547
2386
|
}
|
|
2548
2387
|
|
|
2549
|
-
_getOffset(dataVizDiv) {
|
|
2388
|
+
_getOffset(dataVizDiv: HTMLDivElement) {
|
|
2550
2389
|
var rect = dataVizDiv.getBoundingClientRect(),
|
|
2551
2390
|
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
|
|
2552
2391
|
scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
@@ -2554,8 +2393,8 @@ export class AvsGoDataViz extends AvsElementBase {
|
|
|
2554
2393
|
}
|
|
2555
2394
|
}
|
|
2556
2395
|
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2396
|
+
declare global {
|
|
2397
|
+
interface HTMLElementTagNameMap {
|
|
2398
|
+
'avs-go-dataviz': AvsGoDataViz;
|
|
2399
|
+
}
|
|
2400
|
+
}
|