@inweb/viewer-three 27.9.1 → 27.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensions/loaders/GLTFCloudLoader.js +4 -2
- package/dist/extensions/loaders/GLTFCloudLoader.js.map +1 -1
- package/dist/extensions/loaders/GLTFCloudLoader.min.js +1 -1
- package/dist/extensions/loaders/GLTFCloudLoader.module.js +4 -2
- package/dist/extensions/loaders/GLTFCloudLoader.module.js.map +1 -1
- package/dist/extensions/loaders/GLTFFileLoader.js +2 -0
- package/dist/extensions/loaders/GLTFFileLoader.js.map +1 -1
- package/dist/extensions/loaders/GLTFFileLoader.min.js +1 -1
- package/dist/extensions/loaders/GLTFFileLoader.module.js +2 -0
- package/dist/extensions/loaders/GLTFFileLoader.module.js.map +1 -1
- package/dist/extensions/loaders/IFCXLoader.js +6 -2
- package/dist/extensions/loaders/IFCXLoader.js.map +1 -1
- package/dist/extensions/loaders/IFCXLoader.min.js +1 -1
- package/dist/extensions/loaders/IFCXLoader.module.js +6 -2
- package/dist/extensions/loaders/IFCXLoader.module.js.map +1 -1
- package/dist/extensions/loaders/PotreeLoader.js +2 -0
- package/dist/extensions/loaders/PotreeLoader.js.map +1 -1
- package/dist/extensions/loaders/PotreeLoader.min.js +1 -1
- package/dist/extensions/loaders/PotreeLoader.module.js +2 -0
- package/dist/extensions/loaders/PotreeLoader.module.js.map +1 -1
- package/dist/viewer-three.js +880 -258
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +4 -4
- package/dist/viewer-three.module.js +765 -258
- package/dist/viewer-three.module.js.map +1 -1
- package/extensions/loaders/GLTFCloudLoader.ts +5 -3
- package/extensions/loaders/GLTFFileLoader.ts +2 -0
- package/extensions/loaders/IFCX/IFCXCloudLoader.ts +5 -3
- package/extensions/loaders/IFCX/IFCXFileLoader.ts +2 -0
- package/extensions/loaders/Potree/PotreeFileLoader.ts +2 -0
- package/lib/Viewer/Viewer.d.ts +28 -10
- package/lib/Viewer/commands/Deselect.d.ts +2 -0
- package/lib/Viewer/commands/Explode.d.ts +1 -1
- package/lib/Viewer/commands/GetHidden.d.ts +2 -0
- package/lib/Viewer/commands/GetIsolated.d.ts +2 -0
- package/lib/Viewer/commands/GetSelected.d.ts +1 -1
- package/lib/Viewer/commands/Hide.d.ts +2 -0
- package/lib/Viewer/commands/HideAll.d.ts +2 -0
- package/lib/Viewer/commands/Isolate.d.ts +2 -0
- package/lib/Viewer/commands/Select.d.ts +2 -0
- package/lib/Viewer/commands/SetSelected.d.ts +1 -1
- package/lib/Viewer/commands/SetSelected2.d.ts +1 -1
- package/lib/Viewer/commands/Show.d.ts +2 -0
- package/lib/Viewer/commands/ToHandles.d.ts +2 -0
- package/lib/Viewer/commands/ToHandles2.d.ts +2 -0
- package/lib/Viewer/commands/ToggleSelection.d.ts +2 -0
- package/lib/Viewer/commands/Zoom.d.ts +3 -0
- package/lib/Viewer/commands/ZoomExtents.d.ts +2 -0
- package/lib/Viewer/commands/ZoomTo.d.ts +1 -2
- package/lib/Viewer/components/HighlighterComponent.d.ts +4 -3
- package/lib/Viewer/components/SelectionComponent.d.ts +1 -9
- package/lib/Viewer/components/index.d.ts +1 -1
- package/lib/Viewer/draggers/index.d.ts +2 -2
- package/lib/Viewer/loaders/DynamicGltfLoader/DynamicModelImpl.d.ts +10 -8
- package/lib/Viewer/loaders/GLTFCloudDynamicLoader.d.ts +5 -1
- package/lib/Viewer/loaders/GLTFFileDynamicLoader.d.ts +5 -1
- package/lib/Viewer/loaders/index.d.ts +5 -1
- package/lib/Viewer/models/Highlighter.types.d.ts +5 -0
- package/lib/Viewer/models/ModelImpl.d.ts +15 -11
- package/lib/Viewer/models/ModelImpl.types.d.ts +22 -0
- package/lib/index.d.ts +1 -1
- package/package.json +5 -5
- package/src/Viewer/Viewer.ts +132 -27
- package/src/Viewer/commands/ClearSelected.ts +3 -6
- package/src/Viewer/commands/Deselect.ts +35 -0
- package/src/Viewer/commands/Explode.ts +4 -3
- package/src/Viewer/commands/GetHidden.ts +30 -0
- package/src/Viewer/commands/GetIsolated.ts +30 -0
- package/src/Viewer/commands/GetSelected.ts +4 -4
- package/src/Viewer/commands/GetSelected2.ts +4 -7
- package/src/Viewer/commands/Hide.ts +35 -0
- package/src/Viewer/commands/HideAll.ts +32 -0
- package/src/Viewer/commands/HideSelected.ts +1 -11
- package/src/Viewer/commands/Isolate.ts +41 -0
- package/src/Viewer/commands/IsolateSelected.ts +1 -4
- package/src/Viewer/commands/ResetView.ts +1 -1
- package/src/Viewer/commands/Select.ts +36 -0
- package/src/Viewer/commands/SelectModel.ts +4 -8
- package/src/Viewer/commands/SetDefaultViewPosition.ts +2 -2
- package/src/Viewer/commands/SetSelected.ts +8 -11
- package/src/Viewer/commands/SetSelected2.ts +5 -16
- package/src/Viewer/commands/Show.ts +34 -0
- package/src/Viewer/commands/ShowAll.ts +2 -2
- package/src/Viewer/commands/{ZoomToObjects.ts → ToHandles.ts} +7 -10
- package/src/Viewer/commands/ToHandles2.ts +43 -0
- package/src/Viewer/commands/ToggleSelection.ts +40 -0
- package/src/Viewer/commands/Zoom.ts +66 -0
- package/src/Viewer/commands/{ZoomToExtents.ts → ZoomExtents.ts} +3 -3
- package/src/Viewer/commands/ZoomTo.ts +12 -38
- package/src/Viewer/commands/ZoomToSelected.ts +1 -7
- package/src/Viewer/commands/index.ts +24 -5
- package/src/Viewer/components/HighlighterComponent.ts +14 -12
- package/src/Viewer/components/SelectionComponent.ts +13 -77
- package/src/Viewer/components/index.ts +1 -1
- package/src/Viewer/draggers/OrbitDragger.ts +2 -2
- package/src/Viewer/draggers/index.ts +2 -2
- package/src/Viewer/loaders/DynamicGltfLoader/DynamicGltfLoader.js +429 -2
- package/src/Viewer/loaders/DynamicGltfLoader/DynamicModelImpl.ts +26 -35
- package/src/Viewer/loaders/GLTFCloudDynamicLoader.ts +33 -3
- package/src/Viewer/loaders/GLTFFileDynamicLoader.ts +32 -2
- package/src/Viewer/loaders/index.ts +5 -1
- package/src/Viewer/models/Highlighter.types.ts +30 -0
- package/src/Viewer/models/ModelImpl.ts +69 -58
- package/src/Viewer/models/{IModelImpl.ts → ModelImpl.types.ts} +8 -17
- package/src/index.ts +1 -1
- package/lib/Viewer/commands/ZoomToExtents.d.ts +0 -2
- package/lib/Viewer/commands/ZoomToObjects.d.ts +0 -2
- package/lib/Viewer/models/IModelImpl.d.ts +0 -26
package/dist/viewer-three.js
CHANGED
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
}
|
|
59
59
|
const { handler, thisArg } = command;
|
|
60
60
|
const result = handler.apply(thisArg, [viewer, ...args]);
|
|
61
|
-
viewer === null || viewer === void 0 ? void 0 : viewer.emit({ type: "command", data: id, args });
|
|
61
|
+
viewer === null || viewer === void 0 ? void 0 : viewer.emit({ type: "command", data: id, args, result });
|
|
62
62
|
return result;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -718,6 +718,119 @@
|
|
|
718
718
|
};
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
|
+
class Selector {
|
|
722
|
+
constructor(models) {
|
|
723
|
+
this.models = models;
|
|
724
|
+
this.selected = new Set();
|
|
725
|
+
}
|
|
726
|
+
setSelected(handles) {
|
|
727
|
+
const newSelected = new Set(handles);
|
|
728
|
+
const toUnhighlight = [];
|
|
729
|
+
const toHighlight = [];
|
|
730
|
+
for (const handle of this.selected) {
|
|
731
|
+
if (!newSelected.has(handle))
|
|
732
|
+
toUnhighlight.push(handle);
|
|
733
|
+
}
|
|
734
|
+
for (const handle of newSelected) {
|
|
735
|
+
if (!this.selected.has(handle))
|
|
736
|
+
toHighlight.push(handle);
|
|
737
|
+
}
|
|
738
|
+
this.selected = newSelected;
|
|
739
|
+
if (toUnhighlight.length > 0) {
|
|
740
|
+
this.models.forEach((model) => model.unhighlight(toUnhighlight));
|
|
741
|
+
}
|
|
742
|
+
if (toHighlight.length > 0) {
|
|
743
|
+
this.models.forEach((model) => model.highlight(toHighlight));
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
select(handles) {
|
|
747
|
+
const toHighlight = [];
|
|
748
|
+
for (const handle of handles) {
|
|
749
|
+
if (!this.selected.has(handle)) {
|
|
750
|
+
this.selected.add(handle);
|
|
751
|
+
toHighlight.push(handle);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
if (toHighlight.length > 0) {
|
|
755
|
+
this.models.forEach((model) => model.highlight(toHighlight));
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
deselect(handles) {
|
|
759
|
+
const toUnhighlight = [];
|
|
760
|
+
for (const handle of handles) {
|
|
761
|
+
if (this.selected.delete(handle))
|
|
762
|
+
toUnhighlight.push(handle);
|
|
763
|
+
}
|
|
764
|
+
if (toUnhighlight.length > 0) {
|
|
765
|
+
this.models.forEach((model) => model.unhighlight(toUnhighlight));
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
clearSelected() {
|
|
769
|
+
if (this.selected.size === 0)
|
|
770
|
+
return;
|
|
771
|
+
const toUnhighlight = Array.from(this.selected);
|
|
772
|
+
this.selected.clear();
|
|
773
|
+
this.models.forEach((model) => model.unhighlight(toUnhighlight));
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
class VisibilityManager {
|
|
777
|
+
constructor(models) {
|
|
778
|
+
this.models = models;
|
|
779
|
+
this.defaultVisible = true;
|
|
780
|
+
this.exceptions = new Set();
|
|
781
|
+
}
|
|
782
|
+
get hidden() {
|
|
783
|
+
if (this.defaultVisible)
|
|
784
|
+
return this.exceptions;
|
|
785
|
+
else if (this.exceptions.size > 0)
|
|
786
|
+
return new Set();
|
|
787
|
+
else
|
|
788
|
+
return new Set(["$all"]);
|
|
789
|
+
}
|
|
790
|
+
get isolated() {
|
|
791
|
+
if (!this.defaultVisible)
|
|
792
|
+
return this.exceptions;
|
|
793
|
+
else
|
|
794
|
+
return new Set();
|
|
795
|
+
}
|
|
796
|
+
hide(handles) {
|
|
797
|
+
for (const handle of handles) {
|
|
798
|
+
if (this.defaultVisible)
|
|
799
|
+
this.exceptions.add(handle);
|
|
800
|
+
else
|
|
801
|
+
this.exceptions.delete(handle);
|
|
802
|
+
}
|
|
803
|
+
if (handles.length > 0) {
|
|
804
|
+
this.models.forEach((model) => model.hide(handles));
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
hideAll() {
|
|
808
|
+
this.defaultVisible = false;
|
|
809
|
+
this.exceptions.clear();
|
|
810
|
+
this.models.forEach((model) => model.hideAll());
|
|
811
|
+
}
|
|
812
|
+
isolate(handles) {
|
|
813
|
+
this.defaultVisible = false;
|
|
814
|
+
this.exceptions = new Set(handles);
|
|
815
|
+
this.models.forEach((model) => model.isolate(handles));
|
|
816
|
+
}
|
|
817
|
+
show(handles) {
|
|
818
|
+
for (const handle of handles) {
|
|
819
|
+
if (this.defaultVisible)
|
|
820
|
+
this.exceptions.delete(handle);
|
|
821
|
+
else
|
|
822
|
+
this.exceptions.add(handle);
|
|
823
|
+
}
|
|
824
|
+
if (handles.length > 0) {
|
|
825
|
+
this.models.forEach((model) => model.show(handles));
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
showAll() {
|
|
829
|
+
this.defaultVisible = true;
|
|
830
|
+
this.exceptions.clear();
|
|
831
|
+
this.models.forEach((model) => model.showAll());
|
|
832
|
+
}
|
|
833
|
+
}
|
|
721
834
|
|
|
722
835
|
/**
|
|
723
836
|
* @license
|
|
@@ -35114,7 +35227,7 @@ void main() {
|
|
|
35114
35227
|
this.viewer.addEventListener("drawviewpoint", this.updateControls);
|
|
35115
35228
|
this.viewer.addEventListener("changecameramode", this.updateControlsCamera);
|
|
35116
35229
|
this.viewer.addEventListener("optionschange", this.updateZoomSpeed);
|
|
35117
|
-
this.viewer.addEventListener("contextmenu", this.stopContextMenu);
|
|
35230
|
+
this.viewer.canvas.addEventListener("contextmenu", this.stopContextMenu);
|
|
35118
35231
|
this.updateControls();
|
|
35119
35232
|
this.updateControlsCamera();
|
|
35120
35233
|
}
|
|
@@ -35126,7 +35239,7 @@ void main() {
|
|
|
35126
35239
|
this.viewer.removeEventListener("drawviewpoint", this.updateControls);
|
|
35127
35240
|
this.viewer.removeEventListener("changecameramode", this.updateControlsCamera);
|
|
35128
35241
|
this.viewer.removeEventListener("optionschange", this.updateZoomSpeed);
|
|
35129
|
-
this.viewer.removeEventListener("contextmenu", this.stopContextMenu);
|
|
35242
|
+
this.viewer.canvas.removeEventListener("contextmenu", this.stopContextMenu);
|
|
35130
35243
|
this.orbit.removeEventListener("start", this.controlsStart);
|
|
35131
35244
|
this.orbit.removeEventListener("change", this.controlsChange);
|
|
35132
35245
|
this.orbit.dispose();
|
|
@@ -36595,17 +36708,44 @@ void main() {
|
|
|
36595
36708
|
}
|
|
36596
36709
|
|
|
36597
36710
|
function clearSelected(viewer) {
|
|
36598
|
-
|
|
36599
|
-
|
|
36711
|
+
viewer.selector.clearSelected();
|
|
36712
|
+
viewer.emitEvent({ type: "select" });
|
|
36713
|
+
viewer.emitEvent({ type: "select2" });
|
|
36600
36714
|
viewer.update();
|
|
36601
|
-
viewer.emitEvent({ type: "select", handles: [] });
|
|
36602
|
-
viewer.emitEvent({ type: "select2", handles: [] });
|
|
36603
36715
|
}
|
|
36604
36716
|
|
|
36605
36717
|
function clearSlices(viewer) {
|
|
36606
36718
|
viewer.clearSlices();
|
|
36607
36719
|
}
|
|
36608
36720
|
|
|
36721
|
+
function toHandles2(viewer, handles = []) {
|
|
36722
|
+
if (!Array.isArray(handles))
|
|
36723
|
+
handles = [handles];
|
|
36724
|
+
if (handles.length === 0)
|
|
36725
|
+
return handles;
|
|
36726
|
+
if (handles[0].includes(":"))
|
|
36727
|
+
return handles;
|
|
36728
|
+
const handles2 = [];
|
|
36729
|
+
handles.forEach((handle) => {
|
|
36730
|
+
if (handle.includes(":")) {
|
|
36731
|
+
handles2.push(handle);
|
|
36732
|
+
}
|
|
36733
|
+
else
|
|
36734
|
+
viewer.models.forEach((model) => {
|
|
36735
|
+
handles2.push(`${model.id}:${handle}`);
|
|
36736
|
+
});
|
|
36737
|
+
});
|
|
36738
|
+
return handles2;
|
|
36739
|
+
}
|
|
36740
|
+
|
|
36741
|
+
function deselect(viewer, handles = []) {
|
|
36742
|
+
const handles2 = toHandles2(viewer, handles);
|
|
36743
|
+
viewer.selector.deselect(handles2);
|
|
36744
|
+
viewer.emitEvent({ type: "select" });
|
|
36745
|
+
viewer.emitEvent({ type: "select2" });
|
|
36746
|
+
viewer.update();
|
|
36747
|
+
}
|
|
36748
|
+
|
|
36609
36749
|
function getSnapshot(viewer, type, quality) {
|
|
36610
36750
|
var _a, _b;
|
|
36611
36751
|
viewer.update(true);
|
|
@@ -36617,16 +36757,17 @@ void main() {
|
|
|
36617
36757
|
return viewer.canvas.toDataURL(mimeType, imageQuality);
|
|
36618
36758
|
}
|
|
36619
36759
|
|
|
36620
|
-
function explode(viewer,
|
|
36621
|
-
viewer.models.forEach((model) => model.explode(
|
|
36760
|
+
function explode(viewer, scale = 0) {
|
|
36761
|
+
viewer.models.forEach((model) => model.explode(scale));
|
|
36762
|
+
viewer.explodeScale = scale;
|
|
36622
36763
|
viewer.update();
|
|
36623
|
-
viewer.emitEvent({ type: "explode", data:
|
|
36764
|
+
viewer.emitEvent({ type: "explode", data: scale });
|
|
36624
36765
|
}
|
|
36625
36766
|
function collect(viewer) {
|
|
36626
36767
|
explode(viewer, 0);
|
|
36627
36768
|
}
|
|
36628
36769
|
|
|
36629
|
-
function
|
|
36770
|
+
function zoom(viewer, box) {
|
|
36630
36771
|
if (box.isEmpty())
|
|
36631
36772
|
return;
|
|
36632
36773
|
const boxCenter = box.getCenter(new Vector3());
|
|
@@ -36686,7 +36827,7 @@ void main() {
|
|
|
36686
36827
|
viewer.target.copy(extentsCenter);
|
|
36687
36828
|
viewer.update();
|
|
36688
36829
|
viewer.emit({ type: "viewposition", data: position });
|
|
36689
|
-
|
|
36830
|
+
zoom(viewer, viewer.extents);
|
|
36690
36831
|
}
|
|
36691
36832
|
|
|
36692
36833
|
function getDefaultViewPositions() {
|
|
@@ -36697,34 +36838,72 @@ void main() {
|
|
|
36697
36838
|
return viewer.models.map((model) => model.id);
|
|
36698
36839
|
}
|
|
36699
36840
|
|
|
36700
|
-
function
|
|
36701
|
-
|
|
36841
|
+
function toHandles(viewer, handles2) {
|
|
36842
|
+
if (!Array.isArray(handles2))
|
|
36843
|
+
handles2 = [handles2];
|
|
36844
|
+
if (handles2.length === 0)
|
|
36845
|
+
return handles2;
|
|
36846
|
+
if (!handles2[0].includes(":"))
|
|
36847
|
+
return handles2;
|
|
36702
36848
|
const handles = handles2.map((handle) => handle.slice(handle.indexOf(":") + 1));
|
|
36703
36849
|
return handles;
|
|
36704
36850
|
}
|
|
36705
36851
|
|
|
36852
|
+
function getSelected(viewer, multimodel = false) {
|
|
36853
|
+
const handles2 = Array.from(viewer.selector.selected);
|
|
36854
|
+
return multimodel ? handles2 : toHandles(viewer, handles2);
|
|
36855
|
+
}
|
|
36856
|
+
|
|
36706
36857
|
function getSelected2(viewer) {
|
|
36707
|
-
|
|
36708
|
-
viewer.
|
|
36709
|
-
handles2.push(model.getHandlesByObjects(viewer.selected));
|
|
36710
|
-
});
|
|
36711
|
-
return handles2.flat();
|
|
36858
|
+
console.warn("getSelected2 command has been deprecated since 27.11 and will be removed in a future release, use getSelected instead");
|
|
36859
|
+
return viewer.executeCommand("getSelected", true);
|
|
36712
36860
|
}
|
|
36713
36861
|
|
|
36714
|
-
function
|
|
36715
|
-
|
|
36716
|
-
|
|
36717
|
-
|
|
36718
|
-
|
|
36862
|
+
function getHidden(viewer, multimodel = false) {
|
|
36863
|
+
const handles2 = Array.from(viewer.visibilityManager.hidden);
|
|
36864
|
+
return multimodel ? handles2 : toHandles(viewer, handles2);
|
|
36865
|
+
}
|
|
36866
|
+
|
|
36867
|
+
function getIsolated(viewer, multimodel = false) {
|
|
36868
|
+
const handles2 = Array.from(viewer.visibilityManager.isolated);
|
|
36869
|
+
return multimodel ? handles2 : toHandles(viewer, handles2);
|
|
36870
|
+
}
|
|
36871
|
+
|
|
36872
|
+
function hide(viewer, handles) {
|
|
36873
|
+
const handles2 = toHandles2(viewer, handles);
|
|
36874
|
+
viewer.deselect(handles2);
|
|
36875
|
+
viewer.visibilityManager.hide(handles2);
|
|
36719
36876
|
viewer.emitEvent({ type: "hide" });
|
|
36720
|
-
viewer.
|
|
36721
|
-
viewer.emitEvent({ type: "select2", handles: [] });
|
|
36877
|
+
viewer.update();
|
|
36722
36878
|
}
|
|
36723
36879
|
|
|
36724
|
-
function
|
|
36725
|
-
viewer.
|
|
36880
|
+
function hideAll(viewer) {
|
|
36881
|
+
viewer.clearSelected();
|
|
36882
|
+
viewer.visibilityManager.hideAll();
|
|
36883
|
+
viewer.emitEvent({ type: "hideall" });
|
|
36726
36884
|
viewer.update();
|
|
36885
|
+
}
|
|
36886
|
+
|
|
36887
|
+
function hideSelected(viewer) {
|
|
36888
|
+
viewer.hide(viewer.getSelected(true));
|
|
36889
|
+
}
|
|
36890
|
+
|
|
36891
|
+
function isolate(viewer, handles) {
|
|
36892
|
+
const handles2 = toHandles2(viewer, handles);
|
|
36893
|
+
const handlesSet = new Set(handles2);
|
|
36894
|
+
const toDeselect = [];
|
|
36895
|
+
for (const handle of viewer.selector.selected) {
|
|
36896
|
+
if (!handlesSet.has(handle))
|
|
36897
|
+
toDeselect.push(handle);
|
|
36898
|
+
}
|
|
36899
|
+
viewer.deselect(toDeselect);
|
|
36900
|
+
viewer.visibilityManager.isolate(handles2);
|
|
36727
36901
|
viewer.emitEvent({ type: "isolate" });
|
|
36902
|
+
viewer.update();
|
|
36903
|
+
}
|
|
36904
|
+
|
|
36905
|
+
function isolateSelected(viewer) {
|
|
36906
|
+
viewer.isolate(viewer.getSelected(true));
|
|
36728
36907
|
}
|
|
36729
36908
|
|
|
36730
36909
|
function regenerateAll(viewer) {
|
|
@@ -36739,17 +36918,25 @@ void main() {
|
|
|
36739
36918
|
viewer.executeCommand("clearSelected");
|
|
36740
36919
|
viewer.executeCommand("showAll");
|
|
36741
36920
|
viewer.executeCommand("explode", 0);
|
|
36742
|
-
viewer.executeCommand("
|
|
36921
|
+
viewer.executeCommand("zoomExtents");
|
|
36743
36922
|
viewer.emit({ type: "resetview" });
|
|
36744
36923
|
}
|
|
36745
36924
|
|
|
36746
|
-
function
|
|
36747
|
-
const
|
|
36748
|
-
|
|
36749
|
-
viewer.
|
|
36925
|
+
function select(viewer, handles = []) {
|
|
36926
|
+
const handles2 = toHandles2(viewer, handles);
|
|
36927
|
+
viewer.show(handles2);
|
|
36928
|
+
viewer.selector.select(handles2);
|
|
36929
|
+
viewer.emitEvent({ type: "select" });
|
|
36930
|
+
viewer.emitEvent({ type: "select2" });
|
|
36750
36931
|
viewer.update();
|
|
36751
|
-
|
|
36752
|
-
|
|
36932
|
+
}
|
|
36933
|
+
|
|
36934
|
+
function selectModel(viewer, id) {
|
|
36935
|
+
let handles = [];
|
|
36936
|
+
const model = viewer.models.find((model) => model.id === id);
|
|
36937
|
+
if (model)
|
|
36938
|
+
handles = model.getHandles();
|
|
36939
|
+
viewer.setSelected(handles);
|
|
36753
36940
|
}
|
|
36754
36941
|
|
|
36755
36942
|
function setActiveDragger(viewer, dragger = "") {
|
|
@@ -36761,60 +36948,64 @@ void main() {
|
|
|
36761
36948
|
}
|
|
36762
36949
|
|
|
36763
36950
|
function setSelected(viewer, handles = []) {
|
|
36764
|
-
const handles2 =
|
|
36765
|
-
|
|
36766
|
-
|
|
36767
|
-
|
|
36768
|
-
|
|
36769
|
-
|
|
36770
|
-
viewer.models.forEach((model) => {
|
|
36771
|
-
handles2.push(`${model.id}:${handle}`);
|
|
36772
|
-
});
|
|
36773
|
-
});
|
|
36774
|
-
viewer.executeCommand("setSelected2", handles2);
|
|
36951
|
+
const handles2 = toHandles2(viewer, handles);
|
|
36952
|
+
viewer.show(handles2);
|
|
36953
|
+
viewer.selector.setSelected(handles2);
|
|
36954
|
+
viewer.emitEvent({ type: "select" });
|
|
36955
|
+
viewer.emitEvent({ type: "select2" });
|
|
36956
|
+
viewer.update();
|
|
36775
36957
|
}
|
|
36776
36958
|
|
|
36777
|
-
function setSelected2(viewer,
|
|
36778
|
-
|
|
36779
|
-
|
|
36780
|
-
|
|
36781
|
-
|
|
36782
|
-
|
|
36783
|
-
|
|
36784
|
-
|
|
36785
|
-
viewer.update();
|
|
36959
|
+
function setSelected2(viewer, handles2 = []) {
|
|
36960
|
+
console.warn("setSelected2 command has been deprecated since 27.11 and will be removed in a future release, use setSelected instead");
|
|
36961
|
+
viewer.executeCommand("setSelected", handles2);
|
|
36962
|
+
}
|
|
36963
|
+
|
|
36964
|
+
function show(viewer, handles) {
|
|
36965
|
+
const handles2 = toHandles2(viewer, handles);
|
|
36966
|
+
viewer.visibilityManager.show(handles2);
|
|
36786
36967
|
viewer.emitEvent({ type: "show" });
|
|
36787
|
-
viewer.
|
|
36788
|
-
viewer.emitEvent({ type: "select2", data: undefined, handles });
|
|
36968
|
+
viewer.update();
|
|
36789
36969
|
}
|
|
36790
36970
|
|
|
36791
36971
|
function showAll(viewer) {
|
|
36792
|
-
viewer.
|
|
36793
|
-
viewer.update();
|
|
36972
|
+
viewer.visibilityManager.showAll();
|
|
36794
36973
|
viewer.emitEvent({ type: "showall" });
|
|
36974
|
+
viewer.update();
|
|
36795
36975
|
}
|
|
36796
36976
|
|
|
36797
|
-
function
|
|
36798
|
-
|
|
36977
|
+
function toggleSelection(viewer, handles = []) {
|
|
36978
|
+
const handles2 = toHandles2(viewer, handles);
|
|
36979
|
+
if (viewer.selector.selected.has(handles2[0])) {
|
|
36980
|
+
viewer.selector.deselect(handles2);
|
|
36981
|
+
}
|
|
36982
|
+
else {
|
|
36983
|
+
viewer.show(handles2);
|
|
36984
|
+
viewer.selector.select(handles2);
|
|
36985
|
+
}
|
|
36986
|
+
viewer.emitEvent({ type: "select" });
|
|
36987
|
+
viewer.emitEvent({ type: "select2" });
|
|
36988
|
+
viewer.update();
|
|
36989
|
+
}
|
|
36990
|
+
|
|
36991
|
+
function zoomExtents(viewer) {
|
|
36992
|
+
zoom(viewer, viewer.extents);
|
|
36799
36993
|
}
|
|
36800
36994
|
|
|
36801
|
-
function
|
|
36995
|
+
function zoomTo(viewer, handles = []) {
|
|
36996
|
+
const handles2 = toHandles2(viewer, handles);
|
|
36802
36997
|
const extents = new Box3();
|
|
36803
36998
|
viewer.models.forEach((model) => {
|
|
36804
|
-
const objects = model.getObjectsByHandles(
|
|
36999
|
+
const objects = model.getObjectsByHandles(handles2);
|
|
36805
37000
|
objects.forEach((object) => extents.expandByObject(object));
|
|
36806
37001
|
});
|
|
36807
37002
|
if (extents.isEmpty())
|
|
36808
37003
|
extents.copy(viewer.extents);
|
|
36809
|
-
|
|
37004
|
+
zoom(viewer, extents);
|
|
36810
37005
|
}
|
|
36811
37006
|
|
|
36812
37007
|
function zoomToSelected(viewer) {
|
|
36813
|
-
|
|
36814
|
-
viewer.selected.forEach((object) => extents.expandByObject(object));
|
|
36815
|
-
if (extents.isEmpty())
|
|
36816
|
-
extents.copy(viewer.extents);
|
|
36817
|
-
zoomTo(viewer, extents);
|
|
37008
|
+
zoomTo(viewer, viewer.getSelected(true));
|
|
36818
37009
|
}
|
|
36819
37010
|
|
|
36820
37011
|
const commands = commandsRegistry("threejs");
|
|
@@ -36823,25 +37014,34 @@ void main() {
|
|
|
36823
37014
|
commands.registerCommand("clearSelected", clearSelected);
|
|
36824
37015
|
commands.registerCommand("clearSlices", clearSlices);
|
|
36825
37016
|
commands.registerCommand("collect", collect);
|
|
37017
|
+
commands.registerCommand("deselect", deselect);
|
|
36826
37018
|
commands.registerCommand("getSnapshot", getSnapshot);
|
|
36827
37019
|
commands.registerCommand("explode", explode);
|
|
36828
37020
|
commands.registerCommand("getDefaultViewPositions", getDefaultViewPositions);
|
|
36829
37021
|
commands.registerCommand("getModels", getModels);
|
|
36830
37022
|
commands.registerCommand("getSelected", getSelected);
|
|
36831
37023
|
commands.registerCommand("getSelected2", getSelected2);
|
|
37024
|
+
commands.registerCommand("getHidden", getHidden);
|
|
37025
|
+
commands.registerCommand("getIsolated", getIsolated);
|
|
37026
|
+
commands.registerCommand("hide", hide);
|
|
37027
|
+
commands.registerCommand("hideAll", hideAll);
|
|
36832
37028
|
commands.registerCommand("hideSelected", hideSelected);
|
|
37029
|
+
commands.registerCommand("isolate", isolate);
|
|
36833
37030
|
commands.registerCommand("isolateSelected", isolateSelected);
|
|
36834
37031
|
commands.registerCommand("regenerateAll", regenerateAll);
|
|
36835
37032
|
commands.registerCommand("resetView", resetView);
|
|
37033
|
+
commands.registerCommand("select", select);
|
|
36836
37034
|
commands.registerCommand("selectModel", selectModel);
|
|
36837
37035
|
commands.registerCommand("setActiveDragger", setActiveDragger);
|
|
36838
37036
|
commands.registerCommand("setDefaultViewPosition", setDefaultViewPosition);
|
|
36839
37037
|
commands.registerCommand("setMarkupColor", setMarkupColor);
|
|
36840
37038
|
commands.registerCommand("setSelected", setSelected);
|
|
36841
37039
|
commands.registerCommand("setSelected2", setSelected2);
|
|
37040
|
+
commands.registerCommand("show", show);
|
|
36842
37041
|
commands.registerCommand("showAll", showAll);
|
|
36843
|
-
commands.registerCommand("
|
|
36844
|
-
commands.registerCommand("
|
|
37042
|
+
commands.registerCommand("toggleSelection", toggleSelection);
|
|
37043
|
+
commands.registerCommand("zoomExtents", zoomExtents);
|
|
37044
|
+
commands.registerCommand("zoomTo", zoomTo);
|
|
36845
37045
|
commands.registerCommand("zoomToSelected", zoomToSelected);
|
|
36846
37046
|
commands.registerCommand("top", (viewer) => setDefaultViewPosition(viewer, "top"));
|
|
36847
37047
|
commands.registerCommand("bottom", (viewer) => setDefaultViewPosition(viewer, "bottom"));
|
|
@@ -36856,7 +37056,8 @@ void main() {
|
|
|
36856
37056
|
commands.registerCommandAlias("clearMarkup", "clearOverlay");
|
|
36857
37057
|
commands.registerCommandAlias("clearSelected", "unselect");
|
|
36858
37058
|
commands.registerCommandAlias("getSnapshot", "createPreview");
|
|
36859
|
-
commands.registerCommandAlias("
|
|
37059
|
+
commands.registerCommandAlias("zoomExtents", "zoomToExtents");
|
|
37060
|
+
commands.registerCommandAlias("zoomTo", "zoomToObjects");
|
|
36860
37061
|
commands.registerCommandAlias("top", "k3DViewTop");
|
|
36861
37062
|
commands.registerCommandAlias("bottom", "k3DViewBottom");
|
|
36862
37063
|
commands.registerCommandAlias("left", "k3DViewLeft");
|
|
@@ -38057,10 +38258,7 @@ void main() {
|
|
|
38057
38258
|
this.viewer.removeEventListener("optionschange", this.syncOptions);
|
|
38058
38259
|
this.viewer.removeEventListener("resize", this.viewerResize);
|
|
38059
38260
|
}
|
|
38060
|
-
|
|
38061
|
-
const { edgesVisibility } = this.viewer.options;
|
|
38062
|
-
if (!Array.isArray(objects))
|
|
38063
|
-
objects = [objects];
|
|
38261
|
+
highlightObjects(objects) {
|
|
38064
38262
|
if (objects.length === 0)
|
|
38065
38263
|
return;
|
|
38066
38264
|
objects
|
|
@@ -38075,7 +38273,7 @@ void main() {
|
|
|
38075
38273
|
? HighlighterUtils.fromIndexedLine(positions, indices)
|
|
38076
38274
|
: HighlighterUtils.fromNonIndexedLine(positions, object.isLineSegments);
|
|
38077
38275
|
const wireframe = new Wireframe(lineGeometry, this.lineGlowMaterial);
|
|
38078
|
-
wireframe.visible = edgesVisibility;
|
|
38276
|
+
wireframe.visible = this.viewer.options.edgesVisibility;
|
|
38079
38277
|
wireframe.userData.isHighlightWireframe = true;
|
|
38080
38278
|
object.add(wireframe);
|
|
38081
38279
|
object.userData.highlightWireframe = wireframe;
|
|
@@ -38087,7 +38285,7 @@ void main() {
|
|
|
38087
38285
|
const edgesGeometry = new EdgesGeometry(object.geometry, 89);
|
|
38088
38286
|
const lineGeometry = new LineSegmentsGeometry().fromEdgesGeometry(edgesGeometry);
|
|
38089
38287
|
const wireframe = new Wireframe(lineGeometry, this.edgesMaterial);
|
|
38090
|
-
wireframe.visible = edgesVisibility;
|
|
38288
|
+
wireframe.visible = this.viewer.options.edgesVisibility;
|
|
38091
38289
|
wireframe.userData.isHighlightWireframe = true;
|
|
38092
38290
|
object.add(wireframe);
|
|
38093
38291
|
object.userData.highlightWireframe = wireframe;
|
|
@@ -38097,16 +38295,16 @@ void main() {
|
|
|
38097
38295
|
}
|
|
38098
38296
|
});
|
|
38099
38297
|
}
|
|
38100
|
-
|
|
38101
|
-
if (!Array.isArray(objects))
|
|
38102
|
-
objects = [objects];
|
|
38298
|
+
unhighlightObjects(objects) {
|
|
38103
38299
|
if (objects.length === 0)
|
|
38104
38300
|
return;
|
|
38105
38301
|
objects.forEach((object) => {
|
|
38302
|
+
var _a, _b, _c;
|
|
38106
38303
|
if (!object.userData.isHighlighted)
|
|
38107
38304
|
return;
|
|
38108
38305
|
object.material = object.userData.originalMaterial;
|
|
38109
|
-
object.userData.highlightWireframe.removeFromParent();
|
|
38306
|
+
(_a = object.userData.highlightWireframe) === null || _a === void 0 ? void 0 : _a.removeFromParent();
|
|
38307
|
+
(_c = (_b = object.userData.highlightWireframe) === null || _b === void 0 ? void 0 : _b.geometry) === null || _c === void 0 ? void 0 : _c.dispose();
|
|
38110
38308
|
delete object.userData.isHighlighted;
|
|
38111
38309
|
delete object.userData.originalMaterial;
|
|
38112
38310
|
delete object.userData.highlightWireframe;
|
|
@@ -38127,8 +38325,10 @@ void main() {
|
|
|
38127
38325
|
this.lineGlowMaterial.color.setRGB(edgesColor.r / 255, edgesColor.g / 255, edgesColor.b / 255);
|
|
38128
38326
|
this.lineGlowMaterial.depthTest = !edgesOverlap;
|
|
38129
38327
|
this.lineGlowMaterial.depthWrite = !edgesOverlap;
|
|
38130
|
-
this.viewer.
|
|
38131
|
-
|
|
38328
|
+
const handles = this.viewer.getSelected(true);
|
|
38329
|
+
const objects = this.viewer.models.flatMap((model) => model.getObjectsByHandles(handles));
|
|
38330
|
+
objects.forEach((object) => {
|
|
38331
|
+
const wireframe = object.userData.highlightWireframe;
|
|
38132
38332
|
if (wireframe)
|
|
38133
38333
|
wireframe.visible = edgesVisibility;
|
|
38134
38334
|
});
|
|
@@ -38159,91 +38359,38 @@ void main() {
|
|
|
38159
38359
|
intersections.push({ ...intersects[0], model });
|
|
38160
38360
|
});
|
|
38161
38361
|
intersections = intersections.sort((a, b) => a.distance - b.distance);
|
|
38162
|
-
if (!event.shiftKey)
|
|
38163
|
-
this.clearSelection();
|
|
38164
38362
|
if (intersections.length > 0) {
|
|
38165
38363
|
const model = intersections[0].model;
|
|
38166
|
-
const handles = model.getHandlesByObjects(intersections[0].object);
|
|
38167
|
-
const objects = model.getObjectsByHandles(handles);
|
|
38364
|
+
const handles = model.getHandlesByObjects([intersections[0].object]);
|
|
38168
38365
|
if (!event.shiftKey)
|
|
38169
|
-
this.
|
|
38366
|
+
this.viewer.setSelected(handles);
|
|
38170
38367
|
else
|
|
38171
|
-
this.toggleSelection(
|
|
38368
|
+
this.viewer.toggleSelection(handles);
|
|
38369
|
+
}
|
|
38370
|
+
else {
|
|
38371
|
+
if (!event.shiftKey)
|
|
38372
|
+
this.viewer.clearSelected();
|
|
38172
38373
|
}
|
|
38173
|
-
this.viewer.update();
|
|
38174
|
-
this.viewer.emitEvent({ type: "select", data: undefined, handles: this.viewer.getSelected() });
|
|
38175
|
-
this.viewer.emitEvent({ type: "select2", data: undefined, handles: this.viewer.getSelected2() });
|
|
38176
38374
|
};
|
|
38177
38375
|
this.onDoubleClick = (event) => {
|
|
38178
38376
|
if (event.button !== 0)
|
|
38179
38377
|
return;
|
|
38180
|
-
this.viewer.
|
|
38181
|
-
};
|
|
38182
|
-
this.initHighlighter = () => {
|
|
38183
|
-
this.highlighter = this.viewer.getComponent("HighlighterComponent");
|
|
38378
|
+
this.viewer.zoomToSelected();
|
|
38184
38379
|
};
|
|
38185
38380
|
this.viewer = viewer;
|
|
38186
38381
|
this.downPosition = new Vector2();
|
|
38187
|
-
this.viewer.addEventListener("pointerdown", this.onPointerDown);
|
|
38188
|
-
this.viewer.addEventListener("pointerup", this.onPointerUp);
|
|
38189
|
-
this.viewer.addEventListener("dblclick", this.onDoubleClick);
|
|
38190
|
-
this.viewer.addEventListener("initialize", this.initHighlighter);
|
|
38382
|
+
this.viewer.canvas.addEventListener("pointerdown", this.onPointerDown);
|
|
38383
|
+
this.viewer.canvas.addEventListener("pointerup", this.onPointerUp);
|
|
38384
|
+
this.viewer.canvas.addEventListener("dblclick", this.onDoubleClick);
|
|
38191
38385
|
}
|
|
38192
38386
|
dispose() {
|
|
38193
|
-
this.viewer.removeEventListener("pointerdown", this.onPointerDown);
|
|
38194
|
-
this.viewer.removeEventListener("pointerup", this.onPointerUp);
|
|
38195
|
-
this.viewer.removeEventListener("dblclick", this.onDoubleClick);
|
|
38196
|
-
this.viewer.removeEventListener("initialize", this.initHighlighter);
|
|
38387
|
+
this.viewer.canvas.removeEventListener("pointerdown", this.onPointerDown);
|
|
38388
|
+
this.viewer.canvas.removeEventListener("pointerup", this.onPointerUp);
|
|
38389
|
+
this.viewer.canvas.removeEventListener("dblclick", this.onDoubleClick);
|
|
38197
38390
|
}
|
|
38198
38391
|
getMousePosition(event, target) {
|
|
38199
38392
|
return target.set(event.clientX, event.clientY);
|
|
38200
38393
|
}
|
|
38201
|
-
select(objects, model) {
|
|
38202
|
-
if (!model) {
|
|
38203
|
-
this.viewer.models.forEach((model) => this.select(objects, model));
|
|
38204
|
-
return;
|
|
38205
|
-
}
|
|
38206
|
-
if (!Array.isArray(objects))
|
|
38207
|
-
objects = [objects];
|
|
38208
|
-
if (objects.length === 0)
|
|
38209
|
-
return;
|
|
38210
|
-
model.highlightObjects(objects);
|
|
38211
|
-
this.highlighter.highlight(objects);
|
|
38212
|
-
objects.forEach((object) => this.viewer.selected.push(object));
|
|
38213
|
-
objects.forEach((object) => (object.userData.isSelected = true));
|
|
38214
|
-
}
|
|
38215
|
-
deselect(objects, model) {
|
|
38216
|
-
if (!model) {
|
|
38217
|
-
this.viewer.models.forEach((model) => this.select(objects, model));
|
|
38218
|
-
return;
|
|
38219
|
-
}
|
|
38220
|
-
if (!Array.isArray(objects))
|
|
38221
|
-
objects = [objects];
|
|
38222
|
-
if (objects.length === 0)
|
|
38223
|
-
return;
|
|
38224
|
-
model.unhighlightObjects(objects);
|
|
38225
|
-
this.highlighter.unhighlight(objects);
|
|
38226
|
-
this.viewer.selected = this.viewer.selected.filter((x) => !objects.includes(x));
|
|
38227
|
-
objects.forEach((object) => (object.userData.isSelected = false));
|
|
38228
|
-
}
|
|
38229
|
-
toggleSelection(objects, model) {
|
|
38230
|
-
if (!Array.isArray(objects))
|
|
38231
|
-
objects = [objects];
|
|
38232
|
-
if (objects.length === 0)
|
|
38233
|
-
return;
|
|
38234
|
-
if (objects[0].userData.isSelected)
|
|
38235
|
-
this.deselect(objects, model);
|
|
38236
|
-
else
|
|
38237
|
-
this.select(objects, model);
|
|
38238
|
-
}
|
|
38239
|
-
clearSelection() {
|
|
38240
|
-
if (this.viewer.selected.length === 0)
|
|
38241
|
-
return;
|
|
38242
|
-
this.viewer.models.forEach((model) => model.unhighlightObjects(this.viewer.selected));
|
|
38243
|
-
this.highlighter.unhighlight(this.viewer.selected);
|
|
38244
|
-
this.viewer.selected.forEach((object) => (object.userData.isSelected = false));
|
|
38245
|
-
this.viewer.selected.length = 0;
|
|
38246
|
-
}
|
|
38247
38394
|
}
|
|
38248
38395
|
|
|
38249
38396
|
class ClippingPlaneComponent {
|
|
@@ -39440,20 +39587,8 @@ void main() {
|
|
|
39440
39587
|
constructor(scene) {
|
|
39441
39588
|
this.id = "";
|
|
39442
39589
|
this.scene = scene;
|
|
39443
|
-
this.handleToObjects = new Map();
|
|
39444
39590
|
this.originalObjects = new Set();
|
|
39445
|
-
this.
|
|
39446
|
-
this.originalObjects.add(object);
|
|
39447
|
-
const handle = object.userData.handle;
|
|
39448
|
-
if (!handle)
|
|
39449
|
-
return;
|
|
39450
|
-
let objects = this.handleToObjects.get(handle);
|
|
39451
|
-
if (!objects) {
|
|
39452
|
-
objects = new Set();
|
|
39453
|
-
this.handleToObjects.set(handle, objects);
|
|
39454
|
-
}
|
|
39455
|
-
objects.add(object);
|
|
39456
|
-
});
|
|
39591
|
+
this.handleToObjects = new Map();
|
|
39457
39592
|
}
|
|
39458
39593
|
dispose() {
|
|
39459
39594
|
function disposeMaterial(material) {
|
|
@@ -39474,6 +39609,21 @@ void main() {
|
|
|
39474
39609
|
this.scene.traverse(disposeObject);
|
|
39475
39610
|
this.scene.clear();
|
|
39476
39611
|
}
|
|
39612
|
+
initialize() {
|
|
39613
|
+
this.scene.traverse((object) => {
|
|
39614
|
+
this.originalObjects.add(object);
|
|
39615
|
+
const handle = object.userData.handle;
|
|
39616
|
+
if (!handle)
|
|
39617
|
+
return;
|
|
39618
|
+
const fullHandle = `${this.id}:${handle}`;
|
|
39619
|
+
let objectsSet = this.handleToObjects.get(fullHandle);
|
|
39620
|
+
if (!objectsSet) {
|
|
39621
|
+
objectsSet = new Set();
|
|
39622
|
+
this.handleToObjects.set(fullHandle, objectsSet);
|
|
39623
|
+
}
|
|
39624
|
+
objectsSet.add(object);
|
|
39625
|
+
});
|
|
39626
|
+
}
|
|
39477
39627
|
getUnits() {
|
|
39478
39628
|
return "Meters";
|
|
39479
39629
|
}
|
|
@@ -39644,39 +39794,28 @@ void main() {
|
|
|
39644
39794
|
return objects;
|
|
39645
39795
|
}
|
|
39646
39796
|
getObjectsByHandles(handles) {
|
|
39647
|
-
if (!Array.isArray(handles))
|
|
39648
|
-
handles = [handles];
|
|
39649
|
-
const ownHandles = [];
|
|
39650
|
-
handles.forEach((handle) => {
|
|
39651
|
-
const index = handle.indexOf(":");
|
|
39652
|
-
if (index !== -1) {
|
|
39653
|
-
if (handle.slice(0, index) !== this.id)
|
|
39654
|
-
return;
|
|
39655
|
-
handle = handle.slice(index + 1);
|
|
39656
|
-
}
|
|
39657
|
-
ownHandles.push(handle);
|
|
39658
|
-
});
|
|
39659
|
-
const handlesSet = new Set(ownHandles);
|
|
39660
39797
|
const objects = [];
|
|
39661
|
-
|
|
39662
|
-
|
|
39798
|
+
handles.forEach((handle) => {
|
|
39799
|
+
const objectsSet = this.handleToObjects.get(handle);
|
|
39800
|
+
objects.push(Array.from(objectsSet || []));
|
|
39663
39801
|
});
|
|
39664
39802
|
return objects.flat();
|
|
39665
39803
|
}
|
|
39804
|
+
getHandles() {
|
|
39805
|
+
return Array.from(this.handleToObjects.keys());
|
|
39806
|
+
}
|
|
39666
39807
|
getHandlesByObjects(objects) {
|
|
39667
|
-
|
|
39668
|
-
|
|
39669
|
-
|
|
39670
|
-
|
|
39671
|
-
|
|
39672
|
-
|
|
39673
|
-
handleSet.add(`${this.id}:${object.userData.handle}`);
|
|
39808
|
+
const handlesSet = new Set();
|
|
39809
|
+
objects.forEach((object) => {
|
|
39810
|
+
if (this.originalObjects.has(object)) {
|
|
39811
|
+
const fullHandle = `${this.id}:${object.userData.handle}`;
|
|
39812
|
+
handlesSet.add(fullHandle);
|
|
39813
|
+
}
|
|
39674
39814
|
});
|
|
39675
|
-
return Array.from(
|
|
39815
|
+
return Array.from(handlesSet);
|
|
39676
39816
|
}
|
|
39677
|
-
|
|
39678
|
-
|
|
39679
|
-
objects = [objects];
|
|
39817
|
+
hide(handles) {
|
|
39818
|
+
const objects = this.getObjectsByHandles(handles);
|
|
39680
39819
|
objects
|
|
39681
39820
|
.filter((object) => this.originalObjects.has(object))
|
|
39682
39821
|
.forEach((object) => {
|
|
@@ -39684,40 +39823,48 @@ void main() {
|
|
|
39684
39823
|
});
|
|
39685
39824
|
return this;
|
|
39686
39825
|
}
|
|
39687
|
-
|
|
39688
|
-
return this.
|
|
39826
|
+
hideAll() {
|
|
39827
|
+
return this.isolate([]);
|
|
39689
39828
|
}
|
|
39690
|
-
|
|
39691
|
-
|
|
39692
|
-
objects = [objects];
|
|
39829
|
+
isolate(handles) {
|
|
39830
|
+
const objects = this.getObjectsByHandles(handles);
|
|
39693
39831
|
const visibleSet = new Set(objects);
|
|
39694
39832
|
objects
|
|
39695
39833
|
.filter((object) => this.originalObjects.has(object))
|
|
39696
39834
|
.forEach((object) => {
|
|
39697
39835
|
object.traverseAncestors((parent) => visibleSet.add(parent));
|
|
39836
|
+
object.traverse((child) => visibleSet.add(child));
|
|
39698
39837
|
});
|
|
39699
39838
|
this.scene.traverse((object) => (object.visible = visibleSet.has(object)));
|
|
39700
39839
|
return this;
|
|
39701
39840
|
}
|
|
39702
|
-
|
|
39703
|
-
|
|
39704
|
-
objects = [objects];
|
|
39841
|
+
show(handles) {
|
|
39842
|
+
const objects = this.getObjectsByHandles(handles);
|
|
39705
39843
|
objects
|
|
39706
39844
|
.filter((object) => this.originalObjects.has(object))
|
|
39707
39845
|
.forEach((object) => {
|
|
39708
39846
|
object.visible = true;
|
|
39709
39847
|
object.traverseAncestors((parent) => (parent.visible = true));
|
|
39848
|
+
object.traverse((child) => (child.visible = true));
|
|
39710
39849
|
});
|
|
39711
39850
|
return this;
|
|
39712
39851
|
}
|
|
39713
|
-
|
|
39852
|
+
showAll() {
|
|
39714
39853
|
this.scene.traverse((object) => (object.visible = true));
|
|
39715
39854
|
return this;
|
|
39716
39855
|
}
|
|
39717
|
-
|
|
39856
|
+
highlight(handles) {
|
|
39857
|
+
if (this.highlighter) {
|
|
39858
|
+
const objects = this.getObjectsByHandles(handles);
|
|
39859
|
+
this.highlighter.highlightObjects(objects);
|
|
39860
|
+
}
|
|
39718
39861
|
return this;
|
|
39719
39862
|
}
|
|
39720
|
-
|
|
39863
|
+
unhighlight(handles) {
|
|
39864
|
+
if (this.highlighter) {
|
|
39865
|
+
const objects = this.getObjectsByHandles(handles);
|
|
39866
|
+
this.highlighter.unhighlightObjects(objects);
|
|
39867
|
+
}
|
|
39721
39868
|
return this;
|
|
39722
39869
|
}
|
|
39723
39870
|
explode(scale = 0, coeff = 4) {
|
|
@@ -39727,13 +39874,14 @@ void main() {
|
|
|
39727
39874
|
const handle = object.userData.handle;
|
|
39728
39875
|
if (!handle)
|
|
39729
39876
|
return extents.getCenter(target);
|
|
39730
|
-
const
|
|
39877
|
+
const fullHandle = `${this.id}:${handle}`;
|
|
39878
|
+
const center = centersCache.get(fullHandle);
|
|
39731
39879
|
if (center)
|
|
39732
39880
|
return target.copy(center);
|
|
39733
|
-
const objects = this.getObjectsByHandles(
|
|
39881
|
+
const objects = this.getObjectsByHandles([fullHandle]);
|
|
39734
39882
|
objects.forEach((x) => extents.expandByObject(x));
|
|
39735
39883
|
extents.getCenter(target);
|
|
39736
|
-
centersCache.set(
|
|
39884
|
+
centersCache.set(fullHandle, target.clone());
|
|
39737
39885
|
return target;
|
|
39738
39886
|
};
|
|
39739
39887
|
const calcObjectOffset = (object, target) => {
|
|
@@ -39790,6 +39938,8 @@ void main() {
|
|
|
39790
39938
|
}
|
|
39791
39939
|
|
|
39792
39940
|
class DynamicModelImpl extends ModelImpl {
|
|
39941
|
+
initialize() {
|
|
39942
|
+
}
|
|
39793
39943
|
getInfo() {
|
|
39794
39944
|
const stats = this.gltfLoader.getStats();
|
|
39795
39945
|
const info = new Info();
|
|
@@ -39823,51 +39973,36 @@ void main() {
|
|
|
39823
39973
|
return this.gltfLoader.getOriginalObjectForSelect();
|
|
39824
39974
|
}
|
|
39825
39975
|
getObjectsByHandles(handles) {
|
|
39826
|
-
|
|
39827
|
-
|
|
39828
|
-
|
|
39829
|
-
|
|
39830
|
-
handlesSet.forEach((handle) => {
|
|
39831
|
-
objects.push(this.gltfLoader.getObjectsByHandle(handle));
|
|
39832
|
-
});
|
|
39833
|
-
return objects.flat();
|
|
39976
|
+
return handles.flatMap((handle) => this.gltfLoader.getObjectsByHandle(handle));
|
|
39977
|
+
}
|
|
39978
|
+
getHandles() {
|
|
39979
|
+
return Array.from(this.gltfLoader.handleToObjects.keys());
|
|
39834
39980
|
}
|
|
39835
39981
|
getHandlesByObjects(objects) {
|
|
39836
|
-
|
|
39837
|
-
objects = [objects];
|
|
39838
|
-
const handleSet = new Set();
|
|
39839
|
-
objects
|
|
39840
|
-
.filter((object) => this.gltfLoader.originalObjects.has(object))
|
|
39841
|
-
.forEach((object) => {
|
|
39842
|
-
handleSet.add(object.userData.handle);
|
|
39843
|
-
});
|
|
39844
|
-
return Array.from(handleSet);
|
|
39982
|
+
return this.gltfLoader.getHandlesByObjects(objects);
|
|
39845
39983
|
}
|
|
39846
|
-
|
|
39847
|
-
const handles = this.getHandlesByObjects(objects);
|
|
39984
|
+
hide(handles) {
|
|
39848
39985
|
this.gltfLoader.hideObjects(handles);
|
|
39849
39986
|
return this;
|
|
39850
39987
|
}
|
|
39851
|
-
|
|
39852
|
-
const handles = this.getHandlesByObjects(objects);
|
|
39988
|
+
isolate(handles) {
|
|
39853
39989
|
this.gltfLoader.isolateObjects(new Set(handles));
|
|
39854
39990
|
return this;
|
|
39855
39991
|
}
|
|
39856
|
-
|
|
39857
|
-
const handles = this.getHandlesByObjects(objects);
|
|
39992
|
+
show(handles) {
|
|
39858
39993
|
this.gltfLoader.showObjects(handles);
|
|
39859
39994
|
return this;
|
|
39860
39995
|
}
|
|
39861
|
-
|
|
39996
|
+
showAll() {
|
|
39862
39997
|
this.gltfLoader.showAllHiddenObjects();
|
|
39863
39998
|
return this;
|
|
39864
39999
|
}
|
|
39865
|
-
|
|
39866
|
-
this.gltfLoader.
|
|
40000
|
+
highlight(handles) {
|
|
40001
|
+
this.gltfLoader.highlightObjects(handles);
|
|
39867
40002
|
return this;
|
|
39868
40003
|
}
|
|
39869
|
-
|
|
39870
|
-
this.gltfLoader.
|
|
40004
|
+
unhighlight(handles) {
|
|
40005
|
+
this.gltfLoader.unhighlightObjects(handles);
|
|
39871
40006
|
return this;
|
|
39872
40007
|
}
|
|
39873
40008
|
explode(scale = 0, coeff = 4) {
|
|
@@ -39877,13 +40012,14 @@ void main() {
|
|
|
39877
40012
|
const handle = object.userData.handle;
|
|
39878
40013
|
if (!handle)
|
|
39879
40014
|
return extents.getCenter(target);
|
|
39880
|
-
const
|
|
40015
|
+
const fullHandle = handle;
|
|
40016
|
+
const center = centersCache.get(fullHandle);
|
|
39881
40017
|
if (center)
|
|
39882
40018
|
return target.copy(center);
|
|
39883
|
-
const objects = this.getObjectsByHandles(
|
|
40019
|
+
const objects = this.getObjectsByHandles([fullHandle]);
|
|
39884
40020
|
objects.forEach((x) => extents.expandByObject(x));
|
|
39885
40021
|
extents.getCenter(target);
|
|
39886
|
-
centersCache.set(
|
|
40022
|
+
centersCache.set(fullHandle, target.clone());
|
|
39887
40023
|
return target;
|
|
39888
40024
|
};
|
|
39889
40025
|
const calcObjectOffset = (object, target) => {
|
|
@@ -40757,6 +40893,9 @@ void main() {
|
|
|
40757
40893
|
|
|
40758
40894
|
const DRACO_EXTENSION_NAME = "KHR_draco_mesh_compression";
|
|
40759
40895
|
const STRUCTURE_ID_SEPARATOR = ":";
|
|
40896
|
+
const MAX_HIGHLIGHT_STYLES = 8;
|
|
40897
|
+
const HIGHLIGHT_STYLE_VEC4_COUNT = 4;
|
|
40898
|
+
const HIGHLIGHT_OVERLAY_RENDER_ORDER = 999;
|
|
40760
40899
|
class DynamicGltfLoader {
|
|
40761
40900
|
constructor(camera, scene, renderer) {
|
|
40762
40901
|
this.camera = camera;
|
|
@@ -40830,6 +40969,24 @@ void main() {
|
|
|
40830
40969
|
this.transformData = null;
|
|
40831
40970
|
this.identityTransformData = null;
|
|
40832
40971
|
this.visibilityMaterials = new Set();
|
|
40972
|
+
this.colorOverrides = new Map();
|
|
40973
|
+
this.highlightedHandles = new Map();
|
|
40974
|
+
this.highlightStyles = [];
|
|
40975
|
+
this.highlightStyleNames = new Map();
|
|
40976
|
+
this.highlightOverlays = new Map();
|
|
40977
|
+
this.highlightOverlayMaterials = null;
|
|
40978
|
+
this.objectStateTextureSize = 1;
|
|
40979
|
+
this.colorOverrideData = new Uint8Array(4);
|
|
40980
|
+
this.highlightData = new Uint8Array(4);
|
|
40981
|
+
this.objectStateUniforms = {
|
|
40982
|
+
colorOverrideTexture: { value: this.createObjectStateTexture(this.colorOverrideData, 1) },
|
|
40983
|
+
highlightTexture: { value: this.createObjectStateTexture(this.highlightData, 1) },
|
|
40984
|
+
objectStateTextureSize: { value: 1 },
|
|
40985
|
+
highlightStyles: {
|
|
40986
|
+
value: Array.from({ length: MAX_HIGHLIGHT_STYLES * HIGHLIGHT_STYLE_VEC4_COUNT }, () => new Vector4()),
|
|
40987
|
+
},
|
|
40988
|
+
};
|
|
40989
|
+
this.setHighlightStyle("default", {});
|
|
40833
40990
|
this._dracoLoader = null;
|
|
40834
40991
|
}
|
|
40835
40992
|
setDracoLoader(loader = null) {
|
|
@@ -41057,6 +41214,25 @@ void main() {
|
|
|
41057
41214
|
material.needsUpdate = true;
|
|
41058
41215
|
});
|
|
41059
41216
|
}
|
|
41217
|
+
createObjectStateTexture(data, size) {
|
|
41218
|
+
const texture = new DataTexture(data, size, size, RGBAFormat, UnsignedByteType);
|
|
41219
|
+
texture.minFilter = NearestFilter;
|
|
41220
|
+
texture.magFilter = NearestFilter;
|
|
41221
|
+
texture.generateMipmaps = false;
|
|
41222
|
+
texture.needsUpdate = true;
|
|
41223
|
+
return texture;
|
|
41224
|
+
}
|
|
41225
|
+
initObjectStateTextures() {
|
|
41226
|
+
const size = Math.max(1, Math.ceil(Math.sqrt(this.maxObjectId + 1)));
|
|
41227
|
+
this.objectStateUniforms.colorOverrideTexture.value.dispose();
|
|
41228
|
+
this.objectStateUniforms.highlightTexture.value.dispose();
|
|
41229
|
+
this.objectStateTextureSize = size;
|
|
41230
|
+
this.colorOverrideData = new Uint8Array(size * size * 4);
|
|
41231
|
+
this.highlightData = new Uint8Array(size * size * 4);
|
|
41232
|
+
this.objectStateUniforms.colorOverrideTexture.value = this.createObjectStateTexture(this.colorOverrideData, size);
|
|
41233
|
+
this.objectStateUniforms.highlightTexture.value = this.createObjectStateTexture(this.highlightData, size);
|
|
41234
|
+
this.objectStateUniforms.objectStateTextureSize.value = size;
|
|
41235
|
+
}
|
|
41060
41236
|
_resetTransformData(updateTexture = true) {
|
|
41061
41237
|
if (!this.transformData || !this.identityTransformData) return;
|
|
41062
41238
|
this.transformData.set(this.identityTransformData);
|
|
@@ -41720,6 +41896,15 @@ void main() {
|
|
|
41720
41896
|
if (meshDef.extras && meshDef.extras.handle) {
|
|
41721
41897
|
handle = this.getFullHandle(structure.id, meshDef.extras.handle);
|
|
41722
41898
|
}
|
|
41899
|
+
if (!handle) {
|
|
41900
|
+
handle =
|
|
41901
|
+
isEdge && structure._lastFaceHandle
|
|
41902
|
+
? structure._lastFaceHandle
|
|
41903
|
+
: this.getFullHandle(structure.id, structure._nextObjectId++);
|
|
41904
|
+
}
|
|
41905
|
+
if (!isEdge) {
|
|
41906
|
+
structure._lastFaceHandle = handle;
|
|
41907
|
+
}
|
|
41723
41908
|
this.nodes.set(uniqueNodeId, {
|
|
41724
41909
|
position: nodeGroup ? nodeGroup.position.clone() : new Vector3().setFromMatrixPosition(nodeMatrix),
|
|
41725
41910
|
nodeIndex: nodeId,
|
|
@@ -41731,7 +41916,7 @@ void main() {
|
|
|
41731
41916
|
structure,
|
|
41732
41917
|
extras: nodeDef.extras,
|
|
41733
41918
|
geometryExtents,
|
|
41734
|
-
handle
|
|
41919
|
+
handle,
|
|
41735
41920
|
});
|
|
41736
41921
|
}
|
|
41737
41922
|
if (nodeDef.children) {
|
|
@@ -41968,16 +42153,28 @@ void main() {
|
|
|
41968
42153
|
}
|
|
41969
42154
|
}
|
|
41970
42155
|
}
|
|
41971
|
-
createVisibilityMaterial(material) {
|
|
42156
|
+
createVisibilityMaterial(material, options = {}) {
|
|
41972
42157
|
this.visibilityMaterials.add(material);
|
|
41973
42158
|
const uniforms = {
|
|
41974
42159
|
transformTexture: { value: this.transformTexture },
|
|
41975
42160
|
transformTextureSize: { value: this.transformTextureSize },
|
|
41976
42161
|
};
|
|
41977
42162
|
material.userData.visibilityUniforms = uniforms;
|
|
42163
|
+
const stateUniforms = this.objectStateUniforms;
|
|
42164
|
+
material.defines = material.defines || {};
|
|
42165
|
+
if (material.name === "edges" || options.edges) {
|
|
42166
|
+
material.defines.HL_IS_EDGE = "";
|
|
42167
|
+
}
|
|
42168
|
+
if (options.overlay) {
|
|
42169
|
+
material.defines.HL_OVERLAY = "";
|
|
42170
|
+
}
|
|
41978
42171
|
material.onBeforeCompile = (shader) => {
|
|
41979
42172
|
shader.uniforms.transformTexture = uniforms.transformTexture;
|
|
41980
42173
|
shader.uniforms.transformTextureSize = uniforms.transformTextureSize;
|
|
42174
|
+
shader.uniforms.colorOverrideTexture = stateUniforms.colorOverrideTexture;
|
|
42175
|
+
shader.uniforms.highlightTexture = stateUniforms.highlightTexture;
|
|
42176
|
+
shader.uniforms.objectStateTextureSize = stateUniforms.objectStateTextureSize;
|
|
42177
|
+
shader.uniforms.highlightStyles = stateUniforms.highlightStyles;
|
|
41981
42178
|
shader.vertexShader = shader.vertexShader.replace(
|
|
41982
42179
|
"#include <common>",
|
|
41983
42180
|
`
|
|
@@ -42003,6 +42200,18 @@ void main() {
|
|
|
42003
42200
|
|
|
42004
42201
|
return mat4(row0, row1, row2, row3);
|
|
42005
42202
|
}
|
|
42203
|
+
|
|
42204
|
+
uniform highp sampler2D colorOverrideTexture;
|
|
42205
|
+
uniform highp sampler2D highlightTexture;
|
|
42206
|
+
uniform float objectStateTextureSize;
|
|
42207
|
+
varying vec4 vColorOverride;
|
|
42208
|
+
varying float vHighlightStyle;
|
|
42209
|
+
|
|
42210
|
+
ivec2 getObjectStateCoord(float instanceId) {
|
|
42211
|
+
int size = int(objectStateTextureSize);
|
|
42212
|
+
int index = int(instanceId);
|
|
42213
|
+
return ivec2(index % size, index / size);
|
|
42214
|
+
}
|
|
42006
42215
|
`
|
|
42007
42216
|
);
|
|
42008
42217
|
shader.vertexShader = shader.vertexShader.replace(
|
|
@@ -42011,6 +42220,9 @@ void main() {
|
|
|
42011
42220
|
void main() {
|
|
42012
42221
|
mat4 batchingMatrix = getTransformMatrix(objectId);
|
|
42013
42222
|
vVisibility = visibility;
|
|
42223
|
+
ivec2 objectStateCoord = getObjectStateCoord(objectId);
|
|
42224
|
+
vColorOverride = texelFetch(colorOverrideTexture, objectStateCoord, 0);
|
|
42225
|
+
vHighlightStyle = floor(texelFetch(highlightTexture, objectStateCoord, 0).r * 255.0 + 0.5) - 1.0;
|
|
42014
42226
|
`
|
|
42015
42227
|
);
|
|
42016
42228
|
if (shader.vertexShader.includes("#include <beginnormal_vertex>")) {
|
|
@@ -42040,6 +42252,27 @@ void main() {
|
|
|
42040
42252
|
`
|
|
42041
42253
|
#include <common>
|
|
42042
42254
|
varying float vVisibility;
|
|
42255
|
+
varying vec4 vColorOverride;
|
|
42256
|
+
varying float vHighlightStyle;
|
|
42257
|
+
uniform vec4 highlightStyles[${MAX_HIGHLIGHT_STYLES * HIGHLIGHT_STYLE_VEC4_COUNT}];
|
|
42258
|
+
|
|
42259
|
+
// Edges color for the "edges" material, faces color for everything else
|
|
42260
|
+
vec4 getHighlightColor(int base) {
|
|
42261
|
+
#ifdef HL_IS_EDGE
|
|
42262
|
+
return highlightStyles[base + 1];
|
|
42263
|
+
#else
|
|
42264
|
+
return highlightStyles[base];
|
|
42265
|
+
#endif
|
|
42266
|
+
}
|
|
42267
|
+
|
|
42268
|
+
// Edges overlap flag for the "edges" material, faces overlap for everything else
|
|
42269
|
+
float getHighlightOverlay(int base) {
|
|
42270
|
+
#ifdef HL_IS_EDGE
|
|
42271
|
+
return highlightStyles[base + 3].x;
|
|
42272
|
+
#else
|
|
42273
|
+
return highlightStyles[base + 2].z;
|
|
42274
|
+
#endif
|
|
42275
|
+
}
|
|
42043
42276
|
`
|
|
42044
42277
|
)
|
|
42045
42278
|
.replace(
|
|
@@ -42047,6 +42280,45 @@ void main() {
|
|
|
42047
42280
|
`
|
|
42048
42281
|
void main() {
|
|
42049
42282
|
if (vVisibility < 0.5) discard;
|
|
42283
|
+
#ifdef HL_OVERLAY
|
|
42284
|
+
if (vHighlightStyle < 0.0 || getHighlightOverlay(int(vHighlightStyle) * ${HIGHLIGHT_STYLE_VEC4_COUNT}) < 0.5) discard;
|
|
42285
|
+
#endif
|
|
42286
|
+
`
|
|
42287
|
+
)
|
|
42288
|
+
.replace(
|
|
42289
|
+
"#include <color_fragment>",
|
|
42290
|
+
`
|
|
42291
|
+
#include <color_fragment>
|
|
42292
|
+
if (vColorOverride.a > 0.5) diffuseColor.rgb = vColorOverride.rgb;
|
|
42293
|
+
#ifdef HL_OVERLAY
|
|
42294
|
+
{
|
|
42295
|
+
int hlBase = int(vHighlightStyle) * ${HIGHLIGHT_STYLE_VEC4_COUNT};
|
|
42296
|
+
// Blend factor becomes overlay alpha: blends highlight with what is underneath
|
|
42297
|
+
vec4 hlColor = getHighlightColor(hlBase);
|
|
42298
|
+
diffuseColor = vec4(hlColor.rgb, highlightStyles[hlBase + 2].y * hlColor.a);
|
|
42299
|
+
}
|
|
42300
|
+
#else
|
|
42301
|
+
if (vHighlightStyle >= 0.0) {
|
|
42302
|
+
int hlBase = int(vHighlightStyle) * ${HIGHLIGHT_STYLE_VEC4_COUNT};
|
|
42303
|
+
vec4 hlColor = getHighlightColor(hlBase);
|
|
42304
|
+
// With overlap the overlay pass does the blending, keep the original color here
|
|
42305
|
+
float hlMix = getHighlightOverlay(hlBase) > 0.5 ? 0.0 : hlColor.a;
|
|
42306
|
+
diffuseColor.rgb = mix(diffuseColor.rgb, hlColor.rgb, hlMix);
|
|
42307
|
+
// Keep highlighted objects readable even when the material is dimmed (e.g. X-ray)
|
|
42308
|
+
if (highlightStyles[hlBase + 2].w >= 0.0) diffuseColor.a = highlightStyles[hlBase + 2].w;
|
|
42309
|
+
}
|
|
42310
|
+
#endif
|
|
42311
|
+
`
|
|
42312
|
+
)
|
|
42313
|
+
.replace(
|
|
42314
|
+
"#include <opaque_fragment>",
|
|
42315
|
+
`
|
|
42316
|
+
if (vHighlightStyle >= 0.0) {
|
|
42317
|
+
int hlBase = int(vHighlightStyle) * ${HIGHLIGHT_STYLE_VEC4_COUNT};
|
|
42318
|
+
vec4 hlColor = getHighlightColor(hlBase);
|
|
42319
|
+
outgoingLight += hlColor.rgb * hlColor.a * highlightStyles[hlBase + 2].x;
|
|
42320
|
+
}
|
|
42321
|
+
#include <opaque_fragment>
|
|
42050
42322
|
`
|
|
42051
42323
|
);
|
|
42052
42324
|
};
|
|
@@ -42108,6 +42380,7 @@ void main() {
|
|
|
42108
42380
|
}
|
|
42109
42381
|
});
|
|
42110
42382
|
this.structureRoots.clear();
|
|
42383
|
+
this._disposeHighlightOverlays();
|
|
42111
42384
|
this.mergedMesh.forEach((mesh) => {
|
|
42112
42385
|
if (mesh.geometry) mesh.geometry.dispose();
|
|
42113
42386
|
if (mesh.material) {
|
|
@@ -42166,6 +42439,9 @@ void main() {
|
|
|
42166
42439
|
this.objectVisibility = new Float32Array();
|
|
42167
42440
|
this.meshToNodeMap = null;
|
|
42168
42441
|
this.visibilityMaterials.clear();
|
|
42442
|
+
this.colorOverrides.clear();
|
|
42443
|
+
this.highlightedHandles.clear();
|
|
42444
|
+
this.initObjectStateTextures();
|
|
42169
42445
|
}
|
|
42170
42446
|
setStructureTransform(structureId, matrix) {
|
|
42171
42447
|
const rootGroup = this.structureRoots.get(structureId);
|
|
@@ -42329,6 +42605,7 @@ void main() {
|
|
|
42329
42605
|
if (totalObjectsToMerge > 0) {
|
|
42330
42606
|
this.maxObjectId = totalObjectsToMerge;
|
|
42331
42607
|
this.initTransformTexture();
|
|
42608
|
+
this.initObjectStateTextures();
|
|
42332
42609
|
this.initializeObjectVisibility();
|
|
42333
42610
|
this.maxObjectId = 0;
|
|
42334
42611
|
}
|
|
@@ -42376,6 +42653,8 @@ void main() {
|
|
|
42376
42653
|
this.originalObjectsToSelection.add(obj);
|
|
42377
42654
|
}
|
|
42378
42655
|
});
|
|
42656
|
+
this.syncColorOverrides();
|
|
42657
|
+
this.syncHighlightedObjects();
|
|
42379
42658
|
console.log(`Optimization complete. Total objects: ${this.maxObjectId}`);
|
|
42380
42659
|
this.dispatchEvent("optimizationprogress", {
|
|
42381
42660
|
phase: "complete",
|
|
@@ -42932,6 +43211,217 @@ void main() {
|
|
|
42932
43211
|
});
|
|
42933
43212
|
this.syncHiddenObjects();
|
|
42934
43213
|
}
|
|
43214
|
+
setColorByHandle(handle, color) {
|
|
43215
|
+
if (color === null || color === undefined) {
|
|
43216
|
+
this.colorOverrides.delete(handle);
|
|
43217
|
+
} else {
|
|
43218
|
+
this.colorOverrides.set(handle, new Color(color));
|
|
43219
|
+
}
|
|
43220
|
+
this.syncColorOverrides();
|
|
43221
|
+
}
|
|
43222
|
+
setColorByHandles(handles, color) {
|
|
43223
|
+
const overrideColor = new Color(color);
|
|
43224
|
+
handles.forEach((handle) => {
|
|
43225
|
+
this.colorOverrides.set(handle, overrideColor);
|
|
43226
|
+
});
|
|
43227
|
+
this.syncColorOverrides();
|
|
43228
|
+
}
|
|
43229
|
+
clearColorByHandles(handles) {
|
|
43230
|
+
handles.forEach((handle) => {
|
|
43231
|
+
this.colorOverrides.delete(handle);
|
|
43232
|
+
});
|
|
43233
|
+
this.syncColorOverrides();
|
|
43234
|
+
}
|
|
43235
|
+
setColorsByHandles(colors) {
|
|
43236
|
+
for (const [handle, color] of colors) {
|
|
43237
|
+
if (color === null || color === undefined) {
|
|
43238
|
+
this.colorOverrides.delete(handle);
|
|
43239
|
+
} else {
|
|
43240
|
+
this.colorOverrides.set(handle, new Color(color));
|
|
43241
|
+
}
|
|
43242
|
+
}
|
|
43243
|
+
this.syncColorOverrides();
|
|
43244
|
+
}
|
|
43245
|
+
clearAllColorOverrides() {
|
|
43246
|
+
this.colorOverrides.clear();
|
|
43247
|
+
this.syncColorOverrides();
|
|
43248
|
+
}
|
|
43249
|
+
getOptimizedHandles() {
|
|
43250
|
+
return Array.from(this.handleToOptimizedObjects.keys());
|
|
43251
|
+
}
|
|
43252
|
+
syncColorOverrides() {
|
|
43253
|
+
const data = this.colorOverrideData;
|
|
43254
|
+
const texelCount = data.length / 4;
|
|
43255
|
+
data.fill(0);
|
|
43256
|
+
this.colorOverrides.forEach((color, handle) => {
|
|
43257
|
+
const index = this.objectIdToIndex.get(handle);
|
|
43258
|
+
if (index === undefined || index >= texelCount) return;
|
|
43259
|
+
const offset = index * 4;
|
|
43260
|
+
data[offset] = Math.round(MathUtils.clamp(color.r, 0, 1) * 255);
|
|
43261
|
+
data[offset + 1] = Math.round(MathUtils.clamp(color.g, 0, 1) * 255);
|
|
43262
|
+
data[offset + 2] = Math.round(MathUtils.clamp(color.b, 0, 1) * 255);
|
|
43263
|
+
data[offset + 3] = 255;
|
|
43264
|
+
});
|
|
43265
|
+
this.objectStateUniforms.colorOverrideTexture.value.needsUpdate = true;
|
|
43266
|
+
}
|
|
43267
|
+
setHighlightStyle(name, settings = {}) {
|
|
43268
|
+
let index = this.highlightStyleNames.get(name);
|
|
43269
|
+
if (index === undefined) {
|
|
43270
|
+
if (this.highlightStyles.length >= MAX_HIGHLIGHT_STYLES) {
|
|
43271
|
+
console.warn(`DynamicLoader: Max highlight styles (${MAX_HIGHLIGHT_STYLES}) reached, "${name}" ignored`);
|
|
43272
|
+
return;
|
|
43273
|
+
}
|
|
43274
|
+
index = this.highlightStyles.length;
|
|
43275
|
+
this.highlightStyleNames.set(name, index);
|
|
43276
|
+
}
|
|
43277
|
+
const style = {
|
|
43278
|
+
fillColor: new Color(settings.fillColor ?? 0x4aa9fa),
|
|
43279
|
+
fillMix: settings.fillMix ?? 1,
|
|
43280
|
+
fillOpacity: settings.fillOpacity ?? -1,
|
|
43281
|
+
lineColor: new Color(settings.lineColor ?? settings.fillColor ?? 0x4aa9fa),
|
|
43282
|
+
lineMix: settings.lineMix ?? 1,
|
|
43283
|
+
emissiveIntensity: settings.emissiveIntensity ?? 0,
|
|
43284
|
+
facesOverlay: settings.facesOverlay ?? settings.overlay ?? true,
|
|
43285
|
+
edgesOverlay: settings.edgesOverlay ?? settings.overlay ?? true,
|
|
43286
|
+
overlayOpacity: settings.overlayOpacity ?? 1,
|
|
43287
|
+
};
|
|
43288
|
+
this.highlightStyles[index] = style;
|
|
43289
|
+
const vectors = this.objectStateUniforms.highlightStyles.value;
|
|
43290
|
+
const base = index * HIGHLIGHT_STYLE_VEC4_COUNT;
|
|
43291
|
+
vectors[base].set(style.fillColor.r, style.fillColor.g, style.fillColor.b, style.fillMix);
|
|
43292
|
+
vectors[base + 1].set(style.lineColor.r, style.lineColor.g, style.lineColor.b, style.lineMix);
|
|
43293
|
+
vectors[base + 2].set(style.emissiveIntensity, style.overlayOpacity, style.facesOverlay ? 1 : 0, style.fillOpacity);
|
|
43294
|
+
vectors[base + 3].set(style.edgesOverlay ? 1 : 0, 0, 0, 0);
|
|
43295
|
+
if (this.highlightedHandles.size !== 0) {
|
|
43296
|
+
this.syncHighlightedObjects();
|
|
43297
|
+
}
|
|
43298
|
+
}
|
|
43299
|
+
setHighlightSettings(settings = {}, styleName = "default") {
|
|
43300
|
+
const index = this.highlightStyleNames.get(styleName);
|
|
43301
|
+
const current = index !== undefined ? this.highlightStyles[index] : {};
|
|
43302
|
+
const merged = {
|
|
43303
|
+
facesColor: current.fillColor,
|
|
43304
|
+
edgesColor: current.lineColor,
|
|
43305
|
+
edgesVisibility: true,
|
|
43306
|
+
edgesOverlap: true,
|
|
43307
|
+
facesOverlap: true,
|
|
43308
|
+
colorBlend: 1,
|
|
43309
|
+
...current.viewerSettings,
|
|
43310
|
+
...settings,
|
|
43311
|
+
};
|
|
43312
|
+
this.setHighlightStyle(styleName, {
|
|
43313
|
+
...current,
|
|
43314
|
+
fillColor: merged.facesColor,
|
|
43315
|
+
lineColor: merged.edgesColor,
|
|
43316
|
+
fillMix: merged.colorBlend,
|
|
43317
|
+
lineMix: merged.edgesVisibility ? merged.colorBlend : 0,
|
|
43318
|
+
facesOverlay: merged.facesOverlap,
|
|
43319
|
+
edgesOverlay: merged.edgesVisibility && merged.edgesOverlap,
|
|
43320
|
+
});
|
|
43321
|
+
const style = this.highlightStyles[this.highlightStyleNames.get(styleName)];
|
|
43322
|
+
if (style) style.viewerSettings = merged;
|
|
43323
|
+
}
|
|
43324
|
+
highlightObjects(handles, styleName = "default") {
|
|
43325
|
+
const styleIndex = this.highlightStyleNames.get(styleName);
|
|
43326
|
+
if (styleIndex === undefined) {
|
|
43327
|
+
console.warn(`DynamicLoader: Unknown highlight style "${styleName}"`);
|
|
43328
|
+
return;
|
|
43329
|
+
}
|
|
43330
|
+
handles.forEach((handle) => {
|
|
43331
|
+
this.highlightedHandles.set(handle, styleIndex);
|
|
43332
|
+
});
|
|
43333
|
+
this.syncHighlightedObjects();
|
|
43334
|
+
}
|
|
43335
|
+
unhighlightObjects(handles) {
|
|
43336
|
+
handles.forEach((handle) => {
|
|
43337
|
+
this.highlightedHandles.delete(handle);
|
|
43338
|
+
});
|
|
43339
|
+
this.syncHighlightedObjects();
|
|
43340
|
+
}
|
|
43341
|
+
unhighlightAllObjects() {
|
|
43342
|
+
this.highlightedHandles.clear();
|
|
43343
|
+
this.syncHighlightedObjects();
|
|
43344
|
+
}
|
|
43345
|
+
isHandleHighlighted(handle) {
|
|
43346
|
+
return this.highlightedHandles.has(handle);
|
|
43347
|
+
}
|
|
43348
|
+
isHandleOptimized(handle) {
|
|
43349
|
+
return this.handleToOptimizedObjects.has(handle);
|
|
43350
|
+
}
|
|
43351
|
+
syncHighlightedObjects() {
|
|
43352
|
+
const data = this.highlightData;
|
|
43353
|
+
const texelCount = data.length / 4;
|
|
43354
|
+
data.fill(0);
|
|
43355
|
+
const overlayTargets = new Set();
|
|
43356
|
+
this.highlightedHandles.forEach((styleIndex, handle) => {
|
|
43357
|
+
const index = this.objectIdToIndex.get(handle);
|
|
43358
|
+
if (index === undefined || index >= texelCount) return;
|
|
43359
|
+
data[index * 4] = styleIndex + 1;
|
|
43360
|
+
const style = this.highlightStyles[styleIndex];
|
|
43361
|
+
if (style.facesOverlay || style.edgesOverlay) {
|
|
43362
|
+
const mergedObjects = this.handleToOptimizedObjects.get(handle);
|
|
43363
|
+
if (!mergedObjects) return;
|
|
43364
|
+
mergedObjects.forEach((object) => {
|
|
43365
|
+
if (object.userData.isEdge ? style.edgesOverlay : style.facesOverlay) overlayTargets.add(object);
|
|
43366
|
+
});
|
|
43367
|
+
}
|
|
43368
|
+
});
|
|
43369
|
+
this.objectStateUniforms.highlightTexture.value.needsUpdate = true;
|
|
43370
|
+
this.highlightOverlays.forEach((overlay, mergedObject) => {
|
|
43371
|
+
overlay.visible = overlayTargets.has(mergedObject);
|
|
43372
|
+
});
|
|
43373
|
+
overlayTargets.forEach((mergedObject) => {
|
|
43374
|
+
if (!this.highlightOverlays.has(mergedObject)) {
|
|
43375
|
+
this._createHighlightOverlay(mergedObject);
|
|
43376
|
+
}
|
|
43377
|
+
});
|
|
43378
|
+
}
|
|
43379
|
+
_getHighlightOverlayMaterial(mergedObject) {
|
|
43380
|
+
if (!this.highlightOverlayMaterials) {
|
|
43381
|
+
const common = { transparent: true, depthTest: false, depthWrite: false };
|
|
43382
|
+
this.highlightOverlayMaterials = {
|
|
43383
|
+
mesh: this.createVisibilityMaterial(new MeshPhongMaterial({ ...common, specular: 0x222222, shininess: 0 }), {
|
|
43384
|
+
overlay: true,
|
|
43385
|
+
}),
|
|
43386
|
+
line: this.createVisibilityMaterial(new LineBasicMaterial({ ...common }), { overlay: true }),
|
|
43387
|
+
edges: this.createVisibilityMaterial(new LineBasicMaterial({ ...common }), { overlay: true, edges: true }),
|
|
43388
|
+
points: this.createVisibilityMaterial(new PointsMaterial({ ...common, size: 0.05, sizeAttenuation: false }), {
|
|
43389
|
+
overlay: true,
|
|
43390
|
+
}),
|
|
43391
|
+
};
|
|
43392
|
+
}
|
|
43393
|
+
if (mergedObject.isPoints) return this.highlightOverlayMaterials.points;
|
|
43394
|
+
if (mergedObject.isLine) {
|
|
43395
|
+
return mergedObject.userData.isEdge ? this.highlightOverlayMaterials.edges : this.highlightOverlayMaterials.line;
|
|
43396
|
+
}
|
|
43397
|
+
return this.highlightOverlayMaterials.mesh;
|
|
43398
|
+
}
|
|
43399
|
+
_createHighlightOverlay(mergedObject) {
|
|
43400
|
+
const overlay = new mergedObject.constructor(
|
|
43401
|
+
mergedObject.geometry,
|
|
43402
|
+
this._getHighlightOverlayMaterial(mergedObject)
|
|
43403
|
+
);
|
|
43404
|
+
overlay.frustumCulled = false;
|
|
43405
|
+
overlay.renderOrder = HIGHLIGHT_OVERLAY_RENDER_ORDER;
|
|
43406
|
+
overlay.raycast = () => {};
|
|
43407
|
+
overlay.userData.isHighlightOverlay = true;
|
|
43408
|
+
mergedObject.add(overlay);
|
|
43409
|
+
this.highlightOverlays.set(mergedObject, overlay);
|
|
43410
|
+
return overlay;
|
|
43411
|
+
}
|
|
43412
|
+
_disposeHighlightOverlays() {
|
|
43413
|
+
this.highlightOverlays.forEach((overlay) => {
|
|
43414
|
+
if (overlay.parent) overlay.parent.remove(overlay);
|
|
43415
|
+
});
|
|
43416
|
+
this.highlightOverlays.clear();
|
|
43417
|
+
if (this.highlightOverlayMaterials) {
|
|
43418
|
+
Object.values(this.highlightOverlayMaterials).forEach((material) => {
|
|
43419
|
+
this.visibilityMaterials.delete(material);
|
|
43420
|
+
material.dispose();
|
|
43421
|
+
});
|
|
43422
|
+
this.highlightOverlayMaterials = null;
|
|
43423
|
+
}
|
|
43424
|
+
}
|
|
42935
43425
|
_updateVisibilityAttribute(mergedObject) {
|
|
42936
43426
|
if (
|
|
42937
43427
|
mergedObject.geometry &&
|
|
@@ -44619,9 +45109,13 @@ void main() {
|
|
|
44619
45109
|
class GLTFFileDynamicLoader extends Loader$1 {
|
|
44620
45110
|
constructor(viewer) {
|
|
44621
45111
|
super();
|
|
45112
|
+
this.syncHighlightSettings = ({ data }) => {
|
|
45113
|
+
this.gltfLoader.setHighlightSettings(this.getHighlightSettings(data));
|
|
45114
|
+
};
|
|
44622
45115
|
this.viewer = viewer;
|
|
44623
45116
|
}
|
|
44624
45117
|
dispose() {
|
|
45118
|
+
this.viewer.removeEventListener("optionschange", this.syncHighlightSettings);
|
|
44625
45119
|
if (this.gltfLoader)
|
|
44626
45120
|
this.gltfLoader.clear();
|
|
44627
45121
|
if (this.manager)
|
|
@@ -44639,9 +45133,12 @@ void main() {
|
|
|
44639
45133
|
this.gltfLoader.setVisibleEdges(this.viewer.options.edgeModel);
|
|
44640
45134
|
this.gltfLoader.setMaxConcurrentChunks(params.maxConcurrentChunks);
|
|
44641
45135
|
this.gltfLoader.setDracoLoader(params.dracoLoader);
|
|
45136
|
+
this.gltfLoader.setHighlightSettings(this.getHighlightSettings());
|
|
44642
45137
|
const modelImpl = new DynamicModelImpl(scene);
|
|
44643
45138
|
modelImpl.id = params.modelId || this.extractFileName(file);
|
|
44644
45139
|
modelImpl.gltfLoader = this.gltfLoader;
|
|
45140
|
+
modelImpl.initialize();
|
|
45141
|
+
this.viewer.addEventListener("optionschange", this.syncHighlightSettings);
|
|
44645
45142
|
this.gltfLoader.addEventListener("databasechunk", () => {
|
|
44646
45143
|
this.viewer.scene.add(scene);
|
|
44647
45144
|
this.viewer.models.push(modelImpl);
|
|
@@ -44703,15 +45200,37 @@ void main() {
|
|
|
44703
45200
|
if (this.gltfLoader)
|
|
44704
45201
|
this.gltfLoader.abortLoading();
|
|
44705
45202
|
}
|
|
45203
|
+
getHighlightSettings(options) {
|
|
45204
|
+
if (!options)
|
|
45205
|
+
options = this.viewer.options;
|
|
45206
|
+
if (!options.enableCustomHighlight)
|
|
45207
|
+
options = Options.defaults();
|
|
45208
|
+
let { facesColor, facesTransparancy, edgesColor } = options;
|
|
45209
|
+
facesColor = new Color().setRGB(facesColor.r / 255, facesColor.g / 255, facesColor.b / 255);
|
|
45210
|
+
facesTransparancy = (255 - facesTransparancy) / 255;
|
|
45211
|
+
edgesColor = new Color().setRGB(edgesColor.r / 255, edgesColor.g / 255, edgesColor.b / 255);
|
|
45212
|
+
return {
|
|
45213
|
+
facesColor,
|
|
45214
|
+
facesTransparancy,
|
|
45215
|
+
facesOverlap: options.facesOverlap,
|
|
45216
|
+
edgesColor,
|
|
45217
|
+
edgesVisibility: options.edgesVisibility,
|
|
45218
|
+
edgesOverlap: options.edgesOverlap,
|
|
45219
|
+
};
|
|
45220
|
+
}
|
|
44706
45221
|
}
|
|
44707
45222
|
|
|
44708
45223
|
class GLTFCloudDynamicLoader extends Loader$1 {
|
|
44709
45224
|
constructor(viewer) {
|
|
44710
45225
|
super();
|
|
44711
45226
|
this.requestId = 0;
|
|
45227
|
+
this.syncHighlightSettings = ({ data }) => {
|
|
45228
|
+
this.gltfLoader.setHighlightSettings(this.getHighlightSettings(data));
|
|
45229
|
+
};
|
|
44712
45230
|
this.viewer = viewer;
|
|
44713
45231
|
}
|
|
44714
45232
|
dispose() {
|
|
45233
|
+
this.viewer.removeEventListener("optionschange", this.syncHighlightSettings);
|
|
44715
45234
|
if (this.gltfLoader)
|
|
44716
45235
|
this.gltfLoader.clear();
|
|
44717
45236
|
}
|
|
@@ -44729,9 +45248,12 @@ void main() {
|
|
|
44729
45248
|
this.gltfLoader.setVisibleEdges(this.viewer.options.edgeModel);
|
|
44730
45249
|
this.gltfLoader.setMaxConcurrentChunks(params.maxConcurrentChunks);
|
|
44731
45250
|
this.gltfLoader.setDracoLoader(params.dracoLoader);
|
|
45251
|
+
this.gltfLoader.setHighlightSettings(this.getHighlightSettings());
|
|
44732
45252
|
const modelImpl = new DynamicModelImpl(scene);
|
|
44733
|
-
modelImpl.id = model.file.id;
|
|
45253
|
+
modelImpl.id = params.modelId || model.file.id;
|
|
44734
45254
|
modelImpl.gltfLoader = this.gltfLoader;
|
|
45255
|
+
modelImpl.initialize();
|
|
45256
|
+
this.viewer.addEventListener("optionschange", this.syncHighlightSettings);
|
|
44735
45257
|
this.gltfLoader.addEventListener("databasechunk", (data) => {
|
|
44736
45258
|
this.viewer.scene.add(scene);
|
|
44737
45259
|
this.viewer.models.push(modelImpl);
|
|
@@ -44782,6 +45304,24 @@ void main() {
|
|
|
44782
45304
|
if (this.gltfLoader)
|
|
44783
45305
|
this.gltfLoader.abortLoading();
|
|
44784
45306
|
}
|
|
45307
|
+
getHighlightSettings(options) {
|
|
45308
|
+
if (!options)
|
|
45309
|
+
options = this.viewer.options;
|
|
45310
|
+
if (!options.enableCustomHighlight)
|
|
45311
|
+
options = Options.defaults();
|
|
45312
|
+
let { facesColor, facesTransparancy, edgesColor } = options;
|
|
45313
|
+
facesColor = new Color().setRGB(facesColor.r / 255, facesColor.g / 255, facesColor.b / 255);
|
|
45314
|
+
facesTransparancy = (255 - facesTransparancy) / 255;
|
|
45315
|
+
edgesColor = new Color().setRGB(edgesColor.r / 255, edgesColor.g / 255, edgesColor.b / 255);
|
|
45316
|
+
return {
|
|
45317
|
+
facesColor,
|
|
45318
|
+
facesTransparancy,
|
|
45319
|
+
facesOverlap: options.facesOverlap,
|
|
45320
|
+
edgesColor,
|
|
45321
|
+
edgesVisibility: options.edgesVisibility,
|
|
45322
|
+
edgesOverlap: options.edgesOverlap,
|
|
45323
|
+
};
|
|
45324
|
+
}
|
|
44785
45325
|
}
|
|
44786
45326
|
|
|
44787
45327
|
const loaders = loadersRegistry("threejs");
|
|
@@ -59931,12 +60471,14 @@ js: import "konva/skia-backend";
|
|
|
59931
60471
|
this.info = new Info();
|
|
59932
60472
|
this.canvasEvents = CANVAS_EVENTS.slice();
|
|
59933
60473
|
this.canvaseventlistener = (event) => this.emit(event);
|
|
59934
|
-
this.
|
|
60474
|
+
this.selector = new Selector(this.models);
|
|
60475
|
+
this.visibilityManager = new VisibilityManager(this.models);
|
|
60476
|
+
this.explodeScale = 0;
|
|
60477
|
+
this.clippingPlanes = [];
|
|
59935
60478
|
this.extents = new Box3();
|
|
59936
60479
|
this.target = new Vector3(0, 0, 0);
|
|
59937
|
-
this.clippingPlanes = [];
|
|
59938
60480
|
this._activeDragger = null;
|
|
59939
|
-
this._components =
|
|
60481
|
+
this._components = new Map();
|
|
59940
60482
|
this._renderNeeded = false;
|
|
59941
60483
|
this._renderTime = 0;
|
|
59942
60484
|
this.render = this.render.bind(this);
|
|
@@ -60001,7 +60543,7 @@ js: import "konva/skia-backend";
|
|
|
60001
60543
|
for (const name of components.getComponents().keys()) {
|
|
60002
60544
|
const component = components.createComponent(name, this);
|
|
60003
60545
|
if (component)
|
|
60004
|
-
this._components.
|
|
60546
|
+
this._components.set(name, component);
|
|
60005
60547
|
}
|
|
60006
60548
|
this.syncOptions();
|
|
60007
60549
|
this.syncOverlay();
|
|
@@ -60022,7 +60564,7 @@ js: import "konva/skia-backend";
|
|
|
60022
60564
|
this.removeAllListeners();
|
|
60023
60565
|
this.setActiveDragger();
|
|
60024
60566
|
this._components.forEach((component) => component.dispose());
|
|
60025
|
-
this._components.
|
|
60567
|
+
this._components.clear();
|
|
60026
60568
|
this._markup.dispose();
|
|
60027
60569
|
if (this.canvas) {
|
|
60028
60570
|
this.canvasEvents.forEach((x) => this.canvas.removeEventListener(x, this.canvaseventlistener));
|
|
@@ -60078,8 +60620,8 @@ js: import "konva/skia-backend";
|
|
|
60078
60620
|
}
|
|
60079
60621
|
update(force = false) {
|
|
60080
60622
|
const time = performance.now();
|
|
60081
|
-
if (typeof force === "number"
|
|
60082
|
-
force =
|
|
60623
|
+
if (typeof force === "number")
|
|
60624
|
+
force = time - this._renderTime >= force;
|
|
60083
60625
|
this._renderNeeded = true;
|
|
60084
60626
|
if (force)
|
|
60085
60627
|
this.render(time);
|
|
@@ -60211,8 +60753,8 @@ js: import "konva/skia-backend";
|
|
|
60211
60753
|
this.emitEvent({ type: "clearslices" });
|
|
60212
60754
|
this.update();
|
|
60213
60755
|
}
|
|
60214
|
-
getSelected() {
|
|
60215
|
-
return this.executeCommand("getSelected");
|
|
60756
|
+
getSelected(multimodel) {
|
|
60757
|
+
return this.executeCommand("getSelected", multimodel);
|
|
60216
60758
|
}
|
|
60217
60759
|
getSelected2() {
|
|
60218
60760
|
return this.executeCommand("getSelected2");
|
|
@@ -60223,18 +60765,54 @@ js: import "konva/skia-backend";
|
|
|
60223
60765
|
setSelected2(handles) {
|
|
60224
60766
|
this.executeCommand("setSelected2", handles);
|
|
60225
60767
|
}
|
|
60768
|
+
select(handles) {
|
|
60769
|
+
this.executeCommand("select", handles);
|
|
60770
|
+
}
|
|
60771
|
+
deselect(handles) {
|
|
60772
|
+
this.executeCommand("deselect", handles);
|
|
60773
|
+
}
|
|
60774
|
+
toggleSelection(handles) {
|
|
60775
|
+
this.executeCommand("toggleSelection", handles);
|
|
60776
|
+
}
|
|
60226
60777
|
clearSelected() {
|
|
60227
60778
|
this.executeCommand("clearSelected");
|
|
60228
60779
|
}
|
|
60780
|
+
getHidden(multimodel) {
|
|
60781
|
+
return this.executeCommand("getHidden", multimodel);
|
|
60782
|
+
}
|
|
60783
|
+
getIsolated(multimodel) {
|
|
60784
|
+
return this.executeCommand("getIsolated", multimodel);
|
|
60785
|
+
}
|
|
60786
|
+
hide(handle) {
|
|
60787
|
+
this.executeCommand("hide", handle);
|
|
60788
|
+
}
|
|
60229
60789
|
hideSelected() {
|
|
60230
60790
|
this.executeCommand("hideSelected");
|
|
60231
60791
|
}
|
|
60792
|
+
hideAll() {
|
|
60793
|
+
this.executeCommand("hideAll");
|
|
60794
|
+
}
|
|
60795
|
+
isolate(handle) {
|
|
60796
|
+
this.executeCommand("isolate", handle);
|
|
60797
|
+
}
|
|
60232
60798
|
isolateSelected() {
|
|
60233
60799
|
this.executeCommand("isolateSelected");
|
|
60234
60800
|
}
|
|
60801
|
+
show(handle) {
|
|
60802
|
+
this.executeCommand("show", handle);
|
|
60803
|
+
}
|
|
60235
60804
|
showAll() {
|
|
60236
60805
|
this.executeCommand("showAll");
|
|
60237
60806
|
}
|
|
60807
|
+
zoomExtents() {
|
|
60808
|
+
this.executeCommand("zoomExtents");
|
|
60809
|
+
}
|
|
60810
|
+
zoomTo(handles) {
|
|
60811
|
+
this.executeCommand("zoomTo", handles);
|
|
60812
|
+
}
|
|
60813
|
+
zoomToSelected() {
|
|
60814
|
+
this.executeCommand("zoomToSelected");
|
|
60815
|
+
}
|
|
60238
60816
|
explode(index = 0) {
|
|
60239
60817
|
this.executeCommand("explode", index);
|
|
60240
60818
|
}
|
|
@@ -60276,10 +60854,10 @@ js: import "konva/skia-backend";
|
|
|
60276
60854
|
}
|
|
60277
60855
|
}
|
|
60278
60856
|
getComponent(name) {
|
|
60279
|
-
return this._components.
|
|
60857
|
+
return this._components.get(name) || null;
|
|
60280
60858
|
}
|
|
60281
60859
|
drawViewpoint(viewpoint) {
|
|
60282
|
-
var _a, _b, _c, _d;
|
|
60860
|
+
var _a, _b, _c, _d, _e;
|
|
60283
60861
|
if (!this.renderer)
|
|
60284
60862
|
return;
|
|
60285
60863
|
const getVector3FromPoint3d = ({ x, y, z }) => new Vector3(x, y, z);
|
|
@@ -60341,8 +60919,26 @@ js: import "konva/skia-backend";
|
|
|
60341
60919
|
}
|
|
60342
60920
|
};
|
|
60343
60921
|
const setSelection = (selection) => {
|
|
60344
|
-
if (selection)
|
|
60345
|
-
this.setSelected(selection.map((
|
|
60922
|
+
if (selection) {
|
|
60923
|
+
this.setSelected(selection.map(({ handle }) => handle));
|
|
60924
|
+
}
|
|
60925
|
+
};
|
|
60926
|
+
const setVisibility = (visibility) => {
|
|
60927
|
+
if (visibility && visibility.exceptions)
|
|
60928
|
+
if (visibility.default_visibility) {
|
|
60929
|
+
this.hide(visibility.exceptions.map(({ handle }) => handle));
|
|
60930
|
+
}
|
|
60931
|
+
else {
|
|
60932
|
+
this.isolate(visibility.exceptions.map(({ handle }) => handle));
|
|
60933
|
+
}
|
|
60934
|
+
};
|
|
60935
|
+
const setExplodeScale = (scale) => {
|
|
60936
|
+
if (scale > 0)
|
|
60937
|
+
this.explode(scale);
|
|
60938
|
+
};
|
|
60939
|
+
const setCameraTarget = (target) => {
|
|
60940
|
+
if (target)
|
|
60941
|
+
this.target = getVector3FromPoint3d(target);
|
|
60346
60942
|
};
|
|
60347
60943
|
const draggerName = (_a = this._activeDragger) === null || _a === void 0 ? void 0 : _a.name;
|
|
60348
60944
|
this.setActiveDragger();
|
|
@@ -60354,9 +60950,11 @@ js: import "konva/skia-backend";
|
|
|
60354
60950
|
setOrthogonalCamera(viewpoint.orthogonal_camera);
|
|
60355
60951
|
setPerspectiveCamera(viewpoint.perspective_camera);
|
|
60356
60952
|
setClippingPlanes(viewpoint.clipping_planes);
|
|
60357
|
-
|
|
60358
|
-
|
|
60359
|
-
|
|
60953
|
+
setVisibility(((_b = viewpoint.custom_fields) === null || _b === void 0 ? void 0 : _b.visibility2) || viewpoint.visibility);
|
|
60954
|
+
setSelection(((_c = viewpoint.custom_fields) === null || _c === void 0 ? void 0 : _c.selection2) || viewpoint.selection);
|
|
60955
|
+
setExplodeScale((_d = viewpoint.custom_fields) === null || _d === void 0 ? void 0 : _d.explodeScale);
|
|
60956
|
+
setCameraTarget((_e = viewpoint.custom_fields) === null || _e === void 0 ? void 0 : _e.camera_target);
|
|
60957
|
+
this.markup.setViewpoint(viewpoint);
|
|
60360
60958
|
this.syncOverlay();
|
|
60361
60959
|
this.setActiveDragger(draggerName);
|
|
60362
60960
|
this.emitEvent({ type: "drawviewpoint", data: viewpoint });
|
|
@@ -60402,21 +61000,43 @@ js: import "konva/skia-backend";
|
|
|
60402
61000
|
return clipping_planes;
|
|
60403
61001
|
};
|
|
60404
61002
|
const getSelection = () => {
|
|
60405
|
-
|
|
61003
|
+
const selected2 = Array.from(this.selector.selected);
|
|
61004
|
+
const selected = toHandles(this, selected2);
|
|
61005
|
+
return selected.map((handle) => ({ handle }));
|
|
60406
61006
|
};
|
|
60407
61007
|
const getSelection2 = () => {
|
|
60408
|
-
|
|
61008
|
+
const selected2 = Array.from(this.selector.selected);
|
|
61009
|
+
return selected2.map((handle) => ({ handle }));
|
|
61010
|
+
};
|
|
61011
|
+
const getVisibility = () => {
|
|
61012
|
+
const exceptions2 = Array.from(this.visibilityManager.exceptions);
|
|
61013
|
+
const exceptions = toHandles(this, exceptions2);
|
|
61014
|
+
return {
|
|
61015
|
+
default_visibility: this.visibilityManager.defaultVisible,
|
|
61016
|
+
exceptions: exceptions.map((handle) => ({ handle })),
|
|
61017
|
+
};
|
|
61018
|
+
};
|
|
61019
|
+
const getVisibility2 = () => {
|
|
61020
|
+
const exceptions = Array.from(this.visibilityManager.exceptions);
|
|
61021
|
+
return {
|
|
61022
|
+
default_visibility: this.visibilityManager.defaultVisible,
|
|
61023
|
+
exceptions: exceptions.map((handle) => ({ handle })),
|
|
61024
|
+
};
|
|
60409
61025
|
};
|
|
60410
61026
|
const viewpoint = { custom_fields: {} };
|
|
60411
61027
|
viewpoint.orthogonal_camera = getOrthogonalCamera();
|
|
60412
61028
|
viewpoint.perspective_camera = getPerspectiveCamera();
|
|
60413
61029
|
viewpoint.clipping_planes = getClippingPlanes();
|
|
60414
61030
|
viewpoint.selection = getSelection();
|
|
61031
|
+
viewpoint.visibility = getVisibility();
|
|
60415
61032
|
viewpoint.description = new Date().toDateString();
|
|
60416
61033
|
viewpoint.snapshot = { data: this.getSnapshot() };
|
|
60417
|
-
this._markup.getViewpoint(viewpoint);
|
|
60418
|
-
viewpoint.custom_fields.camera_target = getPoint3dFromVector3(this.target);
|
|
60419
61034
|
viewpoint.custom_fields.selection2 = getSelection2();
|
|
61035
|
+
viewpoint.custom_fields.visibility2 = getVisibility2();
|
|
61036
|
+
viewpoint.custom_fields.explodeScale = this.explodeScale;
|
|
61037
|
+
viewpoint.custom_fields.camera_target = getPoint3dFromVector3(this.target);
|
|
61038
|
+
viewpoint.custom_fields.files = this.models.map((model) => model.id);
|
|
61039
|
+
this.markup.getViewpoint(viewpoint);
|
|
60420
61040
|
this.emitEvent({ type: "createviewpoint", data: viewpoint });
|
|
60421
61041
|
return viewpoint;
|
|
60422
61042
|
}
|
|
@@ -60480,7 +61100,9 @@ js: import "konva/skia-backend";
|
|
|
60480
61100
|
exports.Markup = KonvaMarkup;
|
|
60481
61101
|
exports.ModelImpl = ModelImpl;
|
|
60482
61102
|
exports.Options = Options;
|
|
61103
|
+
exports.Selector = Selector;
|
|
60483
61104
|
exports.Viewer = Viewer;
|
|
61105
|
+
exports.VisibilityManager = VisibilityManager;
|
|
60484
61106
|
exports.commands = commands;
|
|
60485
61107
|
exports.commandsRegistry = commandsRegistry;
|
|
60486
61108
|
exports.components = components;
|