three-cad-viewer 1.5.3 → 1.5.6
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/Readme.md +11 -1
- package/dist/three-cad-viewer.css +24 -10
- package/dist/three-cad-viewer.esm.css +24 -10
- package/dist/three-cad-viewer.esm.js +119 -66
- package/dist/three-cad-viewer.esm.min.css +24 -10
- package/dist/three-cad-viewer.esm.min.js +1 -1
- package/dist/three-cad-viewer.js +119 -66
- package/dist/three-cad-viewer.min.css +24 -10
- package/dist/three-cad-viewer.min.js +1 -1
- package/package.json +1 -1
- package/src/animation.js +4 -0
- package/src/display.js +49 -48
- package/src/treeview.js +32 -7
- package/src/viewer.js +34 -11
package/Readme.md
CHANGED
|
@@ -70,7 +70,7 @@ For the `States` object, see [Class States](https://bernhard-42.github.io/three-
|
|
|
70
70
|
axes: true,
|
|
71
71
|
grid: [false, false, false],
|
|
72
72
|
timeit: false,
|
|
73
|
-
rotateSpeed: 1
|
|
73
|
+
rotateSpeed: 1,
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
const shapes = {}; // a Shapes object, see example or API docs
|
|
@@ -107,3 +107,13 @@ To understand the data format, a look at the simple 1 unit sized box might be he
|
|
|
107
107
|
- [API docs](https://bernhard-42.github.io/three-cad-viewer/Viewer.html)
|
|
108
108
|
|
|
109
109
|
Back to [Github repo](https://github.com/bernhard-42/three-cad-viewer)
|
|
110
|
+
|
|
111
|
+
## Development
|
|
112
|
+
|
|
113
|
+
Run a web server in watch mode
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
yarn run start
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
For the deployment, see [Release.md](./Release.md)
|
|
@@ -64,7 +64,7 @@ canvas {
|
|
|
64
64
|
|
|
65
65
|
.tcv_cad_view_glass {
|
|
66
66
|
position: absolute !important;
|
|
67
|
-
left:
|
|
67
|
+
left: 4px;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
.tcv_cad_tree_toggles {
|
|
@@ -217,7 +217,7 @@ th {
|
|
|
217
217
|
margin: 0;
|
|
218
218
|
padding: 0px;
|
|
219
219
|
position: absolute;
|
|
220
|
-
right:
|
|
220
|
+
right: 0px;
|
|
221
221
|
bottom: 0px;
|
|
222
222
|
z-index: 100;
|
|
223
223
|
}
|
|
@@ -276,7 +276,7 @@ th {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
.tcv_btn_highlight {
|
|
279
|
-
|
|
279
|
+
outline: 1px solid var(--tcv-shadow);
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
.tcv_small_btn {
|
|
@@ -293,7 +293,7 @@ th {
|
|
|
293
293
|
|
|
294
294
|
.tcv_btn:hover {
|
|
295
295
|
box-shadow: 1px 1px 1px 0 var(--tcv-shadow);
|
|
296
|
-
background-color: var(--tcv-bg-
|
|
296
|
+
background-color: var(--tcv-bg-highlight-color);
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
.tcv_btn:active {
|
|
@@ -328,7 +328,7 @@ input[type="button"] {
|
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
.tcv_tab:hover {
|
|
331
|
-
background-color: var(--tcv-bg-
|
|
331
|
+
background-color: var(--tcv-bg-highlight-color);
|
|
332
332
|
font-weight: bold;
|
|
333
333
|
}
|
|
334
334
|
|
|
@@ -342,12 +342,12 @@ input[type="button"] {
|
|
|
342
342
|
|
|
343
343
|
.tcv_tab-selected {
|
|
344
344
|
border-bottom: none;
|
|
345
|
-
|
|
345
|
+
font-weight: bold;
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
.tcv_tab-unselected {
|
|
349
349
|
border-bottom: 1px solid lightgray;
|
|
350
|
-
|
|
350
|
+
font-weight: normal;
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
.tcv_vertical-center {
|
|
@@ -493,6 +493,8 @@ input[type="button"] {
|
|
|
493
493
|
color: var(--tcv-z-color);
|
|
494
494
|
}
|
|
495
495
|
|
|
496
|
+
/* Scrollbar styling for Chrome like browsers */
|
|
497
|
+
|
|
496
498
|
.tcv_mac-scrollbar::-webkit-scrollbar {
|
|
497
499
|
width: 5px !important;
|
|
498
500
|
height: 5px !important;
|
|
@@ -507,16 +509,20 @@ input[type="button"] {
|
|
|
507
509
|
background-color: transparent !important;
|
|
508
510
|
}
|
|
509
511
|
|
|
512
|
+
.tcv_mac-scrollbar::-webkit-scrollbar-piece {
|
|
513
|
+
background-color: transparent !important;
|
|
514
|
+
}
|
|
515
|
+
|
|
510
516
|
.tcv_mac-scrollbar::-webkit-scrollbar-corner {
|
|
511
517
|
background-color: transparent !important;
|
|
512
518
|
}
|
|
513
519
|
|
|
514
520
|
.tcv_mac-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
515
|
-
background: var(--tcv-scrollbar-hover) !important;
|
|
521
|
+
background-color: var(--tcv-scrollbar-hover) !important;
|
|
516
522
|
}
|
|
517
523
|
|
|
518
524
|
.tcv_mac-scrollbar::-webkit-scrollbar-thumb:active {
|
|
519
|
-
background: var(--tcv-scrollbar-
|
|
525
|
+
background-color: var(--tcv-scrollbar-hover) !important;
|
|
520
526
|
}
|
|
521
527
|
|
|
522
528
|
.tcv_mac-scrollbar .widget-html-content {
|
|
@@ -524,12 +530,20 @@ input[type="button"] {
|
|
|
524
530
|
overflow-y: visible;
|
|
525
531
|
}
|
|
526
532
|
|
|
533
|
+
/* Scrollbar styling for Firefox Browser */
|
|
534
|
+
|
|
527
535
|
.tcv_scroller {
|
|
528
|
-
/* scrollbar-color: #7f7f7f white; */
|
|
529
536
|
scrollbar-width: thin;
|
|
537
|
+
scrollbar-color: var(--tcv-scrollbar-thumb) transparent;
|
|
530
538
|
background-color: transparent !important;
|
|
531
539
|
}
|
|
532
540
|
|
|
541
|
+
.tcv_scroller:hover {
|
|
542
|
+
scrollbar-width: thin;
|
|
543
|
+
scrollbar-color: var(--tcv-scrollbar-hover) transparent;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/* tooltips */
|
|
533
547
|
[data-tooltip]:before {
|
|
534
548
|
position: absolute;
|
|
535
549
|
pointer-events: none;
|
|
@@ -64,7 +64,7 @@ canvas {
|
|
|
64
64
|
|
|
65
65
|
.tcv_cad_view_glass {
|
|
66
66
|
position: absolute !important;
|
|
67
|
-
left:
|
|
67
|
+
left: 4px;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
.tcv_cad_tree_toggles {
|
|
@@ -217,7 +217,7 @@ th {
|
|
|
217
217
|
margin: 0;
|
|
218
218
|
padding: 0px;
|
|
219
219
|
position: absolute;
|
|
220
|
-
right:
|
|
220
|
+
right: 0px;
|
|
221
221
|
bottom: 0px;
|
|
222
222
|
z-index: 100;
|
|
223
223
|
}
|
|
@@ -276,7 +276,7 @@ th {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
.tcv_btn_highlight {
|
|
279
|
-
|
|
279
|
+
outline: 1px solid var(--tcv-shadow);
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
.tcv_small_btn {
|
|
@@ -293,7 +293,7 @@ th {
|
|
|
293
293
|
|
|
294
294
|
.tcv_btn:hover {
|
|
295
295
|
box-shadow: 1px 1px 1px 0 var(--tcv-shadow);
|
|
296
|
-
background-color: var(--tcv-bg-
|
|
296
|
+
background-color: var(--tcv-bg-highlight-color);
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
.tcv_btn:active {
|
|
@@ -328,7 +328,7 @@ input[type="button"] {
|
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
.tcv_tab:hover {
|
|
331
|
-
background-color: var(--tcv-bg-
|
|
331
|
+
background-color: var(--tcv-bg-highlight-color);
|
|
332
332
|
font-weight: bold;
|
|
333
333
|
}
|
|
334
334
|
|
|
@@ -342,12 +342,12 @@ input[type="button"] {
|
|
|
342
342
|
|
|
343
343
|
.tcv_tab-selected {
|
|
344
344
|
border-bottom: none;
|
|
345
|
-
|
|
345
|
+
font-weight: bold;
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
.tcv_tab-unselected {
|
|
349
349
|
border-bottom: 1px solid lightgray;
|
|
350
|
-
|
|
350
|
+
font-weight: normal;
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
.tcv_vertical-center {
|
|
@@ -493,6 +493,8 @@ input[type="button"] {
|
|
|
493
493
|
color: var(--tcv-z-color);
|
|
494
494
|
}
|
|
495
495
|
|
|
496
|
+
/* Scrollbar styling for Chrome like browsers */
|
|
497
|
+
|
|
496
498
|
.tcv_mac-scrollbar::-webkit-scrollbar {
|
|
497
499
|
width: 5px !important;
|
|
498
500
|
height: 5px !important;
|
|
@@ -507,16 +509,20 @@ input[type="button"] {
|
|
|
507
509
|
background-color: transparent !important;
|
|
508
510
|
}
|
|
509
511
|
|
|
512
|
+
.tcv_mac-scrollbar::-webkit-scrollbar-piece {
|
|
513
|
+
background-color: transparent !important;
|
|
514
|
+
}
|
|
515
|
+
|
|
510
516
|
.tcv_mac-scrollbar::-webkit-scrollbar-corner {
|
|
511
517
|
background-color: transparent !important;
|
|
512
518
|
}
|
|
513
519
|
|
|
514
520
|
.tcv_mac-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
515
|
-
background: var(--tcv-scrollbar-hover) !important;
|
|
521
|
+
background-color: var(--tcv-scrollbar-hover) !important;
|
|
516
522
|
}
|
|
517
523
|
|
|
518
524
|
.tcv_mac-scrollbar::-webkit-scrollbar-thumb:active {
|
|
519
|
-
background: var(--tcv-scrollbar-
|
|
525
|
+
background-color: var(--tcv-scrollbar-hover) !important;
|
|
520
526
|
}
|
|
521
527
|
|
|
522
528
|
.tcv_mac-scrollbar .widget-html-content {
|
|
@@ -524,12 +530,20 @@ input[type="button"] {
|
|
|
524
530
|
overflow-y: visible;
|
|
525
531
|
}
|
|
526
532
|
|
|
533
|
+
/* Scrollbar styling for Firefox Browser */
|
|
534
|
+
|
|
527
535
|
.tcv_scroller {
|
|
528
|
-
/* scrollbar-color: #7f7f7f white; */
|
|
529
536
|
scrollbar-width: thin;
|
|
537
|
+
scrollbar-color: var(--tcv-scrollbar-thumb) transparent;
|
|
530
538
|
background-color: transparent !important;
|
|
531
539
|
}
|
|
532
540
|
|
|
541
|
+
.tcv_scroller:hover {
|
|
542
|
+
scrollbar-width: thin;
|
|
543
|
+
scrollbar-color: var(--tcv-scrollbar-hover) transparent;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/* tooltips */
|
|
533
547
|
[data-tooltip]:before {
|
|
534
548
|
position: absolute;
|
|
535
549
|
pointer-events: none;
|
|
@@ -51657,10 +51657,14 @@ class Display {
|
|
|
51657
51657
|
|
|
51658
51658
|
this.viewer = null;
|
|
51659
51659
|
this._glassMode = false;
|
|
51660
|
+
this.tools = true;
|
|
51660
51661
|
this._events = [];
|
|
51661
51662
|
this.cadWidth = options.cadWidth;
|
|
51662
51663
|
this.height = options.height;
|
|
51663
51664
|
this.treeWidth = options.treeWidth;
|
|
51665
|
+
|
|
51666
|
+
this.showTools(options.tools);
|
|
51667
|
+
this.glassMode(options.glass);
|
|
51664
51668
|
this.setSizes(options);
|
|
51665
51669
|
|
|
51666
51670
|
this.activeTab = "tree";
|
|
@@ -51754,14 +51758,22 @@ class Display {
|
|
|
51754
51758
|
options.treeWidth,
|
|
51755
51759
|
);
|
|
51756
51760
|
}
|
|
51757
|
-
|
|
51758
|
-
|
|
51759
|
-
|
|
51760
|
-
|
|
51761
|
-
|
|
51761
|
+
if (!options.glass) {
|
|
51762
|
+
const treeHeight = Math.round(options.height * ratio);
|
|
51763
|
+
this.cadTree.parentElement.parentElement.style.height = px(treeHeight);
|
|
51764
|
+
this.cadInfo.parentElement.parentElement.style.height = px(
|
|
51765
|
+
options.height - treeHeight - 4,
|
|
51766
|
+
);
|
|
51767
|
+
}
|
|
51768
|
+
|
|
51769
|
+
if (options.tools && !options.glass) {
|
|
51770
|
+
this.cadTool.style.width = px(options.treeWidth + options.cadWidth + 4);
|
|
51771
|
+
this.cadBody.style.width = px(options.treeWidth + options.cadWidth + 4);
|
|
51772
|
+
} else {
|
|
51773
|
+
this.cadTool.style.width = px(options.cadWidth + 2);
|
|
51774
|
+
this.cadBody.style.width = px(options.cadWidth + 2);
|
|
51775
|
+
}
|
|
51762
51776
|
|
|
51763
|
-
this.cadTool.style.width = px(options.treeWidth + options.cadWidth + 4);
|
|
51764
|
-
this.cadBody.style.width = px(options.treeWidth + options.cadWidth + 4);
|
|
51765
51777
|
this.cadBody.style.height = px(options.height + 4);
|
|
51766
51778
|
}
|
|
51767
51779
|
|
|
@@ -51808,16 +51820,16 @@ class Display {
|
|
|
51808
51820
|
this._setupClickEvent(name, this.setView);
|
|
51809
51821
|
});
|
|
51810
51822
|
|
|
51811
|
-
this._setupClickEvent("tcv_collapse_singles", this.
|
|
51812
|
-
this._setupClickEvent("tcv_collapse_all", this.
|
|
51813
|
-
this._setupClickEvent("tcv_expand", this.
|
|
51823
|
+
this._setupClickEvent("tcv_collapse_singles", this.handleCollapseNodes);
|
|
51824
|
+
this._setupClickEvent("tcv_collapse_all", this.handleCollapseNodes);
|
|
51825
|
+
this._setupClickEvent("tcv_expand", this.handleCollapseNodes);
|
|
51814
51826
|
|
|
51815
51827
|
this._setupClickEvent("tcv_toggle_info", this.toggleInfo);
|
|
51816
51828
|
|
|
51817
51829
|
this._setupClickEvent("tcv_pin", this.pinAsPng);
|
|
51818
51830
|
this._setupClickEvent("tcv_help", this.toggleHelp);
|
|
51819
51831
|
this.help_shown = true;
|
|
51820
|
-
this.info_shown =
|
|
51832
|
+
this.info_shown = !this._glassMode;
|
|
51821
51833
|
|
|
51822
51834
|
const tabs = ["tcv_tab_tree", "tcv_tab_clip"];
|
|
51823
51835
|
tabs.forEach((name) => {
|
|
@@ -51870,15 +51882,13 @@ class Display {
|
|
|
51870
51882
|
* @property {boolean} [blackEdges = false] - show edges in black and not in edgeColor.
|
|
51871
51883
|
* @property {boolean} [clipIntersection = false] - use intersection clipping
|
|
51872
51884
|
* @property {boolean} [clipPlaneHelpers = false] - show clipping planes
|
|
51873
|
-
* @property {boolean} [tools = true] - Show/hide all tools.
|
|
51874
51885
|
*/
|
|
51875
|
-
updateUI(axes, axes0, ortho, transparent, blackEdges
|
|
51886
|
+
updateUI(axes, axes0, ortho, transparent, blackEdges) {
|
|
51876
51887
|
this.checkElement("tcv_axes", axes);
|
|
51877
51888
|
this.checkElement("tcv_axes0", axes0);
|
|
51878
51889
|
this.checkElement("tcv_ortho", ortho);
|
|
51879
51890
|
this.checkElement("tcv_transparent", transparent);
|
|
51880
51891
|
this.checkElement("tcv_black_edges", blackEdges);
|
|
51881
|
-
this.showTools(tools);
|
|
51882
51892
|
}
|
|
51883
51893
|
// setup functions
|
|
51884
51894
|
|
|
@@ -52093,6 +52103,7 @@ class Display {
|
|
|
52093
52103
|
* @param {boolean} flag - whether to show or hide the CAD tools
|
|
52094
52104
|
*/
|
|
52095
52105
|
showTools = (flag) => {
|
|
52106
|
+
this.tools = flag;
|
|
52096
52107
|
var tb = this._getElement("tcv_cad_toolbar");
|
|
52097
52108
|
var cn = this._getElement("tcv_cad_navigation");
|
|
52098
52109
|
for (var el of [cn, tb]) {
|
|
@@ -52132,6 +52143,7 @@ class Display {
|
|
|
52132
52143
|
*/
|
|
52133
52144
|
reset = () => {
|
|
52134
52145
|
this.viewer.reset();
|
|
52146
|
+
this.clearHighlights();
|
|
52135
52147
|
};
|
|
52136
52148
|
|
|
52137
52149
|
/**
|
|
@@ -52271,35 +52283,28 @@ class Display {
|
|
|
52271
52283
|
}
|
|
52272
52284
|
|
|
52273
52285
|
/**
|
|
52274
|
-
* Collapse
|
|
52275
|
-
* @function
|
|
52276
|
-
* @param {Event} e - a DOM click event
|
|
52277
|
-
*/
|
|
52278
|
-
// eslint-disable-next-line no-unused-vars
|
|
52279
|
-
collapseNodes1 = (e) => {
|
|
52280
|
-
this.viewer.treeview.expandNodes(2);
|
|
52281
|
-
this.viewer.treeview.collapseNodes(1);
|
|
52282
|
-
};
|
|
52283
|
-
|
|
52284
|
-
/**
|
|
52285
|
-
* Collapse all nodes
|
|
52286
|
+
* Collapse nodes handler
|
|
52286
52287
|
* @function
|
|
52287
52288
|
* @param {Event} e - a DOM click event
|
|
52288
52289
|
*/
|
|
52289
|
-
|
|
52290
|
-
|
|
52291
|
-
this.viewer.treeview.collapseNodes(2);
|
|
52290
|
+
handleCollapseNodes = (e) => {
|
|
52291
|
+
this.collapseNodes(e.target.value);
|
|
52292
52292
|
};
|
|
52293
52293
|
|
|
52294
52294
|
/**
|
|
52295
|
-
*
|
|
52296
|
-
* @
|
|
52297
|
-
* @param {Event} e - a DOM click event
|
|
52295
|
+
* Collapse nodes handler
|
|
52296
|
+
* @param {string} value - 1: collapse all leaf nodes, 2: collapse all nodes, "E": expand all nodes
|
|
52298
52297
|
*/
|
|
52299
|
-
|
|
52300
|
-
|
|
52301
|
-
|
|
52302
|
-
|
|
52298
|
+
collapseNodes(value) {
|
|
52299
|
+
if (value === "1") {
|
|
52300
|
+
this.viewer.treeview.expandNodes();
|
|
52301
|
+
this.viewer.treeview.collapseNodes(1);
|
|
52302
|
+
} else if (value === "C") {
|
|
52303
|
+
this.viewer.treeview.collapseNodes(2);
|
|
52304
|
+
} else if (value === "E") {
|
|
52305
|
+
this.viewer.treeview.expandNodes();
|
|
52306
|
+
}
|
|
52307
|
+
}
|
|
52303
52308
|
|
|
52304
52309
|
/**
|
|
52305
52310
|
* Set minimum and maximum of the sliders
|
|
@@ -52398,8 +52403,6 @@ class Display {
|
|
|
52398
52403
|
* @param {boolean} flag - whether to show or hide info dialog
|
|
52399
52404
|
*/
|
|
52400
52405
|
showInfo = (flag) => {
|
|
52401
|
-
console.log(flag);
|
|
52402
|
-
console.log(this.cadInfo);
|
|
52403
52406
|
this.cadInfo.parentNode.parentNode.style.display = flag ? "block" : "none";
|
|
52404
52407
|
this._getElement("tcv_toggle_info").value = flag ? "\u25B2 i" : "\u25BC i";
|
|
52405
52408
|
this.info_shown = flag;
|
|
@@ -52429,9 +52432,6 @@ class Display {
|
|
|
52429
52432
|
this._getElement("tcv_cad_info").classList.add("tcv_cad_info_glass");
|
|
52430
52433
|
this._getElement("tcv_cad_view").classList.add("tcv_cad_view_glass");
|
|
52431
52434
|
|
|
52432
|
-
this._getElement("tcv_cad_toolbar").style.width = px(this.cadWidth);
|
|
52433
|
-
this._getElement("tcv_cad_body").style.width = px(this.cadWidth);
|
|
52434
|
-
|
|
52435
52435
|
this._getElement("tcv_toggle_info_wrapper").style.display = "block";
|
|
52436
52436
|
|
|
52437
52437
|
this.showInfo(false);
|
|
@@ -52445,18 +52445,19 @@ class Display {
|
|
|
52445
52445
|
this._getElement("tcv_cad_info").classList.remove("tcv_cad_info_glass");
|
|
52446
52446
|
this._getElement("tcv_cad_view").classList.remove("tcv_cad_view_glass");
|
|
52447
52447
|
|
|
52448
|
-
this._getElement("tcv_cad_toolbar").style.width = px(
|
|
52449
|
-
this.cadWidth + this.treeWidth,
|
|
52450
|
-
);
|
|
52451
|
-
this._getElement("tcv_cad_body").style.width = px(
|
|
52452
|
-
this.cadWidth + this.treeWidth + 4,
|
|
52453
|
-
);
|
|
52454
|
-
|
|
52455
52448
|
this._getElement("tcv_toggle_info_wrapper").style.display = "none";
|
|
52456
52449
|
|
|
52457
52450
|
this.showInfo(true);
|
|
52458
52451
|
this._glassMode = false;
|
|
52459
52452
|
}
|
|
52453
|
+
const options = {
|
|
52454
|
+
cadWidth: this.cadWidth,
|
|
52455
|
+
glass: this._glassMode,
|
|
52456
|
+
height: this.height,
|
|
52457
|
+
tools: this.tools,
|
|
52458
|
+
treeWidth: (flag) ? 0 : this.treeWidth
|
|
52459
|
+
};
|
|
52460
|
+
this.setSizes(options);
|
|
52460
52461
|
}
|
|
52461
52462
|
}
|
|
52462
52463
|
|
|
@@ -54760,7 +54761,7 @@ class TreeView {
|
|
|
54760
54761
|
var icon_id = 0;
|
|
54761
54762
|
var img_button;
|
|
54762
54763
|
|
|
54763
|
-
var li = tag("li");
|
|
54764
|
+
var li = tag("li", [`node${model.id.replaceAll(" ", "_")}`]);
|
|
54764
54765
|
var lbl = tag("span", ["tcv_tree_label"]);
|
|
54765
54766
|
lbl.innerHTML = model.name;
|
|
54766
54767
|
var entry = tag("span", ["tcv_node_entry"], { id: model.id });
|
|
@@ -54844,9 +54845,29 @@ class TreeView {
|
|
|
54844
54845
|
}
|
|
54845
54846
|
}
|
|
54846
54847
|
|
|
54847
|
-
render() {
|
|
54848
|
+
render(collapse) {
|
|
54849
|
+
// before the nodes can be collapsed, the DOM element needs to be rendered and added to the container
|
|
54848
54850
|
this.container = tag("ul", ["tcv_toplevel"]);
|
|
54849
|
-
|
|
54851
|
+
|
|
54852
|
+
// eslint-disable-next-line no-unused-vars
|
|
54853
|
+
var observer = new MutationObserver((_mutuations) => {
|
|
54854
|
+
if (this.container.contains(tree)) {
|
|
54855
|
+
if (collapse > 0 && collapse < 3) {
|
|
54856
|
+
this.collapseNodes(collapse);
|
|
54857
|
+
}
|
|
54858
|
+
observer.disconnect();
|
|
54859
|
+
}
|
|
54860
|
+
});
|
|
54861
|
+
|
|
54862
|
+
observer.observe(this.container, {
|
|
54863
|
+
attributes: false,
|
|
54864
|
+
childList: true,
|
|
54865
|
+
characterData: false,
|
|
54866
|
+
subtree: false,
|
|
54867
|
+
});
|
|
54868
|
+
|
|
54869
|
+
const tree = this.toHtml(this.treeModel);
|
|
54870
|
+
this.container.appendChild(tree);
|
|
54850
54871
|
|
|
54851
54872
|
for (var icon_id in this.icons) {
|
|
54852
54873
|
this.updateNodes(this.treeModel, icon_id);
|
|
@@ -54858,6 +54879,7 @@ class TreeView {
|
|
|
54858
54879
|
this.toggleTreeNode(e.target.parentElement.parentElement, null);
|
|
54859
54880
|
});
|
|
54860
54881
|
}
|
|
54882
|
+
|
|
54861
54883
|
return this.container;
|
|
54862
54884
|
}
|
|
54863
54885
|
|
|
@@ -54923,8 +54945,12 @@ class TreeView {
|
|
|
54923
54945
|
obj.children[0].type === "leaf") ||
|
|
54924
54946
|
mode == 2
|
|
54925
54947
|
) {
|
|
54926
|
-
var el =
|
|
54927
|
-
|
|
54948
|
+
var el = this.container.getElementsByClassName(
|
|
54949
|
+
`node${obj.id.replaceAll(" ", "_")}`,
|
|
54950
|
+
)[0];
|
|
54951
|
+
if (el != null) {
|
|
54952
|
+
this.toggleTreeNode(el, collapse);
|
|
54953
|
+
}
|
|
54928
54954
|
}
|
|
54929
54955
|
for (var o of obj.children) {
|
|
54930
54956
|
walk(o);
|
|
@@ -54938,8 +54964,8 @@ class TreeView {
|
|
|
54938
54964
|
this._toggleNodes(mode, true);
|
|
54939
54965
|
}
|
|
54940
54966
|
|
|
54941
|
-
expandNodes(
|
|
54942
|
-
this._toggleNodes(
|
|
54967
|
+
expandNodes() {
|
|
54968
|
+
this._toggleNodes(2, false);
|
|
54943
54969
|
}
|
|
54944
54970
|
|
|
54945
54971
|
getIcon(icon_id, state) {
|
|
@@ -55282,6 +55308,10 @@ class Animation {
|
|
|
55282
55308
|
};
|
|
55283
55309
|
}
|
|
55284
55310
|
|
|
55311
|
+
cleanBackup() {
|
|
55312
|
+
this._backup = [];
|
|
55313
|
+
}
|
|
55314
|
+
|
|
55285
55315
|
hasTracks() {
|
|
55286
55316
|
return this.tracks != null && this.tracks.length > 0;
|
|
55287
55317
|
}
|
|
@@ -57361,13 +57391,15 @@ class Viewer {
|
|
|
57361
57391
|
this.setDisplayDefaults(options);
|
|
57362
57392
|
this.theme = options.theme;
|
|
57363
57393
|
|
|
57364
|
-
this.display = new Display(container,
|
|
57365
|
-
|
|
57394
|
+
this.display = new Display(container, {
|
|
57395
|
+
theme: this.theme,
|
|
57366
57396
|
cadWidth: this.cadWidth,
|
|
57367
|
-
height: this.height,
|
|
57368
57397
|
treeWidth: this.treeWidth,
|
|
57398
|
+
height: this.height,
|
|
57399
|
+
pinning: this.pinning,
|
|
57400
|
+
glass: this.glass,
|
|
57401
|
+
tools: this.tools,
|
|
57369
57402
|
});
|
|
57370
|
-
this.display.glassMode(options.glass);
|
|
57371
57403
|
|
|
57372
57404
|
window.THREE = THREE;
|
|
57373
57405
|
|
|
@@ -57436,6 +57468,7 @@ class Viewer {
|
|
|
57436
57468
|
this.height = 600;
|
|
57437
57469
|
this.pinning = false;
|
|
57438
57470
|
this.glass = false;
|
|
57471
|
+
this.tools = true;
|
|
57439
57472
|
|
|
57440
57473
|
for (var option in options) {
|
|
57441
57474
|
if (this[option] == null) {
|
|
@@ -57895,6 +57928,8 @@ class Viewer {
|
|
|
57895
57928
|
render(group, tree, states, options) {
|
|
57896
57929
|
this.setViewerDefaults(options);
|
|
57897
57930
|
|
|
57931
|
+
this.animation.cleanBackup();
|
|
57932
|
+
|
|
57898
57933
|
const timer = new Timer("viewer", this.timeit);
|
|
57899
57934
|
|
|
57900
57935
|
this.states = states;
|
|
@@ -58093,12 +58128,7 @@ class Viewer {
|
|
|
58093
58128
|
theme,
|
|
58094
58129
|
);
|
|
58095
58130
|
|
|
58096
|
-
this.display.addCadTree(this.treeview.render());
|
|
58097
|
-
|
|
58098
|
-
if ([1, 2].includes(options.collapse)) {
|
|
58099
|
-
this.treeview.collapseNodes(options.collapse);
|
|
58100
|
-
}
|
|
58101
|
-
|
|
58131
|
+
this.display.addCadTree(this.treeview.render(options.collapse));
|
|
58102
58132
|
this.display.selectTabByName("tree");
|
|
58103
58133
|
|
|
58104
58134
|
timer.split("scene done");
|
|
@@ -58113,9 +58143,13 @@ class Viewer {
|
|
|
58113
58143
|
this.ortho,
|
|
58114
58144
|
this.transparent,
|
|
58115
58145
|
this.blackEdges,
|
|
58116
|
-
this.tools,
|
|
58117
58146
|
);
|
|
58118
58147
|
|
|
58148
|
+
if (this.cadWidth < 600 && this.display._glassMode) {
|
|
58149
|
+
console.info("Small view, collapsing tree");
|
|
58150
|
+
this.display.collapseNodes("C");
|
|
58151
|
+
}
|
|
58152
|
+
|
|
58119
58153
|
//
|
|
58120
58154
|
// show the rendering
|
|
58121
58155
|
//
|
|
@@ -59106,6 +59140,25 @@ class Viewer {
|
|
|
59106
59140
|
}
|
|
59107
59141
|
this.initAnimation(duration, speed, "E", false);
|
|
59108
59142
|
}
|
|
59143
|
+
|
|
59144
|
+
trimUI(tags, flag) {
|
|
59145
|
+
var display = flag ? "inline-block" : "none";
|
|
59146
|
+
for (var tag of tags) {
|
|
59147
|
+
var el;
|
|
59148
|
+
if (["axes", "axes0", "grid", "ortho", "more", "help"].includes(tag)) {
|
|
59149
|
+
if (tag != "more") {
|
|
59150
|
+
el = this.display._getElement(`tcv_${tag}`);
|
|
59151
|
+
el.style.display = display;
|
|
59152
|
+
if (tag !== "help") {
|
|
59153
|
+
el.nextElementSibling.style.display = display;
|
|
59154
|
+
}
|
|
59155
|
+
} else {
|
|
59156
|
+
el = this.display._getElement(`tcv_${tag}-dropdown`);
|
|
59157
|
+
el.style.display = display;
|
|
59158
|
+
}
|
|
59159
|
+
}
|
|
59160
|
+
}
|
|
59161
|
+
}
|
|
59109
59162
|
}
|
|
59110
59163
|
|
|
59111
59164
|
export { Display, Timer, Viewer };
|