@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.
- package/dist/xeokit-sdk.cjs.js +830 -137
- package/dist/xeokit-sdk.es.js +830 -137
- package/dist/xeokit-sdk.es5.js +678 -469
- package/dist/xeokit-sdk.min.cjs.js +2 -2
- package/dist/xeokit-sdk.min.es.js +2 -2
- package/dist/xeokit-sdk.min.es5.js +1 -1
- package/package.json +3 -3
- package/types/plugins/FastNavPlugin/FastNavPlugin.d.ts +1 -1
- package/types/viewer/scene/index.d.ts +1 -0
- package/types/viewer/scene/lights/AmbientLight.d.ts +19 -0
- package/types/viewer/scene/lights/DirLight.d.ts +25 -0
- package/types/viewer/scene/lights/Light.d.ts +4 -0
- package/types/viewer/scene/lights/PointLight.d.ts +31 -0
- package/types/viewer/scene/lights/index.d.ts +3 -0
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -746,9 +746,7 @@ class ContextMenu {
|
|
|
746
746
|
|
|
747
747
|
item.itemElement.addEventListener("mouseenter", (event) => {
|
|
748
748
|
event.preventDefault();
|
|
749
|
-
|
|
750
|
-
return;
|
|
751
|
-
}
|
|
749
|
+
|
|
752
750
|
const subMenu = item.subMenu;
|
|
753
751
|
if (!subMenu) {
|
|
754
752
|
if (lastSubMenu) {
|
|
@@ -762,6 +760,10 @@ class ContextMenu {
|
|
|
762
760
|
lastSubMenu = null;
|
|
763
761
|
}
|
|
764
762
|
|
|
763
|
+
if (item.enabled === false) {
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
|
|
765
767
|
const itemElement = item.itemElement;
|
|
766
768
|
const subMenuElement = subMenu.menuElement;
|
|
767
769
|
|
|
@@ -12638,7 +12640,7 @@ function buildBoxGeometry(cfg = {}) {
|
|
|
12638
12640
|
* xSize: 1, // Half-size on each axis
|
|
12639
12641
|
* ySize: 1,
|
|
12640
12642
|
* zSize: 1
|
|
12641
|
-
* }),
|
|
12643
|
+
* })),
|
|
12642
12644
|
* material: new PhongMaterial(viewer.scene, {
|
|
12643
12645
|
* emissive: [0,1,0]
|
|
12644
12646
|
* })
|
|
@@ -65449,37 +65451,91 @@ class Wire {
|
|
|
65449
65451
|
|
|
65450
65452
|
constructor(parentElement, cfg = {}) {
|
|
65451
65453
|
|
|
65454
|
+
this._color = cfg.color || "black";
|
|
65455
|
+
this._highlightClass = "viewer-ruler-wire-highlighted";
|
|
65456
|
+
|
|
65452
65457
|
this._wire = document.createElement('div');
|
|
65453
65458
|
this._wire.className += this._wire.className ? ' viewer-ruler-wire' : 'viewer-ruler-wire';
|
|
65454
65459
|
|
|
65455
|
-
|
|
65456
|
-
|
|
65460
|
+
this._wireClickable = document.createElement('div');
|
|
65461
|
+
this._wireClickable.className += this._wireClickable.className ? ' viewer-ruler-wire-clickable' : 'viewer-ruler-wire-clickable';
|
|
65457
65462
|
|
|
65458
65463
|
this._thickness = cfg.thickness || 1.0;
|
|
65464
|
+
this._thicknessClickable = cfg.thicknessClickable || 6.0;
|
|
65459
65465
|
|
|
65460
|
-
|
|
65461
|
-
|
|
65462
|
-
|
|
65463
|
-
|
|
65464
|
-
|
|
65465
|
-
|
|
65466
|
-
|
|
65467
|
-
|
|
65468
|
-
|
|
65469
|
-
|
|
65470
|
-
|
|
65471
|
-
|
|
65472
|
-
|
|
65473
|
-
|
|
65474
|
-
|
|
65475
|
-
|
|
65476
|
-
|
|
65477
|
-
|
|
65478
|
-
|
|
65479
|
-
|
|
65466
|
+
var wire = this._wire;
|
|
65467
|
+
var wireStyle = wire.style;
|
|
65468
|
+
|
|
65469
|
+
wireStyle.border = "solid " + this._thickness + "px " + this._color;
|
|
65470
|
+
wireStyle.position = "absolute";
|
|
65471
|
+
wireStyle["z-index"] = cfg.zIndex === undefined ? "2000001" : cfg.zIndex;
|
|
65472
|
+
wireStyle.width = 0 + "px";
|
|
65473
|
+
wireStyle.height = 0 + "px";
|
|
65474
|
+
wireStyle.visibility = "visible";
|
|
65475
|
+
wireStyle.top = 0 + "px";
|
|
65476
|
+
wireStyle.left = 0 + "px";
|
|
65477
|
+
wireStyle['-webkit-transform-origin'] = "0 0";
|
|
65478
|
+
wireStyle['-moz-transform-origin'] = "0 0";
|
|
65479
|
+
wireStyle['-ms-transform-origin'] = "0 0";
|
|
65480
|
+
wireStyle['-o-transform-origin'] = "0 0";
|
|
65481
|
+
wireStyle['transform-origin'] = "0 0";
|
|
65482
|
+
wireStyle['-webkit-transform'] = 'rotate(0deg)';
|
|
65483
|
+
wireStyle['-moz-transform'] = 'rotate(0deg)';
|
|
65484
|
+
wireStyle['-ms-transform'] = 'rotate(0deg)';
|
|
65485
|
+
wireStyle['-o-transform'] = 'rotate(0deg)';
|
|
65486
|
+
wireStyle['transform'] = 'rotate(0deg)';
|
|
65487
|
+
wireStyle["opacity"] = 1.0;
|
|
65488
|
+
if (cfg.onContextMenu) ;
|
|
65480
65489
|
|
|
65481
65490
|
parentElement.appendChild(wire);
|
|
65482
65491
|
|
|
65492
|
+
var wireClickable = this._wireClickable;
|
|
65493
|
+
var wireClickableStyle = wireClickable.style;
|
|
65494
|
+
|
|
65495
|
+
wireClickableStyle.border = "solid " + this._thicknessClickable + "px " + this._color;
|
|
65496
|
+
wireClickableStyle.position = "absolute";
|
|
65497
|
+
wireClickableStyle["z-index"] = cfg.zIndex === undefined ? "2000002" : (cfg.zIndex + 1);
|
|
65498
|
+
wireClickableStyle.width = 0 + "px";
|
|
65499
|
+
wireClickableStyle.height = 0 + "px";
|
|
65500
|
+
wireClickableStyle.visibility = "visible";
|
|
65501
|
+
wireClickableStyle.top = 0 + "px";
|
|
65502
|
+
wireClickableStyle.left = 0 + "px";
|
|
65503
|
+
// wireClickableStyle["pointer-events"] = "none";
|
|
65504
|
+
wireClickableStyle['-webkit-transform-origin'] = "0 0";
|
|
65505
|
+
wireClickableStyle['-moz-transform-origin'] = "0 0";
|
|
65506
|
+
wireClickableStyle['-ms-transform-origin'] = "0 0";
|
|
65507
|
+
wireClickableStyle['-o-transform-origin'] = "0 0";
|
|
65508
|
+
wireClickableStyle['transform-origin'] = "0 0";
|
|
65509
|
+
wireClickableStyle['-webkit-transform'] = 'rotate(0deg)';
|
|
65510
|
+
wireClickableStyle['-moz-transform'] = 'rotate(0deg)';
|
|
65511
|
+
wireClickableStyle['-ms-transform'] = 'rotate(0deg)';
|
|
65512
|
+
wireClickableStyle['-o-transform'] = 'rotate(0deg)';
|
|
65513
|
+
wireClickableStyle['transform'] = 'rotate(0deg)';
|
|
65514
|
+
wireClickableStyle["opacity"] = 0.0;
|
|
65515
|
+
wireClickableStyle["pointer-events"] = "all";
|
|
65516
|
+
if (cfg.onContextMenu) ;
|
|
65517
|
+
|
|
65518
|
+
parentElement.appendChild(wireClickable);
|
|
65519
|
+
|
|
65520
|
+
if (cfg.onMouseOver) {
|
|
65521
|
+
wireClickable.addEventListener('mouseover', (event) => {
|
|
65522
|
+
cfg.onMouseOver(event, this);
|
|
65523
|
+
});
|
|
65524
|
+
}
|
|
65525
|
+
|
|
65526
|
+
if (cfg.onMouseLeave) {
|
|
65527
|
+
wireClickable.addEventListener('mouseleave', (event) => {
|
|
65528
|
+
cfg.onMouseLeave(event, this);
|
|
65529
|
+
});
|
|
65530
|
+
}
|
|
65531
|
+
|
|
65532
|
+
if (cfg.onContextMenu) {
|
|
65533
|
+
wireClickable.addEventListener('contextmenu', (event) => {
|
|
65534
|
+
cfg.onContextMenu(event, this);
|
|
65535
|
+
event.preventDefault();
|
|
65536
|
+
});
|
|
65537
|
+
}
|
|
65538
|
+
|
|
65483
65539
|
this._x1 = 0;
|
|
65484
65540
|
this._y1 = 0;
|
|
65485
65541
|
this._x2 = 0;
|
|
@@ -65497,16 +65553,25 @@ class Wire {
|
|
|
65497
65553
|
var length = Math.abs(Math.sqrt((this._x1 - this._x2) * (this._x1 - this._x2) + (this._y1 - this._y2) * (this._y1 - this._y2)));
|
|
65498
65554
|
var angle = Math.atan2(this._y2 - this._y1, this._x2 - this._x1) * 180.0 / Math.PI;
|
|
65499
65555
|
|
|
65500
|
-
var
|
|
65501
|
-
|
|
65502
|
-
|
|
65503
|
-
|
|
65504
|
-
|
|
65505
|
-
|
|
65506
|
-
|
|
65507
|
-
|
|
65508
|
-
|
|
65509
|
-
|
|
65556
|
+
var wireStyle = this._wire.style;
|
|
65557
|
+
wireStyle["width"] = Math.round(length) + 'px';
|
|
65558
|
+
wireStyle["left"] = Math.round(this._x1) + 'px';
|
|
65559
|
+
wireStyle["top"] = Math.round(this._y1) + 'px';
|
|
65560
|
+
wireStyle['-webkit-transform'] = 'rotate(' + angle + 'deg)';
|
|
65561
|
+
wireStyle['-moz-transform'] = 'rotate(' + angle + 'deg)';
|
|
65562
|
+
wireStyle['-ms-transform'] = 'rotate(' + angle + 'deg)';
|
|
65563
|
+
wireStyle['-o-transform'] = 'rotate(' + angle + 'deg)';
|
|
65564
|
+
wireStyle['transform'] = 'rotate(' + angle + 'deg)';
|
|
65565
|
+
|
|
65566
|
+
var wireClickableStyle = this._wireClickable.style;
|
|
65567
|
+
wireClickableStyle["width"] = Math.round(length) + 'px';
|
|
65568
|
+
wireClickableStyle["left"] = Math.round(this._x1) + 'px';
|
|
65569
|
+
wireClickableStyle["top"] = Math.round(this._y1) + 'px';
|
|
65570
|
+
wireClickableStyle['-webkit-transform'] = 'rotate(' + angle + 'deg)';
|
|
65571
|
+
wireClickableStyle['-moz-transform'] = 'rotate(' + angle + 'deg)';
|
|
65572
|
+
wireClickableStyle['-ms-transform'] = 'rotate(' + angle + 'deg)';
|
|
65573
|
+
wireClickableStyle['-o-transform'] = 'rotate(' + angle + 'deg)';
|
|
65574
|
+
wireClickableStyle['transform'] = 'rotate(' + angle + 'deg)';
|
|
65510
65575
|
}
|
|
65511
65576
|
|
|
65512
65577
|
setStartAndEnd(x1, y1, x2, y2) {
|
|
@@ -65518,7 +65583,8 @@ class Wire {
|
|
|
65518
65583
|
}
|
|
65519
65584
|
|
|
65520
65585
|
setColor(color) {
|
|
65521
|
-
this.
|
|
65586
|
+
this._color = color || "black";
|
|
65587
|
+
this._wire.style.border = "solid " + this._thickness + "px " + this._color;
|
|
65522
65588
|
}
|
|
65523
65589
|
|
|
65524
65590
|
setOpacity(opacity) {
|
|
@@ -65533,8 +65599,25 @@ class Wire {
|
|
|
65533
65599
|
this._wire.style.visibility = visible ? "visible" : "hidden";
|
|
65534
65600
|
}
|
|
65535
65601
|
|
|
65602
|
+
setClickable(clickable) {
|
|
65603
|
+
this._wireClickable.style["pointer-events"] = (!!clickable) ? "all" : "none";
|
|
65604
|
+
}
|
|
65605
|
+
|
|
65606
|
+
setHighlighted(highlighted) {
|
|
65607
|
+
if (this._highlighted === highlighted) {
|
|
65608
|
+
return;
|
|
65609
|
+
}
|
|
65610
|
+
this._highlighted = !!highlighted;
|
|
65611
|
+
if (this._highlighted) {
|
|
65612
|
+
this._wire.classList.add(this._highlightClass);
|
|
65613
|
+
} else {
|
|
65614
|
+
this._wire.classList.remove(this._highlightClass);
|
|
65615
|
+
}
|
|
65616
|
+
}
|
|
65617
|
+
|
|
65536
65618
|
destroy(visible) {
|
|
65537
65619
|
this._wire.parentElement.removeChild(this._wire);
|
|
65620
|
+
this._wireClickable.parentElement.removeChild(this._wireClickable);
|
|
65538
65621
|
}
|
|
65539
65622
|
}
|
|
65540
65623
|
|
|
@@ -65543,6 +65626,8 @@ class Dot {
|
|
|
65543
65626
|
|
|
65544
65627
|
constructor(parentElement, cfg = {}) {
|
|
65545
65628
|
|
|
65629
|
+
this._highlightClass = "viewer-ruler-dot-highlighted";
|
|
65630
|
+
|
|
65546
65631
|
this._x = 0;
|
|
65547
65632
|
this._y = 0;
|
|
65548
65633
|
|
|
@@ -65550,37 +65635,77 @@ class Dot {
|
|
|
65550
65635
|
this._dot = document.createElement('div');
|
|
65551
65636
|
this._dot.className += this._dot.className ? ' viewer-ruler-dot' : 'viewer-ruler-dot';
|
|
65552
65637
|
|
|
65638
|
+
this._dotClickable = document.createElement('div');
|
|
65639
|
+
this._dotClickable.className += this._dotClickable.className ? ' viewer-ruler-dot-clickable' : 'viewer-ruler-dot-clickable';
|
|
65640
|
+
|
|
65553
65641
|
var dot = this._dot;
|
|
65554
|
-
var
|
|
65642
|
+
var dotStyle = dot.style;
|
|
65643
|
+
dotStyle["border-radius"] = 25 + "px";
|
|
65644
|
+
dotStyle.border = "solid 2px white";
|
|
65645
|
+
dotStyle.background = "lightgreen";
|
|
65646
|
+
dotStyle.position = "absolute";
|
|
65647
|
+
dotStyle["z-index"] = cfg.zIndex === undefined ? "40000005" : cfg.zIndex ;
|
|
65648
|
+
dotStyle.width = 8 + "px";
|
|
65649
|
+
dotStyle.height = 8 + "px";
|
|
65650
|
+
dotStyle.visibility = cfg.visible !== false ? "visible" : "hidden";
|
|
65651
|
+
dotStyle.top = 0 + "px";
|
|
65652
|
+
dotStyle.left = 0 + "px";
|
|
65653
|
+
dotStyle["box-shadow"] = "0 2px 5px 0 #182A3D;";
|
|
65654
|
+
dotStyle["opacity"] = 1.0;
|
|
65655
|
+
dotStyle["pointer-events"] = "none";
|
|
65656
|
+
if (cfg.onContextMenu) ;
|
|
65657
|
+
parentElement.appendChild(dot);
|
|
65555
65658
|
|
|
65556
|
-
|
|
65557
|
-
|
|
65558
|
-
|
|
65559
|
-
|
|
65560
|
-
|
|
65561
|
-
|
|
65562
|
-
|
|
65563
|
-
|
|
65564
|
-
|
|
65565
|
-
|
|
65566
|
-
|
|
65567
|
-
|
|
65568
|
-
|
|
65659
|
+
var dotClickable = this._dotClickable;
|
|
65660
|
+
var dotClickableStyle = dotClickable.style;
|
|
65661
|
+
dotClickableStyle["border-radius"] = 35 + "px";
|
|
65662
|
+
dotClickableStyle.border = "solid 10px white";
|
|
65663
|
+
dotClickableStyle.position = "absolute";
|
|
65664
|
+
dotClickableStyle["z-index"] = cfg.zIndex === undefined ? "40000007" : (cfg.zIndex + 1);
|
|
65665
|
+
dotClickableStyle.width = 8 + "px";
|
|
65666
|
+
dotClickableStyle.height = 8 + "px";
|
|
65667
|
+
dotClickableStyle.visibility = "visible";
|
|
65668
|
+
dotClickableStyle.top = 0 + "px";
|
|
65669
|
+
dotClickableStyle.left = 0 + "px";
|
|
65670
|
+
dotClickableStyle["opacity"] = 0.0;
|
|
65671
|
+
dotClickableStyle["pointer-events"] = "all";
|
|
65672
|
+
if (cfg.onContextMenu) ;
|
|
65673
|
+
parentElement.appendChild(dotClickable);
|
|
65674
|
+
|
|
65675
|
+
if (cfg.onMouseOver) {
|
|
65676
|
+
dotClickable.addEventListener('mouseover', (event) => {
|
|
65677
|
+
cfg.onMouseOver(event, this);
|
|
65678
|
+
});
|
|
65679
|
+
}
|
|
65569
65680
|
|
|
65570
|
-
|
|
65681
|
+
if (cfg.onMouseLeave) {
|
|
65682
|
+
dotClickable.addEventListener('mouseleave', (event) => {
|
|
65683
|
+
cfg.onMouseLeave(event, this);
|
|
65684
|
+
});
|
|
65685
|
+
}
|
|
65571
65686
|
|
|
65687
|
+
if (cfg.onContextMenu) {
|
|
65688
|
+
dotClickable.addEventListener('contextmenu', (event) => {
|
|
65689
|
+
cfg.onContextMenu(event, this);
|
|
65690
|
+
event.preventDefault();
|
|
65691
|
+
});
|
|
65692
|
+
}
|
|
65693
|
+
|
|
65572
65694
|
this.setPos(cfg.x || 0, cfg.y || 0);
|
|
65573
65695
|
this.setFillColor(cfg.fillColor);
|
|
65574
65696
|
this.setBorderColor(cfg.borderColor);
|
|
65575
|
-
this.setClickable(false);
|
|
65576
65697
|
}
|
|
65577
65698
|
|
|
65578
65699
|
setPos(x, y) {
|
|
65579
65700
|
this._x = x;
|
|
65580
65701
|
this._y = y;
|
|
65581
|
-
var
|
|
65582
|
-
|
|
65583
|
-
|
|
65702
|
+
var dotStyle = this._dot.style;
|
|
65703
|
+
dotStyle["left"] = (Math.round(x) - 4) + 'px';
|
|
65704
|
+
dotStyle["top"] = (Math.round(y) - 4) + 'px';
|
|
65705
|
+
|
|
65706
|
+
var dotClickableStyle = this._dotClickable.style;
|
|
65707
|
+
dotClickableStyle["left"] = (Math.round(x) - 9) + 'px';
|
|
65708
|
+
dotClickableStyle["top"] = (Math.round(y) - 9) + 'px';
|
|
65584
65709
|
}
|
|
65585
65710
|
|
|
65586
65711
|
setFillColor(color) {
|
|
@@ -65604,12 +65729,26 @@ class Dot {
|
|
|
65604
65729
|
}
|
|
65605
65730
|
|
|
65606
65731
|
setClickable(clickable) {
|
|
65732
|
+
this._dotClickable.style["pointer-events"] = (!!clickable) ? "all" : "none";
|
|
65607
65733
|
this._dot.style["pointer-events"] = (!!clickable) ? "all" : "none";
|
|
65608
65734
|
}
|
|
65609
65735
|
|
|
65736
|
+
setHighlighted(highlighted) {
|
|
65737
|
+
if (this._highlighted === highlighted) {
|
|
65738
|
+
return;
|
|
65739
|
+
}
|
|
65740
|
+
this._highlighted = !!highlighted;
|
|
65741
|
+
if (this._highlighted) {
|
|
65742
|
+
this._dot.classList.add(this._highlightClass);
|
|
65743
|
+
} else {
|
|
65744
|
+
this._dot.classList.remove(this._highlightClass);
|
|
65745
|
+
}
|
|
65746
|
+
}
|
|
65747
|
+
|
|
65610
65748
|
destroy() {
|
|
65611
65749
|
this.setVisible(false);
|
|
65612
65750
|
this._dot.parentElement.removeChild(this._dot);
|
|
65751
|
+
this._dotClickable.parentElement.removeChild(this._dotClickable);
|
|
65613
65752
|
}
|
|
65614
65753
|
}
|
|
65615
65754
|
|
|
@@ -65618,10 +65757,13 @@ class Label {
|
|
|
65618
65757
|
|
|
65619
65758
|
constructor(parentElement, cfg = {}) {
|
|
65620
65759
|
|
|
65760
|
+
this._highlightClass = "viewer-ruler-label-highlighted";
|
|
65761
|
+
|
|
65621
65762
|
this._prefix = cfg.prefix || "";
|
|
65622
65763
|
this._x = 0;
|
|
65623
65764
|
this._y = 0;
|
|
65624
65765
|
this._visible = true;
|
|
65766
|
+
this._culled = false;
|
|
65625
65767
|
|
|
65626
65768
|
this._label = document.createElement('div');
|
|
65627
65769
|
this._label.className += this._label.className ? ' viewer-ruler-label' : 'viewer-ruler-label';
|
|
@@ -65632,7 +65774,7 @@ class Label {
|
|
|
65632
65774
|
style["border-radius"] = 5 + "px";
|
|
65633
65775
|
style.color = "white";
|
|
65634
65776
|
style.padding = "4px";
|
|
65635
|
-
style.border = "solid
|
|
65777
|
+
style.border = "solid 1px";
|
|
65636
65778
|
style.background = "lightgreen";
|
|
65637
65779
|
style.position = "absolute";
|
|
65638
65780
|
style["z-index"] = cfg.zIndex === undefined ? "5000005" : cfg.zIndex;
|
|
@@ -65641,16 +65783,38 @@ class Label {
|
|
|
65641
65783
|
style.visibility = "visible";
|
|
65642
65784
|
style.top = 0 + "px";
|
|
65643
65785
|
style.left = 0 + "px";
|
|
65644
|
-
style["pointer-events"] = "
|
|
65786
|
+
style["pointer-events"] = "all";
|
|
65645
65787
|
style["opacity"] = 1.0;
|
|
65788
|
+
if (cfg.onContextMenu) ;
|
|
65646
65789
|
label.innerText = "";
|
|
65647
65790
|
|
|
65648
65791
|
parentElement.appendChild(label);
|
|
65649
65792
|
|
|
65650
65793
|
this.setPos(cfg.x || 0, cfg.y || 0);
|
|
65651
65794
|
this.setFillColor(cfg.fillColor);
|
|
65652
|
-
this.setBorderColor(cfg.
|
|
65795
|
+
this.setBorderColor(cfg.fillColor);
|
|
65653
65796
|
this.setText(cfg.text);
|
|
65797
|
+
|
|
65798
|
+
if (cfg.onMouseOver) {
|
|
65799
|
+
label.addEventListener('mouseover', (event) => {
|
|
65800
|
+
cfg.onMouseOver(event, this);
|
|
65801
|
+
event.preventDefault();
|
|
65802
|
+
});
|
|
65803
|
+
}
|
|
65804
|
+
|
|
65805
|
+
if (cfg.onMouseLeave) {
|
|
65806
|
+
label.addEventListener('mouseleave', (event) => {
|
|
65807
|
+
cfg.onMouseLeave(event, this);
|
|
65808
|
+
event.preventDefault();
|
|
65809
|
+
});
|
|
65810
|
+
}
|
|
65811
|
+
|
|
65812
|
+
if (cfg.onContextMenu) {
|
|
65813
|
+
label.addEventListener('contextmenu', (event) => {
|
|
65814
|
+
cfg.onContextMenu(event, this);
|
|
65815
|
+
event.preventDefault();
|
|
65816
|
+
});
|
|
65817
|
+
}
|
|
65654
65818
|
}
|
|
65655
65819
|
|
|
65656
65820
|
setPos(x, y) {
|
|
@@ -65682,11 +65846,13 @@ class Label {
|
|
|
65682
65846
|
}
|
|
65683
65847
|
|
|
65684
65848
|
setFillColor(color) {
|
|
65685
|
-
this.
|
|
65849
|
+
this._fillColor = color || "lightgreen";
|
|
65850
|
+
this._label.style.background =this._fillColor;
|
|
65686
65851
|
}
|
|
65687
65852
|
|
|
65688
65853
|
setBorderColor(color) {
|
|
65689
|
-
this.
|
|
65854
|
+
this._borderColor = color || "black";
|
|
65855
|
+
this._label.style.border = "solid 1px " + this._borderColor;
|
|
65690
65856
|
}
|
|
65691
65857
|
|
|
65692
65858
|
setOpacity(opacity) {
|
|
@@ -65698,7 +65864,31 @@ class Label {
|
|
|
65698
65864
|
return;
|
|
65699
65865
|
}
|
|
65700
65866
|
this._visible = !!visible;
|
|
65701
|
-
this._label.style.visibility = this._visible ? "visible" : "hidden";
|
|
65867
|
+
this._label.style.visibility = this._visible && !this._culled ? "visible" : "hidden";
|
|
65868
|
+
}
|
|
65869
|
+
|
|
65870
|
+
setCulled(culled) {
|
|
65871
|
+
if (this._culled === culled) {
|
|
65872
|
+
return;
|
|
65873
|
+
}
|
|
65874
|
+
this._culled = !!culled;
|
|
65875
|
+
this._label.style.visibility = this._visible && !this._culled ? "visible" : "hidden";
|
|
65876
|
+
}
|
|
65877
|
+
|
|
65878
|
+
setHighlighted(highlighted) {
|
|
65879
|
+
if (this._highlighted === highlighted) {
|
|
65880
|
+
return;
|
|
65881
|
+
}
|
|
65882
|
+
this._highlighted = !!highlighted;
|
|
65883
|
+
if (this._highlighted) {
|
|
65884
|
+
this._label.classList.add(this._highlightClass);
|
|
65885
|
+
} else {
|
|
65886
|
+
this._label.classList.remove(this._highlightClass);
|
|
65887
|
+
}
|
|
65888
|
+
}
|
|
65889
|
+
|
|
65890
|
+
setClickable(clickable) {
|
|
65891
|
+
this._label.style["pointer-events"] = (!!clickable) ? "all" : "none";
|
|
65702
65892
|
}
|
|
65703
65893
|
|
|
65704
65894
|
destroy() {
|
|
@@ -65751,35 +65941,65 @@ class AngleMeasurement extends Component {
|
|
|
65751
65941
|
this._pp = new Float64Array(12);
|
|
65752
65942
|
this._cp = new Int16Array(6);
|
|
65753
65943
|
|
|
65944
|
+
const onMouseOver = cfg.onMouseOver ? (event) => {
|
|
65945
|
+
cfg.onMouseOver(event, this);
|
|
65946
|
+
} : null;
|
|
65947
|
+
|
|
65948
|
+
const onMouseLeave = cfg.onMouseLeave ? (event) => {
|
|
65949
|
+
cfg.onMouseLeave(event, this);
|
|
65950
|
+
} : null;
|
|
65951
|
+
|
|
65952
|
+
const onContextMenu = cfg.onContextMenu ? (event) => {
|
|
65953
|
+
cfg.onContextMenu(event, this);
|
|
65954
|
+
} : null;
|
|
65955
|
+
|
|
65754
65956
|
this._originDot = new Dot(this._container, {
|
|
65755
65957
|
fillColor: this._color,
|
|
65756
|
-
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined
|
|
65958
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined,
|
|
65959
|
+
onMouseOver,
|
|
65960
|
+
onMouseLeave,
|
|
65961
|
+
onContextMenu
|
|
65757
65962
|
});
|
|
65758
65963
|
this._cornerDot = new Dot(this._container, {
|
|
65759
65964
|
fillColor: this._color,
|
|
65760
|
-
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined
|
|
65965
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined,
|
|
65966
|
+
onMouseOver,
|
|
65967
|
+
onMouseLeave,
|
|
65968
|
+
onContextMenu
|
|
65761
65969
|
});
|
|
65762
65970
|
this._targetDot = new Dot(this._container, {
|
|
65763
65971
|
fillColor: this._color,
|
|
65764
|
-
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined
|
|
65972
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined,
|
|
65973
|
+
onMouseOver,
|
|
65974
|
+
onMouseLeave,
|
|
65975
|
+
onContextMenu
|
|
65765
65976
|
});
|
|
65766
65977
|
|
|
65767
65978
|
this._originWire = new Wire(this._container, {
|
|
65768
65979
|
color: this._color || "blue",
|
|
65769
65980
|
thickness: 1,
|
|
65770
|
-
zIndex: plugin.zIndex
|
|
65981
|
+
zIndex: plugin.zIndex,
|
|
65982
|
+
onMouseOver,
|
|
65983
|
+
onMouseLeave,
|
|
65984
|
+
onContextMenu
|
|
65771
65985
|
});
|
|
65772
65986
|
this._targetWire = new Wire(this._container, {
|
|
65773
65987
|
color: this._color || "red",
|
|
65774
65988
|
thickness: 1,
|
|
65775
|
-
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1: undefined
|
|
65989
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1: undefined,
|
|
65990
|
+
onMouseOver,
|
|
65991
|
+
onMouseLeave,
|
|
65992
|
+
onContextMenu
|
|
65776
65993
|
});
|
|
65777
65994
|
|
|
65778
65995
|
this._angleLabel = new Label(this._container, {
|
|
65779
65996
|
fillColor: this._color || "#00BBFF",
|
|
65780
65997
|
prefix: "",
|
|
65781
65998
|
text: "",
|
|
65782
|
-
zIndex: plugin.zIndex + 2
|
|
65999
|
+
zIndex: plugin.zIndex + 2,
|
|
66000
|
+
onMouseOver,
|
|
66001
|
+
onMouseLeave,
|
|
66002
|
+
onContextMenu
|
|
65783
66003
|
});
|
|
65784
66004
|
|
|
65785
66005
|
this._wpDirty = false;
|
|
@@ -65795,6 +66015,8 @@ class AngleMeasurement extends Component {
|
|
|
65795
66015
|
this._targetWireVisible = false;
|
|
65796
66016
|
|
|
65797
66017
|
this._angleVisible = false;
|
|
66018
|
+
this._labelsVisible = false;
|
|
66019
|
+
this._clickable = true;
|
|
65798
66020
|
|
|
65799
66021
|
this._originMarker.on("worldPos", (value) => {
|
|
65800
66022
|
this._originWorld.set(value || [0, 0, 0]);
|
|
@@ -65840,6 +66062,7 @@ class AngleMeasurement extends Component {
|
|
|
65840
66062
|
this.targetWireVisible = cfg.targetWireVisible;
|
|
65841
66063
|
|
|
65842
66064
|
this.angleVisible = cfg.angleVisible;
|
|
66065
|
+
this.labelsVisible = cfg.labelsVisible;
|
|
65843
66066
|
}
|
|
65844
66067
|
|
|
65845
66068
|
_update() {
|
|
@@ -65899,7 +66122,7 @@ class AngleMeasurement extends Component {
|
|
|
65899
66122
|
this._originWire.setVisible(false);
|
|
65900
66123
|
this._targetWire.setVisible(false);
|
|
65901
66124
|
|
|
65902
|
-
this._angleLabel.
|
|
66125
|
+
this._angleLabel.setCulled(true);
|
|
65903
66126
|
|
|
65904
66127
|
return;
|
|
65905
66128
|
}
|
|
@@ -65963,7 +66186,7 @@ class AngleMeasurement extends Component {
|
|
|
65963
66186
|
this._originWire.setVisible(this._visible && this._originWireVisible);
|
|
65964
66187
|
this._targetWire.setVisible(this._visible && this._targetWireVisible);
|
|
65965
66188
|
|
|
65966
|
-
this._angleLabel.
|
|
66189
|
+
this._angleLabel.setCulled(!(this._visible && this._angleVisible && this.labelsVisible));
|
|
65967
66190
|
|
|
65968
66191
|
this._cpDirty = false;
|
|
65969
66192
|
}
|
|
@@ -66077,6 +66300,8 @@ class AngleMeasurement extends Component {
|
|
|
66077
66300
|
this._originWire.setVisible(this._visible && this._originWireVisible);
|
|
66078
66301
|
this._targetWire.setVisible(this._visible && this._targetWireVisible);
|
|
66079
66302
|
this._angleLabel.setVisible(this._visible && this._angleVisible);
|
|
66303
|
+
this._cpDirty = true;
|
|
66304
|
+
this._needUpdate();
|
|
66080
66305
|
}
|
|
66081
66306
|
|
|
66082
66307
|
/**
|
|
@@ -66097,6 +66322,8 @@ class AngleMeasurement extends Component {
|
|
|
66097
66322
|
value = value !== false;
|
|
66098
66323
|
this._originVisible = value;
|
|
66099
66324
|
this._originDot.setVisible(this._visible && this._originVisible);
|
|
66325
|
+
this._cpDirty = true;
|
|
66326
|
+
this._needUpdate();
|
|
66100
66327
|
}
|
|
66101
66328
|
|
|
66102
66329
|
/**
|
|
@@ -66117,6 +66344,8 @@ class AngleMeasurement extends Component {
|
|
|
66117
66344
|
value = value !== false;
|
|
66118
66345
|
this._cornerVisible = value;
|
|
66119
66346
|
this._cornerDot.setVisible(this._visible && this._cornerVisible);
|
|
66347
|
+
this._cpDirty = true;
|
|
66348
|
+
this._needUpdate();
|
|
66120
66349
|
}
|
|
66121
66350
|
|
|
66122
66351
|
/**
|
|
@@ -66137,6 +66366,8 @@ class AngleMeasurement extends Component {
|
|
|
66137
66366
|
value = value !== false;
|
|
66138
66367
|
this._targetVisible = value;
|
|
66139
66368
|
this._targetDot.setVisible(this._visible && this._targetVisible);
|
|
66369
|
+
this._cpDirty = true;
|
|
66370
|
+
this._needUpdate();
|
|
66140
66371
|
}
|
|
66141
66372
|
|
|
66142
66373
|
/**
|
|
@@ -66157,6 +66388,8 @@ class AngleMeasurement extends Component {
|
|
|
66157
66388
|
value = value !== false;
|
|
66158
66389
|
this._originWireVisible = value;
|
|
66159
66390
|
this._originWire.setVisible(this._visible && this._originWireVisible);
|
|
66391
|
+
this._cpDirty = true;
|
|
66392
|
+
this._needUpdate();
|
|
66160
66393
|
}
|
|
66161
66394
|
|
|
66162
66395
|
/**
|
|
@@ -66177,6 +66410,8 @@ class AngleMeasurement extends Component {
|
|
|
66177
66410
|
value = value !== false;
|
|
66178
66411
|
this._targetWireVisible = value;
|
|
66179
66412
|
this._targetWire.setVisible(this._visible && this._targetWireVisible);
|
|
66413
|
+
this._cpDirty = true;
|
|
66414
|
+
this._needUpdate();
|
|
66180
66415
|
}
|
|
66181
66416
|
|
|
66182
66417
|
/**
|
|
@@ -66197,6 +66432,8 @@ class AngleMeasurement extends Component {
|
|
|
66197
66432
|
value = value !== false;
|
|
66198
66433
|
this._angleVisible = value;
|
|
66199
66434
|
this._angleLabel.setVisible(this._visible && this._angleVisible);
|
|
66435
|
+
this._cpDirty = true;
|
|
66436
|
+
this._needUpdate();
|
|
66200
66437
|
}
|
|
66201
66438
|
|
|
66202
66439
|
/**
|
|
@@ -66208,6 +66445,67 @@ class AngleMeasurement extends Component {
|
|
|
66208
66445
|
return this._angleVisible;
|
|
66209
66446
|
}
|
|
66210
66447
|
|
|
66448
|
+
/**
|
|
66449
|
+
* Sets if the labels are visible.
|
|
66450
|
+
*
|
|
66451
|
+
* @type {Boolean}
|
|
66452
|
+
*/
|
|
66453
|
+
set labelsVisible(value) {
|
|
66454
|
+
value = value !== undefined ? Boolean(value) : this.plugin.defaultLabelsVisible;
|
|
66455
|
+
this._labelsVisible = value;
|
|
66456
|
+
var labelsVisible = this._visible && this._labelsVisible;
|
|
66457
|
+
this._angleLabel.setVisible(labelsVisible);
|
|
66458
|
+
this._cpDirty = true;
|
|
66459
|
+
this._needUpdate();
|
|
66460
|
+
}
|
|
66461
|
+
|
|
66462
|
+
/**
|
|
66463
|
+
* Gets if the labels are visible.
|
|
66464
|
+
*
|
|
66465
|
+
* @type {Boolean}
|
|
66466
|
+
*/
|
|
66467
|
+
get labelsVisible() {
|
|
66468
|
+
return this._labelsVisible;
|
|
66469
|
+
}
|
|
66470
|
+
|
|
66471
|
+
/**
|
|
66472
|
+
* Sets if this DistanceMeasurement appears highlighted.
|
|
66473
|
+
* @param highlighted
|
|
66474
|
+
*/
|
|
66475
|
+
setHighlighted(highlighted) {
|
|
66476
|
+
this._originDot.setHighlighted(highlighted);
|
|
66477
|
+
this._cornerDot.setHighlighted(highlighted);
|
|
66478
|
+
this._targetDot.setHighlighted(highlighted);
|
|
66479
|
+
this._originWire.setHighlighted(highlighted);
|
|
66480
|
+
this._targetWire.setHighlighted(highlighted);
|
|
66481
|
+
this._angleLabel.setHighlighted(highlighted);
|
|
66482
|
+
}
|
|
66483
|
+
|
|
66484
|
+
/**
|
|
66485
|
+
* Sets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events.
|
|
66486
|
+
*
|
|
66487
|
+
* @type {Boolean}
|
|
66488
|
+
*/
|
|
66489
|
+
set clickable(value) {
|
|
66490
|
+
value = !!value;
|
|
66491
|
+
this._clickable = value;
|
|
66492
|
+
this._originDot.setClickable(this._clickable);
|
|
66493
|
+
this._cornerDot.setClickable(this._clickable);
|
|
66494
|
+
this._targetDot.setClickable(this._clickable);
|
|
66495
|
+
this._originWire.setClickable(this._clickable);
|
|
66496
|
+
this._targetWire.setClickable(this._clickable);
|
|
66497
|
+
this._angleLabel.setClickable(this._clickable);
|
|
66498
|
+
}
|
|
66499
|
+
|
|
66500
|
+
/**
|
|
66501
|
+
* Gets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events.
|
|
66502
|
+
*
|
|
66503
|
+
* @type {Boolean}
|
|
66504
|
+
*/
|
|
66505
|
+
get clickable() {
|
|
66506
|
+
return this._clickable;
|
|
66507
|
+
}
|
|
66508
|
+
|
|
66211
66509
|
/**
|
|
66212
66510
|
* @private
|
|
66213
66511
|
*/
|
|
@@ -66534,6 +66832,7 @@ class AngleMeasurementsControl extends Component {
|
|
|
66534
66832
|
this._currentAngleMeasurement.targetWireVisible = false;
|
|
66535
66833
|
this._currentAngleMeasurement.targetVisible = false;
|
|
66536
66834
|
this._currentAngleMeasurement.angleVisible = false;
|
|
66835
|
+
this._currentAngleMeasurement.clickable = false;
|
|
66537
66836
|
this._state = FINDING_CORNER;
|
|
66538
66837
|
this.fire("measurementStart", this._currentAngleMeasurement);
|
|
66539
66838
|
break;
|
|
@@ -66549,6 +66848,7 @@ class AngleMeasurementsControl extends Component {
|
|
|
66549
66848
|
// this._currentAngleMeasurement.approximate = false;
|
|
66550
66849
|
this._currentAngleMeasurement.targetVisible = true;
|
|
66551
66850
|
this._currentAngleMeasurement.angleVisible = true;
|
|
66851
|
+
this._currentAngleMeasurement.clickable = true;
|
|
66552
66852
|
this.fire("measurementEnd", this._currentAngleMeasurement);
|
|
66553
66853
|
this._currentAngleMeasurement = null;
|
|
66554
66854
|
this._state = FINDING_ORIGIN;
|
|
@@ -66774,6 +67074,85 @@ const getCanvasPosFromEvent$5 = function (event, canvasPos) {
|
|
|
66774
67074
|
*
|
|
66775
67075
|
* angleMeasurements.control.activate(); // <------------ Activate the AngleMeasurementsControl
|
|
66776
67076
|
* ````
|
|
67077
|
+
*
|
|
67078
|
+
* ## Example 4: Attaching Mouse Handlers
|
|
67079
|
+
*
|
|
67080
|
+
* In our fourth example, we'll attach even handlers to our plugin, to catch when the user
|
|
67081
|
+
* hovers or right-clicks over our measurements.
|
|
67082
|
+
*
|
|
67083
|
+
* [[Run example](https://xeokit.github.io/xeokit-sdk/examples/#measurements_angle_modelWithMeasurements)]
|
|
67084
|
+
*
|
|
67085
|
+
* ````javascript
|
|
67086
|
+
* import {Viewer, XKTLoaderPlugin, AngleMeasurementsPlugin} from "xeokit-sdk.es.js";
|
|
67087
|
+
*
|
|
67088
|
+
* const viewer = new Viewer({
|
|
67089
|
+
* canvasId: "myCanvas",
|
|
67090
|
+
* transparent: true
|
|
67091
|
+
* });
|
|
67092
|
+
*
|
|
67093
|
+
* viewer.scene.camera.eye = [-2.37, 18.97, -26.12];
|
|
67094
|
+
* viewer.scene.camera.look = [10.97, 5.82, -11.22];
|
|
67095
|
+
* viewer.scene.camera.up = [0.36, 0.83, 0.40];
|
|
67096
|
+
*
|
|
67097
|
+
* const xktLoader = new XKTLoaderPlugin(viewer);
|
|
67098
|
+
*
|
|
67099
|
+
* const angleMeasurements = new AngleMeasurementsPlugin(viewer);
|
|
67100
|
+
*
|
|
67101
|
+
* angleMeasurements.on("mouseOver", (e) => {
|
|
67102
|
+
* e.measurement.setHighlighted(true);
|
|
67103
|
+
* });
|
|
67104
|
+
*
|
|
67105
|
+
* angleMeasurements.on("mouseLeave", (e) => {
|
|
67106
|
+
* e.measurement.setHighlighted(false);
|
|
67107
|
+
* });
|
|
67108
|
+
*
|
|
67109
|
+
* angleMeasurements.on("contextMenu", (e) => {
|
|
67110
|
+
* // Show context menu
|
|
67111
|
+
* e.event.preventDefault();
|
|
67112
|
+
* });
|
|
67113
|
+
*
|
|
67114
|
+
* const model = xktLoader.load({
|
|
67115
|
+
* src: "./models/xkt/duplex/duplex.xkt"
|
|
67116
|
+
* });
|
|
67117
|
+
*
|
|
67118
|
+
* model.on("loaded", () => {
|
|
67119
|
+
*
|
|
67120
|
+
* angleMeasurementsPlugin.createMeasurement({
|
|
67121
|
+
* id: "angleMeasurement1",
|
|
67122
|
+
* origin: {
|
|
67123
|
+
* entity: viewer.scene.objects["1CZILmCaHETO8tf3SgGEXu"],
|
|
67124
|
+
* worldPos: [0.4158603637281142, 2.5193106917110457, 17.79972838299403]
|
|
67125
|
+
* },
|
|
67126
|
+
* corner: {
|
|
67127
|
+
* entity: viewer.scene.objects["1CZILmCaHETO8tf3SgGEXu"],
|
|
67128
|
+
* worldPos: [0.41857741956197625,0.0987169929481646,17.799763071093395]
|
|
67129
|
+
* },
|
|
67130
|
+
* target: {
|
|
67131
|
+
* entity: viewer.scene.objects["1CZILmCaHETO8tf3SgGEXu"],
|
|
67132
|
+
* worldPos: [5.235526066859247, 0.11580773869801986, 17.824891550941565]
|
|
67133
|
+
* },
|
|
67134
|
+
* visible: true
|
|
67135
|
+
* });
|
|
67136
|
+
*
|
|
67137
|
+
* angleMeasurementsPlugin.createMeasurement({
|
|
67138
|
+
* id: "angleMeasurement2",
|
|
67139
|
+
* origin: {
|
|
67140
|
+
* entity: viewer.scene.objects["2O2Fr$t4X7Zf8NOew3FNr2"],
|
|
67141
|
+
* worldPos: [-0.00003814187850181838, 5.9996748076205115,17.79996871551525]
|
|
67142
|
+
* },
|
|
67143
|
+
* corner: {
|
|
67144
|
+
* entity: viewer.scene.objects["2O2Fr$t4X7Zf8NOew3FNqI"],
|
|
67145
|
+
* worldPos: [-0.0005214119318139865, 3.1010044228517595, 17.787656604483363]
|
|
67146
|
+
*
|
|
67147
|
+
* },
|
|
67148
|
+
* target: {
|
|
67149
|
+
* entity: viewer.scene.objects["1s1jVhK8z0pgKYcr9jt7AB"],
|
|
67150
|
+
* worldPos: [ 8.380657312957396, 3.1055697628459553, 17.799220108187185]
|
|
67151
|
+
* },
|
|
67152
|
+
* visible: true
|
|
67153
|
+
* });
|
|
67154
|
+
* });
|
|
67155
|
+
* ````
|
|
66777
67156
|
*/
|
|
66778
67157
|
class AngleMeasurementsPlugin extends Plugin {
|
|
66779
67158
|
|
|
@@ -66784,6 +67163,7 @@ class AngleMeasurementsPlugin extends Plugin {
|
|
|
66784
67163
|
* @param {String} [cfg.id="AngleMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
66785
67164
|
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````.
|
|
66786
67165
|
* @param {string} [cfg.defaultColor=null] The default color of the dots, wire and label.
|
|
67166
|
+
* @param {boolean} [cfg.defaultLabelsVisible=true] The default value of {@link AngleMeasurement.labelsVisible}.
|
|
66787
67167
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
66788
67168
|
*/
|
|
66789
67169
|
constructor(viewer, cfg = {}) {
|
|
@@ -66796,8 +67176,33 @@ class AngleMeasurementsPlugin extends Plugin {
|
|
|
66796
67176
|
|
|
66797
67177
|
this._measurements = {};
|
|
66798
67178
|
|
|
66799
|
-
this.defaultColor = cfg.defaultColor;
|
|
67179
|
+
this.defaultColor = cfg.defaultColor !== undefined ? cfg.defaultColor : "#00BBFF";
|
|
67180
|
+
this.defaultLabelsVisible = cfg.defaultLabelsVisible !== false;
|
|
66800
67181
|
this.zIndex = cfg.zIndex || 10000;
|
|
67182
|
+
|
|
67183
|
+
this._onMouseOver = (event, measurement) => {
|
|
67184
|
+
this.fire("mouseOver", {
|
|
67185
|
+
plugin: this,
|
|
67186
|
+
measurement,
|
|
67187
|
+
event
|
|
67188
|
+
});
|
|
67189
|
+
};
|
|
67190
|
+
|
|
67191
|
+
this._onMouseLeave = (event, measurement) => {
|
|
67192
|
+
this.fire("mouseLeave", {
|
|
67193
|
+
plugin: this,
|
|
67194
|
+
measurement,
|
|
67195
|
+
event
|
|
67196
|
+
});
|
|
67197
|
+
};
|
|
67198
|
+
|
|
67199
|
+
this._onContextMenu = (event, measurement) => {
|
|
67200
|
+
this.fire("contextMenu", {
|
|
67201
|
+
plugin: this,
|
|
67202
|
+
measurement,
|
|
67203
|
+
event
|
|
67204
|
+
});
|
|
67205
|
+
};
|
|
66801
67206
|
}
|
|
66802
67207
|
|
|
66803
67208
|
/**
|
|
@@ -66872,6 +67277,9 @@ class AngleMeasurementsPlugin extends Plugin {
|
|
|
66872
67277
|
cornerVisible: true,
|
|
66873
67278
|
targetWireVisible: true,
|
|
66874
67279
|
targetVisible: true,
|
|
67280
|
+
onMouseOver: this._onMouseOver,
|
|
67281
|
+
onMouseLeave: this._onMouseLeave,
|
|
67282
|
+
onContextMenu: this._onContextMenu
|
|
66875
67283
|
});
|
|
66876
67284
|
this._measurements[measurement.id] = measurement;
|
|
66877
67285
|
measurement.on("destroyed", () => {
|
|
@@ -66896,6 +67304,17 @@ class AngleMeasurementsPlugin extends Plugin {
|
|
|
66896
67304
|
this.fire("measurementDestroyed", measurement);
|
|
66897
67305
|
}
|
|
66898
67306
|
|
|
67307
|
+
/**
|
|
67308
|
+
* Shows all or hides the angle label of each {@link AngleMeasurement}.
|
|
67309
|
+
*
|
|
67310
|
+
* @param {Boolean} labelsShown Whether or not to show the labels.
|
|
67311
|
+
*/
|
|
67312
|
+
setLabelsShown(labelsShown) {
|
|
67313
|
+
for (const [key, measurement] of Object.entries(this.measurements)) {
|
|
67314
|
+
measurement.labelShown = labelsShown;
|
|
67315
|
+
}
|
|
67316
|
+
}
|
|
67317
|
+
|
|
66899
67318
|
/**
|
|
66900
67319
|
* Destroys all {@link AngleMeasurement}s.
|
|
66901
67320
|
*/
|
|
@@ -74472,7 +74891,7 @@ class CustomProjection extends Component {
|
|
|
74472
74891
|
this._inverseMatrixDirty = true;
|
|
74473
74892
|
this._transposedMatrixDirty = true;
|
|
74474
74893
|
this.glRedraw();
|
|
74475
|
-
this.fire("
|
|
74894
|
+
this.fire("matrix", this._state.matrix);
|
|
74476
74895
|
}
|
|
74477
74896
|
|
|
74478
74897
|
/**
|
|
@@ -80595,7 +81014,7 @@ class DistanceMeasurement extends Component {
|
|
|
80595
81014
|
this._wp = new Float64Array(24);
|
|
80596
81015
|
this._vp = new Float64Array(24);
|
|
80597
81016
|
this._pp = new Float64Array(24);
|
|
80598
|
-
this._cp = new
|
|
81017
|
+
this._cp = new Float64Array(8);
|
|
80599
81018
|
|
|
80600
81019
|
this._xAxisLabelCulled = false;
|
|
80601
81020
|
this._yAxisLabelCulled = false;
|
|
@@ -80603,66 +81022,112 @@ class DistanceMeasurement extends Component {
|
|
|
80603
81022
|
|
|
80604
81023
|
this._color = cfg.color || this.plugin.defaultColor;
|
|
80605
81024
|
|
|
81025
|
+
const onMouseOver = cfg.onMouseOver ? (event) => {
|
|
81026
|
+
cfg.onMouseOver(event, this);
|
|
81027
|
+
} : null;
|
|
81028
|
+
|
|
81029
|
+
const onMouseLeave = cfg.onMouseLeave ? (event) => {
|
|
81030
|
+
cfg.onMouseLeave(event, this);
|
|
81031
|
+
} : null;
|
|
81032
|
+
|
|
81033
|
+
const onContextMenu = cfg.onContextMenu ? (event) => {
|
|
81034
|
+
cfg.onContextMenu(event, this);
|
|
81035
|
+
} : null;
|
|
81036
|
+
|
|
80606
81037
|
this._originDot = new Dot(this._container, {
|
|
80607
81038
|
fillColor: this._color,
|
|
80608
|
-
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined
|
|
81039
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2 : undefined,
|
|
81040
|
+
onMouseOver,
|
|
81041
|
+
onMouseLeave,
|
|
81042
|
+
onContextMenu
|
|
80609
81043
|
});
|
|
80610
81044
|
|
|
80611
81045
|
this._targetDot = new Dot(this._container, {
|
|
80612
81046
|
fillColor: this._color,
|
|
80613
|
-
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2: undefined
|
|
81047
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2 : undefined,
|
|
81048
|
+
onMouseOver,
|
|
81049
|
+
onMouseLeave,
|
|
81050
|
+
onContextMenu
|
|
80614
81051
|
});
|
|
80615
81052
|
|
|
80616
81053
|
this._lengthWire = new Wire(this._container, {
|
|
80617
81054
|
color: this._color,
|
|
80618
81055
|
thickness: 2,
|
|
80619
|
-
|
|
81056
|
+
thicknessClickable: 6,
|
|
81057
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1 : undefined,
|
|
81058
|
+
onMouseOver,
|
|
81059
|
+
onMouseLeave,
|
|
81060
|
+
onContextMenu
|
|
80620
81061
|
});
|
|
80621
81062
|
|
|
80622
81063
|
this._xAxisWire = new Wire(this._container, {
|
|
80623
|
-
color: "
|
|
81064
|
+
color: "#FF0000",
|
|
80624
81065
|
thickness: 1,
|
|
80625
|
-
|
|
81066
|
+
thicknessClickable: 6,
|
|
81067
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1 : undefined,
|
|
81068
|
+
onMouseOver,
|
|
81069
|
+
onMouseLeave,
|
|
81070
|
+
onContextMenu
|
|
80626
81071
|
});
|
|
80627
81072
|
|
|
80628
81073
|
this._yAxisWire = new Wire(this._container, {
|
|
80629
81074
|
color: "green",
|
|
80630
81075
|
thickness: 1,
|
|
80631
|
-
|
|
81076
|
+
thicknessClickable: 6,
|
|
81077
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1 : undefined,
|
|
81078
|
+
onMouseOver,
|
|
81079
|
+
onMouseLeave,
|
|
81080
|
+
onContextMenu
|
|
80632
81081
|
});
|
|
80633
81082
|
|
|
80634
81083
|
this._zAxisWire = new Wire(this._container, {
|
|
80635
81084
|
color: "blue",
|
|
80636
81085
|
thickness: 1,
|
|
80637
|
-
|
|
81086
|
+
thicknessClickable: 6,
|
|
81087
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1 : undefined,
|
|
81088
|
+
onMouseOver,
|
|
81089
|
+
onMouseLeave,
|
|
81090
|
+
onContextMenu
|
|
80638
81091
|
});
|
|
80639
81092
|
|
|
80640
81093
|
this._lengthLabel = new Label(this._container, {
|
|
80641
81094
|
fillColor: this._color,
|
|
80642
81095
|
prefix: "",
|
|
80643
81096
|
text: "",
|
|
80644
|
-
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 4: undefined
|
|
81097
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 4 : undefined,
|
|
81098
|
+
onMouseOver,
|
|
81099
|
+
onMouseLeave,
|
|
81100
|
+
onContextMenu
|
|
80645
81101
|
});
|
|
80646
81102
|
|
|
80647
81103
|
this._xAxisLabel = new Label(this._container, {
|
|
80648
81104
|
fillColor: "red",
|
|
80649
81105
|
prefix: "X",
|
|
80650
81106
|
text: "",
|
|
80651
|
-
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3: undefined
|
|
81107
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3 : undefined,
|
|
81108
|
+
onMouseOver,
|
|
81109
|
+
onMouseLeave,
|
|
81110
|
+
onContextMenu
|
|
80652
81111
|
});
|
|
80653
81112
|
|
|
80654
81113
|
this._yAxisLabel = new Label(this._container, {
|
|
80655
81114
|
fillColor: "green",
|
|
80656
81115
|
prefix: "Y",
|
|
80657
81116
|
text: "",
|
|
80658
|
-
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3: undefined
|
|
81117
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3 : undefined,
|
|
81118
|
+
onMouseOver,
|
|
81119
|
+
onMouseLeave,
|
|
81120
|
+
onContextMenu
|
|
80659
81121
|
});
|
|
80660
81122
|
|
|
80661
81123
|
this._zAxisLabel = new Label(this._container, {
|
|
80662
81124
|
fillColor: "blue",
|
|
80663
81125
|
prefix: "Z",
|
|
80664
81126
|
text: "",
|
|
80665
|
-
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3: undefined
|
|
81127
|
+
zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3 : undefined,
|
|
81128
|
+
onMouseOver,
|
|
81129
|
+
onMouseLeave,
|
|
81130
|
+
onContextMenu
|
|
80666
81131
|
});
|
|
80667
81132
|
|
|
80668
81133
|
this._wpDirty = false;
|
|
@@ -80675,6 +81140,8 @@ class DistanceMeasurement extends Component {
|
|
|
80675
81140
|
this._wireVisible = false;
|
|
80676
81141
|
this._axisVisible = false;
|
|
80677
81142
|
this._axisEnabled = true;
|
|
81143
|
+
this._labelsVisible = false;
|
|
81144
|
+
this._clickable = true;
|
|
80678
81145
|
|
|
80679
81146
|
this._originMarker.on("worldPos", (value) => {
|
|
80680
81147
|
this._originWorld.set(value || [0, 0, 0]);
|
|
@@ -80724,6 +81191,7 @@ class DistanceMeasurement extends Component {
|
|
|
80724
81191
|
this.targetVisible = cfg.targetVisible;
|
|
80725
81192
|
this.wireVisible = cfg.wireVisible;
|
|
80726
81193
|
this.axisVisible = cfg.axisVisible;
|
|
81194
|
+
this.labelsVisible = cfg.labelsVisible;
|
|
80727
81195
|
}
|
|
80728
81196
|
|
|
80729
81197
|
_update() {
|
|
@@ -80833,45 +81301,57 @@ class DistanceMeasurement extends Component {
|
|
|
80833
81301
|
this._yAxisWire.setStartAndEnd(cp[2], cp[3], cp[4], cp[5]);
|
|
80834
81302
|
this._zAxisWire.setStartAndEnd(cp[4], cp[5], cp[6], cp[7]);
|
|
80835
81303
|
|
|
80836
|
-
this.
|
|
80837
|
-
this._xAxisLabel.setPosOnWire(cp[0], cp[1], cp[2], cp[3]);
|
|
80838
|
-
this._yAxisLabel.setPosOnWire(cp[2], cp[3], cp[4], cp[5]);
|
|
80839
|
-
this._zAxisLabel.setPosOnWire(cp[4], cp[5], cp[6], cp[7]);
|
|
81304
|
+
if (!this.labelsVisible) {
|
|
80840
81305
|
|
|
80841
|
-
|
|
81306
|
+
this._lengthLabel.setCulled(true);
|
|
80842
81307
|
|
|
80843
|
-
|
|
80844
|
-
|
|
81308
|
+
this._xAxisLabel.setCulled(true);
|
|
81309
|
+
this._yAxisLabel.setCulled(true);
|
|
81310
|
+
this._zAxisLabel.setCulled(true);
|
|
80845
81311
|
|
|
80846
|
-
|
|
80847
|
-
const yAxisCanvasLength = Math.abs(lengthWire(cp[2], cp[3], cp[4], cp[5]));
|
|
80848
|
-
const zAxisCanvasLength = Math.abs(lengthWire(cp[4], cp[5], cp[6], cp[7]));
|
|
81312
|
+
} else {
|
|
80849
81313
|
|
|
80850
|
-
|
|
81314
|
+
this._lengthLabel.setPosOnWire(cp[0], cp[1], cp[6], cp[7]);
|
|
80851
81315
|
|
|
80852
|
-
|
|
80853
|
-
|
|
80854
|
-
|
|
81316
|
+
this._xAxisLabel.setPosOnWire(cp[0], cp[1], cp[2], cp[3]);
|
|
81317
|
+
this._yAxisLabel.setPosOnWire(cp[2], cp[3], cp[4], cp[5]);
|
|
81318
|
+
this._zAxisLabel.setPosOnWire(cp[4], cp[5], cp[6], cp[7]);
|
|
80855
81319
|
|
|
80856
|
-
|
|
80857
|
-
this._xAxisLabel.setText(tilde + Math.abs((this._targetWorld[0] - this._originWorld[0]) * scale).toFixed(2) + unitAbbrev);
|
|
80858
|
-
this._xAxisLabel.setVisible(this.axisVisible);
|
|
80859
|
-
} else {
|
|
80860
|
-
this._xAxisLabel.setVisible(false);
|
|
80861
|
-
}
|
|
81320
|
+
const tilde = this._approximate ? " ~ " : " = ";
|
|
80862
81321
|
|
|
80863
|
-
|
|
80864
|
-
this.
|
|
80865
|
-
this._yAxisLabel.setVisible(this.axisVisible);
|
|
80866
|
-
} else {
|
|
80867
|
-
this._yAxisLabel.setVisible(false);
|
|
80868
|
-
}
|
|
81322
|
+
this._length = Math.abs(math.lenVec3(math.subVec3(this._targetWorld, this._originWorld, distVec3)));
|
|
81323
|
+
this._lengthLabel.setText(tilde + (this._length * scale).toFixed(2) + unitAbbrev);
|
|
80869
81324
|
|
|
80870
|
-
|
|
80871
|
-
|
|
80872
|
-
|
|
80873
|
-
|
|
80874
|
-
this.
|
|
81325
|
+
const xAxisCanvasLength = Math.abs(lengthWire(cp[0], cp[1], cp[2], cp[3]));
|
|
81326
|
+
const yAxisCanvasLength = Math.abs(lengthWire(cp[2], cp[3], cp[4], cp[5]));
|
|
81327
|
+
const zAxisCanvasLength = Math.abs(lengthWire(cp[4], cp[5], cp[6], cp[7]));
|
|
81328
|
+
|
|
81329
|
+
const labelMinAxisLength = this.plugin.labelMinAxisLength;
|
|
81330
|
+
|
|
81331
|
+
this._xAxisLabelCulled = (xAxisCanvasLength < labelMinAxisLength);
|
|
81332
|
+
this._yAxisLabelCulled = (yAxisCanvasLength < labelMinAxisLength);
|
|
81333
|
+
this._zAxisLabelCulled = (zAxisCanvasLength < labelMinAxisLength);
|
|
81334
|
+
|
|
81335
|
+
if (!this._xAxisLabelCulled) {
|
|
81336
|
+
this._xAxisLabel.setText(tilde + Math.abs((this._targetWorld[0] - this._originWorld[0]) * scale).toFixed(2) + unitAbbrev);
|
|
81337
|
+
this._xAxisLabel.setCulled(!this.axisVisible);
|
|
81338
|
+
} else {
|
|
81339
|
+
this._xAxisLabel.setCulled(true);
|
|
81340
|
+
}
|
|
81341
|
+
|
|
81342
|
+
if (!this._yAxisLabelCulled) {
|
|
81343
|
+
this._yAxisLabel.setText(tilde + Math.abs((this._targetWorld[1] - this._originWorld[1]) * scale).toFixed(2) + unitAbbrev);
|
|
81344
|
+
this._yAxisLabel.setCulled(!this.axisVisible);
|
|
81345
|
+
} else {
|
|
81346
|
+
this._yAxisLabel.setCulled(true);
|
|
81347
|
+
}
|
|
81348
|
+
|
|
81349
|
+
if (!this._zAxisLabelCulled) {
|
|
81350
|
+
this._zAxisLabel.setText(tilde + Math.abs((this._targetWorld[2] - this._originWorld[2]) * scale).toFixed(2) + unitAbbrev);
|
|
81351
|
+
this._zAxisLabel.setCulled(!this.axisVisible);
|
|
81352
|
+
} else {
|
|
81353
|
+
this._zAxisLabel.setCulled(true);
|
|
81354
|
+
}
|
|
80875
81355
|
}
|
|
80876
81356
|
|
|
80877
81357
|
this._originDot.setVisible(this._visible && this._originVisible);
|
|
@@ -80880,7 +81360,7 @@ class DistanceMeasurement extends Component {
|
|
|
80880
81360
|
this._yAxisWire.setVisible(this.axisVisible);
|
|
80881
81361
|
this._zAxisWire.setVisible(this.axisVisible);
|
|
80882
81362
|
this._lengthWire.setVisible(this.wireVisible);
|
|
80883
|
-
this._lengthLabel.
|
|
81363
|
+
this._lengthLabel.setCulled(!this.wireVisible);
|
|
80884
81364
|
|
|
80885
81365
|
this._cpDirty = false;
|
|
80886
81366
|
}
|
|
@@ -80913,7 +81393,7 @@ class DistanceMeasurement extends Component {
|
|
|
80913
81393
|
get approximate() {
|
|
80914
81394
|
return this._approximate;
|
|
80915
81395
|
}
|
|
80916
|
-
|
|
81396
|
+
|
|
80917
81397
|
/**
|
|
80918
81398
|
* Gets the origin {@link Marker}.
|
|
80919
81399
|
*
|
|
@@ -80974,6 +81454,8 @@ class DistanceMeasurement extends Component {
|
|
|
80974
81454
|
this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled);
|
|
80975
81455
|
this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled);
|
|
80976
81456
|
this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled);
|
|
81457
|
+
this._cpDirty = true;
|
|
81458
|
+
this._needUpdate();
|
|
80977
81459
|
}
|
|
80978
81460
|
|
|
80979
81461
|
/**
|
|
@@ -81026,7 +81508,9 @@ class DistanceMeasurement extends Component {
|
|
|
81026
81508
|
}
|
|
81027
81509
|
|
|
81028
81510
|
/**
|
|
81029
|
-
* Sets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are
|
|
81511
|
+
* Sets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are enabled.
|
|
81512
|
+
*
|
|
81513
|
+
* Wires are only shown if enabled and visible.
|
|
81030
81514
|
*
|
|
81031
81515
|
* @type {Boolean}
|
|
81032
81516
|
*/
|
|
@@ -81040,20 +81524,26 @@ class DistanceMeasurement extends Component {
|
|
|
81040
81524
|
this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled);
|
|
81041
81525
|
this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled);
|
|
81042
81526
|
this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled);
|
|
81527
|
+
this._cpDirty = true;
|
|
81528
|
+
this._needUpdate();
|
|
81043
81529
|
}
|
|
81044
81530
|
|
|
81045
81531
|
/**
|
|
81046
|
-
* Gets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are
|
|
81532
|
+
* Gets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are enabled.
|
|
81533
|
+
*
|
|
81534
|
+
* Wires are only shown if enabled and visible.
|
|
81047
81535
|
*
|
|
81048
81536
|
* @type {Boolean}
|
|
81049
81537
|
*/
|
|
81050
81538
|
get axisEnabled() {
|
|
81051
81539
|
return this._axisEnabled;
|
|
81052
81540
|
}
|
|
81053
|
-
|
|
81541
|
+
|
|
81054
81542
|
/**
|
|
81055
81543
|
* Sets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.
|
|
81056
81544
|
*
|
|
81545
|
+
* Wires are only shown if enabled and visible.
|
|
81546
|
+
*
|
|
81057
81547
|
* @type {Boolean}
|
|
81058
81548
|
*/
|
|
81059
81549
|
set axisVisible(value) {
|
|
@@ -81066,11 +81556,15 @@ class DistanceMeasurement extends Component {
|
|
|
81066
81556
|
this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled);
|
|
81067
81557
|
this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled);
|
|
81068
81558
|
this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled);
|
|
81559
|
+
this._cpDirty = true;
|
|
81560
|
+
this._needUpdate();
|
|
81069
81561
|
}
|
|
81070
81562
|
|
|
81071
81563
|
/**
|
|
81072
81564
|
* Gets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.
|
|
81073
81565
|
*
|
|
81566
|
+
* Wires are only shown if enabled and visible.
|
|
81567
|
+
*
|
|
81074
81568
|
* @type {Boolean}
|
|
81075
81569
|
*/
|
|
81076
81570
|
get axisVisible() {
|
|
@@ -81099,6 +81593,78 @@ class DistanceMeasurement extends Component {
|
|
|
81099
81593
|
return this._wireVisible;
|
|
81100
81594
|
}
|
|
81101
81595
|
|
|
81596
|
+
/**
|
|
81597
|
+
* Sets if the labels are visible.
|
|
81598
|
+
*
|
|
81599
|
+
* @type {Boolean}
|
|
81600
|
+
*/
|
|
81601
|
+
set labelsVisible(value) {
|
|
81602
|
+
value = value !== undefined ? Boolean(value) : this.plugin.defaultLabelsVisible;
|
|
81603
|
+
this._labelsVisible = value;
|
|
81604
|
+
var labelsVisible = this._visible && this._labelsVisible;
|
|
81605
|
+
this._xAxisLabel.setVisible(labelsVisible && !this._xAxisLabelCulled && this._clickable && this._axisEnabled);
|
|
81606
|
+
this._yAxisLabel.setVisible(labelsVisible && !this._yAxisLabelCulled && this._clickable && this._axisEnabled);
|
|
81607
|
+
this._zAxisLabel.setVisible(labelsVisible && !this._zAxisLabelCulled && this._clickable && this._axisEnabled);
|
|
81608
|
+
this._lengthLabel.setVisible(labelsVisible);
|
|
81609
|
+
this._cpDirty = true;
|
|
81610
|
+
this._needUpdate();
|
|
81611
|
+
}
|
|
81612
|
+
|
|
81613
|
+
/**
|
|
81614
|
+
* Gets if the labels are visible.
|
|
81615
|
+
*
|
|
81616
|
+
* @type {Boolean}
|
|
81617
|
+
*/
|
|
81618
|
+
get labelsVisible() {
|
|
81619
|
+
return this._labelsVisible;
|
|
81620
|
+
}
|
|
81621
|
+
|
|
81622
|
+
/**
|
|
81623
|
+
* Sets if this DistanceMeasurement appears highlighted.
|
|
81624
|
+
* @param highlighted
|
|
81625
|
+
*/
|
|
81626
|
+
setHighlighted(highlighted) {
|
|
81627
|
+
this._originDot.setHighlighted(highlighted);
|
|
81628
|
+
this._targetDot.setHighlighted(highlighted);
|
|
81629
|
+
this._xAxisWire.setHighlighted(highlighted);
|
|
81630
|
+
this._yAxisWire.setHighlighted(highlighted);
|
|
81631
|
+
this._zAxisWire.setHighlighted(highlighted);
|
|
81632
|
+
this._xAxisLabel.setHighlighted(highlighted);
|
|
81633
|
+
this._yAxisLabel.setHighlighted(highlighted);
|
|
81634
|
+
this._zAxisLabel.setHighlighted(highlighted);
|
|
81635
|
+
this._lengthWire.setHighlighted(highlighted);
|
|
81636
|
+
this._lengthLabel.setHighlighted(highlighted);
|
|
81637
|
+
}
|
|
81638
|
+
|
|
81639
|
+
/**
|
|
81640
|
+
* Sets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events.
|
|
81641
|
+
*
|
|
81642
|
+
* @type {Boolean}
|
|
81643
|
+
*/
|
|
81644
|
+
set clickable(value) {
|
|
81645
|
+
value = !!value;
|
|
81646
|
+
this._clickable = value;
|
|
81647
|
+
this._originDot.setClickable(this._clickable);
|
|
81648
|
+
this._targetDot.setClickable(this._clickable);
|
|
81649
|
+
this._xAxisWire.setClickable(this._clickable);
|
|
81650
|
+
this._yAxisWire.setClickable(this._clickable);
|
|
81651
|
+
this._zAxisWire.setClickable(this._clickable);
|
|
81652
|
+
this._lengthWire.setClickable(this._clickable);
|
|
81653
|
+
this._xAxisLabel.setClickable(this._clickable);
|
|
81654
|
+
this._yAxisLabel.setClickable(this._clickable);
|
|
81655
|
+
this._zAxisLabel.setClickable(this._clickable);
|
|
81656
|
+
this._lengthLabel.setClickable(this._clickable);
|
|
81657
|
+
}
|
|
81658
|
+
|
|
81659
|
+
/**
|
|
81660
|
+
* Gets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events.
|
|
81661
|
+
*
|
|
81662
|
+
* @type {Boolean}
|
|
81663
|
+
*/
|
|
81664
|
+
get clickable() {
|
|
81665
|
+
return this._clickable;
|
|
81666
|
+
}
|
|
81667
|
+
|
|
81102
81668
|
/**
|
|
81103
81669
|
* @private
|
|
81104
81670
|
*/
|
|
@@ -87151,7 +87717,7 @@ class DistanceMeasurementsControl extends Component {
|
|
|
87151
87717
|
}
|
|
87152
87718
|
this._currentDistanceMeasurementByMouse.approximate = false;
|
|
87153
87719
|
}
|
|
87154
|
-
|
|
87720
|
+
this._currentDistanceMeasurementByMouse.clickable = true;
|
|
87155
87721
|
this.fire("measurementEnd", this._currentDistanceMeasurementByMouse);
|
|
87156
87722
|
this._currentDistanceMeasurementByMouse = null;
|
|
87157
87723
|
} else {
|
|
@@ -87186,6 +87752,7 @@ class DistanceMeasurementsControl extends Component {
|
|
|
87186
87752
|
this._currentDistanceMeasurementByMouseInittouchState.axisVisible = this._currentDistanceMeasurementByMouse.axisVisible && this.plugin.defaultAxisVisible;
|
|
87187
87753
|
this._currentDistanceMeasurementByMouseInittouchState.wireVisible = this._currentDistanceMeasurementByMouse.wireVisible;
|
|
87188
87754
|
this._currentDistanceMeasurementByMouseInittouchState.targetVisible = this._currentDistanceMeasurementByMouse.targetVisible;
|
|
87755
|
+
this._currentDistanceMeasurementByMouse.clickable = false;
|
|
87189
87756
|
this.fire("measurementStart", this._currentDistanceMeasurementByMouse);
|
|
87190
87757
|
}
|
|
87191
87758
|
}
|
|
@@ -87245,7 +87812,7 @@ class DistanceMeasurementsControl extends Component {
|
|
|
87245
87812
|
case SECOND_TOUCH_EXPECTED:
|
|
87246
87813
|
startDot.setVisible(false);
|
|
87247
87814
|
this._touchStartMarker.worldPos = pickResult.worldPos;
|
|
87248
|
-
|
|
87815
|
+
const measurement = plugin.createMeasurement({
|
|
87249
87816
|
id: math.createUUID(),
|
|
87250
87817
|
origin: {
|
|
87251
87818
|
entity: mouseHoverEntity,
|
|
@@ -87257,6 +87824,7 @@ class DistanceMeasurementsControl extends Component {
|
|
|
87257
87824
|
},
|
|
87258
87825
|
approximate: (!pickSurfacePrecisionEnabled)
|
|
87259
87826
|
});
|
|
87827
|
+
measurement.clickable = true;
|
|
87260
87828
|
touchState = FIRST_TOUCH_EXPECTED;
|
|
87261
87829
|
break;
|
|
87262
87830
|
}
|
|
@@ -87358,7 +87926,7 @@ const getCanvasPosFromEvent = function (event, canvasPos) {
|
|
|
87358
87926
|
*
|
|
87359
87927
|
* * [[Example 1: Model with distance measurements](https://xeokit.github.io/xeokit-sdk/examples/#measurements_distance_modelWithMeasurements)]
|
|
87360
87928
|
* * [[Example 2: Create distance measurements with mouse](https://xeokit.github.io/xeokit-sdk/examples/#measurements_distance_createWithMouse)]
|
|
87361
|
-
* * [[Example 3: Configuring units and scale](https://xeokit.github.io/xeokit-sdk/examples/#measurements_distance_unitsAndScale)
|
|
87929
|
+
* * [[Example 3: Configuring units and scale](https://xeokit.github.io/xeokit-sdk/examples/#measurements_distance_unitsAndScale)
|
|
87362
87930
|
*
|
|
87363
87931
|
* ## Overview
|
|
87364
87932
|
*
|
|
@@ -87481,6 +88049,78 @@ const getCanvasPosFromEvent = function (event, canvasPos) {
|
|
|
87481
88049
|
* metrics.units = "meters";
|
|
87482
88050
|
* metrics.scale = 10.0;
|
|
87483
88051
|
* ````
|
|
88052
|
+
*
|
|
88053
|
+
* ## Example 4: Attaching Mouse Handlers
|
|
88054
|
+
*
|
|
88055
|
+
* In our fourth example, we'll attach even handlers to our plugin, to catch when the user
|
|
88056
|
+
* hovers or right-clicks over our measurements.
|
|
88057
|
+
*
|
|
88058
|
+
* [[Run example](https://xeokit.github.io/xeokit-sdk/examples/#measurements_distance_modelWithMeasurements)]
|
|
88059
|
+
*
|
|
88060
|
+
* ````javascript
|
|
88061
|
+
* import {Viewer, XKTLoaderPlugin, DistanceMeasurementsPlugin} from "xeokit-sdk.es.js";
|
|
88062
|
+
*
|
|
88063
|
+
* const viewer = new Viewer({
|
|
88064
|
+
* canvasId: "myCanvas",
|
|
88065
|
+
* transparent: true
|
|
88066
|
+
* });
|
|
88067
|
+
*
|
|
88068
|
+
* viewer.scene.camera.eye = [-2.37, 18.97, -26.12];
|
|
88069
|
+
* viewer.scene.camera.look = [10.97, 5.82, -11.22];
|
|
88070
|
+
* viewer.scene.camera.up = [0.36, 0.83, 0.40];
|
|
88071
|
+
*
|
|
88072
|
+
* const xktLoader = new XKTLoaderPlugin(viewer);
|
|
88073
|
+
*
|
|
88074
|
+
* const distanceMeasurements = new DistanceMeasurementsPlugin(viewer);
|
|
88075
|
+
*
|
|
88076
|
+
* distanceMeasurements.on("mouseOver", (e) => {
|
|
88077
|
+
* e.measurement.setHighlighted(true);
|
|
88078
|
+
* });
|
|
88079
|
+
*
|
|
88080
|
+
* distanceMeasurements.on("mouseLeave", (e) => {
|
|
88081
|
+
* e.measurement.setHighlighted(false);
|
|
88082
|
+
* });
|
|
88083
|
+
*
|
|
88084
|
+
* distanceMeasurements.on("contextMenu", (e) => {
|
|
88085
|
+
* // Show context menu
|
|
88086
|
+
* e.event.preventDefault();
|
|
88087
|
+
* });
|
|
88088
|
+
*
|
|
88089
|
+
* const model = xktLoader.load({
|
|
88090
|
+
* src: "./models/xkt/duplex/duplex.xkt"
|
|
88091
|
+
* });
|
|
88092
|
+
*
|
|
88093
|
+
* model.on("loaded", () => {
|
|
88094
|
+
*
|
|
88095
|
+
* const myMeasurement1 = distanceMeasurements.createMeasurement({
|
|
88096
|
+
* id: "distanceMeasurement1",
|
|
88097
|
+
* origin: {
|
|
88098
|
+
* entity: viewer.scene.objects["2O2Fr$t4X7Zf8NOew3FLOH"],
|
|
88099
|
+
* worldPos: [0.044, 5.998, 17.767]
|
|
88100
|
+
* },
|
|
88101
|
+
* target: {
|
|
88102
|
+
* entity: viewer.scene.objects["2O2Fr$t4X7Zf8NOew3FLOH"],
|
|
88103
|
+
* worldPos: [4.738, 3.172, 17.768]
|
|
88104
|
+
* },
|
|
88105
|
+
* visible: true,
|
|
88106
|
+
* wireVisible: true
|
|
88107
|
+
* });
|
|
88108
|
+
*
|
|
88109
|
+
* const myMeasurement2 = distanceMeasurements.createMeasurement({
|
|
88110
|
+
* id: "distanceMeasurement2",
|
|
88111
|
+
* origin: {
|
|
88112
|
+
* entity: viewer.scene.objects["2O2Fr$t4X7Zf8NOew3FNr2"],
|
|
88113
|
+
* worldPos: [0.457, 2.532, 17.766]
|
|
88114
|
+
* },
|
|
88115
|
+
* target: {
|
|
88116
|
+
* entity: viewer.scene.objects["1CZILmCaHETO8tf3SgGEXu"],
|
|
88117
|
+
* worldPos: [0.436, 0.001, 22.135]
|
|
88118
|
+
* },
|
|
88119
|
+
* visible: true,
|
|
88120
|
+
* wireVisible: true
|
|
88121
|
+
* });
|
|
88122
|
+
* });
|
|
88123
|
+
* ````
|
|
87484
88124
|
*/
|
|
87485
88125
|
class DistanceMeasurementsPlugin extends Plugin {
|
|
87486
88126
|
|
|
@@ -87495,10 +88135,11 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
87495
88135
|
* @param {boolean} [cfg.defaultOriginVisible=true] The default value of the DistanceMeasurements `originVisible` property.
|
|
87496
88136
|
* @param {boolean} [cfg.defaultTargetVisible=true] The default value of the DistanceMeasurements `targetVisible` property.
|
|
87497
88137
|
* @param {boolean} [cfg.defaultWireVisible=true] The default value of the DistanceMeasurements `wireVisible` property.
|
|
88138
|
+
* @param {boolean} [cfg.defaultLabelsVisible=true] The default value of the DistanceMeasurements `labelsVisible` property.
|
|
87498
88139
|
* @param {boolean} [cfg.defaultAxisVisible=true] The default value of the DistanceMeasurements `axisVisible` property.
|
|
87499
|
-
* @param {boolean} [cfg.defaultAxisEnabled=true] The default value of the DistanceMeasurements `axisVisible` property.
|
|
87500
88140
|
* @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
|
|
87501
88141
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
88142
|
+
*
|
|
87502
88143
|
*/
|
|
87503
88144
|
constructor(viewer, cfg = {}) {
|
|
87504
88145
|
|
|
@@ -87516,9 +88157,34 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
87516
88157
|
this.defaultOriginVisible = cfg.defaultOriginVisible !== false;
|
|
87517
88158
|
this.defaultTargetVisible = cfg.defaultTargetVisible !== false;
|
|
87518
88159
|
this.defaultWireVisible = cfg.defaultWireVisible !== false;
|
|
88160
|
+
this.defaultLabelsVisible = cfg.defaultLabelsVisible !== false;
|
|
87519
88161
|
this.defaultAxisVisible = cfg.defaultAxisVisible !== false;
|
|
87520
88162
|
this.defaultColor = cfg.defaultColor !== undefined ? cfg.defaultColor : "#00BBFF";
|
|
87521
88163
|
this.zIndex = cfg.zIndex || 10000;
|
|
88164
|
+
|
|
88165
|
+
this._onMouseOver = (event, measurement) => {
|
|
88166
|
+
this.fire("mouseOver", {
|
|
88167
|
+
plugin: this,
|
|
88168
|
+
measurement,
|
|
88169
|
+
event
|
|
88170
|
+
});
|
|
88171
|
+
};
|
|
88172
|
+
|
|
88173
|
+
this._onMouseLeave = (event, measurement) => {
|
|
88174
|
+
this.fire("mouseLeave", {
|
|
88175
|
+
plugin: this,
|
|
88176
|
+
measurement,
|
|
88177
|
+
event
|
|
88178
|
+
});
|
|
88179
|
+
};
|
|
88180
|
+
|
|
88181
|
+
this._onContextMenu = (event, measurement) => {
|
|
88182
|
+
this.fire("contextMenu", {
|
|
88183
|
+
plugin: this,
|
|
88184
|
+
measurement,
|
|
88185
|
+
event
|
|
88186
|
+
});
|
|
88187
|
+
};
|
|
87522
88188
|
}
|
|
87523
88189
|
|
|
87524
88190
|
/**
|
|
@@ -87589,6 +88255,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
87589
88255
|
* @param {Boolean} [params.targetVisible=true] Whether to initially show the {@link DistanceMeasurement} target.
|
|
87590
88256
|
* @param {Boolean} [params.wireVisible=true] Whether to initially show the direct point-to-point wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
|
|
87591
88257
|
* @param {Boolean} [params.axisVisible=true] Whether to initially show the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
|
|
88258
|
+
* @param {Boolean} [params.labelsVisible=true] Whether to initially show the labels.
|
|
87592
88259
|
* @param {string} [params.color] The color of the length dot, wire and label.
|
|
87593
88260
|
* @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
|
|
87594
88261
|
*/
|
|
@@ -87614,9 +88281,13 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
87614
88281
|
visible: params.visible,
|
|
87615
88282
|
wireVisible: params.wireVisible,
|
|
87616
88283
|
axisVisible: params.axisVisible !== false && this.defaultAxisVisible !== false,
|
|
88284
|
+
labelsVisible: params.labelsVisible !== false && this.defaultLabelsVisible !== false,
|
|
87617
88285
|
originVisible: params.originVisible,
|
|
87618
88286
|
targetVisible: params.targetVisible,
|
|
87619
|
-
color: params.color
|
|
88287
|
+
color: params.color,
|
|
88288
|
+
onMouseOver: this._onMouseOver,
|
|
88289
|
+
onMouseLeave: this._onMouseLeave,
|
|
88290
|
+
onContextMenu: this._onContextMenu
|
|
87620
88291
|
});
|
|
87621
88292
|
this._measurements[measurement.id] = measurement;
|
|
87622
88293
|
measurement.on("destroyed", () => {
|
|
@@ -87641,6 +88312,17 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
87641
88312
|
this.fire("measurementDestroyed", measurement);
|
|
87642
88313
|
}
|
|
87643
88314
|
|
|
88315
|
+
/**
|
|
88316
|
+
* Shows all or hides the angle label of each {@link DistanceMeasurement}.
|
|
88317
|
+
*
|
|
88318
|
+
* @param {Boolean} labelsShown Whether or not to show the labels.
|
|
88319
|
+
*/
|
|
88320
|
+
setLabelsShown(labelsShown) {
|
|
88321
|
+
for (const [key, measurement] of Object.entries(this.measurements)) {
|
|
88322
|
+
measurement.labelShown = labelsShown;
|
|
88323
|
+
}
|
|
88324
|
+
}
|
|
88325
|
+
|
|
87644
88326
|
/**
|
|
87645
88327
|
* Destroys all {@link DistanceMeasurement}s.
|
|
87646
88328
|
*/
|
|
@@ -102787,6 +103469,7 @@ class ModelTreeView {
|
|
|
102787
103469
|
numEntities: 0,
|
|
102788
103470
|
numVisibleEntities: 0,
|
|
102789
103471
|
checked: false,
|
|
103472
|
+
xrayed: false,
|
|
102790
103473
|
children: []
|
|
102791
103474
|
};
|
|
102792
103475
|
this._rootNodes.push(buildingNode);
|
|
@@ -102805,6 +103488,7 @@ class ModelTreeView {
|
|
|
102805
103488
|
numEntities: 0,
|
|
102806
103489
|
numVisibleEntities: 0,
|
|
102807
103490
|
checked: false,
|
|
103491
|
+
xrayed: false,
|
|
102808
103492
|
children: []
|
|
102809
103493
|
};
|
|
102810
103494
|
buildingNode.children.push(storeyNode);
|
|
@@ -102829,6 +103513,7 @@ class ModelTreeView {
|
|
|
102829
103513
|
numEntities: 0,
|
|
102830
103514
|
numVisibleEntities: 0,
|
|
102831
103515
|
checked: false,
|
|
103516
|
+
xrayed: false,
|
|
102832
103517
|
children: []
|
|
102833
103518
|
};
|
|
102834
103519
|
storeyNode.children.push(typeNode);
|
|
@@ -102844,6 +103529,7 @@ class ModelTreeView {
|
|
|
102844
103529
|
numEntities: 0,
|
|
102845
103530
|
numVisibleEntities: 0,
|
|
102846
103531
|
checked: false,
|
|
103532
|
+
xrayed: false,
|
|
102847
103533
|
children: []
|
|
102848
103534
|
};
|
|
102849
103535
|
typeNode.children.push(node);
|
|
@@ -102877,6 +103563,7 @@ class ModelTreeView {
|
|
|
102877
103563
|
numEntities: 0,
|
|
102878
103564
|
numVisibleEntities: 0,
|
|
102879
103565
|
checked: false,
|
|
103566
|
+
xrayed: false,
|
|
102880
103567
|
children: []
|
|
102881
103568
|
};
|
|
102882
103569
|
this._rootNodes.push(rootNode);
|
|
@@ -102898,6 +103585,7 @@ class ModelTreeView {
|
|
|
102898
103585
|
numEntities: 0,
|
|
102899
103586
|
numVisibleEntities: 0,
|
|
102900
103587
|
checked: false,
|
|
103588
|
+
xrayed: false,
|
|
102901
103589
|
children: []
|
|
102902
103590
|
};
|
|
102903
103591
|
rootNode.children.push(typeNode);
|
|
@@ -102913,6 +103601,7 @@ class ModelTreeView {
|
|
|
102913
103601
|
numEntities: 0,
|
|
102914
103602
|
numVisibleEntities: 0,
|
|
102915
103603
|
checked: false,
|
|
103604
|
+
xrayed: false,
|
|
102916
103605
|
children: []
|
|
102917
103606
|
};
|
|
102918
103607
|
typeNode.children.push(node);
|
|
@@ -102945,6 +103634,7 @@ class ModelTreeView {
|
|
|
102945
103634
|
numEntities: 0,
|
|
102946
103635
|
numVisibleEntities: 0,
|
|
102947
103636
|
checked: false,
|
|
103637
|
+
xrayed: false,
|
|
102948
103638
|
children: []
|
|
102949
103639
|
};
|
|
102950
103640
|
if (parent) {
|
|
@@ -163207,16 +163897,17 @@ class WebIFCLoaderPlugin extends Plugin {
|
|
|
163207
163897
|
ctx.stats.numPropertySets++;
|
|
163208
163898
|
const relatedObjects = rel.RelatedObjects;
|
|
163209
163899
|
if (!relatedObjects || relatedObjects.length === 0) {
|
|
163210
|
-
|
|
163211
|
-
|
|
163212
|
-
|
|
163213
|
-
|
|
163214
|
-
|
|
163215
|
-
|
|
163216
|
-
|
|
163217
|
-
|
|
163218
|
-
metaObject.propertySetIds
|
|
163900
|
+
return;
|
|
163901
|
+
}
|
|
163902
|
+
for (let i = 0, len = relatedObjects.length; i < len; i++) {
|
|
163903
|
+
const relatedObject = relatedObjects[i];
|
|
163904
|
+
const metaObjectId = relatedObject.GlobalId.value;
|
|
163905
|
+
const metaObject = ctx.metaObjects[metaObjectId];
|
|
163906
|
+
if (metaObject) {
|
|
163907
|
+
if (!metaObject.propertySetIds) {
|
|
163908
|
+
metaObject.propertySetIds = [];
|
|
163219
163909
|
}
|
|
163910
|
+
metaObject.propertySetIds.push(propertySetId);
|
|
163220
163911
|
}
|
|
163221
163912
|
}
|
|
163222
163913
|
}
|
|
@@ -163659,9 +164350,11 @@ class LASLoaderPlugin extends Plugin {
|
|
|
163659
164350
|
}
|
|
163660
164351
|
|
|
163661
164352
|
const options = {
|
|
163662
|
-
|
|
163663
|
-
|
|
163664
|
-
|
|
164353
|
+
las: {
|
|
164354
|
+
skip: this._skip,
|
|
164355
|
+
fp64: this._fp64,
|
|
164356
|
+
colorDepth: this._colorDepth
|
|
164357
|
+
}
|
|
163665
164358
|
};
|
|
163666
164359
|
|
|
163667
164360
|
if (params.src) {
|