@avs/go 0.13.71891 → 0.14.72000
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 +557 -414
- 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,48 @@ 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.");
|
|
653
|
+
return undefined;
|
|
654
|
+
}
|
|
655
|
+
if (!this.width || !this.height) {
|
|
615
656
|
return undefined;
|
|
616
657
|
}
|
|
617
|
-
|
|
618
|
-
var model = {};
|
|
619
658
|
|
|
620
659
|
// Scene Properties
|
|
621
|
-
|
|
660
|
+
const model = {
|
|
661
|
+
sceneProperties: {
|
|
662
|
+
name: this.sceneName
|
|
663
|
+
}
|
|
664
|
+
};
|
|
622
665
|
if (this.sceneUserProperties) {
|
|
623
|
-
|
|
666
|
+
let sceneUserProperties;
|
|
667
|
+
try {
|
|
668
|
+
sceneUserProperties = JSON.parse(this.sceneUserProperties);
|
|
669
|
+
}
|
|
670
|
+
catch (error) {
|
|
671
|
+
this._dispatchErrorEvent("Can't parse 'scene-user-properties'. " + error.message);
|
|
672
|
+
return undefined;
|
|
673
|
+
}
|
|
674
|
+
model.sceneProperties.userProperties = sceneUserProperties;
|
|
624
675
|
}
|
|
625
|
-
model.sceneProperties = sceneProperties;
|
|
626
676
|
|
|
627
677
|
// Renderer Properties
|
|
628
|
-
|
|
678
|
+
const rendererProperties = {
|
|
679
|
+
width: this.width,
|
|
680
|
+
height: this.height,
|
|
681
|
+
name: this.rendererName,
|
|
682
|
+
type: this.renderer
|
|
683
|
+
};
|
|
629
684
|
if (this.rendererUserProperties) {
|
|
630
|
-
|
|
685
|
+
let rendererUserProperties;
|
|
686
|
+
try {
|
|
687
|
+
rendererUserProperties = JSON.parse(this.rendererUserProperties);
|
|
688
|
+
}
|
|
689
|
+
catch (error) {
|
|
690
|
+
this._dispatchErrorEvent("Can't parse 'renderer-user-properties'. " + error.message);
|
|
691
|
+
return undefined;
|
|
692
|
+
}
|
|
693
|
+
rendererProperties.userProperties = rendererUserProperties;
|
|
631
694
|
}
|
|
632
695
|
model.rendererProperties = rendererProperties;
|
|
633
696
|
|
|
@@ -635,7 +698,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
635
698
|
if (this.transformInteractor) {
|
|
636
699
|
// Update the local transform matrix from the transform interactor, we may have transformed since the last request
|
|
637
700
|
this.transformMatrix = this.transformInteractor.object.matrix.elements.slice();
|
|
638
|
-
this.transformClientOnly = this.transformInteractor.clientOnly;
|
|
701
|
+
// this.transformClientOnly = this.transformInteractor.clientOnly;
|
|
639
702
|
}
|
|
640
703
|
if (this.transformMatrix && !this.transformClientOnly) {
|
|
641
704
|
rendererProperties.transformMatrix = this.transformMatrix;
|
|
@@ -651,7 +714,10 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
651
714
|
|
|
652
715
|
// PanInteractor
|
|
653
716
|
if (this.panEnable) {
|
|
654
|
-
rendererProperties.panProperties = {
|
|
717
|
+
rendererProperties.panProperties = {
|
|
718
|
+
widthZoomLevel: Math.min(this.panWidthZoomLevel, this.panMaximumZoomLevel),
|
|
719
|
+
heightZoomLevel: Math.min(this.panHeightZoomLevel, this.panMaximumZoomLevel)
|
|
720
|
+
};
|
|
655
721
|
}
|
|
656
722
|
|
|
657
723
|
// Base theme to use from themeName property
|
|
@@ -685,7 +751,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
685
751
|
"sceneBackgroundGradientColorRepeat": "--avs-scene-background-gradient-color-repeat",
|
|
686
752
|
"sceneHighlightColor": "--avs-scene-highlight-color",
|
|
687
753
|
"sceneSurfaceColor": "--avs-scene-surface-color",
|
|
688
|
-
|
|
754
|
+
"scenePointColor": "--avs-scene-point-color",
|
|
689
755
|
"sceneLineColor": "--avs-scene-line-color",
|
|
690
756
|
"sceneLineWidth": "--avs-scene-line-width",
|
|
691
757
|
"sceneTextColor": "--avs-scene-text-color",
|
|
@@ -711,7 +777,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
711
777
|
"chartBackgroundGradientColorRepeat": "--avs-chart-background-gradient-color-repeat",
|
|
712
778
|
"chartHighlightColor": "--avs-chart-highlight-color",
|
|
713
779
|
"chartSurfaceColor": "--avs-chart-surface-color",
|
|
714
|
-
|
|
780
|
+
"chartPointColor": "--avs-chart-point-color",
|
|
715
781
|
"chartLineColor": "--avs-chart-line-color",
|
|
716
782
|
"chartLineWidth": "--avs-chart-line-width",
|
|
717
783
|
"chartLinePattern": "--avs-chart-line-pattern",
|
|
@@ -800,10 +866,32 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
800
866
|
"legendTitleFontSize": "--avs-legend-title-font-size"
|
|
801
867
|
} );
|
|
802
868
|
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
869
|
+
// Data source properties
|
|
870
|
+
if (this.dataSourceName) {
|
|
871
|
+
model.dataSourceProperties = {
|
|
872
|
+
name: this.dataSourceName
|
|
873
|
+
}
|
|
874
|
+
if (this.dataSourceUserProperties) {
|
|
875
|
+
let dataSourceUserProperties;
|
|
876
|
+
try {
|
|
877
|
+
dataSourceUserProperties = JSON.parse(this.dataSourceUserProperties);
|
|
878
|
+
}
|
|
879
|
+
catch (error) {
|
|
880
|
+
this._dispatchErrorEvent("Can't parse 'data-source-user-properties'. " + error.message);
|
|
881
|
+
return undefined;
|
|
882
|
+
}
|
|
883
|
+
model.dataSourceProperties.userProperties = dataSourceUserProperties;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
// Stream properties
|
|
888
|
+
if (this.threeViewer) {
|
|
889
|
+
if (this.streamEnable) {
|
|
890
|
+
rendererProperties.streamProperties = {
|
|
891
|
+
chunkSizeFirst: this.streamChunkSizeFirst,
|
|
892
|
+
chunkSize: this.streamChunkSize
|
|
893
|
+
};
|
|
894
|
+
}
|
|
807
895
|
}
|
|
808
896
|
|
|
809
897
|
return model;
|
|
@@ -826,57 +914,43 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
826
914
|
/**
|
|
827
915
|
*
|
|
828
916
|
*/
|
|
829
|
-
_onResize() {
|
|
917
|
+
_onResize(contentRect) {
|
|
918
|
+
// Get the width & height provided by our container
|
|
919
|
+
this.width = Math.round(contentRect.width);
|
|
920
|
+
this.height = Math.round(contentRect.height);
|
|
921
|
+
|
|
922
|
+
if (this.rectCanvas) {
|
|
923
|
+
this.rectCanvas.width = this.width;
|
|
924
|
+
this.rectCanvas.height = this.height;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// Check if we need to acquire a new scene due to
|
|
928
|
+
// the size change and other properties
|
|
830
929
|
if (!this.urlLoadJsonFile &&
|
|
831
930
|
!this.manualUpdate &&
|
|
832
931
|
this.resizeThreshold > 0 &&
|
|
833
|
-
(this.
|
|
834
|
-
this.
|
|
835
|
-
this.
|
|
836
|
-
this.
|
|
932
|
+
(!this.lowResizeWidth ||
|
|
933
|
+
this.width < this.lowResizeWidth ||
|
|
934
|
+
this.width > this.highResizeWidth ||
|
|
935
|
+
this.height < this.lowResizeHeight ||
|
|
936
|
+
this.height > this.highResizeHeight)) {
|
|
837
937
|
|
|
938
|
+
this._updateResizeLimits();
|
|
838
939
|
this.updateViewer();
|
|
839
940
|
}
|
|
840
941
|
else {
|
|
841
|
-
this.
|
|
842
|
-
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
/**
|
|
846
|
-
*
|
|
847
|
-
*/
|
|
848
|
-
_updateSize() {
|
|
849
|
-
// Get the width provided by our container
|
|
850
|
-
this.width = this.clientWidth;
|
|
851
|
-
if (this.width <= 0) {
|
|
852
|
-
this.width = 200; // fallback if clientWidth fails
|
|
853
|
-
this.$.container.style.width = this.width + "px";
|
|
854
|
-
}
|
|
855
|
-
else {
|
|
856
|
-
this.$.container.style.width = "100%";
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
// Get the height provided by our container
|
|
860
|
-
this.height = this.clientHeight;
|
|
861
|
-
if (this.height <= 0) {
|
|
862
|
-
if (this.aspectRatio > 0.1) {
|
|
863
|
-
// Use the aspect ratio if one is set
|
|
864
|
-
this.height = this.width / this.aspectRatio;
|
|
865
|
-
}
|
|
866
|
-
else {
|
|
867
|
-
this.height = 200; // fallback if clientHeight fails
|
|
942
|
+
if (this.threeViewer) {
|
|
943
|
+
this.threeViewer.render(true);
|
|
868
944
|
}
|
|
869
|
-
this.$.container.style.height = this.height + "px";
|
|
870
945
|
}
|
|
871
|
-
|
|
872
|
-
this.$.container.style.height = "100%";
|
|
873
|
-
}
|
|
946
|
+
}
|
|
874
947
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
948
|
+
_updateResizeLimits() {
|
|
949
|
+
this.lowResizeWidth = (100 - this.resizeThreshold) / 100 * this.width;
|
|
950
|
+
this.highResizeWidth = (100 + this.resizeThreshold) / 100 * this.width;
|
|
951
|
+
this.lowResizeHeight = (100 - this.resizeThreshold) / 100 * this.height;
|
|
952
|
+
this.highResizeHeight = (100 + this.resizeThreshold) / 100 * this.height;
|
|
953
|
+
}
|
|
880
954
|
|
|
881
955
|
showSpinner() {
|
|
882
956
|
var spinner = window.getComputedStyle(this, null).getPropertyValue("--avs-spinner").trim().replace(/['"]+/g, '');
|
|
@@ -889,55 +963,144 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
889
963
|
return response.text();
|
|
890
964
|
})
|
|
891
965
|
.then((html) => {
|
|
892
|
-
this
|
|
966
|
+
this.renderRoot.querySelector('#spinner').innerHTML = html;
|
|
893
967
|
})
|
|
894
968
|
.catch((error) => {
|
|
895
|
-
this
|
|
969
|
+
this.renderRoot.querySelector('#spinner').innerHTML = '';
|
|
896
970
|
});
|
|
897
971
|
}
|
|
898
972
|
else {
|
|
899
|
-
this
|
|
973
|
+
this.renderRoot.querySelector('#spinner').innerHTML = LOGO;
|
|
900
974
|
}
|
|
901
975
|
|
|
902
|
-
this
|
|
976
|
+
this.renderRoot.querySelector('#spinner').style.display = 'block';
|
|
903
977
|
}
|
|
904
978
|
|
|
905
979
|
hideSpinner() {
|
|
906
|
-
this
|
|
980
|
+
this.renderRoot.querySelector('#spinner').style.display = 'none';
|
|
907
981
|
}
|
|
908
982
|
|
|
909
983
|
startSpinner() {
|
|
910
|
-
this
|
|
984
|
+
this.renderRoot.querySelector('#spinner').className = 'spin';
|
|
911
985
|
}
|
|
912
986
|
|
|
913
987
|
stopSpinner() {
|
|
914
|
-
this
|
|
988
|
+
this.renderRoot.querySelector('#spinner').className = '';
|
|
915
989
|
}
|
|
916
990
|
|
|
917
991
|
/**
|
|
918
|
-
*
|
|
992
|
+
* At least one of the properties was changed.
|
|
919
993
|
*/
|
|
920
|
-
|
|
921
|
-
|
|
994
|
+
updated(changedProperties) {
|
|
995
|
+
if (changedProperties.has('renderer')) {
|
|
996
|
+
this._rendererChanged(this.renderer, changedProperties['renderer']);
|
|
997
|
+
}
|
|
998
|
+
if (changedProperties.has('transformEnable')) {
|
|
999
|
+
this._transformEnableChanged(this.transformEnable, changedProperties['transformEnable']);
|
|
1000
|
+
}
|
|
1001
|
+
if (changedProperties.has('transformClientOnly')) {
|
|
1002
|
+
this._transformClientOnlyChanged(this.transformClientOnly, changedProperties['transformClientOnly']);
|
|
1003
|
+
}
|
|
1004
|
+
if (changedProperties.has('transformRotateDisable')) {
|
|
1005
|
+
this._transformRotateDisableChanged(this.transformRotateDisable, changedProperties['transformRotateDisable']);
|
|
1006
|
+
}
|
|
1007
|
+
if (changedProperties.has('transformZoomDisable')) {
|
|
1008
|
+
this._transformZoomDisableChanged(this.transformZoomDisable, changedProperties['transformZoomDisable']);
|
|
1009
|
+
}
|
|
1010
|
+
if (changedProperties.has('transformPanDisable')) {
|
|
1011
|
+
this._transformPanDisableChanged(this.transformPanDisable, changedProperties['transformPanDisable']);
|
|
1012
|
+
}
|
|
1013
|
+
if (changedProperties.has('animatedGlyphsVisible')) {
|
|
1014
|
+
this._animatedGlyphsVisibleChanged(this.animatedGlyphsVisible, changedProperties['animatedGlyphsVisible']);
|
|
1015
|
+
}
|
|
1016
|
+
if (changedProperties.has('animatedGlyphsEnable')) {
|
|
1017
|
+
this._animatedGlyphsEnableChanged(this.animatedGlyphsEnable, changedProperties['animatedGlyphsEnable']);
|
|
1018
|
+
}
|
|
1019
|
+
if (changedProperties.has('transformTwistAngle') || changedProperties.has('transformTiltAngle') || changedProperties.has('transformScale')) {
|
|
1020
|
+
this._transformValueChanged();
|
|
1021
|
+
}
|
|
1022
|
+
if (changedProperties.has('animatedGlyphsEnable')) {
|
|
1023
|
+
this._animatedGlyphsEnableChanged(this.animatedGlyphsEnable, changedProperties['animatedGlyphsEnable']);
|
|
1024
|
+
}
|
|
1025
|
+
if (changedProperties.has('zoomRectangleEnable')) {
|
|
1026
|
+
this._zoomRectangleEnableChanged(this.zoomRectangleEnable, changedProperties['zoomRectangleEnable']);
|
|
1027
|
+
}
|
|
1028
|
+
if (changedProperties.has('panEnable')) {
|
|
1029
|
+
this._panEnableChanged(this.panEnable, changedProperties['panEnable']);
|
|
1030
|
+
}
|
|
1031
|
+
if (changedProperties.has('panZoomEnable')) {
|
|
1032
|
+
this._panZoomEnableChanged(this.panZoomEnable, changedProperties['panZoomEnable']);
|
|
1033
|
+
}
|
|
1034
|
+
if (changedProperties.has('panWidthZoomLevel')) {
|
|
1035
|
+
this._panWidthZoomLevelChanged(this.panWidthZoomLevel, changedProperties['panWidthZoomLevel']);
|
|
1036
|
+
}
|
|
1037
|
+
if (changedProperties.has('panHeightZoomLevel')) {
|
|
1038
|
+
this._panHeightZoomLevelChanged(this.panHeightZoomLevel, changedProperties['panHeightZoomLevel']);
|
|
1039
|
+
}
|
|
1040
|
+
if (changedProperties.has('panMaximumZoomLevel')) {
|
|
1041
|
+
this._panMaximumZoomLevelChanged(this.panMaximumZoomLevel, changedProperties['panMaximumZoomLevel']);
|
|
1042
|
+
}
|
|
1043
|
+
if (changedProperties.has('trackEnable')) {
|
|
1044
|
+
this._trackEnableChanged(this.trackEnable, changedProperties['trackEnable']);
|
|
1045
|
+
}
|
|
1046
|
+
if (changedProperties.has('displayCanvas')) {
|
|
1047
|
+
this._displayCanvasChanged(this.displayCanvas, changedProperties['displayCanvas']);
|
|
1048
|
+
}
|
|
1049
|
+
if (changedProperties.has('motionCaptureControlsEnable')) {
|
|
1050
|
+
this._motionCaptureControlsEnableChanged(this.motionCaptureControlsEnable, changedProperties['motionCaptureControlsEnable']);
|
|
1051
|
+
}
|
|
1052
|
+
if (changedProperties.has('motionCapture')) {
|
|
1053
|
+
this._motionCaptureValueChanged(this.motionCapture, changedProperties['motionCapture']);
|
|
1054
|
+
}
|
|
1055
|
+
if (changedProperties.has('hidden')) {
|
|
1056
|
+
this._hiddenChanged(this.hidden, changedProperties['hidden']);
|
|
1057
|
+
}
|
|
922
1058
|
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1059
|
+
if (!this.url) {
|
|
1060
|
+
//this._dispatchErrorEvent(''url' property must point to an instance of AVS/Go server.');
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
927
1063
|
|
|
928
|
-
|
|
929
|
-
if (this.
|
|
930
|
-
this.
|
|
1064
|
+
let doUpdate = false;
|
|
1065
|
+
if (this.manualUpdate) {
|
|
1066
|
+
if (this.forceUpdate) {
|
|
1067
|
+
doUpdate = true;
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
else {
|
|
1071
|
+
if (this.forceUpdate ||
|
|
1072
|
+
changedProperties.has('url') ||
|
|
1073
|
+
changedProperties.has('renderer') ||
|
|
1074
|
+
changedProperties.has('urlLoadJsonFile') ||
|
|
1075
|
+
changedProperties.has('sceneName') ||
|
|
1076
|
+
changedProperties.has('sceneUserProperties') ||
|
|
1077
|
+
changedProperties.has('dataSourceName') ||
|
|
1078
|
+
changedProperties.has('dataSourceUserProperties') ||
|
|
1079
|
+
changedProperties.has('rendererName') ||
|
|
1080
|
+
changedProperties.has('rendererUserProperties') ||
|
|
1081
|
+
changedProperties.has('streamEnable') ||
|
|
1082
|
+
(this.panEnable && changedProperties.has('panWidthZoomLevel')) ||
|
|
1083
|
+
(this.panEnable && changedProperties.has('panHeightZoomLevel'))) {
|
|
1084
|
+
doUpdate = true;
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
if (doUpdate) {
|
|
1089
|
+
this.forceUpdate = false;
|
|
931
1090
|
|
|
932
|
-
//
|
|
1091
|
+
// Send the model to the server
|
|
933
1092
|
if (this.urlLoadJsonFile) {
|
|
934
1093
|
this.chunkFile = 0;
|
|
935
|
-
this.
|
|
1094
|
+
this.showSpinner();
|
|
1095
|
+
this.startSpinner();
|
|
1096
|
+
this._httpRequest(this.url, this._handleHttpResponse.bind(this), this._handleHttpError.bind(this));
|
|
936
1097
|
}
|
|
937
1098
|
else {
|
|
938
|
-
this.model = this._assembleModel(fullReset);
|
|
1099
|
+
this.model = this._assembleModel(/*fullReset*/);
|
|
939
1100
|
if (this.model) {
|
|
940
|
-
this.
|
|
1101
|
+
this.showSpinner();
|
|
1102
|
+
this.startSpinner();
|
|
1103
|
+
this._httpRequest(this.url, this._handleHttpResponse.bind(this), this._handleHttpError.bind(this), this.model);
|
|
941
1104
|
}
|
|
942
1105
|
}
|
|
943
1106
|
}
|
|
@@ -954,18 +1117,16 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
954
1117
|
/**
|
|
955
1118
|
*
|
|
956
1119
|
*/
|
|
957
|
-
|
|
958
|
-
this.
|
|
959
|
-
|
|
960
|
-
this.threeViewer.render(true);
|
|
961
|
-
}
|
|
1120
|
+
updateViewer() {
|
|
1121
|
+
this.forceUpdate = true;
|
|
1122
|
+
this.requestUpdate();
|
|
962
1123
|
}
|
|
963
1124
|
|
|
964
1125
|
/**
|
|
965
1126
|
*
|
|
966
1127
|
*/
|
|
967
1128
|
clear() {
|
|
968
|
-
if (this.
|
|
1129
|
+
if (this.threeViewer) {
|
|
969
1130
|
this.threeViewer.clearGeometry();
|
|
970
1131
|
this.threeViewer.render();
|
|
971
1132
|
}
|
|
@@ -988,7 +1149,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
988
1149
|
if (json) {
|
|
989
1150
|
if (json.selectionInfo) {
|
|
990
1151
|
this._dispatchPickEvents(json.selectionInfo);
|
|
991
|
-
|
|
1152
|
+
}
|
|
992
1153
|
|
|
993
1154
|
if (json.sceneInfo) {
|
|
994
1155
|
var sceneEvent = {detail: json.sceneInfo};
|
|
@@ -1011,31 +1172,31 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1011
1172
|
blendedG += (bgCol[1] * (1 - col[3]));
|
|
1012
1173
|
blendedB += (bgCol[2] * (1 - col[3]));
|
|
1013
1174
|
}
|
|
1014
|
-
this
|
|
1015
|
-
this
|
|
1016
|
-
this
|
|
1017
|
-
this
|
|
1175
|
+
this.renderRoot.querySelector('#motionCapture').style.color = "var(--avs-motion-capture-color, rgb(" + blendedR + ", " + blendedG + ", " + blendedB + "))";
|
|
1176
|
+
this.renderRoot.querySelector('#zoomOverlay').style.color = "var(--avs-zoom-overlay-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
|
|
1177
|
+
this.renderRoot.querySelector('#tooltip').style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
|
|
1178
|
+
this.renderRoot.querySelector('#motionCaptureTooltip').style.color = "var(--avs-tooltip-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
|
|
1018
1179
|
}
|
|
1019
1180
|
if (json.sceneInfo.color) {
|
|
1020
1181
|
var col = json.sceneInfo.color.match(/[0-9.]+/gi);
|
|
1021
|
-
this
|
|
1022
|
-
this
|
|
1023
|
-
this
|
|
1024
|
-
this
|
|
1182
|
+
this.renderRoot.querySelector('#motionCapture').style.background = "var(--avs-motion-capture-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
|
|
1183
|
+
this.renderRoot.querySelector('#zoomOverlay').style.background = "var(--avs-zoom-overlay-background, rgba(" + col[0] + "," + col[1] + "," + col[2] + ",0.75))";
|
|
1184
|
+
this.renderRoot.querySelector('#tooltip').style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
|
|
1185
|
+
this.renderRoot.querySelector('#motionCaptureTooltip').style.background = "var(--avs-tooltip-background, rgb(" + col[0] + "," + col[1] + "," + col[2] + "))";
|
|
1025
1186
|
}
|
|
1026
1187
|
if (json.sceneInfo.fontFamily) {
|
|
1027
|
-
this
|
|
1028
|
-
this
|
|
1029
|
-
this
|
|
1030
|
-
this
|
|
1188
|
+
this.renderRoot.querySelector('#motionCapture').style.fontFamily = "var(--avs-motion-capture-font-family, " + json.sceneInfo.fontFamily + ")";
|
|
1189
|
+
this.renderRoot.querySelector('#zoomOverlay').style.fontFamily = "var(--avs-zoom-overlay-font-family, " + json.sceneInfo.fontFamily + ")";
|
|
1190
|
+
this.renderRoot.querySelector('#tooltip').style.fontFamily = "var(--avs-tooltip-font-family, " + json.sceneInfo.fontFamily + ")";
|
|
1191
|
+
this.renderRoot.querySelector('#motionCaptureTooltip').style.fontFamily = "var(--avs-tooltip-font-family, " + json.sceneInfo.fontFamily + ")";
|
|
1031
1192
|
}
|
|
1032
1193
|
}
|
|
1033
1194
|
|
|
1034
1195
|
if (json.image) {
|
|
1035
1196
|
this.sceneImage.src = json.image;
|
|
1036
1197
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1198
|
+
if (json.imagemap) {
|
|
1199
|
+
this.sceneImageMap.innerHTML = decodeURIComponent(json.imagemap.replace(/\+/g, '%20'));
|
|
1039
1200
|
|
|
1040
1201
|
this.imageMapData = Array.from(this.sceneImageMap.querySelectorAll('area')).map(area => {
|
|
1041
1202
|
return {
|
|
@@ -1046,7 +1207,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1046
1207
|
componentInfo: area.getAttribute('component-info')
|
|
1047
1208
|
};
|
|
1048
1209
|
});
|
|
1049
|
-
|
|
1210
|
+
}
|
|
1050
1211
|
else {
|
|
1051
1212
|
this.sceneImageMap.innerHTML = "";
|
|
1052
1213
|
this.imageMapData = undefined;
|
|
@@ -1056,17 +1217,17 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1056
1217
|
this._dispatchSceneData(json);
|
|
1057
1218
|
}
|
|
1058
1219
|
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1220
|
+
this._handleLoadComplete();
|
|
1221
|
+
}
|
|
1222
|
+
else if (json.svg) {
|
|
1223
|
+
this.svgDiv.innerHTML = decodeURIComponent(json.svg.replace(/\+/g, '%20'));
|
|
1063
1224
|
|
|
1064
1225
|
if (!this.urlLoadJsonFile) {
|
|
1065
1226
|
this._dispatchSceneData(json);
|
|
1066
1227
|
}
|
|
1067
1228
|
|
|
1068
|
-
|
|
1069
|
-
|
|
1229
|
+
this._handleLoadComplete();
|
|
1230
|
+
}
|
|
1070
1231
|
else if (json.threejs) {
|
|
1071
1232
|
if (!this.urlLoadJsonFile) {
|
|
1072
1233
|
this._dispatchSceneData(json);
|
|
@@ -1079,14 +1240,14 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1079
1240
|
if (this.urlLoadJsonFile) {
|
|
1080
1241
|
// Load the next chunk file
|
|
1081
1242
|
this.chunkFile++;
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
this._httpRequest(urlBase + '-' + this.chunkFile + '.' + ext, this._handleHttpResponse.bind(this),
|
|
1243
|
+
const urlBase = this.url.substring(0, this.url.lastIndexOf('.')) || this.url;
|
|
1244
|
+
const ext = this.url.split('.').pop();
|
|
1245
|
+
this._httpRequest(urlBase + '-' + this.chunkFile + '.' + ext, this._handleHttpResponse.bind(this), this._handleHttpError.bind(this));
|
|
1085
1246
|
}
|
|
1086
1247
|
else {
|
|
1087
1248
|
// Get the next chunk from the server
|
|
1088
1249
|
this.model.rendererProperties.streamProperties.chunkId = json.threejs.chunkId;
|
|
1089
|
-
this._httpRequest(this.url, this._handleHttpResponse.bind(this),
|
|
1250
|
+
this._httpRequest(this.url, this._handleHttpResponse.bind(this), this._handleHttpError.bind(this), this.model);
|
|
1090
1251
|
}
|
|
1091
1252
|
}
|
|
1092
1253
|
}
|
|
@@ -1095,7 +1256,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1095
1256
|
}
|
|
1096
1257
|
}
|
|
1097
1258
|
else {
|
|
1098
|
-
|
|
1259
|
+
this._dispatchErrorEvent("No image, SVG, or ThreeJS found in response.");
|
|
1099
1260
|
this._handleLoadComplete();
|
|
1100
1261
|
}
|
|
1101
1262
|
}
|
|
@@ -1157,15 +1318,15 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1157
1318
|
* @param e
|
|
1158
1319
|
*/
|
|
1159
1320
|
_handleTap(e) {
|
|
1160
|
-
|
|
1321
|
+
var adjustedCoords = this._getAdjustedCoords(e.detail.x, e.detail.y);
|
|
1161
1322
|
|
|
1162
1323
|
var pickProperties = {type:"TAP", x:adjustedCoords.x, y:adjustedCoords.y};
|
|
1163
1324
|
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1325
|
+
if (this.tapLevel !== undefined) pickProperties.level = this.tapLevel;
|
|
1326
|
+
if (this.tapDepth !== undefined) pickProperties.depth = this.tapDepth;
|
|
1327
|
+
if (this.tapHighlightEnable) pickProperties.highlight = true;
|
|
1328
|
+
if (this.tapHighlightColor !== undefined) pickProperties.highlightColor = this.tapHighlightColor;
|
|
1329
|
+
if (this.tapHighlightLayerEnable) pickProperties.highlightLayer = true;
|
|
1169
1330
|
|
|
1170
1331
|
this._processPick( pickProperties, this.tapProcessEventOnClient, e.originalTarget );
|
|
1171
1332
|
}
|
|
@@ -1174,7 +1335,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1174
1335
|
* @param e
|
|
1175
1336
|
*/
|
|
1176
1337
|
_handleTrack(e) {
|
|
1177
|
-
|
|
1338
|
+
var adjustedCoords = this._getAdjustedRectangleCoords(e);
|
|
1178
1339
|
|
|
1179
1340
|
switch(e.detail.state) {
|
|
1180
1341
|
case 'start':
|
|
@@ -1286,17 +1447,17 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1286
1447
|
}
|
|
1287
1448
|
|
|
1288
1449
|
_getAdjustedCoords(x, y) {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1450
|
+
var rect = this.renderRoot.querySelector('#dataVizDiv').getBoundingClientRect();
|
|
1451
|
+
var x = Math.round(x - rect.left);
|
|
1452
|
+
var y = Math.round(y - rect.top);
|
|
1453
|
+
var clampX = Math.max(0, Math.min(x, this.width));
|
|
1454
|
+
var clampY = Math.max(0, Math.min(y, this.height));
|
|
1294
1455
|
|
|
1295
|
-
|
|
1456
|
+
return {x:clampX, y:clampY};
|
|
1296
1457
|
}
|
|
1297
1458
|
|
|
1298
1459
|
_getAdjustedRectangleCoords(e) {
|
|
1299
|
-
|
|
1460
|
+
var rect = this.renderRoot.querySelector('#dataVizDiv').getBoundingClientRect();
|
|
1300
1461
|
var x = Math.round(e.detail.x - rect.left);
|
|
1301
1462
|
var y = Math.round(e.detail.y - rect.top);
|
|
1302
1463
|
var clampX = Math.max(0, Math.min(x, this.width));
|
|
@@ -1309,12 +1470,12 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1309
1470
|
var top = Math.min(startY, clampY);
|
|
1310
1471
|
var bottom = Math.max(startY, clampY);
|
|
1311
1472
|
|
|
1312
|
-
|
|
1473
|
+
return {left: left, right: right, top: top, bottom: bottom};
|
|
1313
1474
|
}
|
|
1314
1475
|
|
|
1315
1476
|
_processPick( pickProperties, processEventOnClient, originalTarget ) {
|
|
1316
1477
|
if (processEventOnClient) {
|
|
1317
|
-
if (this.
|
|
1478
|
+
if (this.threeViewer) {
|
|
1318
1479
|
// ThreeJS client side pick processing
|
|
1319
1480
|
|
|
1320
1481
|
this.threeViewer.setPickDepth( this._getPickDepth(pickProperties.depth) );
|
|
@@ -1437,11 +1598,11 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1437
1598
|
if (this.url) {
|
|
1438
1599
|
this.startSpinner();
|
|
1439
1600
|
|
|
1440
|
-
//
|
|
1601
|
+
// Send the model to the server
|
|
1441
1602
|
this.model = this._assembleModel();
|
|
1442
1603
|
if (this.model) {
|
|
1443
1604
|
this.model.rendererProperties.pickProperties = pickProperties;
|
|
1444
|
-
this._httpRequest(this.url, this._handleHttpResponse.bind(this),
|
|
1605
|
+
this._httpRequest(this.url, this._handleHttpResponse.bind(this), this._handleHttpError.bind(this), this.model);
|
|
1445
1606
|
}
|
|
1446
1607
|
}
|
|
1447
1608
|
}
|
|
@@ -1562,93 +1723,73 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1562
1723
|
}.bind(this), this.pointerTimeout * 1000);
|
|
1563
1724
|
}
|
|
1564
1725
|
|
|
1726
|
+
constructor() {
|
|
1727
|
+
super();
|
|
1728
|
+
|
|
1729
|
+
// Set default property values
|
|
1730
|
+
this.renderer = 'THREEJS';
|
|
1731
|
+
this.resizeThreshold = 10;
|
|
1732
|
+
this.aspectRatio = 1.777777;
|
|
1733
|
+
this.pointerTimeout = 600;
|
|
1734
|
+
this.panWidthZoomLevel = 100;
|
|
1735
|
+
this.panHeightZoomLevel = 100;
|
|
1736
|
+
this.panMaximumZoomLevel = 1000;
|
|
1737
|
+
|
|
1738
|
+
this.lowResizeWidth = this.highResizeWidth = 0;
|
|
1739
|
+
this.highResizeWidth = this.highResizeHeight = 0;
|
|
1740
|
+
|
|
1741
|
+
this.motionCaptureTime = 0;
|
|
1742
|
+
this.motionCaptureFrames ??= [];
|
|
1743
|
+
|
|
1744
|
+
this._resetTimer();
|
|
1745
|
+
this._updatePixelRatio();
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1565
1748
|
/**
|
|
1566
|
-
*
|
|
1749
|
+
* Element connected to the DOM
|
|
1567
1750
|
*/
|
|
1568
1751
|
connectedCallback() {
|
|
1569
1752
|
super.connectedCallback();
|
|
1570
1753
|
|
|
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();
|
|
1754
|
+
ro.observe(this);
|
|
1582
1755
|
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1756
|
+
this.addEventListener('pointerdown', this._handlePointerDown);
|
|
1757
|
+
this.addEventListener('pointerup', this._handlePointerUp);
|
|
1758
|
+
this.addEventListener('pointermove', this._handlePointerMove);
|
|
1759
|
+
this.addEventListener('pointerout', this._handlePointerMove);
|
|
1587
1760
|
|
|
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 ??= [];
|
|
1761
|
+
var scope = this;
|
|
1762
|
+
this.addEventListener('contextmenu', function(e) {
|
|
1763
|
+
if (scope.trackEnable) {
|
|
1764
|
+
e.preventDefault();
|
|
1765
|
+
}
|
|
1766
|
+
});
|
|
1767
|
+
}
|
|
1630
1768
|
|
|
1631
|
-
|
|
1769
|
+
/**
|
|
1770
|
+
* Element disconnected from the DOM
|
|
1771
|
+
*/
|
|
1772
|
+
disconnectedCallback() {
|
|
1773
|
+
super.disconnectedCallback();
|
|
1632
1774
|
|
|
1633
|
-
|
|
1634
|
-
}
|
|
1635
|
-
});
|
|
1775
|
+
ro.unobserve(this);
|
|
1636
1776
|
}
|
|
1637
1777
|
|
|
1638
1778
|
_handlePointerEnterMotionCaptureControl(e) {
|
|
1639
1779
|
if (!this.showMotionCaptureTooltip) {
|
|
1640
1780
|
var adjustedCoords = this._getAdjustedCoords(e.clientX, e.clientY);
|
|
1641
|
-
var
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1781
|
+
var motionCaptureTooltip = this.renderRoot.querySelector('#motionCaptureTooltip');
|
|
1782
|
+
var pos = this._calcTooltipPosition(motionCaptureTooltip, adjustedCoords.x, adjustedCoords.y);
|
|
1783
|
+
motionCaptureTooltip.style.left = pos.x + "px";
|
|
1784
|
+
motionCaptureTooltip.style.top = pos.y + "px";
|
|
1785
|
+
motionCaptureTooltip.style.opacity = 1;
|
|
1786
|
+
motionCaptureTooltip.innerHTML = e.currentTarget.dataset.tooltip ?? e.currentTarget.id;
|
|
1646
1787
|
this.showMotionCaptureTooltip = true;
|
|
1647
1788
|
}
|
|
1648
1789
|
}
|
|
1649
1790
|
|
|
1650
1791
|
_handlePointerLeaveMotionCaptureControl() {
|
|
1651
|
-
this
|
|
1792
|
+
this.renderRoot.querySelector('#motionCaptureTooltip').style.opacity = 0;
|
|
1652
1793
|
this.showMotionCaptureTooltip = false;
|
|
1653
1794
|
}
|
|
1654
1795
|
|
|
@@ -1675,15 +1816,15 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1675
1816
|
this.motionCaptureFrames.push(frame);
|
|
1676
1817
|
|
|
1677
1818
|
if (this.motionCaptureFrames.length == 1) {
|
|
1678
|
-
this
|
|
1679
|
-
this
|
|
1680
|
-
this
|
|
1681
|
-
this
|
|
1682
|
-
this
|
|
1683
|
-
this
|
|
1819
|
+
this.renderRoot.querySelector('#motionCapturePlay').classList.remove("disabled");
|
|
1820
|
+
this.renderRoot.querySelector('#motionCaptureDelay').classList.remove("disabled");
|
|
1821
|
+
this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = "2";
|
|
1822
|
+
this.renderRoot.querySelector('#motionCaptureClear').classList.remove("disabled");
|
|
1823
|
+
this.renderRoot.querySelector('#motionCaptureCopyData').classList.remove("disabled");
|
|
1824
|
+
this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.remove("disabled");
|
|
1684
1825
|
this.motionCaptureDelay = 2;
|
|
1685
1826
|
}
|
|
1686
|
-
this
|
|
1827
|
+
this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerText = this.motionCaptureFrames.length;
|
|
1687
1828
|
}
|
|
1688
1829
|
|
|
1689
1830
|
_handleMotionCaptureDelayIncrease() {
|
|
@@ -1691,7 +1832,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1691
1832
|
if (this.motionCaptureDelay > 9) {
|
|
1692
1833
|
this.motionCaptureDelay = 9;
|
|
1693
1834
|
}
|
|
1694
|
-
this
|
|
1835
|
+
this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = this.motionCaptureDelay;
|
|
1695
1836
|
}
|
|
1696
1837
|
|
|
1697
1838
|
_handleMotionCaptureDelayDecrease() {
|
|
@@ -1699,7 +1840,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1699
1840
|
if (this.motionCaptureDelay < 1) {
|
|
1700
1841
|
this.motionCaptureDelay = 1;
|
|
1701
1842
|
}
|
|
1702
|
-
this
|
|
1843
|
+
this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = this.motionCaptureDelay;
|
|
1703
1844
|
}
|
|
1704
1845
|
|
|
1705
1846
|
_handleMotionCaptureCopyData() {
|
|
@@ -1708,10 +1849,10 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1708
1849
|
navigator.clipboard.writeText(data);
|
|
1709
1850
|
|
|
1710
1851
|
// Show alert
|
|
1711
|
-
this
|
|
1712
|
-
this
|
|
1852
|
+
this.renderRoot.querySelector('#motionCaptureAlert').innerText = "Motion capture data copied to clipboard";
|
|
1853
|
+
this.renderRoot.querySelector('#motionCaptureAlert').style.opacity = 1;
|
|
1713
1854
|
setTimeout(function () {
|
|
1714
|
-
this
|
|
1855
|
+
this.renderRoot.querySelector('#motionCaptureAlert').style.opacity = 0;
|
|
1715
1856
|
}.bind(this), 2000);
|
|
1716
1857
|
}
|
|
1717
1858
|
|
|
@@ -1726,10 +1867,10 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1726
1867
|
navigator.clipboard.writeText(url);
|
|
1727
1868
|
|
|
1728
1869
|
// Show alert
|
|
1729
|
-
this
|
|
1730
|
-
this
|
|
1870
|
+
this.renderRoot.querySelector('#motionCaptureAlert').innerText = "Motion capture URL copied to clipboard";
|
|
1871
|
+
this.renderRoot.querySelector('#motionCaptureAlert').style.opacity = 1;
|
|
1731
1872
|
setTimeout(function () {
|
|
1732
|
-
this
|
|
1873
|
+
this.renderRoot.querySelector('#motionCaptureAlert').style.opacity = 0;
|
|
1733
1874
|
}.bind(this), 2000);
|
|
1734
1875
|
}
|
|
1735
1876
|
|
|
@@ -1796,13 +1937,13 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1796
1937
|
|
|
1797
1938
|
_handleMotionCaptureClear() {
|
|
1798
1939
|
this.motionCaptureFrames.length = 0;
|
|
1799
|
-
this
|
|
1800
|
-
this
|
|
1801
|
-
this
|
|
1802
|
-
this
|
|
1803
|
-
this
|
|
1804
|
-
this
|
|
1805
|
-
this
|
|
1940
|
+
this.renderRoot.querySelector('#motionCapturePlay').classList.add("disabled");
|
|
1941
|
+
this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerText = "0";
|
|
1942
|
+
this.renderRoot.querySelector('#motionCaptureDelay').classList.add("disabled");
|
|
1943
|
+
this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = "0";
|
|
1944
|
+
this.renderRoot.querySelector('#motionCaptureClear').classList.add("disabled");
|
|
1945
|
+
this.renderRoot.querySelector('#motionCaptureCopyData').classList.add("disabled");
|
|
1946
|
+
this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.add("disabled");
|
|
1806
1947
|
this.motionCaptureDelay = 0;
|
|
1807
1948
|
this.motionCaptureTime = 0;
|
|
1808
1949
|
}
|
|
@@ -1820,10 +1961,10 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1820
1961
|
*/
|
|
1821
1962
|
_motionCaptureControlsEnableChanged(newValue, oldValue) {
|
|
1822
1963
|
if (newValue) {
|
|
1823
|
-
this
|
|
1964
|
+
this.renderRoot.querySelector('#motionCapture').style.display = "block";
|
|
1824
1965
|
}
|
|
1825
1966
|
else {
|
|
1826
|
-
this
|
|
1967
|
+
this.renderRoot.querySelector('#motionCapture').style.display = "none";
|
|
1827
1968
|
}
|
|
1828
1969
|
}
|
|
1829
1970
|
|
|
@@ -1832,10 +1973,10 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1832
1973
|
*/
|
|
1833
1974
|
_hiddenChanged(newValue, oldValue) {
|
|
1834
1975
|
if (newValue) {
|
|
1835
|
-
this
|
|
1976
|
+
this.renderRoot.querySelector('#dataVizDiv').style.display = 'none';
|
|
1836
1977
|
}
|
|
1837
1978
|
else {
|
|
1838
|
-
this
|
|
1979
|
+
this.renderRoot.querySelector('#dataVizDiv').style.display = '';
|
|
1839
1980
|
if (this.threeViewer) {
|
|
1840
1981
|
this.threeViewer.render();
|
|
1841
1982
|
}
|
|
@@ -1849,7 +1990,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1849
1990
|
if (this.threeViewer) {
|
|
1850
1991
|
if (newValue) {
|
|
1851
1992
|
if (this.transformInteractor === undefined) {
|
|
1852
|
-
this.transformInteractor = new TransformInteractor(
|
|
1993
|
+
this.transformInteractor = new TransformInteractor(this.renderRoot.querySelector('#dataVizDiv'));
|
|
1853
1994
|
}
|
|
1854
1995
|
this.threeViewer.addInteractor( this.transformInteractor );
|
|
1855
1996
|
|
|
@@ -1972,7 +2113,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1972
2113
|
}
|
|
1973
2114
|
|
|
1974
2115
|
runAnimation() {
|
|
1975
|
-
if (this.
|
|
2116
|
+
if (this.threeViewer) {
|
|
1976
2117
|
var style = window.getComputedStyle(this, null);
|
|
1977
2118
|
var styleMap = {};
|
|
1978
2119
|
this._applyCustomCssProperties(styleMap, style,
|
|
@@ -1997,7 +2138,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
1997
2138
|
* Change in 'animated-glyphs-visible' property.
|
|
1998
2139
|
*/
|
|
1999
2140
|
_animatedGlyphsVisibleChanged(newValue, oldValue) {
|
|
2000
|
-
if (this.
|
|
2141
|
+
if (this.threeViewer) {
|
|
2001
2142
|
this.threeViewer.setVisibleAnimatedGlyphs(newValue);
|
|
2002
2143
|
}
|
|
2003
2144
|
}
|
|
@@ -2006,7 +2147,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
2006
2147
|
* Change in 'animated-glyphs-enable' property.
|
|
2007
2148
|
*/
|
|
2008
2149
|
_animatedGlyphsEnableChanged(newValue, oldValue) {
|
|
2009
|
-
if (this.
|
|
2150
|
+
if (this.threeViewer) {
|
|
2010
2151
|
this.threeViewer.setEnableAnimatedGlyphs(newValue);
|
|
2011
2152
|
}
|
|
2012
2153
|
}
|
|
@@ -2014,7 +2155,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
2014
2155
|
/**
|
|
2015
2156
|
* Change in 'transform-twist-angle', 'transform-tilt-angle' or 'transform-scale' properties.
|
|
2016
2157
|
*/
|
|
2017
|
-
_transformValueChanged(
|
|
2158
|
+
_transformValueChanged() {
|
|
2018
2159
|
var twist = this.transformTwistAngle !== undefined ? this.transformTwistAngle * Math.PI / 180 : 0;
|
|
2019
2160
|
var tilt = this.transformTiltAngle !== undefined ? this.transformTiltAngle * Math.PI / 180 : 0;
|
|
2020
2161
|
var scale = this.transformScale !== undefined ? this.transformScale / 100.0 : 1.0;
|
|
@@ -2056,24 +2197,24 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
2056
2197
|
}
|
|
2057
2198
|
|
|
2058
2199
|
if (this.motionCaptureFrames.length > 0) {
|
|
2059
|
-
this
|
|
2060
|
-
this
|
|
2061
|
-
this
|
|
2062
|
-
this
|
|
2063
|
-
this
|
|
2064
|
-
this
|
|
2065
|
-
this
|
|
2200
|
+
this.renderRoot.querySelector('#motionCapturePlay').classList.remove("disabled");
|
|
2201
|
+
this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerText = this.motionCaptureFrames.length;
|
|
2202
|
+
this.renderRoot.querySelector('#motionCaptureDelay').classList.remove("disabled");
|
|
2203
|
+
this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = "2";
|
|
2204
|
+
this.renderRoot.querySelector('#motionCaptureClear').classList.remove("disabled");
|
|
2205
|
+
this.renderRoot.querySelector('#motionCaptureCopyData').classList.remove("disabled");
|
|
2206
|
+
this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.remove("disabled");
|
|
2066
2207
|
this.motionCaptureDelay = 2;
|
|
2067
2208
|
this.motionCaptureTime = this.motionCaptureFrames[this.motionCaptureFrames.length - 1].time / 1000;
|
|
2068
2209
|
}
|
|
2069
2210
|
else {
|
|
2070
|
-
this
|
|
2071
|
-
this
|
|
2072
|
-
this
|
|
2073
|
-
this
|
|
2074
|
-
this
|
|
2075
|
-
this
|
|
2076
|
-
this
|
|
2211
|
+
this.renderRoot.querySelector('#motionCapturePlay').classList.add("disabled");
|
|
2212
|
+
this.renderRoot.querySelector('#motionCaptureSnapshotLabel').innerText = "0";
|
|
2213
|
+
this.renderRoot.querySelector('#motionCaptureDelay').classList.add("disabled");
|
|
2214
|
+
this.renderRoot.querySelector('#motionCaptureDelayLabel').innerText = "0";
|
|
2215
|
+
this.renderRoot.querySelector('#motionCaptureClear').classList.add("disabled");
|
|
2216
|
+
this.renderRoot.querySelector('#motionCaptureCopyData').classList.add("disabled");
|
|
2217
|
+
this.renderRoot.querySelector('#motionCaptureCopyUrl').classList.add("disabled");
|
|
2077
2218
|
this.motionCaptureDelay = 0;
|
|
2078
2219
|
this.motionCaptureTime = 0;
|
|
2079
2220
|
}
|
|
@@ -2159,7 +2300,7 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
2159
2300
|
}
|
|
2160
2301
|
|
|
2161
2302
|
_zoomOverlayTimeout() {
|
|
2162
|
-
this
|
|
2303
|
+
this.renderRoot.querySelector('#zoomOverlay').style.opacity = 0;
|
|
2163
2304
|
this.pointerDown = false;
|
|
2164
2305
|
}
|
|
2165
2306
|
|
|
@@ -2169,16 +2310,16 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
2169
2310
|
var width = Math.round(e.detail.widthZoomLevel);
|
|
2170
2311
|
var height = Math.round(e.detail.heightZoomLevel);
|
|
2171
2312
|
if (width === height) {
|
|
2172
|
-
this
|
|
2313
|
+
this.renderRoot.querySelector('#zoomOverlay').innerHTML = width + "%";
|
|
2173
2314
|
}
|
|
2174
2315
|
else {
|
|
2175
|
-
this
|
|
2316
|
+
this.renderRoot.querySelector('#zoomOverlay').innerHTML = width + "%," + height + "%";
|
|
2176
2317
|
}
|
|
2177
2318
|
|
|
2178
2319
|
var coords = this._getAdjustedCoords(e.detail.clientX, e.detail.clientY);
|
|
2179
|
-
this
|
|
2180
|
-
this
|
|
2181
|
-
this
|
|
2320
|
+
this.renderRoot.querySelector('#zoomOverlay').style.left = coords.x + "px";
|
|
2321
|
+
this.renderRoot.querySelector('#zoomOverlay').style.top = coords.y + "px";
|
|
2322
|
+
this.renderRoot.querySelector('#zoomOverlay').style.opacity = 1;
|
|
2182
2323
|
|
|
2183
2324
|
this.pointerDown = true;
|
|
2184
2325
|
this._dispatchPickEvents( {type:"HOVER",x:0,y:0,selected:{}} );
|
|
@@ -2187,11 +2328,8 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
2187
2328
|
}
|
|
2188
2329
|
|
|
2189
2330
|
_handlePanZoomEnd(e) {
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
this.panHeightZoomLevel = e.detail.heightZoomLevel;
|
|
2193
|
-
this.updateViewer();
|
|
2194
|
-
}
|
|
2331
|
+
this.panWidthZoomLevel = e.detail.widthZoomLevel;
|
|
2332
|
+
this.panHeightZoomLevel = e.detail.heightZoomLevel;
|
|
2195
2333
|
}
|
|
2196
2334
|
|
|
2197
2335
|
/**
|
|
@@ -2234,23 +2372,23 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
2234
2372
|
* Change in 'renderer' property.
|
|
2235
2373
|
*/
|
|
2236
2374
|
_rendererChanged(newValue, oldValue) {
|
|
2237
|
-
if (oldValue === 'IMAGE'
|
|
2375
|
+
if (oldValue === 'IMAGE') {
|
|
2238
2376
|
this.sceneImage.src = 'data:,';
|
|
2239
|
-
this
|
|
2240
|
-
this
|
|
2377
|
+
this.renderRoot.querySelector('#dataVizDiv').removeChild(this.sceneImage);
|
|
2378
|
+
this.renderRoot.querySelector('#dataVizDiv').removeChild(this.sceneImageMap);
|
|
2241
2379
|
}
|
|
2242
2380
|
else if (oldValue === 'SVG') {
|
|
2243
2381
|
var el = this.svgDiv;
|
|
2244
2382
|
while (el.firstChild) el.removeChild(el.firstChild);
|
|
2245
|
-
this
|
|
2383
|
+
this.renderRoot.querySelector('#dataVizDiv').removeChild(this.svgDiv);
|
|
2246
2384
|
}
|
|
2247
|
-
else if (
|
|
2385
|
+
else if (this.threeViewer) {
|
|
2248
2386
|
this.threeViewer.clearGeometry();
|
|
2249
2387
|
this.threeViewer.render();
|
|
2250
|
-
this
|
|
2388
|
+
this.renderRoot.querySelector('#dataVizDiv').removeChild(this.threeViewer.domElement);
|
|
2251
2389
|
}
|
|
2252
2390
|
|
|
2253
|
-
if (newValue === 'IMAGE'
|
|
2391
|
+
if (newValue === 'IMAGE') {
|
|
2254
2392
|
if (this.sceneImage === undefined) {
|
|
2255
2393
|
this.sceneImage = document.createElement("img");
|
|
2256
2394
|
this.sceneImage.setAttribute("id", "sceneImage");
|
|
@@ -2261,8 +2399,9 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
2261
2399
|
this.sceneImageMap.setAttribute("name", "sceneImageMap");
|
|
2262
2400
|
}
|
|
2263
2401
|
|
|
2264
|
-
this
|
|
2265
|
-
this
|
|
2402
|
+
this.renderRoot.querySelector('#dataVizDiv').appendChild(this.sceneImage);
|
|
2403
|
+
this.renderRoot.querySelector('#dataVizDiv').appendChild(this.sceneImageMap);
|
|
2404
|
+
this.threeViewer = null;
|
|
2266
2405
|
}
|
|
2267
2406
|
else if (newValue === 'SVG') {
|
|
2268
2407
|
if (this.svgDiv === undefined) {
|
|
@@ -2270,10 +2409,11 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
2270
2409
|
this.svgDiv.setAttribute("id", "svgDiv");
|
|
2271
2410
|
}
|
|
2272
2411
|
|
|
2273
|
-
this
|
|
2412
|
+
this.renderRoot.querySelector('#dataVizDiv').appendChild(this.svgDiv);
|
|
2413
|
+
this.threeViewer = null;
|
|
2274
2414
|
}
|
|
2275
|
-
else
|
|
2276
|
-
if (this.threeViewer
|
|
2415
|
+
else {
|
|
2416
|
+
if (!this.threeViewer) {
|
|
2277
2417
|
// Create ThreeJS viewer
|
|
2278
2418
|
this.threeViewer = new Viewer();
|
|
2279
2419
|
|
|
@@ -2296,15 +2436,11 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
2296
2436
|
}
|
|
2297
2437
|
this.threeViewer.setWebGLRenderer(renderer.webGLRenderer);
|
|
2298
2438
|
|
|
2299
|
-
|
|
2300
|
-
|
|
2439
|
+
this.animator = new Animator();
|
|
2440
|
+
this.threeViewer.setAnimator(this.animator);
|
|
2301
2441
|
}
|
|
2302
2442
|
|
|
2303
|
-
this
|
|
2304
|
-
}
|
|
2305
|
-
|
|
2306
|
-
if (this.initialized && !this.manualUpdate) {
|
|
2307
|
-
this.updateViewer();
|
|
2443
|
+
this.renderRoot.querySelector('#dataVizDiv').appendChild(this.threeViewer.domElement);
|
|
2308
2444
|
}
|
|
2309
2445
|
}
|
|
2310
2446
|
|
|
@@ -2318,10 +2454,10 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
2318
2454
|
this.rectCanvas.setAttribute("id", "rectCanvas");
|
|
2319
2455
|
this.rectCtx = this.rectCanvas.getContext('2d');
|
|
2320
2456
|
}
|
|
2321
|
-
this
|
|
2457
|
+
this.renderRoot.appendChild(this.rectCanvas);
|
|
2322
2458
|
}
|
|
2323
2459
|
else {
|
|
2324
|
-
this
|
|
2460
|
+
this.renderRoot.removeChild(this.rectCanvas);
|
|
2325
2461
|
}
|
|
2326
2462
|
}
|
|
2327
2463
|
|
|
@@ -2335,59 +2471,66 @@ export class AvsGoDataViz extends AvsDataSourceMixin(AvsStreamMixin(AvsHttpMixin
|
|
|
2335
2471
|
}
|
|
2336
2472
|
|
|
2337
2473
|
setTooltipHTML(html) {
|
|
2338
|
-
this
|
|
2474
|
+
this.renderRoot.querySelector('#tooltip').innerHTML = html;
|
|
2339
2475
|
}
|
|
2340
2476
|
|
|
2341
2477
|
showTooltip(clientX, clientY) {
|
|
2342
|
-
var
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2478
|
+
var tooltip = this.renderRoot.querySelector('#tooltip');
|
|
2479
|
+
var pos = this._calcTooltipPosition(tooltip, clientX, clientY);
|
|
2480
|
+
tooltip.style.left = pos.x + "px";
|
|
2481
|
+
tooltip.style.top = pos.y + "px";
|
|
2482
|
+
tooltip.style.opacity = 1;
|
|
2346
2483
|
}
|
|
2347
2484
|
|
|
2348
2485
|
hideTooltip() {
|
|
2349
|
-
this
|
|
2486
|
+
this.renderRoot.querySelector('#tooltip').style.opacity = 0;
|
|
2350
2487
|
}
|
|
2351
2488
|
|
|
2352
|
-
_calcTooltipPosition(clientX, clientY) {
|
|
2489
|
+
_calcTooltipPosition(tooltip, clientX, clientY) {
|
|
2353
2490
|
|
|
2354
|
-
// Calculate the tooltip location based on 4 quadrants of the visible portion
|
|
2491
|
+
// Calculate the tooltip location based on 4 quadrants of the visible portion
|
|
2355
2492
|
// of the visualization window
|
|
2356
2493
|
|
|
2357
|
-
var
|
|
2494
|
+
var dataVizDiv = this.renderRoot.querySelector('#dataVizDiv');
|
|
2495
|
+
|
|
2496
|
+
var offset = this._getOffset(dataVizDiv);
|
|
2358
2497
|
var deltaTop = -Math.min(0, offset.top - window.pageYOffset);
|
|
2359
2498
|
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 =
|
|
2499
|
+
var deltaBottom = -Math.min(0, window.innerHeight - (dataVizDiv.offsetHeight + offset.top - window.pageYOffset));
|
|
2500
|
+
var deltaRight = -Math.min(0, window.innerWidth - (dataVizDiv.offsetWidth + offset.left - window.pageXOffset));
|
|
2501
|
+
var vizHeight = dataVizDiv.offsetHeight - deltaTop - deltaBottom;
|
|
2502
|
+
var vizWidth = dataVizDiv.offsetWidth - deltaLeft - deltaRight;
|
|
2364
2503
|
var vizHalfX = vizWidth / 2 + deltaLeft;
|
|
2365
2504
|
var vizHalfY = vizHeight / 2 + deltaTop;
|
|
2366
2505
|
|
|
2367
2506
|
var toolPosition = { x: 0, y: 0 };
|
|
2368
2507
|
if (clientX < vizHalfX) {
|
|
2369
2508
|
var offset = (clientY < vizHalfY) ? 15 : 5;
|
|
2370
|
-
toolPosition.x = clientX + offset +
|
|
2509
|
+
toolPosition.x = clientX + offset + dataVizDiv.offsetLeft;
|
|
2371
2510
|
}
|
|
2372
2511
|
else {
|
|
2373
|
-
toolPosition.x = clientX - 10 +
|
|
2512
|
+
toolPosition.x = clientX - 10 + dataVizDiv.offsetLeft - tooltip.offsetWidth;
|
|
2374
2513
|
}
|
|
2375
2514
|
if (clientY < vizHalfY) {
|
|
2376
|
-
toolPosition.y = clientY + 5 +
|
|
2515
|
+
toolPosition.y = clientY + 5 + dataVizDiv.offsetTop;
|
|
2377
2516
|
}
|
|
2378
2517
|
else {
|
|
2379
|
-
toolPosition.y = clientY - 10 +
|
|
2518
|
+
toolPosition.y = clientY - 10 + dataVizDiv.offsetTop - tooltip.offsetHeight;
|
|
2380
2519
|
}
|
|
2381
2520
|
|
|
2382
2521
|
return toolPosition;
|
|
2383
2522
|
}
|
|
2384
2523
|
|
|
2385
|
-
_getOffset() {
|
|
2386
|
-
var rect =
|
|
2524
|
+
_getOffset(dataVizDiv) {
|
|
2525
|
+
var rect = dataVizDiv.getBoundingClientRect(),
|
|
2387
2526
|
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
|
|
2388
2527
|
scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
2389
2528
|
return { top: rect.top + scrollTop, left: rect.left + scrollLeft }
|
|
2390
2529
|
}
|
|
2391
2530
|
}
|
|
2392
2531
|
|
|
2393
|
-
|
|
2532
|
+
const ro = new ResizeObserver(entries => {
|
|
2533
|
+
entries.forEach(entry => entry.target._onResize(entry.contentRect));
|
|
2534
|
+
});
|
|
2535
|
+
|
|
2536
|
+
customElements.define('avs-go-dataviz', AvsGoDataViz);
|