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