@ndmspc/ndmvr 0.2.0 → 0.20220401.0

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.
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { Subject } from 'rxjs';
3
- import AFRAME from 'aframe';
3
+ import AFRAME$1 from 'aframe';
4
4
 
5
5
  function _defineProperties(target, props) {
6
6
  for (var i = 0; i < props.length; i++) {
@@ -82,7 +82,7 @@ var JsrootService = /*#__PURE__*/function () {
82
82
  var secondary = projectionTargetAxis ? axisArray[1] : axisArray[0];
83
83
  var primaryAxis = "f" + secondary + "axis";
84
84
  var secondaryAxis = "f" + primary + "axis";
85
- var binAxis = primary.toLowerCase() + "Max";
85
+ var binAxis = primary.toLowerCase() + "Pos";
86
86
 
87
87
  var h1 = _classPrivateFieldLooseBase(this, _jsroot)[_jsroot].createHistogram('TH1I', info.obj[primaryAxis].fNbins);
88
88
 
@@ -93,6 +93,7 @@ var JsrootService = /*#__PURE__*/function () {
93
93
  var currLabel = ((_info$obj$secondaryAx = info.obj[secondaryAxis].fLabels) === null || _info$obj$secondaryAx === void 0 ? void 0 : _info$obj$secondaryAx.arr.length) > 0 ? info.obj[secondaryAxis].fLabels.arr[info.bin[binAxis] - 1].fString : '';
94
94
 
95
95
  for (var n = 0; n < info.obj[primaryAxis].fNbins; n++) {
96
+ console.log(info.obj);
96
97
  h1.setBinContent(n + 1, projectionAxis === axisArray[0] ? info.obj.getBinContent(info.bin[binAxis], n + 1) : info.obj.getBinContent(n + 1, info.bin[binAxis]));
97
98
  }
98
99
 
@@ -105,10 +106,8 @@ var JsrootService = /*#__PURE__*/function () {
105
106
  _proto.openTH1Projection = function openTH1Projection(projectionAxis, info, idTargetElm, axisArray, projections, projIndex) {
106
107
  var _this = this;
107
108
 
108
- var xLength = info.obj.fXaxis.fXmax / info.obj.fXaxis.fNbins;
109
- var yLength = info.obj.fYaxis.fXmax / info.obj.fYaxis.fNbins;
110
- var xBin = info.bin.xMin / xLength;
111
- var yBin = info.bin.yMin / yLength;
109
+ var xBin = info.bin.xPos - 1;
110
+ var yBin = info.bin.yPos - 1;
112
111
 
113
112
  try {
114
113
  var projection = projections.fFolders.arr[xBin].fFolders.arr[yBin].fFolders.arr[projIndex || 0];
@@ -134,6 +133,8 @@ var JsrootService = /*#__PURE__*/function () {
134
133
  canvas.setAttribute('width', width);
135
134
  var svgString = new XMLSerializer().serializeToString(sourceSvgElement);
136
135
  var ctx = canvas.getContext('2d');
136
+ ctx.fillStyle = '#ffffff';
137
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
137
138
  var DOMURL = self.URL || self.webkitURL || self;
138
139
  var img = new Image();
139
140
  var svg = new Blob([svgString], {
@@ -174,13 +175,13 @@ var styles = {
174
175
  width: '90%',
175
176
  textAlign: 'center',
176
177
  align: 'center',
177
- paddingTop: 2
178
+ paddingTop: 4
178
179
  },
179
180
  projection: {
180
181
  display: 'block',
181
182
  margin: 'auto',
182
- width: '460px',
183
- height: '380px'
183
+ width: '420px',
184
+ height: '350px'
184
185
  },
185
186
  form: {
186
187
  display: 'block',
@@ -218,12 +219,15 @@ var JsrootHistogram = function JsrootHistogram(_ref) {
218
219
  setAxis = _useState[1];
219
220
 
220
221
  var _useState2 = useState(null),
221
- data = _useState2[0],
222
- setData = _useState2[1];
222
+ selectedBin = _useState2[0],
223
+ setSelectedBin = _useState2[1];
223
224
 
224
225
  var handleInputChange = function handleInputChange(event) {
225
- var axis = event.target.value;
226
- setAxis(axis);
226
+ setAxis(event.target.value);
227
+ };
228
+
229
+ var handleSubscription = function handleSubscription(data) {
230
+ setSelectedBin(data);
227
231
  };
228
232
 
229
233
  var renderForm = function renderForm() {
@@ -239,24 +243,22 @@ var JsrootHistogram = function JsrootHistogram(_ref) {
239
243
  id: "axisProjection",
240
244
  style: styles.input
241
245
  }, /*#__PURE__*/React.createElement("option", {
242
- defaultValue: projectionAxes[0]
246
+ value: projectionAxes[0]
243
247
  }, histogram["f" + projectionAxes[0] + "axis"].fTitle ? histogram["f" + projectionAxes[0] + "axis"].fTitle : projectionAxes[0]), /*#__PURE__*/React.createElement("option", {
244
248
  value: projectionAxes[1]
245
249
  }, histogram["f" + projectionAxes[1] + "axis"].fTitle ? histogram["f" + projectionAxes[1] + "axis"].fTitle : projectionAxes[1])));
246
250
  };
247
251
 
248
- var handleSubscription = function handleSubscription(data) {
249
- setData(data);
250
-
252
+ var createAndDisplayProjection = function createAndDisplayProjection() {
251
253
  if (projections !== null) {
252
254
  jsrootService.openTH1Projection(axis, {
253
255
  obj: histogram,
254
- bin: data
256
+ bin: selectedBin
255
257
  }, 'projectionContainer', projectionAxes, projections, projIndex);
256
258
  } else {
257
259
  jsrootService.createTH1Projection(axis, {
258
260
  obj: histogram,
259
- bin: data
261
+ bin: selectedBin
260
262
  }, 'projectionContainer', projectionAxes);
261
263
  setTimeout(function () {
262
264
  jsrootService.displayImageOfProjection('projectionContainer', 'th-mapping', '500px', '500px');
@@ -266,24 +268,21 @@ var JsrootHistogram = function JsrootHistogram(_ref) {
266
268
 
267
269
  useEffect(function () {
268
270
  jsrootService.jsrootLibrary = window.JSROOT;
271
+ setSelectedBin(null);
269
272
  subscription = jsrootSubject.getServiceEvent().subscribe(handleSubscription);
270
273
  return function () {
271
274
  return subscription.unsubscribe();
272
275
  };
273
- }, [axis, projections, histogram]);
274
-
275
- if (data !== null) {
276
- return /*#__PURE__*/React.createElement("div", {
277
- style: styles.box
278
- }, projections === null && renderForm(), /*#__PURE__*/React.createElement("div", {
279
- id: "projectionContainer",
280
- style: styles.projection
281
- }));
282
- } else {
283
- return /*#__PURE__*/React.createElement("div", {
284
- style: styles.box
285
- }, /*#__PURE__*/React.createElement("h3", null, "Empty"));
286
- }
276
+ }, [histogram]);
277
+ useEffect(function () {
278
+ if (selectedBin != null) createAndDisplayProjection();
279
+ }, [axis, selectedBin, projections]);
280
+ return /*#__PURE__*/React.createElement("div", {
281
+ style: styles.box
282
+ }, projections === null && selectedBin !== null && renderForm(), /*#__PURE__*/React.createElement("div", {
283
+ id: "projectionContainer",
284
+ style: styles.projection
285
+ }));
287
286
  };
288
287
 
289
288
  var _subject$1 = /*#__PURE__*/_classPrivateFieldLooseKey("subject");
@@ -322,604 +321,719 @@ var CameraSubject = /*#__PURE__*/function () {
322
321
 
323
322
  var cameraSubject = new CameraSubject();
324
323
 
325
- var NdmVrCamera = function NdmVrCamera() {
326
- var subscription;
327
- var offset = 30;
328
-
329
- var _useState = useState(0),
330
- rotation = _useState[0],
331
- setRotation = _useState[1];
324
+ var _cameraWrapper = /*#__PURE__*/_classPrivateFieldLooseKey("cameraWrapper");
332
325
 
333
- var _useState2 = useState(null),
334
- prevPosition = _useState2[0],
335
- setPrevPosition = _useState2[1];
326
+ var _setVerticalOffset = /*#__PURE__*/_classPrivateFieldLooseKey("setVerticalOffset");
336
327
 
337
- var _useState3 = useState('keyboard'),
338
- inputDevice = _useState3[0],
339
- setInputDevice = _useState3[1];
328
+ var CameraService = function CameraService() {
329
+ var _this = this;
340
330
 
341
- var _useState4 = useState(false),
342
- show = _useState4[0],
343
- setShow = _useState4[1];
331
+ Object.defineProperty(this, _cameraWrapper, {
332
+ writable: true,
333
+ value: void 0
334
+ });
344
335
 
345
- var _useState5 = useState(false),
346
- showProjection = _useState5[0],
347
- setShowProjection = _useState5[1];
336
+ this.verticalMoveCamera = function (moveUp, speed) {
337
+ if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] === null) _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] = document.getElementById('cameraWrapper');
348
338
 
349
- var handleSubscription = function handleSubscription(data) {
350
- if (data.device) {
351
- if (inputDevice !== data.device) setInputDevice(data.device);
352
- setShow(!show);
353
- } else if (data === 'shift') {
354
- compileRotation();
355
- } else if (data === 'show') {
356
- setShowProjection(!showProjection);
339
+ if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] !== null) {
340
+ if (moveUp) {
341
+ _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position.y += speed;
342
+ } else {
343
+ if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position.y > 0) _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position.y -= speed;
344
+ }
357
345
  }
358
346
  };
359
347
 
360
- var compileRotation = function compileRotation() {
361
- var currentRotation = rotation + 90;
362
- if (currentRotation >= 360) currentRotation = 0;
363
- setRotation(currentRotation);
364
- };
348
+ this.horizontalMoveCamera = function (axis, increment, speed) {
349
+ if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] === null) _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] = document.getElementById('cameraWrapper');
365
350
 
366
- var renderProjectionsBanners = function renderProjectionsBanners() {
367
- return /*#__PURE__*/React.createElement("a-entity", {
368
- position: prevPosition === null ? "0 " + offset + " 0" : prevPosition.x + " " + offset + " " + prevPosition.z,
369
- animation__rotation: "property: rotation; to: 0 " + rotation + " 0; dur: 1000; easing: linear;",
370
- material: "color: white"
371
- }, /*#__PURE__*/React.createElement("a-entity", {
372
- geometry: "primitive: box; width: 50; height: 10; depth: 0.1;",
373
- position: "-30 28 0",
374
- rotation: "45 90 0",
375
- material: "color:white;"
376
- }, /*#__PURE__*/React.createElement("a-text", {
377
- color: "black",
378
- width: 50,
379
- value: inputDevice === 'keyboard' ? 'Press C to show help panels' : 'Press Button X to show help panels',
380
- position: "-20 2.8 1"
381
- }), /*#__PURE__*/React.createElement("a-text", {
382
- color: "black",
383
- width: 50,
384
- value: inputDevice === 'keyboard' ? 'Press V to switch to histogram view' : 'Press Button Y to switch to histogram view',
385
- position: "-20 0 1"
386
- }), /*#__PURE__*/React.createElement("a-text", {
387
- color: "black",
388
- width: 50,
389
- value: inputDevice === 'keyboard' ? 'Press X to shift panels' : 'Press right Trigger to shift panels',
390
- position: "-20 -2.8 1"
391
- })), /*#__PURE__*/React.createElement("a-box", {
392
- id: "bannerId_1",
393
- scale: "80 50 2",
394
- animation__position: "property: position; from: 0 0 -60; to: 0 -1 -42; delay: 0; dur: 800; easing: linear;",
395
- material: "transparent:true"
396
- }), /*#__PURE__*/React.createElement("a-box", {
397
- scale: "80 52 2",
398
- animation__position: "property: position; from: 0 0 -60; to: 0 0 -42.5; delay: 0; dur: 800; easing: linear;",
399
- material: "color: white;"
400
- }), /*#__PURE__*/React.createElement("a-box", {
401
- id: "bannerId_2",
402
- scale: "80 50 2",
403
- animation__position: "property: position; from: 60 0 0; to: 42 -1 0; delay: 200; dur: 800; easing: linear;",
404
- rotation: "0 90 0",
405
- material: "transparent:true"
406
- }), /*#__PURE__*/React.createElement("a-box", {
407
- scale: "80 52 2",
408
- animation__position: "property: position; from: 60 0 0; to: 42.5 0 0; delay: 200; dur: 800; easing: linear;",
409
- rotation: "0 90 0",
410
- material: "color: white;"
411
- }), /*#__PURE__*/React.createElement("a-box", {
412
- id: "bannerId_3",
413
- scale: "80 50 2",
414
- animation__position: "property: position; from: 0 0 60; to: 0 -1 42; delay: 400; dur: 800; easing: linear;",
415
- material: "transparent:true"
416
- }), /*#__PURE__*/React.createElement("a-box", {
417
- scale: "80 52 2",
418
- animation__position: "property: position; from: 0 0 60; to: 0 0 42.5; delay: 400; dur: 800; easing: linear;",
419
- material: "color: white;"
420
- }), /*#__PURE__*/React.createElement("a-box", {
421
- id: "bannerId_4",
422
- scale: "80 50 2",
423
- animation__position: "property: position; from: -60 0 0; to: -42 -1 0; delay: 600; dur: 800; easing: linear;",
424
- rotation: "0 90 0",
425
- material: "transparent:true"
426
- }), /*#__PURE__*/React.createElement("a-box", {
427
- scale: "80 52 2",
428
- animation__position: "property: position; from: -60 0 0; to: -42.5 0 0; delay: 600; dur: 800; easing: linear;",
429
- rotation: "0 90 0",
430
- material: "color: white;"
431
- }));
351
+ if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] !== null) {
352
+ if (increment) {
353
+ _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position[axis] += speed;
354
+ } else {
355
+ _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position[axis] -= speed;
356
+ }
357
+ }
432
358
  };
433
359
 
434
- var renderBannersWithControls = function renderBannersWithControls() {
435
- if (inputDevice === 'keyboard') {
436
- return /*#__PURE__*/React.createElement("a-entity", {
437
- position: prevPosition === null ? "0 " + offset + " 0" : prevPosition.x + " " + offset + " " + prevPosition.z,
438
- animation__rotation: "property: rotation; to: 0 " + rotation + " 0; dur: 1000; easing: linear;",
439
- material: "color: white"
440
- }, /*#__PURE__*/React.createElement("a-entity", {
441
- geometry: "primitive: box; width: 50; height: 10; depth: 0.1;",
442
- position: "-30 28 0",
443
- rotation: "45 90 0",
444
- material: "color: white"
445
- }, /*#__PURE__*/React.createElement("a-text", {
446
- color: "black",
447
- width: "50",
448
- value: showProjection ? 'Press C to show help panels' : 'Press C to show projection panels',
449
- position: "-20 2.8 1"
450
- }), /*#__PURE__*/React.createElement("a-text", {
451
- color: "black",
452
- width: "50",
453
- value: "Press V to switch to histogram view",
454
- position: "-20 0 1"
455
- }), /*#__PURE__*/React.createElement("a-text", {
456
- color: "black",
457
- width: "50",
458
- value: "Press X to shift panels",
459
- position: "-20 -2.8 1"
460
- })), /*#__PURE__*/React.createElement("a-box", {
461
- scale: "80 50 2",
462
- animation__position: "property: position; from: -30 0 60; to: -30 0 30; delay: 0; dur: 800; easing: linear;",
463
- rotation: "0 -45 0",
464
- src: "./ndmvr/keyboardControls/keyboard.png"
465
- }), /*#__PURE__*/React.createElement("a-box", {
466
- scale: "80 50 2",
467
- animation__position: "property: position; from: -30 0 -60; to: -30 0 -30; delay: 200; dur: 800; easing: linear;",
468
- rotation: "0 45 0",
469
- src: "./ndmvr/keyboardControls/keyboard1.png"
470
- }), /*#__PURE__*/React.createElement("a-box", {
471
- scale: "80 50 2",
472
- animation__position: "property: position; from: 30 0 -60; to: 30 0 -30; delay: 400; dur: 800; easing: linear;",
473
- rotation: "0 -45 0",
474
- src: "./ndmvr/keyboardControls/keyboard2.png"
475
- }), /*#__PURE__*/React.createElement("a-box", {
476
- scale: "80 50 2",
477
- animation__position: "property: position; from: 30 0 60; to: 30 0 30; delay: 600; dur: 800; easing: linear;",
478
- rotation: " 0 45 0",
479
- src: "./ndmvr/keyboardControls/keyboard3.png"
480
- }));
481
- } else {
482
- return /*#__PURE__*/React.createElement("a-entity", {
483
- position: prevPosition === null ? "0 " + offset + " 0" : prevPosition.x + " " + offset + " " + prevPosition.z,
484
- animation__rotation: "property: rotation; to: 0 " + rotation + " 0; dur: 1000; easing: linear;"
485
- }, /*#__PURE__*/React.createElement("a-entity", {
486
- geometry: "primitive: box; width: 50; height: 10; depth: 0.1;",
487
- position: "-30 28 0",
488
- rotation: "45 90 0",
489
- material: "color: white"
490
- }, /*#__PURE__*/React.createElement("a-text", {
491
- color: "black",
492
- width: "50",
493
- value: showProjection ? 'Press Button X to show help panels' : 'Press Button X to show projection panels',
494
- position: "-20 2.8 1"
495
- }), /*#__PURE__*/React.createElement("a-text", {
496
- color: "black",
497
- width: "50",
498
- value: "Press Button Y to switch to histogram view",
499
- position: "-20 0 1"
500
- }), /*#__PURE__*/React.createElement("a-text", {
501
- color: "black",
502
- width: "50",
503
- value: "Press right Trigger to shift panels",
504
- position: "-20 -2.8 1"
505
- })), /*#__PURE__*/React.createElement("a-box", {
506
- scale: "80 50 2",
507
- animation__position: "property: position; from: -35 0 60; to: -32 0 32; delay: 0; dur: 800; easing: linear;",
508
- rotation: "-10 -45 0",
509
- src: "./ndmvr/oculusControls/oculus.png"
510
- }), /*#__PURE__*/React.createElement("a-box", {
511
- scale: "80 50 2",
512
- animation__position: "property: position; from: -35 0 -60; to: -32 0 -32; delay: 200; dur: 800; easing: linear;",
513
- rotation: "10 45 0",
514
- src: "./ndmvr/oculusControls/oculus2.png"
515
- }), /*#__PURE__*/React.createElement("a-box", {
516
- scale: "80 50 2",
517
- animation__position: "property: position; from: 35 0 -60; to: 32 0 -32; delay: 400; dur: 800; easing: linear;",
518
- rotation: "10 -45 0",
519
- src: "./ndmvr/oculusControls/oculus1.png"
520
- }), /*#__PURE__*/React.createElement("a-box", {
521
- scale: "80 50 2",
522
- animation__position: "property: position; from: 35 0 60; to: 32 0 32; delay: 600; dur: 800; easing: linear;",
523
- rotation: "-10 45 0",
524
- src: "./ndmvr/oculusControls/oculus3.png"
525
- }));
360
+ Object.defineProperty(this, _setVerticalOffset, {
361
+ writable: true,
362
+ value: function value(elm, offset, rotation) {
363
+ if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] !== null && elm !== null) {
364
+ var newXPos = elm.object3D.position.x + 1 * elm.object3D.position.x;
365
+ var newZPos = elm.object3D.position.z + 1 * elm.object3D.position.z;
366
+ var newYPos = offset;
367
+
368
+ _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].setAttribute('animation', "property: position; to: " + (newXPos + 1) + " " + newYPos + " " + (newZPos + 1) + "; dur: 100;");
369
+
370
+ _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].setAttribute('animation__1', "property: rotation; to: " + _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.rotation.x + " " + rotation + " " + _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.rotation.z + "; dur: 100;");
371
+ }
372
+ }
373
+ });
374
+
375
+ this.setCameraPosition = function (offsets) {
376
+ if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] !== null) {
377
+ var newZPos = _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position.y;
378
+
379
+ if (offsets.zOffset !== undefined) {
380
+ newZPos = offsets.zOffset * 2;
381
+ }
382
+
383
+ var newXPos = offsets.xOffset + offsets.xOffset;
384
+ var newYPos = offsets.yOffset + offsets.yOffset;
385
+ setTimeout(function () {
386
+ _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].setAttribute('animation', "property: position; to: " + (newXPos - 3) + " " + newZPos + " " + (newYPos - 3) + "; dur: 40;");
387
+ }, 1800);
526
388
  }
527
389
  };
528
390
 
529
- var hideMappingBanner = function hideMappingBanner() {
530
- var banner = document.getElementById('th-mapping');
531
- var background = document.getElementById('th-background');
391
+ this.setPredefinedDownPosition = function () {
392
+ var labelElement = document.getElementById('downLabel');
532
393
 
533
- if (banner !== undefined && background !== undefined) {
534
- banner.setAttribute('material', 'opacity', 0);
535
- background.setAttribute('material', 'opacity', 0);
394
+ if (labelElement !== undefined) {
395
+ _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 0, 180);
536
396
  }
537
397
  };
538
398
 
539
- var showMappingBanner = function showMappingBanner() {
540
- var banner = document.getElementById('th-mapping');
541
- var background = document.getElementById('th-background');
399
+ this.setPredefinedUpPosition = function () {
400
+ var labelElement = document.getElementById('upLabel');
542
401
 
543
- if (banner !== undefined && background !== undefined) {
544
- banner.setAttribute('material', 'opacity', 1);
545
- background.setAttribute('material', 'opacity', 1);
402
+ if (labelElement !== undefined) {
403
+ _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 0, 0);
546
404
  }
547
405
  };
548
406
 
549
- useEffect(function () {
550
- subscription = cameraSubject.getCameraSubject().subscribe(handleSubscription);
551
- return function () {
552
- return subscription.unsubscribe();
553
- };
554
- }, [show, showProjection, rotation]);
555
- useEffect(function () {
556
- var camera = document.getElementById('camera');
407
+ this.setPredefinedRightPosition = function () {
408
+ var labelElement = document.getElementById('rightLabel');
557
409
 
558
- if (!show) {
559
- camera.object3D.position.y = 1.6;
410
+ if (labelElement !== undefined) {
411
+ _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 0, 90);
412
+ }
413
+ };
560
414
 
561
- if (prevPosition !== null) {
562
- camera.object3D.position.x = prevPosition.x;
563
- camera.object3D.position.z = prevPosition.z;
564
- camera.object3D.position.y = prevPosition.y;
565
- }
415
+ this.setPredefinedLeftPosition = function () {
416
+ var labelElement = document.getElementById('leftLabel');
566
417
 
567
- showMappingBanner();
568
- } else {
569
- setPrevPosition({
570
- x: camera.object3D.position.x,
571
- y: camera.object3D.position.y,
572
- z: camera.object3D.position.z
573
- });
574
- camera.object3D.position.y = camera.object3D.position.y + offset;
575
- hideMappingBanner();
418
+ if (labelElement !== undefined) {
419
+ _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 0, 270);
576
420
  }
577
- }, [show, inputDevice]);
578
- useEffect(function () {
579
- if (showProjection) {
580
- jsrootService.displayImageOfProjection('projectionContainer', 'bannerId_1', '500px', '400px');
421
+ };
422
+
423
+ this.setPredefinedDownPositionWithOffset = function () {
424
+ var labelElement = document.getElementById('downLabel');
425
+
426
+ if (labelElement !== undefined) {
427
+ _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 10, 180);
581
428
  }
582
- }, [showProjection]);
583
- return /*#__PURE__*/React.createElement("a-entity", {
584
- id: "cameraWrapper",
585
- rotation: "0 180 0",
586
- position: "0 2 0"
587
- }, show && !showProjection && renderBannersWithControls(), show && showProjection && renderProjectionsBanners(), /*#__PURE__*/React.createElement("a-camera", {
588
- id: "camera",
589
- "look-control": true,
590
- "wasd-controls-enabled": "acceleration:=50"
591
- }, /*#__PURE__*/React.createElement("a-entity", {
592
- cursor: "fuse: false; fuseTimeout: 2000;",
593
- raycaster: "objects: .clickable; showLine: false; far: 100;",
594
- animation__click: "property: scale; startEvents: click; from: 0.1 0.1 0.1; to: 1.4 1.4 1.4; dur: 150",
595
- animation__mouseenter: "property: scale; startEvents: mouseenter; from: 1 1 1; to: 1.4 1.4 1.4; dur: 180",
596
- animation__mouseleave: "property: scale; startEvents: mouseleave; from: 1.4 1.4 1.4; to: 1 1 1; dur: 180",
597
- line: "color: orange; opacity: 0.5",
598
- far: "100",
599
- position: "0 0 -1",
600
- geometry: "primitive: ring; radiusInner: 0.02; radiusOuter: 0.03",
601
- material: "color: white; shader: flat"
602
- }), /*#__PURE__*/React.createElement("a-entity", {
603
- "oculus-touch-controls": "hand: left",
604
- "left-controller-logging": true
605
- }), /*#__PURE__*/React.createElement("a-entity", {
606
- "oculus-touch-controls": "hand: right",
607
- "right-controller-logging": true
608
- })));
609
- };
429
+ };
610
430
 
611
- var _storage = /*#__PURE__*/_classPrivateFieldLooseKey("storage");
431
+ this.setPredefinedUpPositionWithOffset = function () {
432
+ var labelElement = document.getElementById('upLabel');
612
433
 
613
- var _camera = /*#__PURE__*/_classPrivateFieldLooseKey("camera");
434
+ if (labelElement !== undefined) {
435
+ _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 10, 0);
436
+ }
437
+ };
614
438
 
615
- var _selectedBins = /*#__PURE__*/_classPrivateFieldLooseKey("selectedBins");
439
+ this.setPredefinedRightPositionWithOffset = function () {
440
+ var labelElement = document.getElementById('rightLabel');
616
441
 
617
- var _deleteCurrentBin = /*#__PURE__*/_classPrivateFieldLooseKey("deleteCurrentBin");
442
+ if (labelElement !== undefined) {
443
+ _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 10, 90);
444
+ }
445
+ };
618
446
 
619
- var NdmVrStorageService = /*#__PURE__*/function () {
620
- function NdmVrStorageService() {
621
- var _this = this;
447
+ this.setPredefinedLeftPositionWithOffset = function () {
448
+ var labelElement = document.getElementById('leftLabel');
622
449
 
623
- Object.defineProperty(this, _storage, {
624
- writable: true,
625
- value: void 0
626
- });
627
- Object.defineProperty(this, _camera, {
450
+ if (labelElement !== undefined) {
451
+ _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 10, 270);
452
+ }
453
+ };
454
+
455
+ _classPrivateFieldLooseBase(this, _cameraWrapper)[_cameraWrapper] = document.getElementById('cameraWrapper');
456
+ };
457
+
458
+ var _subject$2 = /*#__PURE__*/_classPrivateFieldLooseKey("subject");
459
+
460
+ var HistogramSubject = /*#__PURE__*/function () {
461
+ function HistogramSubject() {
462
+ Object.defineProperty(this, _subject$2, {
628
463
  writable: true,
629
464
  value: void 0
630
465
  });
631
- Object.defineProperty(this, _selectedBins, {
632
- writable: true,
633
- value: []
634
- });
635
- Object.defineProperty(this, _deleteCurrentBin, {
636
- writable: true,
637
- value: function value(binData) {
638
- return _classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins].filter(function (item) {
639
- return item.id !== binData.id;
640
- });
641
- }
642
- });
466
+ _classPrivateFieldLooseBase(this, _subject$2)[_subject$2] = new Subject();
467
+ }
643
468
 
644
- this.containThisBin = function (binData) {
645
- var updatedArray = _classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins].filter(function (item) {
646
- return item.id === binData.id;
647
- });
469
+ var _proto = HistogramSubject.prototype;
648
470
 
649
- return updatedArray.length !== 0;
650
- };
471
+ _proto.changeHistogramSectionByOffset = function changeHistogramSectionByOffset(axis, histogramType, increment, defaultRange) {
472
+ _classPrivateFieldLooseBase(this, _subject$2)[_subject$2].next({
473
+ name: histogramType,
474
+ axis: axis,
475
+ increment: increment,
476
+ defaultRange: defaultRange
477
+ });
478
+ };
651
479
 
652
- this.storeBinToLocalStorage = function (binData) {
653
- if (!_this.containThisBin(binData)) {
654
- _classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins].push(binData);
480
+ _proto.changeHistogramFunction = function changeHistogramFunction(typeFunction, histogramType) {
481
+ _classPrivateFieldLooseBase(this, _subject$2)[_subject$2].next({
482
+ fFunction: typeFunction,
483
+ name: histogramType
484
+ });
485
+ };
655
486
 
656
- _classPrivateFieldLooseBase(_this, _storage)[_storage].setItem('selectedBins', JSON.stringify(_classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins]));
657
- }
658
- };
487
+ _proto.changeTypeOfBinMark = function changeTypeOfBinMark(value, histogramType) {
488
+ _classPrivateFieldLooseBase(this, _subject$2)[_subject$2].next({
489
+ binMarkMode: value,
490
+ name: histogramType
491
+ });
492
+ };
659
493
 
660
- this.deleteBinFromLocalStorage = function (binData) {
661
- if (_this.containThisBin(binData)) {
662
- _classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins] = _classPrivateFieldLooseBase(_this, _deleteCurrentBin)[_deleteCurrentBin](binData);
494
+ _proto.getChangedSection = function getChangedSection() {
495
+ return _classPrivateFieldLooseBase(this, _subject$2)[_subject$2].asObservable();
496
+ };
663
497
 
664
- _classPrivateFieldLooseBase(_this, _storage)[_storage].setItem('selectedBins', JSON.stringify(_classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins]));
665
- }
666
- };
498
+ return HistogramSubject;
499
+ }();
667
500
 
668
- this.getBinsFromLocalStorage = function () {
669
- var selectedBins = JSON.parse(_classPrivateFieldLooseBase(_this, _storage)[_storage].getItem('selectedBins'));
501
+ var histogramTH2Service = new HistogramSubject();
502
+ var histogramTH3Service = new HistogramSubject();
670
503
 
671
- if (selectedBins === null) {
672
- return [];
673
- } else {
674
- return selectedBins;
675
- }
676
- };
504
+ var _subject$3 = /*#__PURE__*/_classPrivateFieldLooseKey("subject");
677
505
 
678
- _classPrivateFieldLooseBase(this, _storage)[_storage] = window.localStorage;
679
- _classPrivateFieldLooseBase(this, _camera)[_camera] = document.getElementById('cameraWrapper');
680
- _classPrivateFieldLooseBase(this, _selectedBins)[_selectedBins] = this.getBinsFromLocalStorage();
506
+ var BinSubject = /*#__PURE__*/function () {
507
+ function BinSubject() {
508
+ Object.defineProperty(this, _subject$3, {
509
+ writable: true,
510
+ value: void 0
511
+ });
512
+ _classPrivateFieldLooseBase(this, _subject$3)[_subject$3] = new Subject();
681
513
  }
682
514
 
683
- var _proto = NdmVrStorageService.prototype;
515
+ var _proto = BinSubject.prototype;
684
516
 
685
- _proto.storeCurrentBinToLocalStorage = function storeCurrentBinToLocalStorage(binData) {
686
- _classPrivateFieldLooseBase(this, _storage)[_storage].setItem('currentBin', JSON.stringify(binData));
517
+ _proto.saveSelectedBinToLocalStorage = function saveSelectedBinToLocalStorage() {
518
+ _classPrivateFieldLooseBase(this, _subject$3)[_subject$3].next(true);
687
519
  };
688
520
 
689
- _proto.getCurrentBinFromLocalStorage = function getCurrentBinFromLocalStorage() {
690
- var currentBin = JSON.parse(_classPrivateFieldLooseBase(this, _storage)[_storage].getItem('currentBin'));
691
-
692
- if (currentBin === undefined || currentBin === '') {
693
- return null;
694
- }
695
-
696
- return currentBin;
521
+ _proto.deleteBinFromLocalStorage = function deleteBinFromLocalStorage() {
522
+ _classPrivateFieldLooseBase(this, _subject$3)[_subject$3].next(false);
697
523
  };
698
524
 
699
- _proto.loadProperty = function loadProperty(property) {
700
- return JSON.parse(_classPrivateFieldLooseBase(this, _storage)[_storage].getItem(property));
525
+ _proto.getKeyboardEvent = function getKeyboardEvent() {
526
+ return _classPrivateFieldLooseBase(this, _subject$3)[_subject$3].asObservable();
701
527
  };
702
528
 
703
- _proto.storeProperty = function storeProperty(property, object) {
704
- _classPrivateFieldLooseBase(this, _storage)[_storage].setItem(property, JSON.stringify(object));
705
- };
529
+ return BinSubject;
530
+ }();
706
531
 
707
- _proto.initHistogramData = function initHistogramData(histogram) {
708
- if (histogram._typename.includes('TH3')) {
709
- this.storeTH3HistogramLimits(histogram);
710
- } else if (histogram._typename.includes('TH2')) {
711
- this.storeTH2HistogramLimits(histogram);
712
- }
713
- };
532
+ var binSubject = new BinSubject();
714
533
 
715
- _proto.storeTH2Offsets = function storeTH2Offsets(xOffset, yOffset, range) {
716
- var object = this.loadProperty('TH2');
717
- var section;
534
+ var keyPressed = {};
535
+ var cameraService = new CameraService();
536
+ var aframeObj;
537
+ var geoAttributes;
538
+ var toolsSelector = new Subject();
539
+ var activeTool;
718
540
 
719
- if (object === null) {
720
- object = {};
721
- section = {
722
- name: 'TH2',
723
- xOffset: 1,
724
- yOffset: 1,
725
- range: 8
726
- };
727
- } else {
728
- section = {
729
- name: 'TH2',
730
- xOffset: xOffset,
731
- yOffset: yOffset,
732
- range: range
733
- };
734
- }
541
+ var handlePositioning = function handlePositioning(property, event) {
542
+ var difference = 0.2;
543
+ if (property.name === 'scale') difference = 0.01;else if (property.name === 'rotation') difference = 2;
735
544
 
736
- object.section = section;
737
- this.storeProperty('TH2', object);
738
- };
545
+ if (event.key === 'ArrowDown') {
546
+ property.xValue = property.xValue + difference;
547
+ } else if (event.key === 'ArrowUp') {
548
+ property.xValue = property.xValue - difference;
549
+ } else if (event.key === '=') {
550
+ property.yValue = property.yValue + difference;
551
+ } else if (event.key === '-') {
552
+ property.yValue = property.yValue - difference;
553
+ } else if (event.key === 'ArrowRight') {
554
+ property.zValue = property.zValue + difference;
555
+ } else if (event.key === 'ArrowLeft') {
556
+ property.zValue = property.zValue - difference;
557
+ }
739
558
 
740
- _proto.storeTH3Offsets = function storeTH3Offsets(xOffset, yOffset, zOffset, range) {
741
- var object = this.loadProperty('TH3');
742
- var section;
559
+ aframeObj.setAttribute(property.name, property.xValue + " " + property.yValue + " " + property.zValue);
560
+ };
743
561
 
744
- if (object === null) {
745
- object = {};
746
- section = {
747
- name: 'TH3',
748
- xOffset: 1,
749
- yOffset: 1,
750
- zOffset: 1,
751
- range: 4
752
- };
753
- } else {
754
- section = {
755
- name: 'TH3',
756
- xOffset: xOffset,
757
- yOffset: yOffset,
758
- zOffset: zOffset,
759
- range: range
760
- };
761
- }
562
+ var handleChangeHistogramSectionByDefaultRange = function handleChangeHistogramSectionByDefaultRange(event) {
563
+ if (event.key === 'k' || event.key === 'K') {
564
+ histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', false, true);
565
+ histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', false, true);
566
+ } else if (event.key === 'i' || event.key === 'I') {
567
+ histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', true, true);
568
+ histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', true, true);
569
+ } else if (event.key === 'u' || event.key === 'U') {
570
+ histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', true, true);
571
+ } else if (event.key === 'o' || event.key === 'O') {
572
+ histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', false, true);
573
+ } else if (event.key === 'l' || event.key === 'L') {
574
+ histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', false, true);
575
+ histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', false, true);
576
+ } else if (event.key === 'j' || event.key === 'J') {
577
+ histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', true, true);
578
+ histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', true, true);
579
+ }
580
+ };
762
581
 
763
- object.section = section;
764
- this.storeProperty('TH3', object);
765
- };
582
+ var handleChangeHistogramSectionByOwnRange = function handleChangeHistogramSectionByOwnRange(event) {
583
+ if (event.key === 'k' || event.key === 'K') {
584
+ histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', false, false);
585
+ histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', false, false);
586
+ } else if (event.key === 'i' || event.key === 'I') {
587
+ histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', true, false);
588
+ histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', true, false);
589
+ } else if (event.key === 'u' || event.key === 'U') {
590
+ histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', true, false);
591
+ } else if (event.key === 'o' || event.key === 'O') {
592
+ histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', false, false);
593
+ } else if (event.key === 'l' || event.key === 'L') {
594
+ histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', false, false);
595
+ histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', false, false);
596
+ } else if (event.key === 'j' || event.key === 'J') {
597
+ histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', true, false);
598
+ histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', true, false);
599
+ }
600
+ };
766
601
 
767
- _proto.storeOffsets = function storeOffsets(section) {
768
- if (section.name.includes('TH3') || section.name.includes('th3')) {
769
- this.storeTH3Offsets(section.xOffset, section.yOffset, section.zOffset, section.range);
770
- } else if (section.name.includes('TH2') || section.name.includes('th2')) {
771
- this.storeTH2Offsets(section.xOffset, section.yOffset, section.range);
772
- }
773
- };
602
+ var keyPressHandlerFunction = function keyPressHandlerFunction(event) {
603
+ keyPressed[event.key] = true;
774
604
 
775
- _proto.storeFilePath = function storeFilePath(filePath) {
776
- _classPrivateFieldLooseBase(this, _storage)[_storage].setItem('rootFile', filePath);
777
- };
605
+ if (keyPressed.Z || keyPressed.z) {
606
+ handlePositioning(geoAttributes[0], event);
607
+ }
778
608
 
779
- _proto.loadFilePath = function loadFilePath() {
780
- var filename = _classPrivateFieldLooseBase(this, _storage)[_storage].getItem('rootFile');
609
+ if (keyPressed.X || keyPressed.x) {
610
+ handlePositioning(geoAttributes[1], event);
611
+ }
781
612
 
782
- if (filename === null || filename === undefined) {
783
- return 'defaultHistogram';
784
- }
613
+ if (keyPressed.C || keyPressed.c) {
614
+ handlePositioning(geoAttributes[2], event);
615
+ }
785
616
 
786
- return filename;
787
- };
617
+ if (keyPressed.Shift) {
618
+ handleChangeHistogramSectionByOwnRange(event);
619
+ }
788
620
 
789
- _proto.loadTH2Offsets = function loadTH2Offsets() {
790
- var object = this.loadProperty('TH2');
621
+ handleChangeHistogramSectionByDefaultRange(event);
791
622
 
792
- if (object !== null) {
793
- return object.section;
794
- } else {
795
- return null;
796
- }
797
- };
623
+ if (event.key === ' ') {
624
+ cameraService.verticalMoveCamera(true, 0.3);
625
+ }
798
626
 
799
- _proto.loadTH3Offsets = function loadTH3Offsets() {
800
- var object = this.loadProperty('TH3');
627
+ if (event.shiftKey) {
628
+ cameraService.verticalMoveCamera(false, 0.3);
629
+ }
801
630
 
802
- if (object !== null) {
803
- return object.section;
804
- } else {
805
- return null;
806
- }
807
- };
631
+ if (event.key === '1') {
632
+ toolsSelector.next(1);
633
+ activeTool = 1;
634
+ }
808
635
 
809
- _proto.loadOffsets = function loadOffsets(type) {
810
- if (type.includes('TH3') || type.includes('th3')) {
811
- return this.loadTH3Offsets();
812
- } else if (type.includes('TH2') || type.includes('th2')) {
813
- return this.loadTH2Offsets();
814
- }
815
- };
636
+ if (event.key === '2') {
637
+ toolsSelector.next(2);
638
+ activeTool = 2;
639
+ }
816
640
 
817
- return NdmVrStorageService;
818
- }();
819
- var localStorageService = new NdmVrStorageService();
641
+ if (event.key === '3') {
642
+ toolsSelector.next(3);
643
+ activeTool = 3;
644
+ }
820
645
 
821
- var _subject$2 = /*#__PURE__*/_classPrivateFieldLooseKey("subject");
646
+ if (event.key === '4') {
647
+ toolsSelector.next(4);
648
+ activeTool = 4;
649
+ }
822
650
 
823
- var BinSubject = /*#__PURE__*/function () {
824
- function BinSubject() {
825
- Object.defineProperty(this, _subject$2, {
826
- writable: true,
827
- value: void 0
828
- });
829
- _classPrivateFieldLooseBase(this, _subject$2)[_subject$2] = new Subject();
651
+ if (event.key === '5') {
652
+ toolsSelector.next(5);
653
+ activeTool = 5;
830
654
  }
831
655
 
832
- var _proto = BinSubject.prototype;
656
+ if (event.key === '6') {
657
+ toolsSelector.next(6);
658
+ activeTool = 6;
659
+ }
833
660
 
834
- _proto.saveSelectedBinToLocalStorage = function saveSelectedBinToLocalStorage() {
835
- _classPrivateFieldLooseBase(this, _subject$2)[_subject$2].next(true);
836
- };
661
+ if (event.key === '7') {
662
+ toolsSelector.next(7);
663
+ activeTool = 7;
664
+ }
837
665
 
838
- _proto.deleteBinFromLocalStorage = function deleteBinFromLocalStorage() {
839
- _classPrivateFieldLooseBase(this, _subject$2)[_subject$2].next(false);
840
- };
666
+ if (event.key === '8') {
667
+ toolsSelector.next(8);
668
+ activeTool = 8;
669
+ }
841
670
 
842
- _proto.getKeyboardEvent = function getKeyboardEvent() {
843
- return _classPrivateFieldLooseBase(this, _subject$2)[_subject$2].asObservable();
844
- };
671
+ if (event.key === '9') {
672
+ toolsSelector.next(9);
673
+ activeTool = 9;
674
+ }
845
675
 
846
- return BinSubject;
847
- }();
676
+ if (event.key === '0') {
677
+ toolsSelector.next(0);
678
+ activeTool = 0;
679
+ }
848
680
 
849
- var binSubject = new BinSubject();
681
+ if (event.key === 'Enter') {
682
+ binSubject.saveSelectedBinToLocalStorage();
683
+ ['th-mapping', 'bannerId_1', 'bannerId_2', 'bannerId_3', 'bannerId_4'].forEach(function (targetId) {
684
+ if (document.getElementById(targetId) !== null) {
685
+ jsrootService.displayImageOfProjection('projectionContainer', targetId, '500px', '400px');
686
+ }
687
+ });
688
+ }
850
689
 
851
- var _subject$3 = /*#__PURE__*/_classPrivateFieldLooseKey("subject");
690
+ if (event.key === 'r' || event.key === 'R') {
691
+ binSubject.deleteBinFromLocalStorage();
692
+ }
852
693
 
853
- var BinDataDistributor = /*#__PURE__*/function () {
854
- function BinDataDistributor() {
855
- Object.defineProperty(this, _subject$3, {
856
- writable: true,
857
- value: void 0
858
- });
859
- _classPrivateFieldLooseBase(this, _subject$3)[_subject$3] = new Subject();
694
+ if (event.key === 'm' || event.key === 'M') {
695
+ histogramTH2Service.changeHistogramFunction('feet', 'TH2');
860
696
  }
861
697
 
862
- var _proto = BinDataDistributor.prototype;
698
+ if (event.key === 'n' || event.key === 'N') {
699
+ histogramTH2Service.changeHistogramFunction('default', 'TH2');
700
+ }
863
701
 
864
- _proto.sendDataOfTheSelectedBin = function sendDataOfTheSelectedBin(binData) {
865
- _classPrivateFieldLooseBase(this, _subject$3)[_subject$3].next(binData);
866
- };
702
+ if (event.key === 'c' || event.key === 'C') {
703
+ cameraSubject.setUserState();
704
+ }
867
705
 
868
- _proto.getBinDistributor = function getBinDistributor() {
869
- return _classPrivateFieldLooseBase(this, _subject$3)[_subject$3].asObservable();
870
- };
706
+ if (event.key === 'v' || event.key === 'V') {
707
+ cameraSubject.setVisibilityOfBanners('keyboard');
708
+ }
871
709
 
872
- return BinDataDistributor;
873
- }();
710
+ if (event.key === 'x' || event.key === 'X') {
711
+ cameraSubject.shiftBanners();
712
+ }
874
713
 
875
- var binDataDistributor = new BinDataDistributor();
714
+ if (event.key === 'x' || event.key === 'X') {
715
+ cameraSubject.shiftBanners();
716
+ }
717
+ };
876
718
 
877
- AFRAME.registerComponent('mouseevent', {
878
- init: function init() {
879
- var subscription;
880
- var el = this.el;
881
- var clickCount = 0;
882
- var checked = false;
883
- el.addEventListener('mouseenter', function setHover(evt) {
884
- var _this = this;
719
+ var switchDisplayModeOnBin = function switchDisplayModeOnBin(event) {
720
+ event.preventDefault();
721
+ var binDisplayMode;
885
722
 
886
- checked = false;
887
- var intersection = evt.detail.intersection;
888
- subscription = binSubject.getKeyboardEvent().subscribe(function (save) {
889
- if (save) {
890
- localStorageService.storeBinToLocalStorage(_this.userData);
891
- localStorageService.storeCurrentBinToLocalStorage(_this.userData);
892
- binDataDistributor.sendDataOfTheSelectedBin(_this.userData);
893
- _this.userData.markedColor = _this.userData.selectColor;
723
+ if (event.deltaY > 0) {
724
+ binDisplayMode = 1;
725
+ } else {
726
+ binDisplayMode = -1;
727
+ }
894
728
 
895
- _this.setAttribute('material', 'opacity', '1');
729
+ histogramTH2Service.changeTypeOfBinMark(binDisplayMode, 'TH2');
730
+ histogramTH3Service.changeTypeOfBinMark(binDisplayMode, 'TH3');
731
+ };
896
732
 
897
- jsrootSubject.showBinProjection(_this.userData);
898
- } else {
899
- localStorageService.deleteBinFromLocalStorage(_this.userData);
900
- _this.userData.markedColor = _this.userData.color;
733
+ var getActiveTool = function getActiveTool() {
734
+ return activeTool;
735
+ };
901
736
 
902
- _this.setAttribute('material', 'opacity', '0.75');
903
- }
904
- });
737
+ var keyReleaseHandlerFunction = function keyReleaseHandlerFunction(event) {
738
+ delete keyPressed[event.key];
739
+ };
905
740
 
906
- if (intersection.face.normal.x !== 0) {
907
- this.setAttribute('material', 'color', this.userData.axisZ);
908
- } else if (intersection.face.normal.y !== 0) {
909
- this.setAttribute('material', 'color', this.userData.axisY);
910
- } else {
911
- this.setAttribute('material', 'color', this.userData.axisX);
912
- }
741
+ var initialKeyboardController = function initialKeyboardController(data, object) {
742
+ aframeObj = object;
743
+ geoAttributes = [data.position, data.scale, data.rotation];
913
744
 
914
- this.setAttribute('material', 'opacity', '1');
915
- });
916
- el.addEventListener('mouseleave', function setPassive() {
917
- subscription.unsubscribe();
745
+ for (var i = 0; i < 3; i++) {
746
+ aframeObj.setAttribute(geoAttributes[i].name, geoAttributes[i].xValue + " " + geoAttributes[i].yValue + " " + geoAttributes[i].zValue);
747
+ }
748
+ };
918
749
 
919
- if (checked === false) {
920
- this.setAttribute('material', 'color', this.userData.markedColor);
921
- this.setAttribute('material', 'opacity', '0.75');
922
- }
750
+ var keyboardUpdateCameraReference = function keyboardUpdateCameraReference() {
751
+ cameraService = new CameraService();
752
+ };
753
+
754
+ var _storage = /*#__PURE__*/_classPrivateFieldLooseKey("storage");
755
+
756
+ var _camera = /*#__PURE__*/_classPrivateFieldLooseKey("camera");
757
+
758
+ var _selectedBins = /*#__PURE__*/_classPrivateFieldLooseKey("selectedBins");
759
+
760
+ var _deleteCurrentBin = /*#__PURE__*/_classPrivateFieldLooseKey("deleteCurrentBin");
761
+
762
+ var NdmVrStorageService = /*#__PURE__*/function () {
763
+ function NdmVrStorageService() {
764
+ var _this = this;
765
+
766
+ Object.defineProperty(this, _storage, {
767
+ writable: true,
768
+ value: void 0
769
+ });
770
+ Object.defineProperty(this, _camera, {
771
+ writable: true,
772
+ value: void 0
773
+ });
774
+ Object.defineProperty(this, _selectedBins, {
775
+ writable: true,
776
+ value: []
777
+ });
778
+ Object.defineProperty(this, _deleteCurrentBin, {
779
+ writable: true,
780
+ value: function value(binData) {
781
+ return _classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins].filter(function (item) {
782
+ return item.id !== binData.id;
783
+ });
784
+ }
785
+ });
786
+
787
+ this.containThisBin = function (binData) {
788
+ var updatedArray = _classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins].filter(function (item) {
789
+ return item.id === binData.id;
790
+ });
791
+
792
+ return updatedArray.length !== 0;
793
+ };
794
+
795
+ this.storeBinToLocalStorage = function (binData) {
796
+ if (!_this.containThisBin(binData)) {
797
+ _classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins].push(binData);
798
+
799
+ _classPrivateFieldLooseBase(_this, _storage)[_storage].setItem('selectedBins', JSON.stringify(_classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins]));
800
+ }
801
+ };
802
+
803
+ this.deleteBinFromLocalStorage = function (binData) {
804
+ if (_this.containThisBin(binData)) {
805
+ _classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins] = _classPrivateFieldLooseBase(_this, _deleteCurrentBin)[_deleteCurrentBin](binData);
806
+
807
+ _classPrivateFieldLooseBase(_this, _storage)[_storage].setItem('selectedBins', JSON.stringify(_classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins]));
808
+ }
809
+ };
810
+
811
+ this.getBinsFromLocalStorage = function () {
812
+ var selectedBins = JSON.parse(_classPrivateFieldLooseBase(_this, _storage)[_storage].getItem('selectedBins'));
813
+
814
+ if (selectedBins === null) {
815
+ return [];
816
+ } else {
817
+ return selectedBins;
818
+ }
819
+ };
820
+
821
+ _classPrivateFieldLooseBase(this, _storage)[_storage] = window.localStorage;
822
+ _classPrivateFieldLooseBase(this, _camera)[_camera] = document.getElementById('cameraWrapper');
823
+ _classPrivateFieldLooseBase(this, _selectedBins)[_selectedBins] = this.getBinsFromLocalStorage();
824
+ }
825
+
826
+ var _proto = NdmVrStorageService.prototype;
827
+
828
+ _proto.storeCurrentBinToLocalStorage = function storeCurrentBinToLocalStorage(binData) {
829
+ _classPrivateFieldLooseBase(this, _storage)[_storage].setItem('currentBin', JSON.stringify(binData));
830
+ };
831
+
832
+ _proto.getCurrentBinFromLocalStorage = function getCurrentBinFromLocalStorage() {
833
+ var currentBin = JSON.parse(_classPrivateFieldLooseBase(this, _storage)[_storage].getItem('currentBin'));
834
+
835
+ if (currentBin === undefined || currentBin === '') {
836
+ return null;
837
+ }
838
+
839
+ return currentBin;
840
+ };
841
+
842
+ _proto.loadProperty = function loadProperty(property) {
843
+ return JSON.parse(_classPrivateFieldLooseBase(this, _storage)[_storage].getItem(property));
844
+ };
845
+
846
+ _proto.storeProperty = function storeProperty(property, object) {
847
+ _classPrivateFieldLooseBase(this, _storage)[_storage].setItem(property, JSON.stringify(object));
848
+ };
849
+
850
+ _proto.initHistogramData = function initHistogramData(histogram) {
851
+ if (histogram._typename.includes('TH3')) {
852
+ this.storeTH3HistogramLimits(histogram);
853
+ } else if (histogram._typename.includes('TH2')) {
854
+ this.storeTH2HistogramLimits(histogram);
855
+ }
856
+ };
857
+
858
+ _proto.storeTH2Offsets = function storeTH2Offsets(xOffset, yOffset, range) {
859
+ var object = this.loadProperty('TH2');
860
+ var section;
861
+
862
+ if (object === null) {
863
+ object = {};
864
+ section = {
865
+ name: 'TH2',
866
+ xOffset: 1,
867
+ yOffset: 1,
868
+ range: 8
869
+ };
870
+ } else {
871
+ section = {
872
+ name: 'TH2',
873
+ xOffset: xOffset,
874
+ yOffset: yOffset,
875
+ range: range
876
+ };
877
+ }
878
+
879
+ object.section = section;
880
+ this.storeProperty('TH2', object);
881
+ };
882
+
883
+ _proto.storeTH3Offsets = function storeTH3Offsets(xOffset, yOffset, zOffset, range) {
884
+ var object = this.loadProperty('TH3');
885
+ var section;
886
+
887
+ if (object === null) {
888
+ object = {};
889
+ section = {
890
+ name: 'TH3',
891
+ xOffset: 1,
892
+ yOffset: 1,
893
+ zOffset: 1,
894
+ range: 4
895
+ };
896
+ } else {
897
+ section = {
898
+ name: 'TH3',
899
+ xOffset: xOffset,
900
+ yOffset: yOffset,
901
+ zOffset: zOffset,
902
+ range: range
903
+ };
904
+ }
905
+
906
+ object.section = section;
907
+ this.storeProperty('TH3', object);
908
+ };
909
+
910
+ _proto.storeOffsets = function storeOffsets(section) {
911
+ if (section.name.includes('TH3') || section.name.includes('th3')) {
912
+ this.storeTH3Offsets(section.xOffset, section.yOffset, section.zOffset, section.range);
913
+ } else if (section.name.includes('TH2') || section.name.includes('th2')) {
914
+ this.storeTH2Offsets(section.xOffset, section.yOffset, section.range);
915
+ }
916
+ };
917
+
918
+ _proto.storeFilePath = function storeFilePath(filePath) {
919
+ _classPrivateFieldLooseBase(this, _storage)[_storage].setItem('rootFile', filePath);
920
+ };
921
+
922
+ _proto.loadFilePath = function loadFilePath() {
923
+ var filename = _classPrivateFieldLooseBase(this, _storage)[_storage].getItem('rootFile');
924
+
925
+ if (filename === null || filename === undefined) {
926
+ return 'defaultHistogram';
927
+ }
928
+
929
+ return filename;
930
+ };
931
+
932
+ _proto.loadTH2Offsets = function loadTH2Offsets() {
933
+ var object = this.loadProperty('TH2');
934
+
935
+ if (object !== null) {
936
+ return object.section;
937
+ } else {
938
+ return null;
939
+ }
940
+ };
941
+
942
+ _proto.loadTH3Offsets = function loadTH3Offsets() {
943
+ var object = this.loadProperty('TH3');
944
+
945
+ if (object !== null) {
946
+ return object.section;
947
+ } else {
948
+ return null;
949
+ }
950
+ };
951
+
952
+ _proto.loadOffsets = function loadOffsets(type) {
953
+ if (type.includes('TH3') || type.includes('th3')) {
954
+ return this.loadTH3Offsets();
955
+ } else if (type.includes('TH2') || type.includes('th2')) {
956
+ return this.loadTH2Offsets();
957
+ }
958
+ };
959
+
960
+ return NdmVrStorageService;
961
+ }();
962
+ var localStorageService = new NdmVrStorageService();
963
+
964
+ var _subject$4 = /*#__PURE__*/_classPrivateFieldLooseKey("subject");
965
+
966
+ var BinDataDistributor = /*#__PURE__*/function () {
967
+ function BinDataDistributor() {
968
+ Object.defineProperty(this, _subject$4, {
969
+ writable: true,
970
+ value: void 0
971
+ });
972
+ _classPrivateFieldLooseBase(this, _subject$4)[_subject$4] = new Subject();
973
+ }
974
+
975
+ var _proto = BinDataDistributor.prototype;
976
+
977
+ _proto.sendDataOfTheSelectedBin = function sendDataOfTheSelectedBin(binData) {
978
+ _classPrivateFieldLooseBase(this, _subject$4)[_subject$4].next(binData);
979
+ };
980
+
981
+ _proto.getBinDistributor = function getBinDistributor() {
982
+ return _classPrivateFieldLooseBase(this, _subject$4)[_subject$4].asObservable();
983
+ };
984
+
985
+ return BinDataDistributor;
986
+ }();
987
+
988
+ var binDataDistributor = new BinDataDistributor();
989
+
990
+ var binData = new Subject();
991
+ AFRAME$1.registerComponent('mouseevent', {
992
+ init: function init() {
993
+ var subscription;
994
+ var el = this.el;
995
+ var clickCount = 0;
996
+ var checked = false;
997
+ el.addEventListener('mouseenter', function setHover(evt) {
998
+ var _this = this;
999
+
1000
+ checked = false;
1001
+ var intersection = evt.detail.intersection;
1002
+ subscription = binSubject.getKeyboardEvent().subscribe(function (save) {
1003
+ if (save) {
1004
+ localStorageService.storeBinToLocalStorage(_this.userData);
1005
+ localStorageService.storeCurrentBinToLocalStorage(_this.userData);
1006
+ binDataDistributor.sendDataOfTheSelectedBin(_this.userData);
1007
+ _this.userData.markedColor = _this.userData.selectColor;
1008
+
1009
+ _this.setAttribute('material', 'opacity', '0.70');
1010
+
1011
+ jsrootSubject.showBinProjection(_this.userData);
1012
+ } else {
1013
+ localStorageService.deleteBinFromLocalStorage(_this.userData);
1014
+ _this.userData.markedColor = _this.userData.color;
1015
+
1016
+ _this.setAttribute('material', 'opacity', '0.50');
1017
+ }
1018
+ });
1019
+
1020
+ if (intersection.face.normal.x !== 0) {
1021
+ this.setAttribute('material', 'color', this.userData.axisZ);
1022
+ } else if (intersection.face.normal.y !== 0) {
1023
+ this.setAttribute('material', 'color', this.userData.axisY);
1024
+ } else {
1025
+ this.setAttribute('material', 'color', this.userData.axisX);
1026
+ }
1027
+
1028
+ this.setAttribute('material', 'opacity', '0.70');
1029
+ });
1030
+ el.addEventListener('mouseleave', function setPassive() {
1031
+ subscription.unsubscribe();
1032
+
1033
+ if (checked === false) {
1034
+ this.setAttribute('material', 'color', this.userData.markedColor);
1035
+ this.setAttribute('material', 'opacity', '0.50');
1036
+ }
923
1037
 
924
1038
  clickCount = 0;
925
1039
  });
@@ -953,6 +1067,12 @@ AFRAME.registerComponent('mouseevent', {
953
1067
  this.setAttribute('material', 'opacity', '1');
954
1068
  localStorageService.storeCurrentBinToLocalStorage(this.userData);
955
1069
  jsrootSubject.showBinProjection(this.userData);
1070
+
1071
+ switch (getActiveTool()) {
1072
+ case 1:
1073
+ binData.next(this.userData);
1074
+ break;
1075
+ }
956
1076
  }
957
1077
 
958
1078
  var infoBanner = document.getElementById('th2-banner');
@@ -973,524 +1093,580 @@ AFRAME.registerComponent('mouseevent', {
973
1093
  planes[1].setAttribute('text', "value: " + xCor + "; color: " + this.userData.axisX + "; align: center; width: 30; height: auto;");
974
1094
  planes[2].setAttribute('text', "value: " + yCor + "; color: " + this.userData.axisY + "; align: center; width: 30; height: auto;");
975
1095
  planes[3].setAttribute('text', "value: " + zCor + "; color: " + this.userData.axisZ + "; align: center; width: 30; height: auto;");
976
- } else {
977
- var _content = "Content: " + this.userData.absoluteContent + " [" + this.userData.content + "]\n";
978
-
979
- var _xCor = "[" + this.userData.xTitle + "] [" + this.userData.xMin + "," + this.userData.xMax + "] " + (this.userData.binName !== '' ? this.userData.binName + '\n' : '\n');
980
-
981
- var _yCor = "[" + this.userData.yTitle + "] [" + this.userData.yMin + "," + this.userData.yMax + "] " + (this.userData.binName !== '' ? this.userData.binName + '\n' : '\n');
982
-
983
- planes[0].setAttribute('text', "value: " + _content + "; color: " + this.userData.color + "; align: center; baseline: center; width: 30; height: auto;");
984
- planes[1].setAttribute('text', "value: " + _xCor + "; color: " + this.userData.axisX + "; align: center; width: 30; height: auto;");
985
- planes[2].setAttribute('text', "value: " + _yCor + "; color: " + this.userData.axisY + "; align: center; width: 30; height: auto;");
986
- }
987
- }
988
- });
989
- },
990
- update: function update() {
991
- var el = this.el;
992
- el.setAttribute('material', 'color', el.userData.markedColor);
993
- el.setAttribute('material', 'opacity', '0.75');
994
- }
995
- });
996
-
997
- AFRAME.registerComponent('binth', {
998
- schema: {
999
- id: {
1000
- type: 'string'
1001
- },
1002
- typeName: {
1003
- type: 'string'
1004
- },
1005
- content: {
1006
- "default": 0
1007
- },
1008
- absoluteContent: {
1009
- "default": 0
1010
- },
1011
- binName: {
1012
- "default": ''
1013
- },
1014
- xTitle: {
1015
- type: 'string'
1016
- },
1017
- yTitle: {
1018
- type: 'string'
1019
- },
1020
- zTitle: {
1021
- type: 'string'
1022
- },
1023
- xMin: {
1024
- type: 'number'
1025
- },
1026
- yMin: {
1027
- type: 'number'
1028
- },
1029
- zMin: {
1030
- type: 'number'
1031
- },
1032
- xMax: {
1033
- type: 'number'
1034
- },
1035
- yMax: {
1036
- type: 'number'
1037
- },
1038
- zMax: {
1039
- type: 'number'
1040
- },
1041
- xCenter: {
1042
- type: 'number'
1043
- },
1044
- yCenter: {
1045
- type: 'number'
1046
- },
1047
- zCenter: {
1048
- type: 'number'
1049
- },
1050
- xWidth: {
1051
- type: 'number'
1052
- },
1053
- yWidth: {
1054
- type: 'number'
1055
- },
1056
- zWidth: {
1057
- type: 'number'
1058
- },
1059
- color: {
1060
- type: 'string'
1061
- },
1062
- axisX: {
1063
- type: 'string'
1064
- },
1065
- axisY: {
1066
- type: 'string'
1067
- },
1068
- axisZ: {
1069
- type: 'string'
1070
- },
1071
- selectColor: {
1072
- type: 'string'
1073
- },
1074
- markedColor: {
1075
- type: 'string'
1076
- }
1077
- },
1078
- init: function init() {
1079
- var el = this.el;
1080
- el.userData = {
1081
- typeName: this.data.typeName,
1082
- id: this.data.id,
1083
- content: this.data.content,
1084
- absoluteContent: this.data.absoluteContent,
1085
- binName: this.data.binName,
1086
- xTitle: this.data.xTitle,
1087
- yTitle: this.data.yTitle,
1088
- zTitle: this.data.zTitle,
1089
- xMin: this.data.xMin,
1090
- yMin: this.data.yMin,
1091
- zMin: this.data.zMin,
1092
- xMax: this.data.xMax,
1093
- yMax: this.data.yMax,
1094
- zMax: this.data.zMax,
1095
- xCenter: this.data.xCenter,
1096
- yCenter: this.data.yCenter,
1097
- zCenter: this.data.zCenter,
1098
- xWidth: this.data.xWidth,
1099
- yWidth: this.data.yWidth,
1100
- zWidth: this.data.zWidth,
1101
- color: this.data.color,
1102
- axisX: this.data.axisX,
1103
- axisY: this.data.axisY,
1104
- axisZ: this.data.axisZ,
1105
- selectColor: this.data.selectColor,
1106
- markedColor: this.data.markedColor
1107
- };
1108
- },
1109
- update: function update() {
1110
- var el = this.el;
1111
- el.userData = {
1112
- typeName: this.data.typeName,
1113
- id: this.data.id,
1114
- content: this.data.content,
1115
- absoluteContent: this.data.absoluteContent,
1116
- binName: this.data.binName,
1117
- xTitle: this.data.xTitle,
1118
- yTitle: this.data.yTitle,
1119
- zTitle: this.data.zTitle,
1120
- xMin: this.data.xMin,
1121
- yMin: this.data.yMin,
1122
- zMin: this.data.zMin,
1123
- xMax: this.data.xMax,
1124
- yMax: this.data.yMax,
1125
- zMax: this.data.zMax,
1126
- xCenter: this.data.xCenter,
1127
- yCenter: this.data.yCenter,
1128
- zCenter: this.data.zCenter,
1129
- xWidth: this.data.xWidth,
1130
- yWidth: this.data.yWidth,
1131
- zWidth: this.data.zWidth,
1132
- color: this.data.color,
1133
- axisX: this.data.axisX,
1134
- axisY: this.data.axisY,
1135
- axisZ: this.data.axisZ,
1136
- selectColor: this.data.selectColor,
1137
- markedColor: this.data.markedColor
1138
- };
1139
- }
1140
- });
1141
-
1142
- var _cameraWrapper = /*#__PURE__*/_classPrivateFieldLooseKey("cameraWrapper");
1143
-
1144
- var _setVerticalOffset = /*#__PURE__*/_classPrivateFieldLooseKey("setVerticalOffset");
1145
-
1146
- var CameraService = function CameraService() {
1147
- var _this = this;
1148
-
1149
- Object.defineProperty(this, _cameraWrapper, {
1150
- writable: true,
1151
- value: void 0
1152
- });
1153
-
1154
- this.verticalMoveCamera = function (moveUp, speed) {
1155
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] === null) _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] = document.getElementById('cameraWrapper');
1096
+ } else {
1097
+ var _content = "Content: " + this.userData.absoluteContent + " [" + this.userData.content + "]\n";
1156
1098
 
1157
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] !== null) {
1158
- if (moveUp) {
1159
- _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position.y += speed;
1160
- } else {
1161
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position.y > 0) _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position.y -= speed;
1162
- }
1163
- }
1164
- };
1099
+ var _xCor = "[" + this.userData.xTitle + "] [" + this.userData.xMin + "," + this.userData.xMax + "] " + (this.userData.binName !== '' ? this.userData.binName + '\n' : '\n');
1165
1100
 
1166
- this.horizontalMoveCamera = function (axis, increment, speed) {
1167
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] === null) _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] = document.getElementById('cameraWrapper');
1101
+ var _yCor = "[" + this.userData.yTitle + "] [" + this.userData.yMin + "," + this.userData.yMax + "] " + (this.userData.binName !== '' ? this.userData.binName + '\n' : '\n');
1168
1102
 
1169
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] !== null) {
1170
- if (increment) {
1171
- _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position[axis] += speed;
1172
- } else {
1173
- _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position[axis] -= speed;
1103
+ planes[0].setAttribute('text', "value: " + _content + "; color: " + this.userData.color + "; align: center; baseline: center; width: 30; height: auto;");
1104
+ planes[1].setAttribute('text', "value: " + _xCor + "; color: " + this.userData.axisX + "; align: center; width: 30; height: auto;");
1105
+ planes[2].setAttribute('text', "value: " + _yCor + "; color: " + this.userData.axisY + "; align: center; width: 30; height: auto;");
1106
+ }
1174
1107
  }
1175
- }
1176
- };
1108
+ });
1109
+ },
1110
+ update: function update() {
1111
+ var el = this.el;
1112
+ el.setAttribute('material', 'color', el.userData.markedColor);
1113
+ el.setAttribute('material', 'opacity', '0.75');
1114
+ }
1115
+ });
1177
1116
 
1178
- Object.defineProperty(this, _setVerticalOffset, {
1179
- writable: true,
1180
- value: function value(elm, offset, rotation) {
1181
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] !== null && elm !== null) {
1182
- var newXPos = elm.object3D.position.x + 1 * elm.object3D.position.x;
1183
- var newZPos = elm.object3D.position.z + 1 * elm.object3D.position.z;
1184
- var newYPos = offset;
1117
+ var AFRAME = window.AFRAME;
1185
1118
 
1186
- _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].setAttribute('animation', "property: position; to: " + (newXPos + 1) + " " + newYPos + " " + (newZPos + 1) + "; dur: 100;");
1119
+ var NdmVrCamera = function NdmVrCamera() {
1120
+ var subscription;
1121
+ var activeToolHighlight = '0 -0.75 -1';
1122
+ var binDataSubscription;
1187
1123
 
1188
- _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].setAttribute('animation__1', "property: rotation; to: " + _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.rotation.x + " " + rotation + " " + _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.rotation.z + "; dur: 100;");
1189
- }
1190
- }
1191
- });
1124
+ var _useState = useState('value: Bin data:\nX: null\nY: null\nZ: null;color: black;'),
1125
+ selectedBinData = _useState[0],
1126
+ setSelectedBinData = _useState[1];
1192
1127
 
1193
- this.setCameraPosition = function (offsets) {
1194
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] !== null) {
1195
- var newZPos = _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position.y;
1128
+ var offset = 30;
1196
1129
 
1197
- if (offsets.zOffset !== undefined) {
1198
- newZPos = offsets.zOffset * 2;
1199
- }
1130
+ var _useState2 = useState(0),
1131
+ rotation = _useState2[0],
1132
+ setRotation = _useState2[1];
1200
1133
 
1201
- var newXPos = offsets.xOffset + offsets.xOffset;
1202
- var newYPos = offsets.yOffset + offsets.yOffset;
1203
- setTimeout(function () {
1204
- _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].setAttribute('animation', "property: position; to: " + (newXPos - 3) + " " + newZPos + " " + (newYPos - 3) + "; dur: 40;");
1205
- }, 1800);
1206
- }
1207
- };
1134
+ var _useState3 = useState(null),
1135
+ prevPosition = _useState3[0],
1136
+ setPrevPosition = _useState3[1];
1208
1137
 
1209
- this.setPredefinedDownPosition = function () {
1210
- var labelElement = document.getElementById('downLabel');
1138
+ var _useState4 = useState('keyboard'),
1139
+ inputDevice = _useState4[0],
1140
+ setInputDevice = _useState4[1];
1211
1141
 
1212
- if (labelElement !== undefined) {
1213
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 0, 180);
1214
- }
1215
- };
1142
+ var _useState5 = useState(false),
1143
+ show = _useState5[0],
1144
+ setShow = _useState5[1];
1216
1145
 
1217
- this.setPredefinedUpPosition = function () {
1218
- var labelElement = document.getElementById('upLabel');
1146
+ var _useState6 = useState(false),
1147
+ showProjection = _useState6[0],
1148
+ setShowProjection = _useState6[1];
1219
1149
 
1220
- if (labelElement !== undefined) {
1221
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 0, 0);
1222
- }
1223
- };
1150
+ var _useState7 = useState(3),
1151
+ activeTool = _useState7[0],
1152
+ setActiveTool = _useState7[1];
1224
1153
 
1225
- this.setPredefinedRightPosition = function () {
1226
- var labelElement = document.getElementById('rightLabel');
1154
+ toolsSelector.subscribe(function (value) {
1155
+ setActiveTool(value);
1227
1156
 
1228
- if (labelElement !== undefined) {
1229
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 0, 90);
1157
+ if (value === 1) {
1158
+ binDataSubscription = binData.subscribe(function (value) {
1159
+ return setSelectedBinData(String('value: Bin data:\n' + 'X: ' + value.xPos + '\n' + 'Y: ' + value.yPos + '\n' + 'Z: ' + value.zPos + '; color: black;'));
1160
+ });
1161
+ } else {
1162
+ if (binDataSubscription) binDataSubscription.unsubscribe();
1230
1163
  }
1231
- };
1164
+ });
1232
1165
 
1233
- this.setPredefinedLeftPosition = function () {
1234
- var labelElement = document.getElementById('leftLabel');
1166
+ var handleSubscription = function handleSubscription(data) {
1167
+ if (data.device) {
1168
+ if (inputDevice !== data.device) {
1169
+ setInputDevice(data.device);
1170
+ }
1235
1171
 
1236
- if (labelElement !== undefined) {
1237
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 0, 270);
1172
+ setShow(!show);
1173
+ } else if (data === 'shift') {
1174
+ compileRotation();
1175
+ } else if (data === 'show') {
1176
+ setShowProjection(!showProjection);
1238
1177
  }
1239
1178
  };
1240
1179
 
1241
- this.setPredefinedDownPositionWithOffset = function () {
1242
- var labelElement = document.getElementById('downLabel');
1243
-
1244
- if (labelElement !== undefined) {
1245
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 10, 180);
1246
- }
1180
+ var compileRotation = function compileRotation() {
1181
+ var currentRotation = rotation + 90;
1182
+ if (currentRotation >= 360) currentRotation = 0;
1183
+ setRotation(currentRotation);
1247
1184
  };
1248
1185
 
1249
- this.setPredefinedUpPositionWithOffset = function () {
1250
- var labelElement = document.getElementById('upLabel');
1186
+ var renderProjectionsBanners = function renderProjectionsBanners() {
1187
+ return /*#__PURE__*/React.createElement("a-entity", {
1188
+ position: prevPosition === null ? "0 " + offset + " 0" : prevPosition.x + " " + offset + " " + prevPosition.z,
1189
+ animation__rotation: "property: rotation; to: 0 " + rotation + " 0; dur: 1000; easing: linear;",
1190
+ material: "color: white"
1191
+ }, /*#__PURE__*/React.createElement("a-entity", {
1192
+ geometry: "primitive: box; width: 50; height: 10; depth: 0.1;",
1193
+ position: "-30 28 0",
1194
+ rotation: "45 90 0",
1195
+ material: "color:white;"
1196
+ }, /*#__PURE__*/React.createElement("a-text", {
1197
+ color: "black",
1198
+ width: 50,
1199
+ value: inputDevice === 'keyboard' ? 'Press C to show help panels' : 'Press Button X to show help panels',
1200
+ position: "-20 2.8 1"
1201
+ }), /*#__PURE__*/React.createElement("a-text", {
1202
+ color: "black",
1203
+ width: 50,
1204
+ value: inputDevice === 'keyboard' ? 'Press V to switch to histogram view' : 'Press Button Y to switch to histogram view',
1205
+ position: "-20 0 1"
1206
+ }), /*#__PURE__*/React.createElement("a-text", {
1207
+ color: "black",
1208
+ width: 50,
1209
+ value: inputDevice === 'keyboard' ? 'Press X to shift panels' : 'Press right Trigger to shift panels',
1210
+ position: "-20 -2.8 1"
1211
+ })), /*#__PURE__*/React.createElement("a-box", {
1212
+ id: "bannerId_1",
1213
+ scale: "80 50 2",
1214
+ animation__position: "property: position; from: 0 0 -60; to: 0 -1 -42; delay: 0; dur: 800; easing: linear;",
1215
+ material: "transparent:true"
1216
+ }), /*#__PURE__*/React.createElement("a-box", {
1217
+ scale: "80 52 2",
1218
+ animation__position: "property: position; from: 0 0 -60; to: 0 0 -42.5; delay: 0; dur: 800; easing: linear;",
1219
+ material: "color: white;"
1220
+ }), /*#__PURE__*/React.createElement("a-box", {
1221
+ id: "bannerId_2",
1222
+ scale: "80 50 2",
1223
+ animation__position: "property: position; from: 60 0 0; to: 42 -1 0; delay: 200; dur: 800; easing: linear;",
1224
+ rotation: "0 90 0",
1225
+ material: "transparent:true"
1226
+ }), /*#__PURE__*/React.createElement("a-box", {
1227
+ scale: "80 52 2",
1228
+ animation__position: "property: position; from: 60 0 0; to: 42.5 0 0; delay: 200; dur: 800; easing: linear;",
1229
+ rotation: "0 90 0",
1230
+ material: "color: white;"
1231
+ }), /*#__PURE__*/React.createElement("a-box", {
1232
+ id: "bannerId_3",
1233
+ scale: "80 50 2",
1234
+ animation__position: "property: position; from: 0 0 60; to: 0 -1 42; delay: 400; dur: 800; easing: linear;",
1235
+ material: "transparent:true"
1236
+ }), /*#__PURE__*/React.createElement("a-box", {
1237
+ scale: "80 52 2",
1238
+ animation__position: "property: position; from: 0 0 60; to: 0 0 42.5; delay: 400; dur: 800; easing: linear;",
1239
+ material: "color: white;"
1240
+ }), /*#__PURE__*/React.createElement("a-box", {
1241
+ id: "bannerId_4",
1242
+ scale: "80 50 2",
1243
+ animation__position: "property: position; from: -60 0 0; to: -42 -1 0; delay: 600; dur: 800; easing: linear;",
1244
+ rotation: "0 90 0",
1245
+ material: "transparent:true"
1246
+ }), /*#__PURE__*/React.createElement("a-box", {
1247
+ scale: "80 52 2",
1248
+ animation__position: "property: position; from: -60 0 0; to: -42.5 0 0; delay: 600; dur: 800; easing: linear;",
1249
+ rotation: "0 90 0",
1250
+ material: "color: white;"
1251
+ }));
1252
+ };
1251
1253
 
1252
- if (labelElement !== undefined) {
1253
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 10, 0);
1254
+ var renderBannersWithControls = function renderBannersWithControls() {
1255
+ if (inputDevice === 'keyboard') {
1256
+ return /*#__PURE__*/React.createElement("a-entity", {
1257
+ position: prevPosition === null ? "0 " + offset + " 0" : prevPosition.x + " " + offset + " " + prevPosition.z,
1258
+ animation__rotation: "property: rotation; to: 0 " + rotation + " 0; dur: 1000; easing: linear;",
1259
+ material: "color: white"
1260
+ }, /*#__PURE__*/React.createElement("a-entity", {
1261
+ geometry: "primitive: box; width: 50; height: 10; depth: 0.1;",
1262
+ position: "-30 28 0",
1263
+ rotation: "45 90 0",
1264
+ material: "color: white"
1265
+ }, /*#__PURE__*/React.createElement("a-text", {
1266
+ color: "black",
1267
+ width: "50",
1268
+ value: showProjection ? 'Press C to show help panels' : 'Press C to show projection panels',
1269
+ position: "-20 2.8 1"
1270
+ }), /*#__PURE__*/React.createElement("a-text", {
1271
+ color: "black",
1272
+ width: "50",
1273
+ value: "Press V to switch to histogram view",
1274
+ position: "-20 0 1"
1275
+ }), /*#__PURE__*/React.createElement("a-text", {
1276
+ color: "black",
1277
+ width: "50",
1278
+ value: "Press X to shift panels",
1279
+ position: "-20 -2.8 1"
1280
+ })), /*#__PURE__*/React.createElement("a-box", {
1281
+ scale: "80 50 2",
1282
+ animation__position: "property: position; from: -30 0 60; to: -30 0 30; delay: 0; dur: 800; easing: linear;",
1283
+ rotation: "0 -45 0",
1284
+ src: "./ndmvr/keyboardControls/keyboard.png"
1285
+ }), /*#__PURE__*/React.createElement("a-box", {
1286
+ scale: "80 50 2",
1287
+ animation__position: "property: position; from: -30 0 -60; to: -30 0 -30; delay: 200; dur: 800; easing: linear;",
1288
+ rotation: "0 45 0",
1289
+ src: "./ndmvr/keyboardControls/keyboard1.png"
1290
+ }), /*#__PURE__*/React.createElement("a-box", {
1291
+ scale: "80 50 2",
1292
+ animation__position: "property: position; from: 30 0 -60; to: 30 0 -30; delay: 400; dur: 800; easing: linear;",
1293
+ rotation: "0 -45 0",
1294
+ src: "./ndmvr/keyboardControls/keyboard2.png"
1295
+ }), /*#__PURE__*/React.createElement("a-box", {
1296
+ scale: "80 50 2",
1297
+ animation__position: "property: position; from: 30 0 60; to: 30 0 30; delay: 600; dur: 800; easing: linear;",
1298
+ rotation: " 0 45 0",
1299
+ src: "./ndmvr/keyboardControls/keyboard3.png"
1300
+ }));
1301
+ } else {
1302
+ return /*#__PURE__*/React.createElement("a-entity", {
1303
+ position: prevPosition === null ? "0 " + offset + " 0" : prevPosition.x + " " + offset + " " + prevPosition.z,
1304
+ animation__rotation: "property: rotation; to: 0 " + rotation + " 0; dur: 1000; easing: linear;"
1305
+ }, /*#__PURE__*/React.createElement("a-entity", {
1306
+ geometry: "primitive: box; width: 50; height: 10; depth: 0.1;",
1307
+ position: "-30 28 0",
1308
+ rotation: "45 90 0",
1309
+ material: "color: white"
1310
+ }, /*#__PURE__*/React.createElement("a-text", {
1311
+ color: "black",
1312
+ width: "50",
1313
+ value: showProjection ? 'Press Button X to show help panels' : 'Press Button X to show projection panels',
1314
+ position: "-20 2.8 1"
1315
+ }), /*#__PURE__*/React.createElement("a-text", {
1316
+ color: "black",
1317
+ width: "50",
1318
+ value: "Press Button Y to switch to histogram view",
1319
+ position: "-20 0 1"
1320
+ }), /*#__PURE__*/React.createElement("a-text", {
1321
+ color: "black",
1322
+ width: "50",
1323
+ value: "Press right Trigger to shift panels",
1324
+ position: "-20 -2.8 1"
1325
+ })), /*#__PURE__*/React.createElement("a-box", {
1326
+ scale: "80 50 2",
1327
+ animation__position: "property: position; from: -35 0 60; to: -32 0 32; delay: 0; dur: 800; easing: linear;",
1328
+ rotation: "-10 -45 0",
1329
+ src: "./ndmvr/oculusControls/oculus.png"
1330
+ }), /*#__PURE__*/React.createElement("a-box", {
1331
+ scale: "80 50 2",
1332
+ animation__position: "property: position; from: -35 0 -60; to: -32 0 -32; delay: 200; dur: 800; easing: linear;",
1333
+ rotation: "10 45 0",
1334
+ src: "./ndmvr/oculusControls/oculus2.png"
1335
+ }), /*#__PURE__*/React.createElement("a-box", {
1336
+ scale: "80 50 2",
1337
+ animation__position: "property: position; from: 35 0 -60; to: 32 0 -32; delay: 400; dur: 800; easing: linear;",
1338
+ rotation: "10 -45 0",
1339
+ src: "./ndmvr/oculusControls/oculus1.png"
1340
+ }), /*#__PURE__*/React.createElement("a-box", {
1341
+ scale: "80 50 2",
1342
+ animation__position: "property: position; from: 35 0 60; to: 32 0 32; delay: 600; dur: 800; easing: linear;",
1343
+ rotation: "-10 45 0",
1344
+ src: "./ndmvr/oculusControls/oculus3.png"
1345
+ }));
1254
1346
  }
1255
1347
  };
1256
1348
 
1257
- this.setPredefinedRightPositionWithOffset = function () {
1258
- var labelElement = document.getElementById('rightLabel');
1349
+ var hideMappingBanner = function hideMappingBanner() {
1350
+ var banner = document.getElementById('th-mapping');
1259
1351
 
1260
- if (labelElement !== undefined) {
1261
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 10, 90);
1352
+ if (banner !== undefined) {
1353
+ banner.setAttribute('material', 'opacity', 0);
1262
1354
  }
1263
1355
  };
1264
1356
 
1265
- this.setPredefinedLeftPositionWithOffset = function () {
1266
- var labelElement = document.getElementById('leftLabel');
1357
+ var showMappingBanner = function showMappingBanner() {
1358
+ var banner = document.getElementById('th-mapping');
1267
1359
 
1268
- if (labelElement !== undefined) {
1269
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 10, 270);
1360
+ if (banner !== undefined) {
1361
+ banner.setAttribute('material', 'opacity', 1);
1270
1362
  }
1271
1363
  };
1272
1364
 
1273
- _classPrivateFieldLooseBase(this, _cameraWrapper)[_cameraWrapper] = document.getElementById('cameraWrapper');
1274
- };
1275
-
1276
- var _subject$4 = /*#__PURE__*/_classPrivateFieldLooseKey("subject");
1277
-
1278
- var HistogramSubject = /*#__PURE__*/function () {
1279
- function HistogramSubject() {
1280
- Object.defineProperty(this, _subject$4, {
1281
- writable: true,
1282
- value: void 0
1283
- });
1284
- _classPrivateFieldLooseBase(this, _subject$4)[_subject$4] = new Subject();
1285
- }
1286
-
1287
- var _proto = HistogramSubject.prototype;
1288
-
1289
- _proto.changeHistogramSectionByOffset = function changeHistogramSectionByOffset(axis, histogramType, increment, defaultRange) {
1290
- _classPrivateFieldLooseBase(this, _subject$4)[_subject$4].next({
1291
- name: histogramType,
1292
- axis: axis,
1293
- increment: increment,
1294
- defaultRange: defaultRange
1295
- });
1296
- };
1297
-
1298
- _proto.changeHistogramFunction = function changeHistogramFunction(typeFunction, histogramType) {
1299
- _classPrivateFieldLooseBase(this, _subject$4)[_subject$4].next({
1300
- fFunction: typeFunction,
1301
- name: histogramType
1302
- });
1303
- };
1304
-
1305
- _proto.getChangedSection = function getChangedSection() {
1306
- return _classPrivateFieldLooseBase(this, _subject$4)[_subject$4].asObservable();
1307
- };
1308
-
1309
- return HistogramSubject;
1310
- }();
1311
-
1312
- var histogramTH2Service = new HistogramSubject();
1313
- var histogramTH3Service = new HistogramSubject();
1314
-
1315
- var keyPressed = {};
1316
- var cameraService = new CameraService();
1317
- var aframeObj;
1318
- var geoAttributes;
1319
-
1320
- var handlePositioning = function handlePositioning(property, event) {
1321
- var difference = 0.2;
1322
- if (property.name === 'scale') difference = 0.01;else if (property.name === 'rotation') difference = 2;
1323
-
1324
- if (event.key === 'ArrowDown') {
1325
- property.xValue = property.xValue + difference;
1326
- } else if (event.key === 'ArrowUp') {
1327
- property.xValue = property.xValue - difference;
1328
- } else if (event.key === '=') {
1329
- property.yValue = property.yValue + difference;
1330
- } else if (event.key === '-') {
1331
- property.yValue = property.yValue - difference;
1332
- } else if (event.key === 'ArrowRight') {
1333
- property.zValue = property.zValue + difference;
1334
- } else if (event.key === 'ArrowLeft') {
1335
- property.zValue = property.zValue - difference;
1336
- }
1337
-
1338
- aframeObj.setAttribute(property.name, property.xValue + " " + property.yValue + " " + property.zValue);
1339
- };
1340
-
1341
- var handleChangeHistogramSectionByDefaultRange = function handleChangeHistogramSectionByDefaultRange(event) {
1342
- if (event.key === 'k' || event.key === 'K') {
1343
- histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', false, true);
1344
- histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', false, true);
1345
- } else if (event.key === 'i' || event.key === 'I') {
1346
- histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', true, true);
1347
- histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', true, true);
1348
- } else if (event.key === 'u' || event.key === 'U') {
1349
- histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', true, true);
1350
- } else if (event.key === 'o' || event.key === 'O') {
1351
- histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', false, true);
1352
- } else if (event.key === 'l' || event.key === 'L') {
1353
- histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', false, true);
1354
- histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', false, true);
1355
- } else if (event.key === 'j' || event.key === 'J') {
1356
- histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', true, true);
1357
- histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', true, true);
1358
- }
1359
- };
1360
-
1361
- var handleChangeHistogramSectionByOwnRange = function handleChangeHistogramSectionByOwnRange(event) {
1362
- if (event.key === 'k' || event.key === 'K') {
1363
- histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', false, false);
1364
- histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', false, false);
1365
- } else if (event.key === 'i' || event.key === 'I') {
1366
- histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', true, false);
1367
- histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', true, false);
1368
- } else if (event.key === 'u' || event.key === 'U') {
1369
- histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', true, false);
1370
- } else if (event.key === 'o' || event.key === 'O') {
1371
- histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', false, false);
1372
- } else if (event.key === 'l' || event.key === 'L') {
1373
- histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', false, false);
1374
- histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', false, false);
1375
- } else if (event.key === 'j' || event.key === 'J') {
1376
- histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', true, false);
1377
- histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', true, false);
1378
- }
1379
- };
1380
-
1381
- var keyPressHandlerFunction = function keyPressHandlerFunction(event) {
1382
- keyPressed[event.key] = true;
1383
-
1384
- if (keyPressed.Z || keyPressed.z) {
1385
- handlePositioning(geoAttributes[0], event);
1386
- }
1387
-
1388
- if (keyPressed.X || keyPressed.x) {
1389
- handlePositioning(geoAttributes[1], event);
1390
- }
1391
-
1392
- if (keyPressed.C || keyPressed.c) {
1393
- handlePositioning(geoAttributes[2], event);
1394
- }
1395
-
1396
- if (keyPressed.Shift) {
1397
- handleChangeHistogramSectionByOwnRange(event);
1398
- }
1399
-
1400
- handleChangeHistogramSectionByDefaultRange(event);
1401
-
1402
- if (event.key === 'q' || event.key === 'Q') {
1403
- cameraService.verticalMoveCamera(true, 0.3);
1404
- }
1405
-
1406
- if (event.key === 'e' || event.key === 'E') {
1407
- cameraService.verticalMoveCamera(false, 0.3);
1408
- }
1409
-
1410
- if (event.key === '1') {
1411
- cameraService.setPredefinedDownPosition();
1412
- }
1413
-
1414
- if (event.key === '2') {
1415
- cameraService.setPredefinedUpPosition();
1416
- }
1365
+ useEffect(function () {
1366
+ subscription = cameraSubject.getCameraSubject().subscribe(handleSubscription);
1367
+ return function () {
1368
+ return subscription.unsubscribe();
1369
+ };
1370
+ }, [show, showProjection, rotation]);
1371
+ useEffect(function () {
1372
+ var camera = document.getElementById('camera');
1417
1373
 
1418
- if (event.key === '3') {
1419
- cameraService.setPredefinedRightPosition();
1420
- }
1374
+ if (!show) {
1375
+ camera.object3D.position.y = 1.6;
1421
1376
 
1422
- if (event.key === '4') {
1423
- cameraService.setPredefinedLeftPosition();
1424
- }
1377
+ if (prevPosition !== null) {
1378
+ camera.object3D.position.x = prevPosition.x;
1379
+ camera.object3D.position.z = prevPosition.z;
1380
+ camera.object3D.position.y = prevPosition.y;
1381
+ }
1425
1382
 
1426
- if (event.key === '5') {
1427
- cameraService.setPredefinedDownPositionWithOffset();
1428
- }
1383
+ showMappingBanner();
1384
+ } else {
1385
+ setPrevPosition({
1386
+ x: camera.object3D.position.x,
1387
+ y: camera.object3D.position.y,
1388
+ z: camera.object3D.position.z
1389
+ });
1390
+ camera.object3D.position.y = camera.object3D.position.y + offset;
1391
+ hideMappingBanner();
1392
+ }
1393
+ }, [show, inputDevice]);
1394
+ useEffect(function () {
1395
+ if (showProjection) {
1396
+ jsrootService.displayImageOfProjection('projectionContainer', 'bannerId_1', '500px', '400px');
1397
+ }
1398
+ }, [showProjection]);
1429
1399
 
1430
- if (event.key === '6') {
1431
- cameraService.setPredefinedUpPositionWithOffset();
1432
- }
1400
+ var renderActiveTool = function renderActiveTool() {
1401
+ switch (activeTool) {
1402
+ case 1:
1403
+ activeToolHighlight = '-0.675 -0.825 -1';
1404
+ break;
1433
1405
 
1434
- if (event.key === '7') {
1435
- cameraService.setPredefinedRightPositionWithOffset();
1436
- }
1406
+ case 2:
1407
+ activeToolHighlight = '-0.525 -0.825 -1';
1408
+ break;
1437
1409
 
1438
- if (event.key === '8') {
1439
- cameraService.setPredefinedLeftPositionWithOffset();
1440
- }
1410
+ case 3:
1411
+ activeToolHighlight = '-0.375 -0.825 -1';
1412
+ break;
1441
1413
 
1442
- if (event.key === 'Enter') {
1443
- binSubject.saveSelectedBinToLocalStorage();
1444
- ['th-mapping', 'bannerId_1', 'bannerId_2', 'bannerId_3', 'bannerId_4'].forEach(function (targetId) {
1445
- if (document.getElementById(targetId) !== null) {
1446
- jsrootService.displayImageOfProjection('projectionContainer', targetId, '500px', '400px');
1447
- }
1448
- });
1449
- }
1414
+ case 4:
1415
+ activeToolHighlight = '-0.225 -0.825 -1';
1416
+ break;
1450
1417
 
1451
- if (event.key === 'r' || event.key === 'R') {
1452
- binSubject.deleteBinFromLocalStorage();
1453
- }
1418
+ case 5:
1419
+ activeToolHighlight = '-0.075 -0.825 -1';
1420
+ break;
1454
1421
 
1455
- if (event.key === 'm' || event.key === 'M') {
1456
- histogramTH2Service.changeHistogramFunction('feet', 'TH2');
1457
- }
1422
+ case 6:
1423
+ activeToolHighlight = '0.075 -0.825 -1';
1424
+ break;
1458
1425
 
1459
- if (event.key === 'n' || event.key === 'N') {
1460
- histogramTH2Service.changeHistogramFunction('default', 'TH2');
1461
- }
1426
+ case 7:
1427
+ activeToolHighlight = '0.225 -0.825 -1';
1428
+ break;
1462
1429
 
1463
- if (event.key === 'c' || event.key === 'C') {
1464
- cameraSubject.setUserState();
1465
- }
1430
+ case 8:
1431
+ activeToolHighlight = '0.375 -0.825 -1';
1432
+ break;
1466
1433
 
1467
- if (event.key === 'v' || event.key === 'V') {
1468
- cameraSubject.setVisibilityOfBanners('keyboard');
1469
- }
1434
+ case 9:
1435
+ activeToolHighlight = '0.525 -0.825 -1';
1436
+ break;
1470
1437
 
1471
- if (event.key === 'x' || event.key === 'X') {
1472
- cameraSubject.shiftBanners();
1473
- }
1474
- };
1438
+ case 0:
1439
+ activeToolHighlight = '0.675 -0.825 -1';
1440
+ break;
1441
+ }
1475
1442
 
1476
- var keyReleaseHandlerFunction = function keyReleaseHandlerFunction(event) {
1477
- delete keyPressed[event.key];
1478
- };
1443
+ var tools = ['info', 2, 3, 4, 5, 6, 7, 8, 9, 0];
1444
+ var toolNumXPos = -0.825;
1445
+ return /*#__PURE__*/React.createElement(React.Fragment, null, tools.map(function (tool) {
1446
+ var txt;
1447
+ toolNumXPos = toolNumXPos + 0.15;
1448
+ var txtPos = String(toolNumXPos + ' -0.78' + ' -1');
1449
+ if (tools.indexOf(tool) + 1 === activeTool) txt = String('value: ' + tool + '; color: #0F52BA;width:1.4;align:center');else txt = String('value: ' + tool + '; color: black;width:1;align:center');
1450
+ return /*#__PURE__*/React.createElement("a-entity", {
1451
+ key: tools.indexOf(tool),
1452
+ text: txt,
1453
+ position: txtPos,
1454
+ material: "shader: flat;"
1455
+ });
1456
+ }), /*#__PURE__*/React.createElement("a-entity", {
1457
+ geometry: "primitive: plane; height: 0.007; width: 0.17",
1458
+ position: activeToolHighlight,
1459
+ material: "color: #0F52BA;"
1460
+ }));
1461
+ };
1479
1462
 
1480
- var initialKeyboardController = function initialKeyboardController(data, object) {
1481
- aframeObj = object;
1482
- geoAttributes = [data.position, data.scale, data.rotation];
1463
+ var renderOculusControls = function renderOculusControls() {
1464
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a-entity", {
1465
+ "laser-controls": "hand: right",
1466
+ raycaster: "objects: .clickable; lineOpacity: 0.5; far: 20;"
1467
+ }), /*#__PURE__*/React.createElement("a-entity", {
1468
+ "oculus-touch-controls": "hand: left",
1469
+ "left-controller-logging": true
1470
+ }), /*#__PURE__*/React.createElement("a-entity", {
1471
+ "oculus-touch-controls": "hand: right",
1472
+ "right-controller-logging": true
1473
+ }));
1474
+ };
1483
1475
 
1484
- for (var i = 0; i < 3; i++) {
1485
- aframeObj.setAttribute(geoAttributes[i].name, geoAttributes[i].xValue + " " + geoAttributes[i].yValue + " " + geoAttributes[i].zValue);
1486
- }
1476
+ return /*#__PURE__*/React.createElement("a-entity", {
1477
+ id: "cameraWrapper",
1478
+ rotation: "0 -135 0",
1479
+ position: "-7 2 -7"
1480
+ }, show && !showProjection && renderBannersWithControls(), show && showProjection && renderProjectionsBanners(), /*#__PURE__*/React.createElement("a-camera", {
1481
+ id: "camera",
1482
+ "look-control": true,
1483
+ "wasd-controls-enabled": "acceleration:=50"
1484
+ }, /*#__PURE__*/React.createElement("a-entity", {
1485
+ geometry: "primitive: plane; height: 0.2; width: 2",
1486
+ position: "0 -0.825 -1",
1487
+ material: "color: #eee;shader: flat;"
1488
+ }), /*#__PURE__*/React.createElement("a-entity", {
1489
+ geometry: "primitive: plane; height: 0.001; width: 1.75",
1490
+ position: "0 -0.825 -1",
1491
+ material: "color: #aaa;shader: flat;"
1492
+ }), activeTool === 1 && /*#__PURE__*/React.createElement("a-entity", {
1493
+ text: selectedBinData,
1494
+ position: "-0.8 0.7 -1"
1495
+ }), renderActiveTool(), !AFRAME.utils.device.checkHeadsetConnected() && /*#__PURE__*/React.createElement("a-entity", {
1496
+ cursor: "fuse: false; fuseTimeout: 2000;",
1497
+ raycaster: "objects: .clickable; showLine: false; far: 100;",
1498
+ animation__click: "property: scale; startEvents: click; from: 0.1 0.1 0.1; to: 1.4 1.4 1.4; dur: 150",
1499
+ animation__mouseenter: "property: scale; startEvents: mouseenter; from: 1 1 1; to: 1.4 1.4 1.4; dur: 180",
1500
+ animation__mouseleave: "property: scale; startEvents: mouseleave; from: 1.4 1.4 1.4; to: 1 1 1; dur: 180",
1501
+ line: "color: orange; opacity: 0.5",
1502
+ far: "100",
1503
+ position: "0 0 -1",
1504
+ geometry: "primitive: ring; radiusInner: 0.02; radiusOuter: 0.03",
1505
+ material: "color: white; shader: flat"
1506
+ })), AFRAME.utils.device.checkHeadsetConnected() && renderOculusControls());
1487
1507
  };
1488
1508
 
1489
- var keyboardUpdateCameraReference = function keyboardUpdateCameraReference() {
1490
- cameraService = new CameraService();
1491
- };
1509
+ AFRAME$1.registerComponent('binth', {
1510
+ schema: {
1511
+ id: {
1512
+ type: 'string'
1513
+ },
1514
+ typeName: {
1515
+ type: 'string'
1516
+ },
1517
+ content: {
1518
+ "default": 0
1519
+ },
1520
+ absoluteContent: {
1521
+ "default": 0
1522
+ },
1523
+ binName: {
1524
+ "default": ''
1525
+ },
1526
+ xTitle: {
1527
+ type: 'string'
1528
+ },
1529
+ yTitle: {
1530
+ type: 'string'
1531
+ },
1532
+ zTitle: {
1533
+ type: 'string'
1534
+ },
1535
+ xMin: {
1536
+ type: 'number'
1537
+ },
1538
+ yMin: {
1539
+ type: 'number'
1540
+ },
1541
+ zMin: {
1542
+ type: 'number'
1543
+ },
1544
+ xMax: {
1545
+ type: 'number'
1546
+ },
1547
+ yMax: {
1548
+ type: 'number'
1549
+ },
1550
+ zMax: {
1551
+ type: 'number'
1552
+ },
1553
+ xPos: {
1554
+ type: 'number'
1555
+ },
1556
+ yPos: {
1557
+ type: 'number'
1558
+ },
1559
+ zPos: {
1560
+ type: 'number'
1561
+ },
1562
+ xCenter: {
1563
+ type: 'number'
1564
+ },
1565
+ yCenter: {
1566
+ type: 'number'
1567
+ },
1568
+ zCenter: {
1569
+ type: 'number'
1570
+ },
1571
+ xWidth: {
1572
+ type: 'number'
1573
+ },
1574
+ yWidth: {
1575
+ type: 'number'
1576
+ },
1577
+ zWidth: {
1578
+ type: 'number'
1579
+ },
1580
+ color: {
1581
+ type: 'string'
1582
+ },
1583
+ axisX: {
1584
+ type: 'string'
1585
+ },
1586
+ axisY: {
1587
+ type: 'string'
1588
+ },
1589
+ axisZ: {
1590
+ type: 'string'
1591
+ },
1592
+ selectColor: {
1593
+ type: 'string'
1594
+ },
1595
+ markedColor: {
1596
+ type: 'string'
1597
+ }
1598
+ },
1599
+ init: function init() {
1600
+ var el = this.el;
1601
+ el.userData = {
1602
+ typeName: this.data.typeName,
1603
+ id: this.data.id,
1604
+ content: this.data.content,
1605
+ absoluteContent: this.data.absoluteContent,
1606
+ binName: this.data.binName,
1607
+ xTitle: this.data.xTitle,
1608
+ yTitle: this.data.yTitle,
1609
+ zTitle: this.data.zTitle,
1610
+ xMin: this.data.xMin,
1611
+ yMin: this.data.yMin,
1612
+ zMin: this.data.zMin,
1613
+ xMax: this.data.xMax,
1614
+ yMax: this.data.yMax,
1615
+ zMax: this.data.zMax,
1616
+ xPos: this.data.xPos,
1617
+ yPos: this.data.yPos,
1618
+ zPos: this.data.zPos,
1619
+ xCenter: this.data.xCenter,
1620
+ yCenter: this.data.yCenter,
1621
+ zCenter: this.data.zCenter,
1622
+ xWidth: this.data.xWidth,
1623
+ yWidth: this.data.yWidth,
1624
+ zWidth: this.data.zWidth,
1625
+ color: this.data.color,
1626
+ axisX: this.data.axisX,
1627
+ axisY: this.data.axisY,
1628
+ axisZ: this.data.axisZ,
1629
+ selectColor: this.data.selectColor,
1630
+ markedColor: this.data.markedColor
1631
+ };
1632
+ },
1633
+ update: function update() {
1634
+ var el = this.el;
1635
+ el.userData = {
1636
+ typeName: this.data.typeName,
1637
+ id: this.data.id,
1638
+ content: this.data.content,
1639
+ absoluteContent: this.data.absoluteContent,
1640
+ binName: this.data.binName,
1641
+ xTitle: this.data.xTitle,
1642
+ yTitle: this.data.yTitle,
1643
+ zTitle: this.data.zTitle,
1644
+ xMin: this.data.xMin,
1645
+ yMin: this.data.yMin,
1646
+ zMin: this.data.zMin,
1647
+ xMax: this.data.xMax,
1648
+ yMax: this.data.yMax,
1649
+ zMax: this.data.zMax,
1650
+ xPos: this.data.xPos,
1651
+ yPos: this.data.yPos,
1652
+ zPos: this.data.zPos,
1653
+ xCenter: this.data.xCenter,
1654
+ yCenter: this.data.yCenter,
1655
+ zCenter: this.data.zCenter,
1656
+ xWidth: this.data.xWidth,
1657
+ yWidth: this.data.yWidth,
1658
+ zWidth: this.data.zWidth,
1659
+ color: this.data.color,
1660
+ axisX: this.data.axisX,
1661
+ axisY: this.data.axisY,
1662
+ axisZ: this.data.axisZ,
1663
+ selectColor: this.data.selectColor,
1664
+ markedColor: this.data.markedColor
1665
+ };
1666
+ }
1667
+ });
1492
1668
 
1493
- AFRAME.registerComponent('histogram-control', {
1669
+ AFRAME$1.registerComponent('histogram-control', {
1494
1670
  schema: {
1495
1671
  position: {
1496
1672
  name: 'position',
@@ -1516,13 +1692,14 @@ AFRAME.registerComponent('histogram-control', {
1516
1692
  initialKeyboardController(this.schema, el);
1517
1693
  document.addEventListener('keydown', keyPressHandlerFunction);
1518
1694
  document.addEventListener('keyup', keyReleaseHandlerFunction);
1695
+ document.addEventListener('wheel', switchDisplayModeOnBin);
1519
1696
  },
1520
1697
  update: function update() {
1521
1698
  keyboardUpdateCameraReference();
1522
1699
  }
1523
1700
  });
1524
1701
 
1525
- AFRAME.registerComponent('label-handler', {
1702
+ AFRAME$1.registerComponent('label-handler', {
1526
1703
  schema: {
1527
1704
  value: {
1528
1705
  type: 'string'
@@ -1837,7 +2014,7 @@ var _range = /*#__PURE__*/_classPrivateFieldLooseKey("range");
1837
2014
 
1838
2015
  var _labels = /*#__PURE__*/_classPrivateFieldLooseKey("labels");
1839
2016
 
1840
- var _contentCoef = /*#__PURE__*/_classPrivateFieldLooseKey("contentCoef");
2017
+ var _contentScale = /*#__PURE__*/_classPrivateFieldLooseKey("contentScale");
1841
2018
 
1842
2019
  var _minDisplayedContent = /*#__PURE__*/_classPrivateFieldLooseKey("minDisplayedContent");
1843
2020
 
@@ -1947,7 +2124,7 @@ var HistogramReactFactory = /*#__PURE__*/function () {
1947
2124
  zInitial: 0
1948
2125
  }
1949
2126
  });
1950
- Object.defineProperty(this, _contentCoef, {
2127
+ Object.defineProperty(this, _contentScale, {
1951
2128
  writable: true,
1952
2129
  value: 1
1953
2130
  });
@@ -2116,20 +2293,17 @@ var HistogramReactFactory = /*#__PURE__*/function () {
2116
2293
  markedColor = color;
2117
2294
  }
2118
2295
 
2119
- var binData = "id: " + id + ";\n typeName: 'TH2'\n content: " + c + ";\n color: " + color + ";\n yTitle: " + yTitle + ";\n xTitle: " + xTitle + ";\n zTitle: " + zTitle + ";\n absoluteContent: " + absoluteContent + ";\n binName: " + binName + ";\n xMin: " + xmin + ";\n yMin: " + ymin + ";\n zMin: " + zmin + ";\n xMax: " + xmax + ";\n yMax: " + ymax + ";\n zMax: " + zmax + ";\n xCenter: " + xcenter + ";\n yCenter: " + ycenter + ";\n zCenter: " + zcenter + ";\n xWidth: " + xwidth + ";\n yWidth: " + ywidth + ";\n zWidth: " + zwidth + ";\n markedColor: " + markedColor + ";\n selectColor: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryAccentColor() + ";\n axisX: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x') + ";\n axisY: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y') + ";\n axisZ: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z');
2120
-
2121
- var width = size * 0.9;
2122
-
2123
- var posX = (ix - 1) / _classPrivateFieldLooseBase(_this, _xWidth)[_xWidth];
2124
-
2125
- var posY = (iz - 1) / _classPrivateFieldLooseBase(_this, _zWidth)[_zWidth] + 0.2;
2126
-
2127
- var posZ = (iy - 1) / _classPrivateFieldLooseBase(_this, _yWidth)[_yWidth];
2296
+ var binData = "id: " + id + ";\n typeName: 'TH2'\n content: " + c + ";\n color: " + color + ";\n yTitle: " + yTitle + ";\n xTitle: " + xTitle + ";\n zTitle: " + zTitle + ";\n absoluteContent: " + absoluteContent + ";\n binName: " + binName + ";\n xMin: " + xmin + ";\n yMin: " + ymin + ";\n zMin: " + zmin + ";\n xMax: " + xmax + ";\n yMax: " + ymax + ";\n zMax: " + zmax + ";\n xPos: " + ix + ";\n yPos: " + iy + ";\n zPos: " + iz + ";\n xCenter: " + xcenter + ";\n yCenter: " + ycenter + ";\n zCenter: " + zcenter + ";\n xWidth: " + xwidth + ";\n yWidth: " + ywidth + ";\n zWidth: " + zwidth + ";\n markedColor: " + markedColor + ";\n selectColor: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryAccentColor() + ";\n axisX: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x') + ";\n axisY: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y') + ";\n axisZ: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z');
2128
2297
 
2298
+ var width = size * 0.8;
2299
+ var posX = ix - 1;
2300
+ var posY = iz - 1;
2301
+ var posZ = iy - 1;
2129
2302
  elements.bins[count] = {
2130
2303
  id: id,
2131
2304
  color: color,
2132
2305
  binData: binData,
2306
+ content: absoluteContent,
2133
2307
  animation: {
2134
2308
  fromWidth: _classPrivateFieldLooseBase(_this, _getPreviousBinScales)[_getPreviousBinScales](id),
2135
2309
  fromHeight: _classPrivateFieldLooseBase(_this, _getPreviousBinScales)[_getPreviousBinScales](id),
@@ -2355,48 +2529,6 @@ var HistogramReactFactory = /*#__PURE__*/function () {
2355
2529
  toZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 1.5
2356
2530
  }
2357
2531
  };
2358
- elements.titles[0] = {
2359
- key: 150000 + _classPrivateFieldLooseBase(_this, _id)[_id],
2360
- text: {
2361
- value: _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fTitle,
2362
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getPrimaryFontColor()
2363
- },
2364
- rotation: {
2365
- x: 0,
2366
- y: 123,
2367
- z: 0
2368
- },
2369
- position: {
2370
- x: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 90,
2371
- y: maxZLength + 16.5,
2372
- z: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + 90
2373
- },
2374
- innerText: {
2375
- value: 'Press V to show projections or controls',
2376
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getPrimaryFontColor()
2377
- }
2378
- };
2379
- elements.titles[1] = {
2380
- key: 120001 + _classPrivateFieldLooseBase(_this, _id)[_id],
2381
- text: {
2382
- value: _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fName,
2383
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getPrimaryFontColor()
2384
- },
2385
- rotation: {
2386
- x: 0,
2387
- y: 330,
2388
- z: 0
2389
- },
2390
- position: {
2391
- x: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] + 120,
2392
- y: maxZLength + 16.5,
2393
- z: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 70
2394
- },
2395
- innerText: {
2396
- value: 'Press buttonY to show projections or controls',
2397
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getPrimaryFontColor()
2398
- }
2399
- };
2400
2532
  count++;
2401
2533
  var bannerWidthX = _classPrivateFieldLooseBase(_this, _range)[_range] > _classPrivateFieldLooseBase(_this, _xLimit)[_xLimit] ? _classPrivateFieldLooseBase(_this, _xLimit)[_xLimit] + 1 : _classPrivateFieldLooseBase(_this, _range)[_range];
2402
2534
  var bannerWidthY = _classPrivateFieldLooseBase(_this, _range)[_range] > _classPrivateFieldLooseBase(_this, _yLimit)[_yLimit] ? _classPrivateFieldLooseBase(_this, _yLimit)[_yLimit] + 1 : _classPrivateFieldLooseBase(_this, _range)[_range];
@@ -2435,25 +2567,6 @@ var HistogramReactFactory = /*#__PURE__*/function () {
2435
2567
  transparent: true
2436
2568
  }
2437
2569
  };
2438
- count++;
2439
- elements.banners[2] = {
2440
- key: 135000 + count + _classPrivateFieldLooseBase(_this, _id)[_id],
2441
- id: 'th-background',
2442
- geometry: {
2443
- width: 0.2,
2444
- height: 15,
2445
- depth: 24
2446
- },
2447
- position: {
2448
- x: maxXLength + 8.2,
2449
- y: _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] + _classPrivateFieldLooseBase(_this, _range)[_range] / 2 + 0.5,
2450
- z: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + 1 + _classPrivateFieldLooseBase(_this, _range)[_range] / 2 + 1.5
2451
- },
2452
- material: {
2453
- color: '#ffffff',
2454
- transparent: false
2455
- }
2456
- };
2457
2570
  elements.labels = [].concat(normalAxis, reversedAxis);
2458
2571
  return elements;
2459
2572
  }
@@ -2498,7 +2611,7 @@ var HistogramReactFactory = /*#__PURE__*/function () {
2498
2611
  ywidth = ymax - ymin;
2499
2612
  absoluteContent = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].getBinContent(ix, iy);
2500
2613
  c = _classPrivateFieldLooseBase(_this, _optimizeBinContent)[_optimizeBinContent](absoluteContent, _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fMaximum);
2501
- centeredYPosition = c / 2;
2614
+ centeredYPosition = c * _classPrivateFieldLooseBase(_this, _range)[_range] * _classPrivateFieldLooseBase(_this, _contentScale)[_contentScale] / 16;
2502
2615
 
2503
2616
  if (c > _classPrivateFieldLooseBase(_this, _minDisplayedContent)[_minDisplayedContent]) {
2504
2617
  var projectionColor = _classPrivateFieldLooseBase(_this, _projectionFunction)[_projectionFunction](projectionFunction, xmin, ymin);
@@ -2513,7 +2626,7 @@ var HistogramReactFactory = /*#__PURE__*/function () {
2513
2626
  markedColor = color;
2514
2627
  }
2515
2628
 
2516
- var binData = "id: " + id + ";\n typeName: 'TH2'\n content: " + c + ";\n color: " + color + ";\n yTitle: " + yTitle + ";\n xTitle: " + xTitle + ";\n zTitle: 'none';\n absoluteContent: " + absoluteContent + ";\n binName: " + binName + ";\n xMin: " + xmin + ";\n yMin: " + ymin + ";\n zMin: " + 0 + ";\n xMax: " + xmax + ";\n yMax: " + ymax + ";\n zMax: " + 0 + ";\n xCenter: " + xcenter + ";\n yCenter: " + ycenter + ";\n yCenter: " + 0 + ";\n xWidth: " + xwidth + ";\n yWidth: " + ywidth + ";\n zWidth: " + 0 + ";\n markedColor: " + markedColor + ";\n selectColor: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryAccentColor() + ";\n axisX: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x') + ";\n axisY: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y') + ";\n axisZ: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z');
2629
+ var binData = "id: " + id + ";\n typeName: 'TH2'\n content: " + c + ";\n color: " + color + ";\n yTitle: " + yTitle + ";\n xTitle: " + xTitle + ";\n zTitle: 'none';\n absoluteContent: " + absoluteContent + ";\n binName: " + binName + ";\n xMin: " + xmin + ";\n yMin: " + ymin + ";\n zMin: " + 0 + ";\n xMax: " + xmax + ";\n yMax: " + ymax + ";\n zMax: " + 0 + ";\n xPos: " + ix + ";\n yPos: " + iy + ";\n zPos: " + 0 + ";\n xCenter: " + xcenter + ";\n yCenter: " + ycenter + ";\n yCenter: " + 0 + ";\n xWidth: " + xwidth + ";\n yWidth: " + ywidth + ";\n zWidth: " + 0 + ";\n markedColor: " + markedColor + ";\n selectColor: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryAccentColor() + ";\n axisX: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x') + ";\n axisY: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y') + ";\n axisZ: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z');
2517
2630
 
2518
2631
  var width = xwidth / _classPrivateFieldLooseBase(_this, _xWidth)[_xWidth] / _classPrivateFieldLooseBase(_this, _binScaleCoef)[_binScaleCoef];
2519
2632
 
@@ -2525,12 +2638,13 @@ var HistogramReactFactory = /*#__PURE__*/function () {
2525
2638
  id: id,
2526
2639
  color: color,
2527
2640
  binData: binData,
2641
+ content: absoluteContent,
2528
2642
  animation: {
2529
2643
  fromWidth: width,
2530
2644
  fromHeight: _classPrivateFieldLooseBase(_this, _getPreviousBinScales)[_getPreviousBinScales](id),
2531
2645
  fromDepth: depth,
2532
2646
  toWidth: width,
2533
- toHeight: c,
2647
+ toHeight: c * _classPrivateFieldLooseBase(_this, _range)[_range] * _classPrivateFieldLooseBase(_this, _contentScale)[_contentScale] / 8,
2534
2648
  toDepth: depth
2535
2649
  },
2536
2650
  animation2: {
@@ -2686,27 +2800,6 @@ var HistogramReactFactory = /*#__PURE__*/function () {
2686
2800
  color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getPrimaryFontColor()
2687
2801
  }
2688
2802
  };
2689
- elements.titles[1] = {
2690
- key: 195001 + _classPrivateFieldLooseBase(_this, _id)[_id],
2691
- text: {
2692
- value: _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fName,
2693
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getPrimaryFontColor()
2694
- },
2695
- rotation: {
2696
- x: 0,
2697
- y: 330,
2698
- z: 0
2699
- },
2700
- position: {
2701
- x: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] + 120,
2702
- y: 16.5,
2703
- z: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 70
2704
- },
2705
- innerText: {
2706
- value: 'Press buttonY to show projections or controls',
2707
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getPrimaryFontColor()
2708
- }
2709
- };
2710
2803
  count++;
2711
2804
  var bannerWidthX = _classPrivateFieldLooseBase(_this, _range)[_range] > _classPrivateFieldLooseBase(_this, _xLimit)[_xLimit] ? _classPrivateFieldLooseBase(_this, _xLimit)[_xLimit] + 1 : _classPrivateFieldLooseBase(_this, _range)[_range];
2712
2805
  var bannerWidthY = _classPrivateFieldLooseBase(_this, _range)[_range] > _classPrivateFieldLooseBase(_this, _yLimit)[_yLimit] ? _classPrivateFieldLooseBase(_this, _yLimit)[_yLimit] + 1 : _classPrivateFieldLooseBase(_this, _range)[_range];
@@ -2745,25 +2838,6 @@ var HistogramReactFactory = /*#__PURE__*/function () {
2745
2838
  transparent: true
2746
2839
  }
2747
2840
  };
2748
- count++;
2749
- elements.banners[2] = {
2750
- key: 255000 + count + _classPrivateFieldLooseBase(_this, _id)[_id],
2751
- id: 'th-background',
2752
- geometry: {
2753
- width: 0.2,
2754
- height: 16,
2755
- depth: 24
2756
- },
2757
- position: {
2758
- x: maxXLength + 8.2,
2759
- y: 7,
2760
- z: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + 1 + _classPrivateFieldLooseBase(_this, _range)[_range] / 2 + 1.5
2761
- },
2762
- material: {
2763
- color: '#ffffff',
2764
- transparent: false
2765
- }
2766
- };
2767
2841
  elements.labels = [].concat(normalAxis, reversedAxis);
2768
2842
  return elements;
2769
2843
  }
@@ -2774,7 +2848,7 @@ var HistogramReactFactory = /*#__PURE__*/function () {
2774
2848
  if (binContent <= 0) return 0;
2775
2849
 
2776
2850
  if (maxContent > 1) {
2777
- binContent = Math.round((binContent / (maxContent * _classPrivateFieldLooseBase(_this, _contentCoef)[_contentCoef]) + Number.EPSILON) * 100) / 100;
2851
+ binContent = Math.round((binContent / maxContent + Number.EPSILON) * 100) / 100;
2778
2852
  }
2779
2853
 
2780
2854
  return binContent;
@@ -3028,11 +3102,21 @@ var NdmVrHistogram3D = function NdmVrHistogram3D(_ref) {
3028
3102
  elements = _useState3[0],
3029
3103
  setElements = _useState3[1];
3030
3104
 
3105
+ var _useState4 = useState(1),
3106
+ binMarkState = _useState4[0],
3107
+ setBinMarkState = _useState4[1];
3108
+
3031
3109
  var handleSubscription = function handleSubscription(data) {
3032
3110
  if (histogram._typename.includes(data.name)) {
3033
3111
  if (data.axis) {
3034
3112
  factory.updateSection(data.axis, data.increment, data.defaultRange);
3035
3113
  setElements(factory.getElements(mode));
3114
+ } else if (data.binMarkMode) {
3115
+ setBinMarkState(function (prevState) {
3116
+ if (prevState + data.binMarkMode > 2) return 2;
3117
+ if (prevState + data.binMarkMode < 1) return 1;
3118
+ return prevState + data.binMarkMode;
3119
+ });
3036
3120
  } else {
3037
3121
  setMode(function (prevState) {
3038
3122
  return prevState !== data.fFunction ? data.fFunction : prevState;
@@ -3083,14 +3167,23 @@ var NdmVrHistogram3D = function NdmVrHistogram3D(_ref) {
3083
3167
  return /*#__PURE__*/React.createElement("a-box", {
3084
3168
  key: bin.id,
3085
3169
  "class": "clickable",
3086
- material: "color: " + bin.color + "; opacity: 0.75;",
3170
+ material: "color: " + bin.color + "; transparent: true",
3087
3171
  binth: bin.binData,
3088
3172
  mouseevent: true,
3089
3173
  animation: "property: scale; from: " + bin.animation.fromWidth + " " + bin.animation.fromHeight + " " + bin.animation.fromDepth + "; to: " + bin.animation.toWidth + " " + bin.animation.toHeight + " " + bin.animation.toDepth + "; delay:100; dur: 1500; easing: linear;",
3090
- animation__1: "property: material.opacity; from: 0; to: 0.75; dur: 2000;",
3174
+ animation__1: "property: material.opacity; from: 0; to: 0.50; dur: 2000;",
3091
3175
  animation__2: "property: position; from: " + bin.animation2.fromX + " " + bin.animation2.fromY + " " + bin.animation2.fromZ + "; to: " + bin.animation2.toX + " " + bin.animation2.toY + " " + bin.animation2.toZ + "; dur: 1000;",
3092
3176
  animation__3: "property: material.color; from: " + bin.animation3.fromColor + "; to: " + bin.animation3.toColor + "; dur: 1600;"
3093
- });
3177
+ }, /*#__PURE__*/React.createElement("a-text", {
3178
+ value: bin.content,
3179
+ align: "center",
3180
+ width: "10",
3181
+ color: "black",
3182
+ geometry: "primitive:plane; width: 1; height: 1",
3183
+ material: "color: " + bin.animation3.toColor + "; opacity: 0.50; transparent: true",
3184
+ rotation: "270 180 0",
3185
+ position: "0 " + (binMarkState === 1 ? -0.5 : 0.501) + " 0"
3186
+ }));
3094
3187
  }), elements.labels.map(function (label) {
3095
3188
  return /*#__PURE__*/React.createElement("a-entity", {
3096
3189
  key: label.key,
@@ -3098,7 +3191,7 @@ var NdmVrHistogram3D = function NdmVrHistogram3D(_ref) {
3098
3191
  text: "color: " + label.text.color + "; width: " + label.text.width + "; height: " + label.text.height + "; align:center;",
3099
3192
  "label-handler": "value: " + label.labelHandler.value + "; delay:" + label.labelHandler.delay,
3100
3193
  rotation: label.rotation.x + " " + label.rotation.y + " " + label.rotation.z,
3101
- material: "color: " + label.material.color + ";",
3194
+ material: "color: " + label.material.color + "; transparent: true",
3102
3195
  animation: "property: text.width; from: 0; to: 4; dur: 1000;",
3103
3196
  animation__1: "property: material.opacity; from: 0; to: 0.8; dur: 1500;",
3104
3197
  animation__2: "property: position; from: " + label.animation.fromX + " " + label.animation.fromY + " " + label.animation.fromZ + "; to: " + label.animation.toX + " " + label.animation.toY + " " + label.animation.toZ + "; dur: 1005;"
@@ -3108,7 +3201,8 @@ var NdmVrHistogram3D = function NdmVrHistogram3D(_ref) {
3108
3201
  key: title.key,
3109
3202
  text: "value: " + title.text.value + "; color: " + title.text.color + "; width: 230; height:auto; align:center;",
3110
3203
  rotation: title.rotation.x + " " + title.rotation.y + " " + title.rotation.z,
3111
- position: title.position.x + " " + title.position.y + " " + title.position.z
3204
+ position: title.position.x + " " + title.position.y + " " + title.position.z,
3205
+ material: "transparent: true"
3112
3206
  }, /*#__PURE__*/React.createElement("a-text", {
3113
3207
  value: title.innerText.value,
3114
3208
  position: "0 10 0",
@@ -3119,7 +3213,7 @@ var NdmVrHistogram3D = function NdmVrHistogram3D(_ref) {
3119
3213
  }), /*#__PURE__*/React.createElement("a-entity", {
3120
3214
  geometry: "primitive: plane; width:170; height:30;",
3121
3215
  position: "0 0 -1",
3122
- material: "opacity: 0.9; color: white;"
3216
+ material: "opacity: 0.9; color: white; transparent: true"
3123
3217
  }));
3124
3218
  }), elements.axisLabels.map(function (axisLabel) {
3125
3219
  return /*#__PURE__*/React.createElement("a-entity", {
@@ -3128,12 +3222,12 @@ var NdmVrHistogram3D = function NdmVrHistogram3D(_ref) {
3128
3222
  text: "value: " + axisLabel.text.value + "; color: " + axisLabel.text.color + "; width: 10; height:auto; align:center;",
3129
3223
  rotation: axisLabel.rotation.x + " " + axisLabel.rotation.y + " " + axisLabel.rotation.z,
3130
3224
  animation: "property: position; from: " + axisLabel.animation.fromX + " " + axisLabel.animation.fromY + " " + axisLabel.animation.fromZ + "; to: " + axisLabel.animation.toX + " " + axisLabel.animation.toY + " " + axisLabel.animation.toZ + "; dur: 1000;",
3131
- material: "opacity: 0;"
3225
+ material: "opacity: 0; transparent: true"
3132
3226
  });
3133
3227
  }), elements.ground && /*#__PURE__*/React.createElement("a-box", {
3134
3228
  key: elements.ground.key,
3135
3229
  width: elements.ground.scale.width,
3136
- material: "color: #171717",
3230
+ material: "color: #fafafa",
3137
3231
  height: elements.ground.scale.height,
3138
3232
  depth: elements.ground.scale.depth,
3139
3233
  animation: "property: position; from: " + elements.ground.animation.fromX + " " + elements.ground.animation.fromY + " " + elements.ground.animation.fromZ + ";\n to:\n " + elements.ground.animation.toX + " " + elements.ground.animation.toY + " " + elements.ground.animation.toZ + "; dur: 1000;"
@@ -3156,18 +3250,22 @@ var NdmVrHistogram3D = function NdmVrHistogram3D(_ref) {
3156
3250
  }
3157
3251
  };
3158
3252
 
3253
+ function NdmVrLaboratory() {
3254
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a-sky", {
3255
+ color: "#dbf0fe"
3256
+ }), /*#__PURE__*/React.createElement("a-plane", {
3257
+ rotation: "-90 0 0",
3258
+ position: "0 -0.5 0",
3259
+ width: "1000",
3260
+ height: "1000",
3261
+ color: "#aaa",
3262
+ material: "shader:flat;"
3263
+ }));
3264
+ }
3265
+
3159
3266
  var NdmVrScene = function NdmVrScene(_ref) {
3160
3267
  var data = _ref.data,
3161
3268
  info = _ref.info;
3162
-
3163
- var _useState = useState({
3164
- url: info.background.url ? info.background.url : './ndmvr/backgrounds/background1.jpg',
3165
- radius: info.background.radius ? info.background.radius : '3000',
3166
- height: info.background.height ? info.background.height : '2048',
3167
- width: info.background.width ? info.background.width : '2048'
3168
- }),
3169
- background = _useState[0];
3170
-
3171
3269
  return /*#__PURE__*/React.createElement("a-scene", {
3172
3270
  embedded: true,
3173
3271
  style: {
@@ -3177,21 +3275,15 @@ var NdmVrScene = function NdmVrScene(_ref) {
3177
3275
  }
3178
3276
  }, /*#__PURE__*/React.createElement("a-assets", null, /*#__PURE__*/React.createElement("img", {
3179
3277
  id: "skyTexture",
3180
- src: background.url,
3278
+ src: info.background.url,
3181
3279
  alt: "background"
3182
- })), /*#__PURE__*/React.createElement(NdmVrCamera, null), /*#__PURE__*/React.createElement(NdmVrHistogram3D, {
3280
+ })), /*#__PURE__*/React.createElement(NdmVrLaboratory, null), /*#__PURE__*/React.createElement(NdmVrCamera, null), /*#__PURE__*/React.createElement(NdmVrHistogram3D, {
3183
3281
  name: info.name,
3184
3282
  histogram: data.histogram,
3185
3283
  histoSection: data.section,
3186
3284
  projections: data.projections,
3187
3285
  range: data.range,
3188
3286
  theme: info.theme
3189
- }), /*#__PURE__*/React.createElement("a-sky", {
3190
- height: background.height,
3191
- radius: background.radius,
3192
- width: background.width,
3193
- src: "#skyTexture",
3194
- position: "0 1000 0"
3195
3287
  }));
3196
3288
  };
3197
3289
 
@@ -3776,7 +3868,7 @@ var optimizeBinContent = function optimizeBinContent(binContent, maxContent) {
3776
3868
  return binContent;
3777
3869
  };
3778
3870
 
3779
- AFRAME.registerComponent('binth2', {
3871
+ AFRAME$1.registerComponent('binth2', {
3780
3872
  schema: {
3781
3873
  id: {
3782
3874
  type: 'string'
@@ -3958,7 +4050,7 @@ var HistogramDemoFactory = /*#__PURE__*/function () {
3958
4050
  return HistogramDemoFactory;
3959
4051
  }();
3960
4052
 
3961
- var index = AFRAME.registerComponent('th2-histogram', {
4053
+ var index = AFRAME$1.registerComponent('th2-histogram', {
3962
4054
  schema: {
3963
4055
  section: {
3964
4056
  type: 'string'
@@ -4097,7 +4189,7 @@ var index = AFRAME.registerComponent('th2-histogram', {
4097
4189
  }
4098
4190
  });
4099
4191
 
4100
- var infoBannerAframeComponent = AFRAME.registerComponent('banner-control', {
4192
+ var infoBannerAframeComponent = AFRAME$1.registerComponent('banner-control', {
4101
4193
  schema: {
4102
4194
  position: {
4103
4195
  name: 'position',
@@ -4275,7 +4367,7 @@ var oculusRedrawHistogramBanners = function oculusRedrawHistogramBanners() {
4275
4367
  });
4276
4368
  };
4277
4369
 
4278
- var leftOculusController = AFRAME.registerComponent('left-controller-logging', {
4370
+ var leftOculusController = AFRAME$1.registerComponent('left-controller-logging', {
4279
4371
  init: function init() {
4280
4372
  var gripActive = false;
4281
4373
  var speed = 1;
@@ -4322,7 +4414,7 @@ var leftOculusController = AFRAME.registerComponent('left-controller-logging', {
4322
4414
  }
4323
4415
  });
4324
4416
 
4325
- var rightOculusController = AFRAME.registerComponent('right-controller-logging', {
4417
+ var rightOculusController = AFRAME$1.registerComponent('right-controller-logging', {
4326
4418
  init: function init() {
4327
4419
  var gripActive = false;
4328
4420
  var el = this.el;