@xeokit/xeokit-sdk 2.3.2 → 2.3.3

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.
@@ -750,9 +750,7 @@ class ContextMenu {
750
750
 
751
751
  item.itemElement.addEventListener("mouseenter", (event) => {
752
752
  event.preventDefault();
753
- if (item.enabled === false) {
754
- return;
755
- }
753
+
756
754
  const subMenu = item.subMenu;
757
755
  if (!subMenu) {
758
756
  if (lastSubMenu) {
@@ -766,6 +764,10 @@ class ContextMenu {
766
764
  lastSubMenu = null;
767
765
  }
768
766
 
767
+ if (item.enabled === false) {
768
+ return;
769
+ }
770
+
769
771
  const itemElement = item.itemElement;
770
772
  const subMenuElement = subMenu.menuElement;
771
773
 
@@ -12642,7 +12644,7 @@ function buildBoxGeometry(cfg = {}) {
12642
12644
  * xSize: 1, // Half-size on each axis
12643
12645
  * ySize: 1,
12644
12646
  * zSize: 1
12645
- * }),
12647
+ * })),
12646
12648
  * material: new PhongMaterial(viewer.scene, {
12647
12649
  * emissive: [0,1,0]
12648
12650
  * })
@@ -65453,37 +65455,91 @@ class Wire {
65453
65455
 
65454
65456
  constructor(parentElement, cfg = {}) {
65455
65457
 
65458
+ this._color = cfg.color || "black";
65459
+ this._highlightClass = "viewer-ruler-wire-highlighted";
65460
+
65456
65461
  this._wire = document.createElement('div');
65457
65462
  this._wire.className += this._wire.className ? ' viewer-ruler-wire' : 'viewer-ruler-wire';
65458
65463
 
65459
- var wire = this._wire;
65460
- var style = wire.style;
65464
+ this._wireClickable = document.createElement('div');
65465
+ this._wireClickable.className += this._wireClickable.className ? ' viewer-ruler-wire-clickable' : 'viewer-ruler-wire-clickable';
65461
65466
 
65462
65467
  this._thickness = cfg.thickness || 1.0;
65468
+ this._thicknessClickable = cfg.thicknessClickable || 6.0;
65463
65469
 
65464
- style.border = "solid " + this._thickness + "px " + (cfg.color || "black");
65465
- style.position = "absolute";
65466
- style["z-index"] = cfg.zIndex === undefined ? "2000001" : cfg.zIndex ;
65467
- style.width = 0 + "px";
65468
- style.height = 0 + "px";
65469
- style.visibility = "visible";
65470
- style.top = 0 + "px";
65471
- style.left = 0 + "px";
65472
- style["pointer-events"] = "none";
65473
- style['-webkit-transform-origin'] = "0 0";
65474
- style['-moz-transform-origin'] = "0 0";
65475
- style['-ms-transform-origin'] = "0 0";
65476
- style['-o-transform-origin'] = "0 0";
65477
- style['transform-origin'] = "0 0";
65478
- style['-webkit-transform'] = 'rotate(0deg)';
65479
- style['-moz-transform'] = 'rotate(0deg)';
65480
- style['-ms-transform'] = 'rotate(0deg)';
65481
- style['-o-transform'] = 'rotate(0deg)';
65482
- style['transform'] = 'rotate(0deg)';
65483
- style["opacity"] = 1.0;
65470
+ var wire = this._wire;
65471
+ var wireStyle = wire.style;
65472
+
65473
+ wireStyle.border = "solid " + this._thickness + "px " + this._color;
65474
+ wireStyle.position = "absolute";
65475
+ wireStyle["z-index"] = cfg.zIndex === undefined ? "2000001" : cfg.zIndex;
65476
+ wireStyle.width = 0 + "px";
65477
+ wireStyle.height = 0 + "px";
65478
+ wireStyle.visibility = "visible";
65479
+ wireStyle.top = 0 + "px";
65480
+ wireStyle.left = 0 + "px";
65481
+ wireStyle['-webkit-transform-origin'] = "0 0";
65482
+ wireStyle['-moz-transform-origin'] = "0 0";
65483
+ wireStyle['-ms-transform-origin'] = "0 0";
65484
+ wireStyle['-o-transform-origin'] = "0 0";
65485
+ wireStyle['transform-origin'] = "0 0";
65486
+ wireStyle['-webkit-transform'] = 'rotate(0deg)';
65487
+ wireStyle['-moz-transform'] = 'rotate(0deg)';
65488
+ wireStyle['-ms-transform'] = 'rotate(0deg)';
65489
+ wireStyle['-o-transform'] = 'rotate(0deg)';
65490
+ wireStyle['transform'] = 'rotate(0deg)';
65491
+ wireStyle["opacity"] = 1.0;
65492
+ if (cfg.onContextMenu) ;
65484
65493
 
65485
65494
  parentElement.appendChild(wire);
65486
65495
 
65496
+ var wireClickable = this._wireClickable;
65497
+ var wireClickableStyle = wireClickable.style;
65498
+
65499
+ wireClickableStyle.border = "solid " + this._thicknessClickable + "px " + this._color;
65500
+ wireClickableStyle.position = "absolute";
65501
+ wireClickableStyle["z-index"] = cfg.zIndex === undefined ? "2000002" : (cfg.zIndex + 1);
65502
+ wireClickableStyle.width = 0 + "px";
65503
+ wireClickableStyle.height = 0 + "px";
65504
+ wireClickableStyle.visibility = "visible";
65505
+ wireClickableStyle.top = 0 + "px";
65506
+ wireClickableStyle.left = 0 + "px";
65507
+ // wireClickableStyle["pointer-events"] = "none";
65508
+ wireClickableStyle['-webkit-transform-origin'] = "0 0";
65509
+ wireClickableStyle['-moz-transform-origin'] = "0 0";
65510
+ wireClickableStyle['-ms-transform-origin'] = "0 0";
65511
+ wireClickableStyle['-o-transform-origin'] = "0 0";
65512
+ wireClickableStyle['transform-origin'] = "0 0";
65513
+ wireClickableStyle['-webkit-transform'] = 'rotate(0deg)';
65514
+ wireClickableStyle['-moz-transform'] = 'rotate(0deg)';
65515
+ wireClickableStyle['-ms-transform'] = 'rotate(0deg)';
65516
+ wireClickableStyle['-o-transform'] = 'rotate(0deg)';
65517
+ wireClickableStyle['transform'] = 'rotate(0deg)';
65518
+ wireClickableStyle["opacity"] = 0.0;
65519
+ wireClickableStyle["pointer-events"] = "all";
65520
+ if (cfg.onContextMenu) ;
65521
+
65522
+ parentElement.appendChild(wireClickable);
65523
+
65524
+ if (cfg.onMouseOver) {
65525
+ wireClickable.addEventListener('mouseover', (event) => {
65526
+ cfg.onMouseOver(event, this);
65527
+ });
65528
+ }
65529
+
65530
+ if (cfg.onMouseLeave) {
65531
+ wireClickable.addEventListener('mouseleave', (event) => {
65532
+ cfg.onMouseLeave(event, this);
65533
+ });
65534
+ }
65535
+
65536
+ if (cfg.onContextMenu) {
65537
+ wireClickable.addEventListener('contextmenu', (event) => {
65538
+ cfg.onContextMenu(event, this);
65539
+ event.preventDefault();
65540
+ });
65541
+ }
65542
+
65487
65543
  this._x1 = 0;
65488
65544
  this._y1 = 0;
65489
65545
  this._x2 = 0;
@@ -65501,16 +65557,25 @@ class Wire {
65501
65557
  var length = Math.abs(Math.sqrt((this._x1 - this._x2) * (this._x1 - this._x2) + (this._y1 - this._y2) * (this._y1 - this._y2)));
65502
65558
  var angle = Math.atan2(this._y2 - this._y1, this._x2 - this._x1) * 180.0 / Math.PI;
65503
65559
 
65504
- var style = this._wire.style;
65505
- style["width"] = Math.round(length) + 'px';
65506
- style["left"] = Math.round(this._x1) + 'px';
65507
- style["top"] = Math.round(this._y1) + 'px';
65508
- style['-webkit-transform'] = 'rotate(' + angle + 'deg)';
65509
- style['-moz-transform'] = 'rotate(' + angle + 'deg)';
65510
- style['-ms-transform'] = 'rotate(' + angle + 'deg)';
65511
- style['-o-transform'] = 'rotate(' + angle + 'deg)';
65512
- style['transform'] = 'rotate(' + angle + 'deg)';
65513
- style["pointer-events"] = "none";
65560
+ var wireStyle = this._wire.style;
65561
+ wireStyle["width"] = Math.round(length) + 'px';
65562
+ wireStyle["left"] = Math.round(this._x1) + 'px';
65563
+ wireStyle["top"] = Math.round(this._y1) + 'px';
65564
+ wireStyle['-webkit-transform'] = 'rotate(' + angle + 'deg)';
65565
+ wireStyle['-moz-transform'] = 'rotate(' + angle + 'deg)';
65566
+ wireStyle['-ms-transform'] = 'rotate(' + angle + 'deg)';
65567
+ wireStyle['-o-transform'] = 'rotate(' + angle + 'deg)';
65568
+ wireStyle['transform'] = 'rotate(' + angle + 'deg)';
65569
+
65570
+ var wireClickableStyle = this._wireClickable.style;
65571
+ wireClickableStyle["width"] = Math.round(length) + 'px';
65572
+ wireClickableStyle["left"] = Math.round(this._x1) + 'px';
65573
+ wireClickableStyle["top"] = Math.round(this._y1) + 'px';
65574
+ wireClickableStyle['-webkit-transform'] = 'rotate(' + angle + 'deg)';
65575
+ wireClickableStyle['-moz-transform'] = 'rotate(' + angle + 'deg)';
65576
+ wireClickableStyle['-ms-transform'] = 'rotate(' + angle + 'deg)';
65577
+ wireClickableStyle['-o-transform'] = 'rotate(' + angle + 'deg)';
65578
+ wireClickableStyle['transform'] = 'rotate(' + angle + 'deg)';
65514
65579
  }
65515
65580
 
65516
65581
  setStartAndEnd(x1, y1, x2, y2) {
@@ -65522,7 +65587,8 @@ class Wire {
65522
65587
  }
65523
65588
 
65524
65589
  setColor(color) {
65525
- this._wire.style.border = "solid " + this._thickness + "px " + (color || "black");
65590
+ this._color = color || "black";
65591
+ this._wire.style.border = "solid " + this._thickness + "px " + this._color;
65526
65592
  }
65527
65593
 
65528
65594
  setOpacity(opacity) {
@@ -65537,8 +65603,25 @@ class Wire {
65537
65603
  this._wire.style.visibility = visible ? "visible" : "hidden";
65538
65604
  }
65539
65605
 
65606
+ setClickable(clickable) {
65607
+ this._wireClickable.style["pointer-events"] = (!!clickable) ? "all" : "none";
65608
+ }
65609
+
65610
+ setHighlighted(highlighted) {
65611
+ if (this._highlighted === highlighted) {
65612
+ return;
65613
+ }
65614
+ this._highlighted = !!highlighted;
65615
+ if (this._highlighted) {
65616
+ this._wire.classList.add(this._highlightClass);
65617
+ } else {
65618
+ this._wire.classList.remove(this._highlightClass);
65619
+ }
65620
+ }
65621
+
65540
65622
  destroy(visible) {
65541
65623
  this._wire.parentElement.removeChild(this._wire);
65624
+ this._wireClickable.parentElement.removeChild(this._wireClickable);
65542
65625
  }
65543
65626
  }
65544
65627
 
@@ -65547,6 +65630,8 @@ class Dot {
65547
65630
 
65548
65631
  constructor(parentElement, cfg = {}) {
65549
65632
 
65633
+ this._highlightClass = "viewer-ruler-dot-highlighted";
65634
+
65550
65635
  this._x = 0;
65551
65636
  this._y = 0;
65552
65637
 
@@ -65554,37 +65639,77 @@ class Dot {
65554
65639
  this._dot = document.createElement('div');
65555
65640
  this._dot.className += this._dot.className ? ' viewer-ruler-dot' : 'viewer-ruler-dot';
65556
65641
 
65642
+ this._dotClickable = document.createElement('div');
65643
+ this._dotClickable.className += this._dotClickable.className ? ' viewer-ruler-dot-clickable' : 'viewer-ruler-dot-clickable';
65644
+
65557
65645
  var dot = this._dot;
65558
- var style = dot.style;
65646
+ var dotStyle = dot.style;
65647
+ dotStyle["border-radius"] = 25 + "px";
65648
+ dotStyle.border = "solid 2px white";
65649
+ dotStyle.background = "lightgreen";
65650
+ dotStyle.position = "absolute";
65651
+ dotStyle["z-index"] = cfg.zIndex === undefined ? "40000005" : cfg.zIndex ;
65652
+ dotStyle.width = 8 + "px";
65653
+ dotStyle.height = 8 + "px";
65654
+ dotStyle.visibility = cfg.visible !== false ? "visible" : "hidden";
65655
+ dotStyle.top = 0 + "px";
65656
+ dotStyle.left = 0 + "px";
65657
+ dotStyle["box-shadow"] = "0 2px 5px 0 #182A3D;";
65658
+ dotStyle["opacity"] = 1.0;
65659
+ dotStyle["pointer-events"] = "none";
65660
+ if (cfg.onContextMenu) ;
65661
+ parentElement.appendChild(dot);
65559
65662
 
65560
- style["border-radius"] = 25 + "px";
65561
- style.border = "solid 2px white";
65562
- style.background = "lightgreen";
65563
- style.position = "absolute";
65564
- style["z-index"] = cfg.zIndex === undefined ? "40000005" : cfg.zIndex ;
65565
- style.width = 8 + "px";
65566
- style.height = 8 + "px";
65567
- style.visibility = cfg.visible !== false ? "visible" : "hidden";
65568
- style.top = 0 + "px";
65569
- style.left = 0 + "px";
65570
- style["box-shadow"] = "0 2px 5px 0 #182A3D;";
65571
- style["pointer-events"] = "none";
65572
- style["opacity"] = 1.0;
65663
+ var dotClickable = this._dotClickable;
65664
+ var dotClickableStyle = dotClickable.style;
65665
+ dotClickableStyle["border-radius"] = 35 + "px";
65666
+ dotClickableStyle.border = "solid 10px white";
65667
+ dotClickableStyle.position = "absolute";
65668
+ dotClickableStyle["z-index"] = cfg.zIndex === undefined ? "40000007" : (cfg.zIndex + 1);
65669
+ dotClickableStyle.width = 8 + "px";
65670
+ dotClickableStyle.height = 8 + "px";
65671
+ dotClickableStyle.visibility = "visible";
65672
+ dotClickableStyle.top = 0 + "px";
65673
+ dotClickableStyle.left = 0 + "px";
65674
+ dotClickableStyle["opacity"] = 0.0;
65675
+ dotClickableStyle["pointer-events"] = "all";
65676
+ if (cfg.onContextMenu) ;
65677
+ parentElement.appendChild(dotClickable);
65678
+
65679
+ if (cfg.onMouseOver) {
65680
+ dotClickable.addEventListener('mouseover', (event) => {
65681
+ cfg.onMouseOver(event, this);
65682
+ });
65683
+ }
65573
65684
 
65574
- parentElement.appendChild(dot);
65685
+ if (cfg.onMouseLeave) {
65686
+ dotClickable.addEventListener('mouseleave', (event) => {
65687
+ cfg.onMouseLeave(event, this);
65688
+ });
65689
+ }
65575
65690
 
65691
+ if (cfg.onContextMenu) {
65692
+ dotClickable.addEventListener('contextmenu', (event) => {
65693
+ cfg.onContextMenu(event, this);
65694
+ event.preventDefault();
65695
+ });
65696
+ }
65697
+
65576
65698
  this.setPos(cfg.x || 0, cfg.y || 0);
65577
65699
  this.setFillColor(cfg.fillColor);
65578
65700
  this.setBorderColor(cfg.borderColor);
65579
- this.setClickable(false);
65580
65701
  }
65581
65702
 
65582
65703
  setPos(x, y) {
65583
65704
  this._x = x;
65584
65705
  this._y = y;
65585
- var style = this._dot.style;
65586
- style["left"] = (Math.round(x) - 5) + 'px';
65587
- style["top"] = (Math.round(y) - 5) + 'px';
65706
+ var dotStyle = this._dot.style;
65707
+ dotStyle["left"] = (Math.round(x) - 4) + 'px';
65708
+ dotStyle["top"] = (Math.round(y) - 4) + 'px';
65709
+
65710
+ var dotClickableStyle = this._dotClickable.style;
65711
+ dotClickableStyle["left"] = (Math.round(x) - 9) + 'px';
65712
+ dotClickableStyle["top"] = (Math.round(y) - 9) + 'px';
65588
65713
  }
65589
65714
 
65590
65715
  setFillColor(color) {
@@ -65608,12 +65733,26 @@ class Dot {
65608
65733
  }
65609
65734
 
65610
65735
  setClickable(clickable) {
65736
+ this._dotClickable.style["pointer-events"] = (!!clickable) ? "all" : "none";
65611
65737
  this._dot.style["pointer-events"] = (!!clickable) ? "all" : "none";
65612
65738
  }
65613
65739
 
65740
+ setHighlighted(highlighted) {
65741
+ if (this._highlighted === highlighted) {
65742
+ return;
65743
+ }
65744
+ this._highlighted = !!highlighted;
65745
+ if (this._highlighted) {
65746
+ this._dot.classList.add(this._highlightClass);
65747
+ } else {
65748
+ this._dot.classList.remove(this._highlightClass);
65749
+ }
65750
+ }
65751
+
65614
65752
  destroy() {
65615
65753
  this.setVisible(false);
65616
65754
  this._dot.parentElement.removeChild(this._dot);
65755
+ this._dotClickable.parentElement.removeChild(this._dotClickable);
65617
65756
  }
65618
65757
  }
65619
65758
 
@@ -65622,10 +65761,13 @@ class Label {
65622
65761
 
65623
65762
  constructor(parentElement, cfg = {}) {
65624
65763
 
65764
+ this._highlightClass = "viewer-ruler-label-highlighted";
65765
+
65625
65766
  this._prefix = cfg.prefix || "";
65626
65767
  this._x = 0;
65627
65768
  this._y = 0;
65628
65769
  this._visible = true;
65770
+ this._culled = false;
65629
65771
 
65630
65772
  this._label = document.createElement('div');
65631
65773
  this._label.className += this._label.className ? ' viewer-ruler-label' : 'viewer-ruler-label';
@@ -65636,7 +65778,7 @@ class Label {
65636
65778
  style["border-radius"] = 5 + "px";
65637
65779
  style.color = "white";
65638
65780
  style.padding = "4px";
65639
- style.border = "solid 0px white";
65781
+ style.border = "solid 1px";
65640
65782
  style.background = "lightgreen";
65641
65783
  style.position = "absolute";
65642
65784
  style["z-index"] = cfg.zIndex === undefined ? "5000005" : cfg.zIndex;
@@ -65645,16 +65787,38 @@ class Label {
65645
65787
  style.visibility = "visible";
65646
65788
  style.top = 0 + "px";
65647
65789
  style.left = 0 + "px";
65648
- style["pointer-events"] = "none";
65790
+ style["pointer-events"] = "all";
65649
65791
  style["opacity"] = 1.0;
65792
+ if (cfg.onContextMenu) ;
65650
65793
  label.innerText = "";
65651
65794
 
65652
65795
  parentElement.appendChild(label);
65653
65796
 
65654
65797
  this.setPos(cfg.x || 0, cfg.y || 0);
65655
65798
  this.setFillColor(cfg.fillColor);
65656
- this.setBorderColor(cfg.borderColor);
65799
+ this.setBorderColor(cfg.fillColor);
65657
65800
  this.setText(cfg.text);
65801
+
65802
+ if (cfg.onMouseOver) {
65803
+ label.addEventListener('mouseover', (event) => {
65804
+ cfg.onMouseOver(event, this);
65805
+ event.preventDefault();
65806
+ });
65807
+ }
65808
+
65809
+ if (cfg.onMouseLeave) {
65810
+ label.addEventListener('mouseleave', (event) => {
65811
+ cfg.onMouseLeave(event, this);
65812
+ event.preventDefault();
65813
+ });
65814
+ }
65815
+
65816
+ if (cfg.onContextMenu) {
65817
+ label.addEventListener('contextmenu', (event) => {
65818
+ cfg.onContextMenu(event, this);
65819
+ event.preventDefault();
65820
+ });
65821
+ }
65658
65822
  }
65659
65823
 
65660
65824
  setPos(x, y) {
@@ -65686,11 +65850,13 @@ class Label {
65686
65850
  }
65687
65851
 
65688
65852
  setFillColor(color) {
65689
- this._label.style.background = color || "lightgreen";
65853
+ this._fillColor = color || "lightgreen";
65854
+ this._label.style.background =this._fillColor;
65690
65855
  }
65691
65856
 
65692
65857
  setBorderColor(color) {
65693
- this._label.style.border = "solid 2px" + (color || "black");
65858
+ this._borderColor = color || "black";
65859
+ this._label.style.border = "solid 1px " + this._borderColor;
65694
65860
  }
65695
65861
 
65696
65862
  setOpacity(opacity) {
@@ -65702,7 +65868,31 @@ class Label {
65702
65868
  return;
65703
65869
  }
65704
65870
  this._visible = !!visible;
65705
- this._label.style.visibility = this._visible ? "visible" : "hidden";
65871
+ this._label.style.visibility = this._visible && !this._culled ? "visible" : "hidden";
65872
+ }
65873
+
65874
+ setCulled(culled) {
65875
+ if (this._culled === culled) {
65876
+ return;
65877
+ }
65878
+ this._culled = !!culled;
65879
+ this._label.style.visibility = this._visible && !this._culled ? "visible" : "hidden";
65880
+ }
65881
+
65882
+ setHighlighted(highlighted) {
65883
+ if (this._highlighted === highlighted) {
65884
+ return;
65885
+ }
65886
+ this._highlighted = !!highlighted;
65887
+ if (this._highlighted) {
65888
+ this._label.classList.add(this._highlightClass);
65889
+ } else {
65890
+ this._label.classList.remove(this._highlightClass);
65891
+ }
65892
+ }
65893
+
65894
+ setClickable(clickable) {
65895
+ this._label.style["pointer-events"] = (!!clickable) ? "all" : "none";
65706
65896
  }
65707
65897
 
65708
65898
  destroy() {
@@ -65755,35 +65945,65 @@ class AngleMeasurement extends Component {
65755
65945
  this._pp = new Float64Array(12);
65756
65946
  this._cp = new Int16Array(6);
65757
65947
 
65948
+ const onMouseOver = cfg.onMouseOver ? (event) => {
65949
+ cfg.onMouseOver(event, this);
65950
+ } : null;
65951
+
65952
+ const onMouseLeave = cfg.onMouseLeave ? (event) => {
65953
+ cfg.onMouseLeave(event, this);
65954
+ } : null;
65955
+
65956
+ const onContextMenu = cfg.onContextMenu ? (event) => {
65957
+ cfg.onContextMenu(event, this);
65958
+ } : null;
65959
+
65758
65960
  this._originDot = new Dot(this._container, {
65759
65961
  fillColor: this._color,
65760
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined
65962
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined,
65963
+ onMouseOver,
65964
+ onMouseLeave,
65965
+ onContextMenu
65761
65966
  });
65762
65967
  this._cornerDot = new Dot(this._container, {
65763
65968
  fillColor: this._color,
65764
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined
65969
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined,
65970
+ onMouseOver,
65971
+ onMouseLeave,
65972
+ onContextMenu
65765
65973
  });
65766
65974
  this._targetDot = new Dot(this._container, {
65767
65975
  fillColor: this._color,
65768
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined
65976
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined,
65977
+ onMouseOver,
65978
+ onMouseLeave,
65979
+ onContextMenu
65769
65980
  });
65770
65981
 
65771
65982
  this._originWire = new Wire(this._container, {
65772
65983
  color: this._color || "blue",
65773
65984
  thickness: 1,
65774
- zIndex: plugin.zIndex
65985
+ zIndex: plugin.zIndex,
65986
+ onMouseOver,
65987
+ onMouseLeave,
65988
+ onContextMenu
65775
65989
  });
65776
65990
  this._targetWire = new Wire(this._container, {
65777
65991
  color: this._color || "red",
65778
65992
  thickness: 1,
65779
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1: undefined
65993
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1: undefined,
65994
+ onMouseOver,
65995
+ onMouseLeave,
65996
+ onContextMenu
65780
65997
  });
65781
65998
 
65782
65999
  this._angleLabel = new Label(this._container, {
65783
66000
  fillColor: this._color || "#00BBFF",
65784
66001
  prefix: "",
65785
66002
  text: "",
65786
- zIndex: plugin.zIndex + 2
66003
+ zIndex: plugin.zIndex + 2,
66004
+ onMouseOver,
66005
+ onMouseLeave,
66006
+ onContextMenu
65787
66007
  });
65788
66008
 
65789
66009
  this._wpDirty = false;
@@ -65799,6 +66019,8 @@ class AngleMeasurement extends Component {
65799
66019
  this._targetWireVisible = false;
65800
66020
 
65801
66021
  this._angleVisible = false;
66022
+ this._labelsVisible = false;
66023
+ this._clickable = true;
65802
66024
 
65803
66025
  this._originMarker.on("worldPos", (value) => {
65804
66026
  this._originWorld.set(value || [0, 0, 0]);
@@ -65844,6 +66066,7 @@ class AngleMeasurement extends Component {
65844
66066
  this.targetWireVisible = cfg.targetWireVisible;
65845
66067
 
65846
66068
  this.angleVisible = cfg.angleVisible;
66069
+ this.labelsVisible = cfg.labelsVisible;
65847
66070
  }
65848
66071
 
65849
66072
  _update() {
@@ -65903,7 +66126,7 @@ class AngleMeasurement extends Component {
65903
66126
  this._originWire.setVisible(false);
65904
66127
  this._targetWire.setVisible(false);
65905
66128
 
65906
- this._angleLabel.setVisible(false);
66129
+ this._angleLabel.setCulled(true);
65907
66130
 
65908
66131
  return;
65909
66132
  }
@@ -65967,7 +66190,7 @@ class AngleMeasurement extends Component {
65967
66190
  this._originWire.setVisible(this._visible && this._originWireVisible);
65968
66191
  this._targetWire.setVisible(this._visible && this._targetWireVisible);
65969
66192
 
65970
- this._angleLabel.setVisible(this._visible && this._angleVisible);
66193
+ this._angleLabel.setCulled(!(this._visible && this._angleVisible && this.labelsVisible));
65971
66194
 
65972
66195
  this._cpDirty = false;
65973
66196
  }
@@ -66081,6 +66304,8 @@ class AngleMeasurement extends Component {
66081
66304
  this._originWire.setVisible(this._visible && this._originWireVisible);
66082
66305
  this._targetWire.setVisible(this._visible && this._targetWireVisible);
66083
66306
  this._angleLabel.setVisible(this._visible && this._angleVisible);
66307
+ this._cpDirty = true;
66308
+ this._needUpdate();
66084
66309
  }
66085
66310
 
66086
66311
  /**
@@ -66101,6 +66326,8 @@ class AngleMeasurement extends Component {
66101
66326
  value = value !== false;
66102
66327
  this._originVisible = value;
66103
66328
  this._originDot.setVisible(this._visible && this._originVisible);
66329
+ this._cpDirty = true;
66330
+ this._needUpdate();
66104
66331
  }
66105
66332
 
66106
66333
  /**
@@ -66121,6 +66348,8 @@ class AngleMeasurement extends Component {
66121
66348
  value = value !== false;
66122
66349
  this._cornerVisible = value;
66123
66350
  this._cornerDot.setVisible(this._visible && this._cornerVisible);
66351
+ this._cpDirty = true;
66352
+ this._needUpdate();
66124
66353
  }
66125
66354
 
66126
66355
  /**
@@ -66141,6 +66370,8 @@ class AngleMeasurement extends Component {
66141
66370
  value = value !== false;
66142
66371
  this._targetVisible = value;
66143
66372
  this._targetDot.setVisible(this._visible && this._targetVisible);
66373
+ this._cpDirty = true;
66374
+ this._needUpdate();
66144
66375
  }
66145
66376
 
66146
66377
  /**
@@ -66161,6 +66392,8 @@ class AngleMeasurement extends Component {
66161
66392
  value = value !== false;
66162
66393
  this._originWireVisible = value;
66163
66394
  this._originWire.setVisible(this._visible && this._originWireVisible);
66395
+ this._cpDirty = true;
66396
+ this._needUpdate();
66164
66397
  }
66165
66398
 
66166
66399
  /**
@@ -66181,6 +66414,8 @@ class AngleMeasurement extends Component {
66181
66414
  value = value !== false;
66182
66415
  this._targetWireVisible = value;
66183
66416
  this._targetWire.setVisible(this._visible && this._targetWireVisible);
66417
+ this._cpDirty = true;
66418
+ this._needUpdate();
66184
66419
  }
66185
66420
 
66186
66421
  /**
@@ -66201,6 +66436,8 @@ class AngleMeasurement extends Component {
66201
66436
  value = value !== false;
66202
66437
  this._angleVisible = value;
66203
66438
  this._angleLabel.setVisible(this._visible && this._angleVisible);
66439
+ this._cpDirty = true;
66440
+ this._needUpdate();
66204
66441
  }
66205
66442
 
66206
66443
  /**
@@ -66212,6 +66449,67 @@ class AngleMeasurement extends Component {
66212
66449
  return this._angleVisible;
66213
66450
  }
66214
66451
 
66452
+ /**
66453
+ * Sets if the labels are visible.
66454
+ *
66455
+ * @type {Boolean}
66456
+ */
66457
+ set labelsVisible(value) {
66458
+ value = value !== undefined ? Boolean(value) : this.plugin.defaultLabelsVisible;
66459
+ this._labelsVisible = value;
66460
+ var labelsVisible = this._visible && this._labelsVisible;
66461
+ this._angleLabel.setVisible(labelsVisible);
66462
+ this._cpDirty = true;
66463
+ this._needUpdate();
66464
+ }
66465
+
66466
+ /**
66467
+ * Gets if the labels are visible.
66468
+ *
66469
+ * @type {Boolean}
66470
+ */
66471
+ get labelsVisible() {
66472
+ return this._labelsVisible;
66473
+ }
66474
+
66475
+ /**
66476
+ * Sets if this DistanceMeasurement appears highlighted.
66477
+ * @param highlighted
66478
+ */
66479
+ setHighlighted(highlighted) {
66480
+ this._originDot.setHighlighted(highlighted);
66481
+ this._cornerDot.setHighlighted(highlighted);
66482
+ this._targetDot.setHighlighted(highlighted);
66483
+ this._originWire.setHighlighted(highlighted);
66484
+ this._targetWire.setHighlighted(highlighted);
66485
+ this._angleLabel.setHighlighted(highlighted);
66486
+ }
66487
+
66488
+ /**
66489
+ * Sets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events.
66490
+ *
66491
+ * @type {Boolean}
66492
+ */
66493
+ set clickable(value) {
66494
+ value = !!value;
66495
+ this._clickable = value;
66496
+ this._originDot.setClickable(this._clickable);
66497
+ this._cornerDot.setClickable(this._clickable);
66498
+ this._targetDot.setClickable(this._clickable);
66499
+ this._originWire.setClickable(this._clickable);
66500
+ this._targetWire.setClickable(this._clickable);
66501
+ this._angleLabel.setClickable(this._clickable);
66502
+ }
66503
+
66504
+ /**
66505
+ * Gets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events.
66506
+ *
66507
+ * @type {Boolean}
66508
+ */
66509
+ get clickable() {
66510
+ return this._clickable;
66511
+ }
66512
+
66215
66513
  /**
66216
66514
  * @private
66217
66515
  */
@@ -66538,6 +66836,7 @@ class AngleMeasurementsControl extends Component {
66538
66836
  this._currentAngleMeasurement.targetWireVisible = false;
66539
66837
  this._currentAngleMeasurement.targetVisible = false;
66540
66838
  this._currentAngleMeasurement.angleVisible = false;
66839
+ this._currentAngleMeasurement.clickable = false;
66541
66840
  this._state = FINDING_CORNER;
66542
66841
  this.fire("measurementStart", this._currentAngleMeasurement);
66543
66842
  break;
@@ -66553,6 +66852,7 @@ class AngleMeasurementsControl extends Component {
66553
66852
  // this._currentAngleMeasurement.approximate = false;
66554
66853
  this._currentAngleMeasurement.targetVisible = true;
66555
66854
  this._currentAngleMeasurement.angleVisible = true;
66855
+ this._currentAngleMeasurement.clickable = true;
66556
66856
  this.fire("measurementEnd", this._currentAngleMeasurement);
66557
66857
  this._currentAngleMeasurement = null;
66558
66858
  this._state = FINDING_ORIGIN;
@@ -66778,6 +67078,85 @@ const getCanvasPosFromEvent$5 = function (event, canvasPos) {
66778
67078
  *
66779
67079
  * angleMeasurements.control.activate(); // <------------ Activate the AngleMeasurementsControl
66780
67080
  * ````
67081
+ *
67082
+ * ## Example 4: Attaching Mouse Handlers
67083
+ *
67084
+ * In our fourth example, we'll attach even handlers to our plugin, to catch when the user
67085
+ * hovers or right-clicks over our measurements.
67086
+ *
67087
+ * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/#measurements_angle_modelWithMeasurements)]
67088
+ *
67089
+ * ````javascript
67090
+ * import {Viewer, XKTLoaderPlugin, AngleMeasurementsPlugin} from "xeokit-sdk.es.js";
67091
+ *
67092
+ * const viewer = new Viewer({
67093
+ * canvasId: "myCanvas",
67094
+ * transparent: true
67095
+ * });
67096
+ *
67097
+ * viewer.scene.camera.eye = [-2.37, 18.97, -26.12];
67098
+ * viewer.scene.camera.look = [10.97, 5.82, -11.22];
67099
+ * viewer.scene.camera.up = [0.36, 0.83, 0.40];
67100
+ *
67101
+ * const xktLoader = new XKTLoaderPlugin(viewer);
67102
+ *
67103
+ * const angleMeasurements = new AngleMeasurementsPlugin(viewer);
67104
+ *
67105
+ * angleMeasurements.on("mouseOver", (e) => {
67106
+ * e.measurement.setHighlighted(true);
67107
+ * });
67108
+ *
67109
+ * angleMeasurements.on("mouseLeave", (e) => {
67110
+ * e.measurement.setHighlighted(false);
67111
+ * });
67112
+ *
67113
+ * angleMeasurements.on("contextMenu", (e) => {
67114
+ * // Show context menu
67115
+ * e.event.preventDefault();
67116
+ * });
67117
+ *
67118
+ * const model = xktLoader.load({
67119
+ * src: "./models/xkt/duplex/duplex.xkt"
67120
+ * });
67121
+ *
67122
+ * model.on("loaded", () => {
67123
+ *
67124
+ * angleMeasurementsPlugin.createMeasurement({
67125
+ * id: "angleMeasurement1",
67126
+ * origin: {
67127
+ * entity: viewer.scene.objects["1CZILmCaHETO8tf3SgGEXu"],
67128
+ * worldPos: [0.4158603637281142, 2.5193106917110457, 17.79972838299403]
67129
+ * },
67130
+ * corner: {
67131
+ * entity: viewer.scene.objects["1CZILmCaHETO8tf3SgGEXu"],
67132
+ * worldPos: [0.41857741956197625,0.0987169929481646,17.799763071093395]
67133
+ * },
67134
+ * target: {
67135
+ * entity: viewer.scene.objects["1CZILmCaHETO8tf3SgGEXu"],
67136
+ * worldPos: [5.235526066859247, 0.11580773869801986, 17.824891550941565]
67137
+ * },
67138
+ * visible: true
67139
+ * });
67140
+ *
67141
+ * angleMeasurementsPlugin.createMeasurement({
67142
+ * id: "angleMeasurement2",
67143
+ * origin: {
67144
+ * entity: viewer.scene.objects["2O2Fr$t4X7Zf8NOew3FNr2"],
67145
+ * worldPos: [-0.00003814187850181838, 5.9996748076205115,17.79996871551525]
67146
+ * },
67147
+ * corner: {
67148
+ * entity: viewer.scene.objects["2O2Fr$t4X7Zf8NOew3FNqI"],
67149
+ * worldPos: [-0.0005214119318139865, 3.1010044228517595, 17.787656604483363]
67150
+ *
67151
+ * },
67152
+ * target: {
67153
+ * entity: viewer.scene.objects["1s1jVhK8z0pgKYcr9jt7AB"],
67154
+ * worldPos: [ 8.380657312957396, 3.1055697628459553, 17.799220108187185]
67155
+ * },
67156
+ * visible: true
67157
+ * });
67158
+ * });
67159
+ * ````
66781
67160
  */
66782
67161
  class AngleMeasurementsPlugin extends Plugin {
66783
67162
 
@@ -66788,6 +67167,7 @@ class AngleMeasurementsPlugin extends Plugin {
66788
67167
  * @param {String} [cfg.id="AngleMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
66789
67168
  * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````.
66790
67169
  * @param {string} [cfg.defaultColor=null] The default color of the dots, wire and label.
67170
+ * @param {boolean} [cfg.defaultLabelsVisible=true] The default value of {@link AngleMeasurement.labelsVisible}.
66791
67171
  * @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
66792
67172
  */
66793
67173
  constructor(viewer, cfg = {}) {
@@ -66800,8 +67180,33 @@ class AngleMeasurementsPlugin extends Plugin {
66800
67180
 
66801
67181
  this._measurements = {};
66802
67182
 
66803
- this.defaultColor = cfg.defaultColor;
67183
+ this.defaultColor = cfg.defaultColor !== undefined ? cfg.defaultColor : "#00BBFF";
67184
+ this.defaultLabelsVisible = cfg.defaultLabelsVisible !== false;
66804
67185
  this.zIndex = cfg.zIndex || 10000;
67186
+
67187
+ this._onMouseOver = (event, measurement) => {
67188
+ this.fire("mouseOver", {
67189
+ plugin: this,
67190
+ measurement,
67191
+ event
67192
+ });
67193
+ };
67194
+
67195
+ this._onMouseLeave = (event, measurement) => {
67196
+ this.fire("mouseLeave", {
67197
+ plugin: this,
67198
+ measurement,
67199
+ event
67200
+ });
67201
+ };
67202
+
67203
+ this._onContextMenu = (event, measurement) => {
67204
+ this.fire("contextMenu", {
67205
+ plugin: this,
67206
+ measurement,
67207
+ event
67208
+ });
67209
+ };
66805
67210
  }
66806
67211
 
66807
67212
  /**
@@ -66876,6 +67281,9 @@ class AngleMeasurementsPlugin extends Plugin {
66876
67281
  cornerVisible: true,
66877
67282
  targetWireVisible: true,
66878
67283
  targetVisible: true,
67284
+ onMouseOver: this._onMouseOver,
67285
+ onMouseLeave: this._onMouseLeave,
67286
+ onContextMenu: this._onContextMenu
66879
67287
  });
66880
67288
  this._measurements[measurement.id] = measurement;
66881
67289
  measurement.on("destroyed", () => {
@@ -66900,6 +67308,17 @@ class AngleMeasurementsPlugin extends Plugin {
66900
67308
  this.fire("measurementDestroyed", measurement);
66901
67309
  }
66902
67310
 
67311
+ /**
67312
+ * Shows all or hides the angle label of each {@link AngleMeasurement}.
67313
+ *
67314
+ * @param {Boolean} labelsShown Whether or not to show the labels.
67315
+ */
67316
+ setLabelsShown(labelsShown) {
67317
+ for (const [key, measurement] of Object.entries(this.measurements)) {
67318
+ measurement.labelShown = labelsShown;
67319
+ }
67320
+ }
67321
+
66903
67322
  /**
66904
67323
  * Destroys all {@link AngleMeasurement}s.
66905
67324
  */
@@ -74476,7 +74895,7 @@ class CustomProjection extends Component {
74476
74895
  this._inverseMatrixDirty = true;
74477
74896
  this._transposedMatrixDirty = true;
74478
74897
  this.glRedraw();
74479
- this.fire("far", this._state.matrix);
74898
+ this.fire("matrix", this._state.matrix);
74480
74899
  }
74481
74900
 
74482
74901
  /**
@@ -80599,7 +81018,7 @@ class DistanceMeasurement extends Component {
80599
81018
  this._wp = new Float64Array(24);
80600
81019
  this._vp = new Float64Array(24);
80601
81020
  this._pp = new Float64Array(24);
80602
- this._cp = new Int16Array(8);
81021
+ this._cp = new Float64Array(8);
80603
81022
 
80604
81023
  this._xAxisLabelCulled = false;
80605
81024
  this._yAxisLabelCulled = false;
@@ -80607,66 +81026,112 @@ class DistanceMeasurement extends Component {
80607
81026
 
80608
81027
  this._color = cfg.color || this.plugin.defaultColor;
80609
81028
 
81029
+ const onMouseOver = cfg.onMouseOver ? (event) => {
81030
+ cfg.onMouseOver(event, this);
81031
+ } : null;
81032
+
81033
+ const onMouseLeave = cfg.onMouseLeave ? (event) => {
81034
+ cfg.onMouseLeave(event, this);
81035
+ } : null;
81036
+
81037
+ const onContextMenu = cfg.onContextMenu ? (event) => {
81038
+ cfg.onContextMenu(event, this);
81039
+ } : null;
81040
+
80610
81041
  this._originDot = new Dot(this._container, {
80611
81042
  fillColor: this._color,
80612
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined
81043
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2 : undefined,
81044
+ onMouseOver,
81045
+ onMouseLeave,
81046
+ onContextMenu
80613
81047
  });
80614
81048
 
80615
81049
  this._targetDot = new Dot(this._container, {
80616
81050
  fillColor: this._color,
80617
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined
81051
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2 : undefined,
81052
+ onMouseOver,
81053
+ onMouseLeave,
81054
+ onContextMenu
80618
81055
  });
80619
81056
 
80620
81057
  this._lengthWire = new Wire(this._container, {
80621
81058
  color: this._color,
80622
81059
  thickness: 2,
80623
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1: undefined
81060
+ thicknessClickable: 6,
81061
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1 : undefined,
81062
+ onMouseOver,
81063
+ onMouseLeave,
81064
+ onContextMenu
80624
81065
  });
80625
81066
 
80626
81067
  this._xAxisWire = new Wire(this._container, {
80627
- color: "red",
81068
+ color: "#FF0000",
80628
81069
  thickness: 1,
80629
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1: undefined
81070
+ thicknessClickable: 6,
81071
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1 : undefined,
81072
+ onMouseOver,
81073
+ onMouseLeave,
81074
+ onContextMenu
80630
81075
  });
80631
81076
 
80632
81077
  this._yAxisWire = new Wire(this._container, {
80633
81078
  color: "green",
80634
81079
  thickness: 1,
80635
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1: undefined
81080
+ thicknessClickable: 6,
81081
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1 : undefined,
81082
+ onMouseOver,
81083
+ onMouseLeave,
81084
+ onContextMenu
80636
81085
  });
80637
81086
 
80638
81087
  this._zAxisWire = new Wire(this._container, {
80639
81088
  color: "blue",
80640
81089
  thickness: 1,
80641
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1: undefined
81090
+ thicknessClickable: 6,
81091
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1 : undefined,
81092
+ onMouseOver,
81093
+ onMouseLeave,
81094
+ onContextMenu
80642
81095
  });
80643
81096
 
80644
81097
  this._lengthLabel = new Label(this._container, {
80645
81098
  fillColor: this._color,
80646
81099
  prefix: "",
80647
81100
  text: "",
80648
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 4: undefined
81101
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 4 : undefined,
81102
+ onMouseOver,
81103
+ onMouseLeave,
81104
+ onContextMenu
80649
81105
  });
80650
81106
 
80651
81107
  this._xAxisLabel = new Label(this._container, {
80652
81108
  fillColor: "red",
80653
81109
  prefix: "X",
80654
81110
  text: "",
80655
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3: undefined
81111
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3 : undefined,
81112
+ onMouseOver,
81113
+ onMouseLeave,
81114
+ onContextMenu
80656
81115
  });
80657
81116
 
80658
81117
  this._yAxisLabel = new Label(this._container, {
80659
81118
  fillColor: "green",
80660
81119
  prefix: "Y",
80661
81120
  text: "",
80662
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3: undefined
81121
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3 : undefined,
81122
+ onMouseOver,
81123
+ onMouseLeave,
81124
+ onContextMenu
80663
81125
  });
80664
81126
 
80665
81127
  this._zAxisLabel = new Label(this._container, {
80666
81128
  fillColor: "blue",
80667
81129
  prefix: "Z",
80668
81130
  text: "",
80669
- zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3: undefined
81131
+ zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3 : undefined,
81132
+ onMouseOver,
81133
+ onMouseLeave,
81134
+ onContextMenu
80670
81135
  });
80671
81136
 
80672
81137
  this._wpDirty = false;
@@ -80679,6 +81144,8 @@ class DistanceMeasurement extends Component {
80679
81144
  this._wireVisible = false;
80680
81145
  this._axisVisible = false;
80681
81146
  this._axisEnabled = true;
81147
+ this._labelsVisible = false;
81148
+ this._clickable = true;
80682
81149
 
80683
81150
  this._originMarker.on("worldPos", (value) => {
80684
81151
  this._originWorld.set(value || [0, 0, 0]);
@@ -80728,6 +81195,7 @@ class DistanceMeasurement extends Component {
80728
81195
  this.targetVisible = cfg.targetVisible;
80729
81196
  this.wireVisible = cfg.wireVisible;
80730
81197
  this.axisVisible = cfg.axisVisible;
81198
+ this.labelsVisible = cfg.labelsVisible;
80731
81199
  }
80732
81200
 
80733
81201
  _update() {
@@ -80837,45 +81305,57 @@ class DistanceMeasurement extends Component {
80837
81305
  this._yAxisWire.setStartAndEnd(cp[2], cp[3], cp[4], cp[5]);
80838
81306
  this._zAxisWire.setStartAndEnd(cp[4], cp[5], cp[6], cp[7]);
80839
81307
 
80840
- this._lengthLabel.setPosOnWire(cp[0], cp[1], cp[6], cp[7]);
80841
- this._xAxisLabel.setPosOnWire(cp[0], cp[1], cp[2], cp[3]);
80842
- this._yAxisLabel.setPosOnWire(cp[2], cp[3], cp[4], cp[5]);
80843
- this._zAxisLabel.setPosOnWire(cp[4], cp[5], cp[6], cp[7]);
81308
+ if (!this.labelsVisible) {
80844
81309
 
80845
- const tilde = this._approximate ? " ~ " : " = ";
81310
+ this._lengthLabel.setCulled(true);
80846
81311
 
80847
- this._length = Math.abs(math.lenVec3(math.subVec3(this._targetWorld, this._originWorld, distVec3)));
80848
- this._lengthLabel.setText(tilde + (this._length * scale).toFixed(2) + unitAbbrev);
81312
+ this._xAxisLabel.setCulled(true);
81313
+ this._yAxisLabel.setCulled(true);
81314
+ this._zAxisLabel.setCulled(true);
80849
81315
 
80850
- const xAxisCanvasLength = Math.abs(lengthWire(cp[0], cp[1], cp[2], cp[3]));
80851
- const yAxisCanvasLength = Math.abs(lengthWire(cp[2], cp[3], cp[4], cp[5]));
80852
- const zAxisCanvasLength = Math.abs(lengthWire(cp[4], cp[5], cp[6], cp[7]));
81316
+ } else {
80853
81317
 
80854
- const labelMinAxisLength = this.plugin.labelMinAxisLength;
81318
+ this._lengthLabel.setPosOnWire(cp[0], cp[1], cp[6], cp[7]);
80855
81319
 
80856
- this._xAxisLabelCulled = (xAxisCanvasLength < labelMinAxisLength);
80857
- this._yAxisLabelCulled = (yAxisCanvasLength < labelMinAxisLength);
80858
- this._zAxisLabelCulled = (zAxisCanvasLength < labelMinAxisLength);
81320
+ this._xAxisLabel.setPosOnWire(cp[0], cp[1], cp[2], cp[3]);
81321
+ this._yAxisLabel.setPosOnWire(cp[2], cp[3], cp[4], cp[5]);
81322
+ this._zAxisLabel.setPosOnWire(cp[4], cp[5], cp[6], cp[7]);
80859
81323
 
80860
- if (!this._xAxisLabelCulled) {
80861
- this._xAxisLabel.setText(tilde + Math.abs((this._targetWorld[0] - this._originWorld[0]) * scale).toFixed(2) + unitAbbrev);
80862
- this._xAxisLabel.setVisible(this.axisVisible);
80863
- } else {
80864
- this._xAxisLabel.setVisible(false);
80865
- }
81324
+ const tilde = this._approximate ? " ~ " : " = ";
80866
81325
 
80867
- if (!this._yAxisLabelCulled) {
80868
- this._yAxisLabel.setText(tilde + Math.abs((this._targetWorld[1] - this._originWorld[1]) * scale).toFixed(2) + unitAbbrev);
80869
- this._yAxisLabel.setVisible(this.axisVisible);
80870
- } else {
80871
- this._yAxisLabel.setVisible(false);
80872
- }
81326
+ this._length = Math.abs(math.lenVec3(math.subVec3(this._targetWorld, this._originWorld, distVec3)));
81327
+ this._lengthLabel.setText(tilde + (this._length * scale).toFixed(2) + unitAbbrev);
80873
81328
 
80874
- if (!this._zAxisLabelCulled) {
80875
- this._zAxisLabel.setText(tilde + Math.abs((this._targetWorld[2] - this._originWorld[2]) * scale).toFixed(2) + unitAbbrev);
80876
- this._zAxisLabel.setVisible(this.axisVisible);
80877
- } else {
80878
- this._zAxisLabel.setVisible(false);
81329
+ const xAxisCanvasLength = Math.abs(lengthWire(cp[0], cp[1], cp[2], cp[3]));
81330
+ const yAxisCanvasLength = Math.abs(lengthWire(cp[2], cp[3], cp[4], cp[5]));
81331
+ const zAxisCanvasLength = Math.abs(lengthWire(cp[4], cp[5], cp[6], cp[7]));
81332
+
81333
+ const labelMinAxisLength = this.plugin.labelMinAxisLength;
81334
+
81335
+ this._xAxisLabelCulled = (xAxisCanvasLength < labelMinAxisLength);
81336
+ this._yAxisLabelCulled = (yAxisCanvasLength < labelMinAxisLength);
81337
+ this._zAxisLabelCulled = (zAxisCanvasLength < labelMinAxisLength);
81338
+
81339
+ if (!this._xAxisLabelCulled) {
81340
+ this._xAxisLabel.setText(tilde + Math.abs((this._targetWorld[0] - this._originWorld[0]) * scale).toFixed(2) + unitAbbrev);
81341
+ this._xAxisLabel.setCulled(!this.axisVisible);
81342
+ } else {
81343
+ this._xAxisLabel.setCulled(true);
81344
+ }
81345
+
81346
+ if (!this._yAxisLabelCulled) {
81347
+ this._yAxisLabel.setText(tilde + Math.abs((this._targetWorld[1] - this._originWorld[1]) * scale).toFixed(2) + unitAbbrev);
81348
+ this._yAxisLabel.setCulled(!this.axisVisible);
81349
+ } else {
81350
+ this._yAxisLabel.setCulled(true);
81351
+ }
81352
+
81353
+ if (!this._zAxisLabelCulled) {
81354
+ this._zAxisLabel.setText(tilde + Math.abs((this._targetWorld[2] - this._originWorld[2]) * scale).toFixed(2) + unitAbbrev);
81355
+ this._zAxisLabel.setCulled(!this.axisVisible);
81356
+ } else {
81357
+ this._zAxisLabel.setCulled(true);
81358
+ }
80879
81359
  }
80880
81360
 
80881
81361
  this._originDot.setVisible(this._visible && this._originVisible);
@@ -80884,7 +81364,7 @@ class DistanceMeasurement extends Component {
80884
81364
  this._yAxisWire.setVisible(this.axisVisible);
80885
81365
  this._zAxisWire.setVisible(this.axisVisible);
80886
81366
  this._lengthWire.setVisible(this.wireVisible);
80887
- this._lengthLabel.setVisible(this.wireVisible);
81367
+ this._lengthLabel.setCulled(!this.wireVisible);
80888
81368
 
80889
81369
  this._cpDirty = false;
80890
81370
  }
@@ -80917,7 +81397,7 @@ class DistanceMeasurement extends Component {
80917
81397
  get approximate() {
80918
81398
  return this._approximate;
80919
81399
  }
80920
-
81400
+
80921
81401
  /**
80922
81402
  * Gets the origin {@link Marker}.
80923
81403
  *
@@ -80978,6 +81458,8 @@ class DistanceMeasurement extends Component {
80978
81458
  this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled);
80979
81459
  this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled);
80980
81460
  this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled);
81461
+ this._cpDirty = true;
81462
+ this._needUpdate();
80981
81463
  }
80982
81464
 
80983
81465
  /**
@@ -81030,7 +81512,9 @@ class DistanceMeasurement extends Component {
81030
81512
  }
81031
81513
 
81032
81514
  /**
81033
- * Sets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.
81515
+ * Sets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are enabled.
81516
+ *
81517
+ * Wires are only shown if enabled and visible.
81034
81518
  *
81035
81519
  * @type {Boolean}
81036
81520
  */
@@ -81044,20 +81528,26 @@ class DistanceMeasurement extends Component {
81044
81528
  this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled);
81045
81529
  this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled);
81046
81530
  this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled);
81531
+ this._cpDirty = true;
81532
+ this._needUpdate();
81047
81533
  }
81048
81534
 
81049
81535
  /**
81050
- * Gets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.
81536
+ * Gets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are enabled.
81537
+ *
81538
+ * Wires are only shown if enabled and visible.
81051
81539
  *
81052
81540
  * @type {Boolean}
81053
81541
  */
81054
81542
  get axisEnabled() {
81055
81543
  return this._axisEnabled;
81056
81544
  }
81057
-
81545
+
81058
81546
  /**
81059
81547
  * Sets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.
81060
81548
  *
81549
+ * Wires are only shown if enabled and visible.
81550
+ *
81061
81551
  * @type {Boolean}
81062
81552
  */
81063
81553
  set axisVisible(value) {
@@ -81070,11 +81560,15 @@ class DistanceMeasurement extends Component {
81070
81560
  this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled);
81071
81561
  this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled);
81072
81562
  this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled);
81563
+ this._cpDirty = true;
81564
+ this._needUpdate();
81073
81565
  }
81074
81566
 
81075
81567
  /**
81076
81568
  * Gets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.
81077
81569
  *
81570
+ * Wires are only shown if enabled and visible.
81571
+ *
81078
81572
  * @type {Boolean}
81079
81573
  */
81080
81574
  get axisVisible() {
@@ -81103,6 +81597,78 @@ class DistanceMeasurement extends Component {
81103
81597
  return this._wireVisible;
81104
81598
  }
81105
81599
 
81600
+ /**
81601
+ * Sets if the labels are visible.
81602
+ *
81603
+ * @type {Boolean}
81604
+ */
81605
+ set labelsVisible(value) {
81606
+ value = value !== undefined ? Boolean(value) : this.plugin.defaultLabelsVisible;
81607
+ this._labelsVisible = value;
81608
+ var labelsVisible = this._visible && this._labelsVisible;
81609
+ this._xAxisLabel.setVisible(labelsVisible && !this._xAxisLabelCulled && this._clickable && this._axisEnabled);
81610
+ this._yAxisLabel.setVisible(labelsVisible && !this._yAxisLabelCulled && this._clickable && this._axisEnabled);
81611
+ this._zAxisLabel.setVisible(labelsVisible && !this._zAxisLabelCulled && this._clickable && this._axisEnabled);
81612
+ this._lengthLabel.setVisible(labelsVisible);
81613
+ this._cpDirty = true;
81614
+ this._needUpdate();
81615
+ }
81616
+
81617
+ /**
81618
+ * Gets if the labels are visible.
81619
+ *
81620
+ * @type {Boolean}
81621
+ */
81622
+ get labelsVisible() {
81623
+ return this._labelsVisible;
81624
+ }
81625
+
81626
+ /**
81627
+ * Sets if this DistanceMeasurement appears highlighted.
81628
+ * @param highlighted
81629
+ */
81630
+ setHighlighted(highlighted) {
81631
+ this._originDot.setHighlighted(highlighted);
81632
+ this._targetDot.setHighlighted(highlighted);
81633
+ this._xAxisWire.setHighlighted(highlighted);
81634
+ this._yAxisWire.setHighlighted(highlighted);
81635
+ this._zAxisWire.setHighlighted(highlighted);
81636
+ this._xAxisLabel.setHighlighted(highlighted);
81637
+ this._yAxisLabel.setHighlighted(highlighted);
81638
+ this._zAxisLabel.setHighlighted(highlighted);
81639
+ this._lengthWire.setHighlighted(highlighted);
81640
+ this._lengthLabel.setHighlighted(highlighted);
81641
+ }
81642
+
81643
+ /**
81644
+ * Sets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events.
81645
+ *
81646
+ * @type {Boolean}
81647
+ */
81648
+ set clickable(value) {
81649
+ value = !!value;
81650
+ this._clickable = value;
81651
+ this._originDot.setClickable(this._clickable);
81652
+ this._targetDot.setClickable(this._clickable);
81653
+ this._xAxisWire.setClickable(this._clickable);
81654
+ this._yAxisWire.setClickable(this._clickable);
81655
+ this._zAxisWire.setClickable(this._clickable);
81656
+ this._lengthWire.setClickable(this._clickable);
81657
+ this._xAxisLabel.setClickable(this._clickable);
81658
+ this._yAxisLabel.setClickable(this._clickable);
81659
+ this._zAxisLabel.setClickable(this._clickable);
81660
+ this._lengthLabel.setClickable(this._clickable);
81661
+ }
81662
+
81663
+ /**
81664
+ * Gets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events.
81665
+ *
81666
+ * @type {Boolean}
81667
+ */
81668
+ get clickable() {
81669
+ return this._clickable;
81670
+ }
81671
+
81106
81672
  /**
81107
81673
  * @private
81108
81674
  */
@@ -87155,7 +87721,7 @@ class DistanceMeasurementsControl extends Component {
87155
87721
  }
87156
87722
  this._currentDistanceMeasurementByMouse.approximate = false;
87157
87723
  }
87158
-
87724
+ this._currentDistanceMeasurementByMouse.clickable = true;
87159
87725
  this.fire("measurementEnd", this._currentDistanceMeasurementByMouse);
87160
87726
  this._currentDistanceMeasurementByMouse = null;
87161
87727
  } else {
@@ -87190,6 +87756,7 @@ class DistanceMeasurementsControl extends Component {
87190
87756
  this._currentDistanceMeasurementByMouseInittouchState.axisVisible = this._currentDistanceMeasurementByMouse.axisVisible && this.plugin.defaultAxisVisible;
87191
87757
  this._currentDistanceMeasurementByMouseInittouchState.wireVisible = this._currentDistanceMeasurementByMouse.wireVisible;
87192
87758
  this._currentDistanceMeasurementByMouseInittouchState.targetVisible = this._currentDistanceMeasurementByMouse.targetVisible;
87759
+ this._currentDistanceMeasurementByMouse.clickable = false;
87193
87760
  this.fire("measurementStart", this._currentDistanceMeasurementByMouse);
87194
87761
  }
87195
87762
  }
@@ -87249,7 +87816,7 @@ class DistanceMeasurementsControl extends Component {
87249
87816
  case SECOND_TOUCH_EXPECTED:
87250
87817
  startDot.setVisible(false);
87251
87818
  this._touchStartMarker.worldPos = pickResult.worldPos;
87252
- plugin.createMeasurement({
87819
+ const measurement = plugin.createMeasurement({
87253
87820
  id: math.createUUID(),
87254
87821
  origin: {
87255
87822
  entity: mouseHoverEntity,
@@ -87261,6 +87828,7 @@ class DistanceMeasurementsControl extends Component {
87261
87828
  },
87262
87829
  approximate: (!pickSurfacePrecisionEnabled)
87263
87830
  });
87831
+ measurement.clickable = true;
87264
87832
  touchState = FIRST_TOUCH_EXPECTED;
87265
87833
  break;
87266
87834
  }
@@ -87362,7 +87930,7 @@ const getCanvasPosFromEvent = function (event, canvasPos) {
87362
87930
  *
87363
87931
  * * [[Example 1: Model with distance measurements](https://xeokit.github.io/xeokit-sdk/examples/#measurements_distance_modelWithMeasurements)]
87364
87932
  * * [[Example 2: Create distance measurements with mouse](https://xeokit.github.io/xeokit-sdk/examples/#measurements_distance_createWithMouse)]
87365
- * * [[Example 3: Configuring units and scale](https://xeokit.github.io/xeokit-sdk/examples/#measurements_distance_unitsAndScale)]
87933
+ * * [[Example 3: Configuring units and scale](https://xeokit.github.io/xeokit-sdk/examples/#measurements_distance_unitsAndScale)
87366
87934
  *
87367
87935
  * ## Overview
87368
87936
  *
@@ -87485,6 +88053,78 @@ const getCanvasPosFromEvent = function (event, canvasPos) {
87485
88053
  * metrics.units = "meters";
87486
88054
  * metrics.scale = 10.0;
87487
88055
  * ````
88056
+ *
88057
+ * ## Example 4: Attaching Mouse Handlers
88058
+ *
88059
+ * In our fourth example, we'll attach even handlers to our plugin, to catch when the user
88060
+ * hovers or right-clicks over our measurements.
88061
+ *
88062
+ * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/#measurements_distance_modelWithMeasurements)]
88063
+ *
88064
+ * ````javascript
88065
+ * import {Viewer, XKTLoaderPlugin, DistanceMeasurementsPlugin} from "xeokit-sdk.es.js";
88066
+ *
88067
+ * const viewer = new Viewer({
88068
+ * canvasId: "myCanvas",
88069
+ * transparent: true
88070
+ * });
88071
+ *
88072
+ * viewer.scene.camera.eye = [-2.37, 18.97, -26.12];
88073
+ * viewer.scene.camera.look = [10.97, 5.82, -11.22];
88074
+ * viewer.scene.camera.up = [0.36, 0.83, 0.40];
88075
+ *
88076
+ * const xktLoader = new XKTLoaderPlugin(viewer);
88077
+ *
88078
+ * const distanceMeasurements = new DistanceMeasurementsPlugin(viewer);
88079
+ *
88080
+ * distanceMeasurements.on("mouseOver", (e) => {
88081
+ * e.measurement.setHighlighted(true);
88082
+ * });
88083
+ *
88084
+ * distanceMeasurements.on("mouseLeave", (e) => {
88085
+ * e.measurement.setHighlighted(false);
88086
+ * });
88087
+ *
88088
+ * distanceMeasurements.on("contextMenu", (e) => {
88089
+ * // Show context menu
88090
+ * e.event.preventDefault();
88091
+ * });
88092
+ *
88093
+ * const model = xktLoader.load({
88094
+ * src: "./models/xkt/duplex/duplex.xkt"
88095
+ * });
88096
+ *
88097
+ * model.on("loaded", () => {
88098
+ *
88099
+ * const myMeasurement1 = distanceMeasurements.createMeasurement({
88100
+ * id: "distanceMeasurement1",
88101
+ * origin: {
88102
+ * entity: viewer.scene.objects["2O2Fr$t4X7Zf8NOew3FLOH"],
88103
+ * worldPos: [0.044, 5.998, 17.767]
88104
+ * },
88105
+ * target: {
88106
+ * entity: viewer.scene.objects["2O2Fr$t4X7Zf8NOew3FLOH"],
88107
+ * worldPos: [4.738, 3.172, 17.768]
88108
+ * },
88109
+ * visible: true,
88110
+ * wireVisible: true
88111
+ * });
88112
+ *
88113
+ * const myMeasurement2 = distanceMeasurements.createMeasurement({
88114
+ * id: "distanceMeasurement2",
88115
+ * origin: {
88116
+ * entity: viewer.scene.objects["2O2Fr$t4X7Zf8NOew3FNr2"],
88117
+ * worldPos: [0.457, 2.532, 17.766]
88118
+ * },
88119
+ * target: {
88120
+ * entity: viewer.scene.objects["1CZILmCaHETO8tf3SgGEXu"],
88121
+ * worldPos: [0.436, 0.001, 22.135]
88122
+ * },
88123
+ * visible: true,
88124
+ * wireVisible: true
88125
+ * });
88126
+ * });
88127
+ * ````
87488
88128
  */
87489
88129
  class DistanceMeasurementsPlugin extends Plugin {
87490
88130
 
@@ -87499,10 +88139,11 @@ class DistanceMeasurementsPlugin extends Plugin {
87499
88139
  * @param {boolean} [cfg.defaultOriginVisible=true] The default value of the DistanceMeasurements `originVisible` property.
87500
88140
  * @param {boolean} [cfg.defaultTargetVisible=true] The default value of the DistanceMeasurements `targetVisible` property.
87501
88141
  * @param {boolean} [cfg.defaultWireVisible=true] The default value of the DistanceMeasurements `wireVisible` property.
88142
+ * @param {boolean} [cfg.defaultLabelsVisible=true] The default value of the DistanceMeasurements `labelsVisible` property.
87502
88143
  * @param {boolean} [cfg.defaultAxisVisible=true] The default value of the DistanceMeasurements `axisVisible` property.
87503
- * @param {boolean} [cfg.defaultAxisEnabled=true] The default value of the DistanceMeasurements `axisVisible` property.
87504
88144
  * @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
87505
88145
  * @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
88146
+ *
87506
88147
  */
87507
88148
  constructor(viewer, cfg = {}) {
87508
88149
 
@@ -87520,9 +88161,34 @@ class DistanceMeasurementsPlugin extends Plugin {
87520
88161
  this.defaultOriginVisible = cfg.defaultOriginVisible !== false;
87521
88162
  this.defaultTargetVisible = cfg.defaultTargetVisible !== false;
87522
88163
  this.defaultWireVisible = cfg.defaultWireVisible !== false;
88164
+ this.defaultLabelsVisible = cfg.defaultLabelsVisible !== false;
87523
88165
  this.defaultAxisVisible = cfg.defaultAxisVisible !== false;
87524
88166
  this.defaultColor = cfg.defaultColor !== undefined ? cfg.defaultColor : "#00BBFF";
87525
88167
  this.zIndex = cfg.zIndex || 10000;
88168
+
88169
+ this._onMouseOver = (event, measurement) => {
88170
+ this.fire("mouseOver", {
88171
+ plugin: this,
88172
+ measurement,
88173
+ event
88174
+ });
88175
+ };
88176
+
88177
+ this._onMouseLeave = (event, measurement) => {
88178
+ this.fire("mouseLeave", {
88179
+ plugin: this,
88180
+ measurement,
88181
+ event
88182
+ });
88183
+ };
88184
+
88185
+ this._onContextMenu = (event, measurement) => {
88186
+ this.fire("contextMenu", {
88187
+ plugin: this,
88188
+ measurement,
88189
+ event
88190
+ });
88191
+ };
87526
88192
  }
87527
88193
 
87528
88194
  /**
@@ -87593,6 +88259,7 @@ class DistanceMeasurementsPlugin extends Plugin {
87593
88259
  * @param {Boolean} [params.targetVisible=true] Whether to initially show the {@link DistanceMeasurement} target.
87594
88260
  * @param {Boolean} [params.wireVisible=true] Whether to initially show the direct point-to-point wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
87595
88261
  * @param {Boolean} [params.axisVisible=true] Whether to initially show the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
88262
+ * @param {Boolean} [params.labelsVisible=true] Whether to initially show the labels.
87596
88263
  * @param {string} [params.color] The color of the length dot, wire and label.
87597
88264
  * @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
87598
88265
  */
@@ -87618,9 +88285,13 @@ class DistanceMeasurementsPlugin extends Plugin {
87618
88285
  visible: params.visible,
87619
88286
  wireVisible: params.wireVisible,
87620
88287
  axisVisible: params.axisVisible !== false && this.defaultAxisVisible !== false,
88288
+ labelsVisible: params.labelsVisible !== false && this.defaultLabelsVisible !== false,
87621
88289
  originVisible: params.originVisible,
87622
88290
  targetVisible: params.targetVisible,
87623
- color: params.color
88291
+ color: params.color,
88292
+ onMouseOver: this._onMouseOver,
88293
+ onMouseLeave: this._onMouseLeave,
88294
+ onContextMenu: this._onContextMenu
87624
88295
  });
87625
88296
  this._measurements[measurement.id] = measurement;
87626
88297
  measurement.on("destroyed", () => {
@@ -87645,6 +88316,17 @@ class DistanceMeasurementsPlugin extends Plugin {
87645
88316
  this.fire("measurementDestroyed", measurement);
87646
88317
  }
87647
88318
 
88319
+ /**
88320
+ * Shows all or hides the angle label of each {@link DistanceMeasurement}.
88321
+ *
88322
+ * @param {Boolean} labelsShown Whether or not to show the labels.
88323
+ */
88324
+ setLabelsShown(labelsShown) {
88325
+ for (const [key, measurement] of Object.entries(this.measurements)) {
88326
+ measurement.labelShown = labelsShown;
88327
+ }
88328
+ }
88329
+
87648
88330
  /**
87649
88331
  * Destroys all {@link DistanceMeasurement}s.
87650
88332
  */
@@ -102791,6 +103473,7 @@ class ModelTreeView {
102791
103473
  numEntities: 0,
102792
103474
  numVisibleEntities: 0,
102793
103475
  checked: false,
103476
+ xrayed: false,
102794
103477
  children: []
102795
103478
  };
102796
103479
  this._rootNodes.push(buildingNode);
@@ -102809,6 +103492,7 @@ class ModelTreeView {
102809
103492
  numEntities: 0,
102810
103493
  numVisibleEntities: 0,
102811
103494
  checked: false,
103495
+ xrayed: false,
102812
103496
  children: []
102813
103497
  };
102814
103498
  buildingNode.children.push(storeyNode);
@@ -102833,6 +103517,7 @@ class ModelTreeView {
102833
103517
  numEntities: 0,
102834
103518
  numVisibleEntities: 0,
102835
103519
  checked: false,
103520
+ xrayed: false,
102836
103521
  children: []
102837
103522
  };
102838
103523
  storeyNode.children.push(typeNode);
@@ -102848,6 +103533,7 @@ class ModelTreeView {
102848
103533
  numEntities: 0,
102849
103534
  numVisibleEntities: 0,
102850
103535
  checked: false,
103536
+ xrayed: false,
102851
103537
  children: []
102852
103538
  };
102853
103539
  typeNode.children.push(node);
@@ -102881,6 +103567,7 @@ class ModelTreeView {
102881
103567
  numEntities: 0,
102882
103568
  numVisibleEntities: 0,
102883
103569
  checked: false,
103570
+ xrayed: false,
102884
103571
  children: []
102885
103572
  };
102886
103573
  this._rootNodes.push(rootNode);
@@ -102902,6 +103589,7 @@ class ModelTreeView {
102902
103589
  numEntities: 0,
102903
103590
  numVisibleEntities: 0,
102904
103591
  checked: false,
103592
+ xrayed: false,
102905
103593
  children: []
102906
103594
  };
102907
103595
  rootNode.children.push(typeNode);
@@ -102917,6 +103605,7 @@ class ModelTreeView {
102917
103605
  numEntities: 0,
102918
103606
  numVisibleEntities: 0,
102919
103607
  checked: false,
103608
+ xrayed: false,
102920
103609
  children: []
102921
103610
  };
102922
103611
  typeNode.children.push(node);
@@ -102949,6 +103638,7 @@ class ModelTreeView {
102949
103638
  numEntities: 0,
102950
103639
  numVisibleEntities: 0,
102951
103640
  checked: false,
103641
+ xrayed: false,
102952
103642
  children: []
102953
103643
  };
102954
103644
  if (parent) {
@@ -163211,16 +163901,17 @@ class WebIFCLoaderPlugin extends Plugin {
163211
163901
  ctx.stats.numPropertySets++;
163212
163902
  const relatedObjects = rel.RelatedObjects;
163213
163903
  if (!relatedObjects || relatedObjects.length === 0) {
163214
- for (let i = 0, len = relatedObjects.length; i < len; i++) {
163215
- const relatedObject = relatedObjects[i];
163216
- const metaObjectId = relatedObject.GlobalId.value;
163217
- const metaObject = ctx.metaObjects[metaObjectId];
163218
- if (metaObject) {
163219
- if (!metaObject.propertySetIds) {
163220
- metaObject.propertySetIds = [];
163221
- }
163222
- metaObject.propertySetIds.push(propertySetId);
163904
+ return;
163905
+ }
163906
+ for (let i = 0, len = relatedObjects.length; i < len; i++) {
163907
+ const relatedObject = relatedObjects[i];
163908
+ const metaObjectId = relatedObject.GlobalId.value;
163909
+ const metaObject = ctx.metaObjects[metaObjectId];
163910
+ if (metaObject) {
163911
+ if (!metaObject.propertySetIds) {
163912
+ metaObject.propertySetIds = [];
163223
163913
  }
163914
+ metaObject.propertySetIds.push(propertySetId);
163224
163915
  }
163225
163916
  }
163226
163917
  }
@@ -163663,9 +164354,11 @@ class LASLoaderPlugin extends Plugin {
163663
164354
  }
163664
164355
 
163665
164356
  const options = {
163666
- skip: this._skip,
163667
- fp64: this._fp64,
163668
- colorDepth: this._colorDepth
164357
+ las: {
164358
+ skip: this._skip,
164359
+ fp64: this._fp64,
164360
+ colorDepth: this._colorDepth
164361
+ }
163669
164362
  };
163670
164363
 
163671
164364
  if (params.src) {