three-cad-viewer 3.4.1 → 3.4.2
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/three-cad-viewer.css +6 -0
- package/dist/three-cad-viewer.esm.js +142 -90
- package/dist/three-cad-viewer.esm.js.map +1 -1
- package/dist/three-cad-viewer.esm.min.js +1 -1
- package/dist/three-cad-viewer.js +142 -90
- package/dist/three-cad-viewer.min.js +1 -1
- package/package.json +1 -1
- package/src/_version.js +1 -1
- package/src/cad_tools/measure.js +127 -80
- package/src/cad_tools/select.js +3 -1
- package/src/cad_tools/tools.js +3 -1
- package/src/display.js +9 -0
- package/src/treeview.js +4 -12
|
@@ -47,6 +47,11 @@ canvas {
|
|
|
47
47
|
outline: none !important;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/* Disables text selection of UI elements */
|
|
51
|
+
body {
|
|
52
|
+
user-select: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
50
55
|
.tcv_cad_viewer {
|
|
51
56
|
margin: 0;
|
|
52
57
|
display: flex;
|
|
@@ -114,6 +119,7 @@ canvas {
|
|
|
114
119
|
border-style: solid;
|
|
115
120
|
border-width: 1px;
|
|
116
121
|
overflow: hidden;
|
|
122
|
+
user-select:text;
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
.tcv_cad_info_wrapper {
|
|
@@ -57660,25 +57660,35 @@ class Measurement {
|
|
|
57660
57660
|
this.panelDragData.y = e.clientY;
|
|
57661
57661
|
e.stopPropagation();
|
|
57662
57662
|
});
|
|
57663
|
-
document.addEventListener("mouseup", this._mouseup);
|
|
57664
|
-
document.addEventListener("mousemove", this._dragPanel);
|
|
57665
57663
|
}
|
|
57666
57664
|
|
|
57667
57665
|
enableContext() {
|
|
57668
57666
|
this.contextEnabled = true;
|
|
57669
57667
|
this.panelCenter = new Vector3(1, 0, 0);
|
|
57668
|
+
|
|
57669
|
+
document.addEventListener("mouseup", this._mouseup);
|
|
57670
|
+
document.addEventListener("mousemove", this._dragPanel);
|
|
57670
57671
|
}
|
|
57671
57672
|
|
|
57672
57673
|
disableContext() {
|
|
57674
|
+
this._hideMeasurement();
|
|
57673
57675
|
this.contextEnabled = false;
|
|
57676
|
+
this.responseData = null;
|
|
57677
|
+
|
|
57678
|
+
for (var group of this.selectedShapes) {
|
|
57679
|
+
group.obj.clearHighlights();
|
|
57680
|
+
}
|
|
57674
57681
|
this.selectedShapes = [];
|
|
57675
|
-
|
|
57682
|
+
|
|
57683
|
+
document.removeEventListener("mouseup", this._mouseup);
|
|
57684
|
+
document.removeEventListener("mousemove", this._dragPanel);
|
|
57685
|
+
|
|
57676
57686
|
this.viewer.checkChanges({ selectedShapeIDs: [] });
|
|
57677
57687
|
}
|
|
57678
57688
|
|
|
57679
57689
|
_hideMeasurement() {
|
|
57680
|
-
this.responseData = null;
|
|
57681
57690
|
this.panel.show(false);
|
|
57691
|
+
this.disposeArrows();
|
|
57682
57692
|
this.scene.clear();
|
|
57683
57693
|
}
|
|
57684
57694
|
|
|
@@ -57698,6 +57708,10 @@ class Measurement {
|
|
|
57698
57708
|
throw new Error("Subclass needs to override this method");
|
|
57699
57709
|
}
|
|
57700
57710
|
|
|
57711
|
+
_updateConnectionLine() {
|
|
57712
|
+
throw new Error("Subclass needs to override this method");
|
|
57713
|
+
}
|
|
57714
|
+
|
|
57701
57715
|
/**
|
|
57702
57716
|
* Get the maximum number of selected obj this measurement can handle
|
|
57703
57717
|
* @returns {int} The numbers of obj handled by the measurement
|
|
@@ -57767,7 +57781,6 @@ class Measurement {
|
|
|
57767
57781
|
* @param {object} selectedObj The selected obj.
|
|
57768
57782
|
*/
|
|
57769
57783
|
handleSelection = (selectedObj) => {
|
|
57770
|
-
this._hideMeasurement();
|
|
57771
57784
|
if (
|
|
57772
57785
|
this.selectedShapes.find((o) => o.obj.name === selectedObj.obj.name) !==
|
|
57773
57786
|
undefined
|
|
@@ -57827,8 +57840,9 @@ class Measurement {
|
|
|
57827
57840
|
camera.updateMatrixWorld();
|
|
57828
57841
|
this.panelCenter = panelCenter.unproject(camera);
|
|
57829
57842
|
|
|
57830
|
-
this.scene.
|
|
57831
|
-
|
|
57843
|
+
if (this.scene.children.length > 0) {
|
|
57844
|
+
this._updateConnectionLine();
|
|
57845
|
+
}
|
|
57832
57846
|
};
|
|
57833
57847
|
|
|
57834
57848
|
/**
|
|
@@ -57863,7 +57877,6 @@ class Measurement {
|
|
|
57863
57877
|
this.panelY += dy;
|
|
57864
57878
|
}
|
|
57865
57879
|
|
|
57866
|
-
this.scene.clear();
|
|
57867
57880
|
this._updateMeasurement();
|
|
57868
57881
|
|
|
57869
57882
|
// Update the drag start position
|
|
@@ -57903,19 +57916,23 @@ class Measurement {
|
|
|
57903
57916
|
(Math.max(this.viewer.cadWidth, this.viewer.height) / 60);
|
|
57904
57917
|
this._adjustArrowsScaleFactor(zoom);
|
|
57905
57918
|
this.viewer.renderer.clearDepth();
|
|
57906
|
-
this.viewer.renderer.render(this.scene, camera);
|
|
57907
57919
|
this._movePanel();
|
|
57920
|
+
this.viewer.renderer.render(this.scene, camera);
|
|
57908
57921
|
}
|
|
57909
57922
|
|
|
57910
|
-
|
|
57911
|
-
document.removeEventListener("mouseup", this._mouseup);
|
|
57912
|
-
document.removeEventListener("mousemove", this._dragPanel);
|
|
57913
|
-
|
|
57923
|
+
disposeArrows() {
|
|
57914
57924
|
for (var i in this.scene.children) {
|
|
57915
57925
|
this.scene.children[i].dispose();
|
|
57916
|
-
this.scene.children[i] = null;
|
|
57917
57926
|
}
|
|
57918
|
-
this.
|
|
57927
|
+
this.scene.children = [];
|
|
57928
|
+
}
|
|
57929
|
+
|
|
57930
|
+
dispose() {
|
|
57931
|
+
if (this.panel) {
|
|
57932
|
+
this.panel.show(false);
|
|
57933
|
+
this.panel.dispose();
|
|
57934
|
+
}
|
|
57935
|
+
this.disposeArrows();
|
|
57919
57936
|
this.panel = null;
|
|
57920
57937
|
this.viewer = null;
|
|
57921
57938
|
this.scene = null;
|
|
@@ -57955,29 +57972,38 @@ class DistanceMeasurement extends Measurement {
|
|
|
57955
57972
|
}
|
|
57956
57973
|
|
|
57957
57974
|
_makeLines() {
|
|
57958
|
-
|
|
57959
|
-
|
|
57960
|
-
|
|
57961
|
-
|
|
57962
|
-
|
|
57963
|
-
|
|
57964
|
-
|
|
57965
|
-
|
|
57966
|
-
|
|
57967
|
-
|
|
57968
|
-
|
|
57969
|
-
|
|
57970
|
-
|
|
57971
|
-
|
|
57972
|
-
|
|
57973
|
-
|
|
57974
|
-
|
|
57975
|
-
|
|
57976
|
-
|
|
57977
|
-
|
|
57978
|
-
|
|
57979
|
-
|
|
57980
|
-
|
|
57975
|
+
if (this.scene.children.length === 0) {
|
|
57976
|
+
const lineWidth = 1.5;
|
|
57977
|
+
const distanceLine = new DistanceLineArrow(
|
|
57978
|
+
this.coneLength,
|
|
57979
|
+
this.point1,
|
|
57980
|
+
this.point2,
|
|
57981
|
+
2 * lineWidth,
|
|
57982
|
+
this.measurementLineColor,
|
|
57983
|
+
);
|
|
57984
|
+
this.scene.add(distanceLine);
|
|
57985
|
+
|
|
57986
|
+
this.middlePoint = new Vector3()
|
|
57987
|
+
.addVectors(this.point1, this.point2)
|
|
57988
|
+
.multiplyScalar(0.5);
|
|
57989
|
+
const connectingLine = new DistanceLineArrow(
|
|
57990
|
+
this.coneLength,
|
|
57991
|
+
this.panelCenter,
|
|
57992
|
+
this.middlePoint,
|
|
57993
|
+
lineWidth,
|
|
57994
|
+
this.connectingLineColor,
|
|
57995
|
+
false,
|
|
57996
|
+
false,
|
|
57997
|
+
);
|
|
57998
|
+
this.scene.add(connectingLine);
|
|
57999
|
+
}
|
|
58000
|
+
}
|
|
58001
|
+
|
|
58002
|
+
_updateConnectionLine() {
|
|
58003
|
+
this.scene.children[1].children[0].geometry.setPositions([
|
|
58004
|
+
...this.middlePoint,
|
|
58005
|
+
...this.panelCenter,
|
|
58006
|
+
]);
|
|
57981
58007
|
}
|
|
57982
58008
|
|
|
57983
58009
|
/**
|
|
@@ -58027,18 +58053,27 @@ class PropertiesMeasurement extends Measurement {
|
|
|
58027
58053
|
}
|
|
58028
58054
|
|
|
58029
58055
|
_makeLines() {
|
|
58030
|
-
|
|
58031
|
-
|
|
58032
|
-
|
|
58033
|
-
|
|
58034
|
-
|
|
58035
|
-
|
|
58036
|
-
|
|
58037
|
-
|
|
58038
|
-
|
|
58039
|
-
|
|
58040
|
-
|
|
58041
|
-
|
|
58056
|
+
if (this.scene.children.length === 0) {
|
|
58057
|
+
const lineWidth = 1.5;
|
|
58058
|
+
this.middlePoint = this.responseData.center;
|
|
58059
|
+
const connectingLine = new DistanceLineArrow(
|
|
58060
|
+
this.coneLength,
|
|
58061
|
+
this.panelCenter,
|
|
58062
|
+
this.middlePoint,
|
|
58063
|
+
lineWidth,
|
|
58064
|
+
this.connectingLineColor,
|
|
58065
|
+
false,
|
|
58066
|
+
false,
|
|
58067
|
+
);
|
|
58068
|
+
this.scene.add(connectingLine);
|
|
58069
|
+
}
|
|
58070
|
+
}
|
|
58071
|
+
|
|
58072
|
+
_updateConnectionLine() {
|
|
58073
|
+
this.scene.children[0].children[0].geometry.setPositions([
|
|
58074
|
+
...this.middlePoint,
|
|
58075
|
+
...this.panelCenter,
|
|
58076
|
+
]);
|
|
58042
58077
|
}
|
|
58043
58078
|
|
|
58044
58079
|
/**
|
|
@@ -58094,31 +58129,43 @@ class AngleMeasurement extends Measurement {
|
|
|
58094
58129
|
}
|
|
58095
58130
|
|
|
58096
58131
|
_makeLines() {
|
|
58097
|
-
|
|
58098
|
-
|
|
58099
|
-
|
|
58100
|
-
|
|
58101
|
-
|
|
58102
|
-
|
|
58103
|
-
|
|
58104
|
-
|
|
58105
|
-
|
|
58106
|
-
|
|
58107
|
-
|
|
58108
|
-
|
|
58109
|
-
|
|
58110
|
-
|
|
58111
|
-
|
|
58112
|
-
|
|
58113
|
-
|
|
58114
|
-
|
|
58115
|
-
|
|
58116
|
-
|
|
58117
|
-
|
|
58118
|
-
|
|
58119
|
-
|
|
58120
|
-
|
|
58121
|
-
|
|
58132
|
+
if (this.scene.children.length === 0) {
|
|
58133
|
+
const lineWidth = 1.5;
|
|
58134
|
+
this._getPoints();
|
|
58135
|
+
const item1Line = new DistanceLineArrow(
|
|
58136
|
+
this.coneLength,
|
|
58137
|
+
this.point1,
|
|
58138
|
+
this.panelCenter,
|
|
58139
|
+
lineWidth,
|
|
58140
|
+
this.connectingLineColor,
|
|
58141
|
+
false,
|
|
58142
|
+
false,
|
|
58143
|
+
);
|
|
58144
|
+
const item2Line = new DistanceLineArrow(
|
|
58145
|
+
this.coneLength,
|
|
58146
|
+
this.point2,
|
|
58147
|
+
this.panelCenter,
|
|
58148
|
+
lineWidth,
|
|
58149
|
+
this.connectingLineColor,
|
|
58150
|
+
false,
|
|
58151
|
+
false,
|
|
58152
|
+
);
|
|
58153
|
+
this.scene.add(item1Line);
|
|
58154
|
+
this.scene.add(item2Line);
|
|
58155
|
+
this.middlePoint = new Vector3()
|
|
58156
|
+
.addVectors(this.point1, this.point2)
|
|
58157
|
+
.multiplyScalar(0.5);
|
|
58158
|
+
}
|
|
58159
|
+
}
|
|
58160
|
+
|
|
58161
|
+
_updateConnectionLine() {
|
|
58162
|
+
for (var i = 0; i < 2; i++) {
|
|
58163
|
+
const p = i == 0 ? this.point1 : this.point2;
|
|
58164
|
+
this.scene.children[i].children[0].geometry.setPositions([
|
|
58165
|
+
...p,
|
|
58166
|
+
...this.panelCenter,
|
|
58167
|
+
]);
|
|
58168
|
+
}
|
|
58122
58169
|
}
|
|
58123
58170
|
|
|
58124
58171
|
handleResponse(response) {
|
|
@@ -58149,6 +58196,9 @@ class SelectObject {
|
|
|
58149
58196
|
this.viewer.raycaster.filters.geomFilter = [GeomFilter.none];
|
|
58150
58197
|
}
|
|
58151
58198
|
this.contextEnabled = false;
|
|
58199
|
+
for (var group of this.selectedShapes) {
|
|
58200
|
+
group.obj.clearHighlights();
|
|
58201
|
+
}
|
|
58152
58202
|
this.selectedShapes = [];
|
|
58153
58203
|
}
|
|
58154
58204
|
|
|
@@ -58218,7 +58268,6 @@ class SelectObject {
|
|
|
58218
58268
|
|
|
58219
58269
|
dispose() {
|
|
58220
58270
|
this.disableContext();
|
|
58221
|
-
this.selectedShapes = [];
|
|
58222
58271
|
}
|
|
58223
58272
|
}
|
|
58224
58273
|
|
|
@@ -58257,7 +58306,9 @@ class Tools {
|
|
|
58257
58306
|
*/
|
|
58258
58307
|
enable(toolType) {
|
|
58259
58308
|
// Disable the currently enabled tool (if any)
|
|
58260
|
-
this.
|
|
58309
|
+
if (this.enabledTool) {
|
|
58310
|
+
this.disable();
|
|
58311
|
+
}
|
|
58261
58312
|
|
|
58262
58313
|
switch (toolType) {
|
|
58263
58314
|
case ToolTypes.DISTANCE:
|
|
@@ -59163,6 +59214,15 @@ class Display {
|
|
|
59163
59214
|
this.viewer.toggleTab(false);
|
|
59164
59215
|
this.currentButton = null;
|
|
59165
59216
|
}
|
|
59217
|
+
if (name == "distance") {
|
|
59218
|
+
this.viewer.cadTools.disable(ToolTypes.DISTANCE);
|
|
59219
|
+
} else if (name == "properties") {
|
|
59220
|
+
this.viewer.cadTools.disable(ToolTypes.PROPERTIES);
|
|
59221
|
+
} else if (name == "angle") {
|
|
59222
|
+
this.viewer.cadTools.disable(ToolTypes.ANGLE);
|
|
59223
|
+
} else if (name == "select") {
|
|
59224
|
+
this.viewer.cadTools.disable(ToolTypes.SELECT);
|
|
59225
|
+
}
|
|
59166
59226
|
this.viewer.checkChanges({ activeTool: ToolTypes.NONE });
|
|
59167
59227
|
this.viewer.clearSelection();
|
|
59168
59228
|
if (this.viewer.hasAnimation()) {
|
|
@@ -61850,19 +61910,11 @@ class TreeView {
|
|
|
61850
61910
|
* Handles the scroll event.
|
|
61851
61911
|
*/
|
|
61852
61912
|
handleScroll = () => {
|
|
61853
|
-
|
|
61854
|
-
|
|
61855
|
-
|
|
61856
|
-
this.lastScrollTop = scrollTop;
|
|
61857
|
-
if (this.debug) {
|
|
61858
|
-
console.log("update => scroll");
|
|
61859
|
-
}
|
|
61860
|
-
this.update();
|
|
61861
|
-
|
|
61862
|
-
this.ticking = false;
|
|
61863
|
-
});
|
|
61864
|
-
this.ticking = true;
|
|
61913
|
+
this.lastScrollTop = this.scrollContainer.scrollTop;
|
|
61914
|
+
if (this.debug) {
|
|
61915
|
+
console.log("update => scroll");
|
|
61865
61916
|
}
|
|
61917
|
+
this.update();
|
|
61866
61918
|
};
|
|
61867
61919
|
|
|
61868
61920
|
/**
|
|
@@ -65197,7 +65249,7 @@ class Camera {
|
|
|
65197
65249
|
}
|
|
65198
65250
|
}
|
|
65199
65251
|
|
|
65200
|
-
const version = "3.4.
|
|
65252
|
+
const version = "3.4.2";
|
|
65201
65253
|
|
|
65202
65254
|
Mesh.prototype.dispose = function () {
|
|
65203
65255
|
if (this.geometry) {
|