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