three-cad-viewer 1.5.4 → 1.5.5
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.esm.js +31 -11
- package/dist/three-cad-viewer.esm.min.js +1 -1
- package/dist/three-cad-viewer.js +31 -11
- package/dist/three-cad-viewer.min.js +1 -1
- package/package.json +1 -1
- package/src/treeview.js +30 -5
- package/src/viewer.js +1 -6
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)
|
|
@@ -54759,7 +54759,7 @@ class TreeView {
|
|
|
54759
54759
|
var icon_id = 0;
|
|
54760
54760
|
var img_button;
|
|
54761
54761
|
|
|
54762
|
-
var li = tag("li");
|
|
54762
|
+
var li = tag("li", [`node${model.id.replaceAll(" ", "_")}`]);
|
|
54763
54763
|
var lbl = tag("span", ["tcv_tree_label"]);
|
|
54764
54764
|
lbl.innerHTML = model.name;
|
|
54765
54765
|
var entry = tag("span", ["tcv_node_entry"], { id: model.id });
|
|
@@ -54843,9 +54843,29 @@ class TreeView {
|
|
|
54843
54843
|
}
|
|
54844
54844
|
}
|
|
54845
54845
|
|
|
54846
|
-
render() {
|
|
54846
|
+
render(collapse) {
|
|
54847
|
+
// before the nodes can be collapsed, the DOM element needs to be rendered and added to the container
|
|
54847
54848
|
this.container = tag("ul", ["tcv_toplevel"]);
|
|
54848
|
-
|
|
54849
|
+
|
|
54850
|
+
// eslint-disable-next-line no-unused-vars
|
|
54851
|
+
var observer = new MutationObserver((_mutuations) => {
|
|
54852
|
+
if (this.container.contains(tree)) {
|
|
54853
|
+
if (collapse > 0 && collapse < 3) {
|
|
54854
|
+
this.collapseNodes(collapse);
|
|
54855
|
+
}
|
|
54856
|
+
observer.disconnect();
|
|
54857
|
+
}
|
|
54858
|
+
});
|
|
54859
|
+
|
|
54860
|
+
observer.observe(this.container, {
|
|
54861
|
+
attributes: false,
|
|
54862
|
+
childList: true,
|
|
54863
|
+
characterData: false,
|
|
54864
|
+
subtree: false,
|
|
54865
|
+
});
|
|
54866
|
+
|
|
54867
|
+
const tree = this.toHtml(this.treeModel);
|
|
54868
|
+
this.container.appendChild(tree);
|
|
54849
54869
|
|
|
54850
54870
|
for (var icon_id in this.icons) {
|
|
54851
54871
|
this.updateNodes(this.treeModel, icon_id);
|
|
@@ -54857,6 +54877,7 @@ class TreeView {
|
|
|
54857
54877
|
this.toggleTreeNode(e.target.parentElement.parentElement, null);
|
|
54858
54878
|
});
|
|
54859
54879
|
}
|
|
54880
|
+
|
|
54860
54881
|
return this.container;
|
|
54861
54882
|
}
|
|
54862
54883
|
|
|
@@ -54922,8 +54943,12 @@ class TreeView {
|
|
|
54922
54943
|
obj.children[0].type === "leaf") ||
|
|
54923
54944
|
mode == 2
|
|
54924
54945
|
) {
|
|
54925
|
-
var el =
|
|
54926
|
-
|
|
54946
|
+
var el = this.container.getElementsByClassName(
|
|
54947
|
+
`node${obj.id.replaceAll(" ", "_")}`,
|
|
54948
|
+
)[0];
|
|
54949
|
+
if (el != null) {
|
|
54950
|
+
this.toggleTreeNode(el, collapse);
|
|
54951
|
+
}
|
|
54927
54952
|
}
|
|
54928
54953
|
for (var o of obj.children) {
|
|
54929
54954
|
walk(o);
|
|
@@ -58098,12 +58123,7 @@ class Viewer {
|
|
|
58098
58123
|
theme,
|
|
58099
58124
|
);
|
|
58100
58125
|
|
|
58101
|
-
this.display.addCadTree(this.treeview.render());
|
|
58102
|
-
|
|
58103
|
-
if ([1, 2].includes(options.collapse)) {
|
|
58104
|
-
this.treeview.collapseNodes(options.collapse);
|
|
58105
|
-
}
|
|
58106
|
-
|
|
58126
|
+
this.display.addCadTree(this.treeview.render(options.collapse));
|
|
58107
58127
|
this.display.selectTabByName("tree");
|
|
58108
58128
|
|
|
58109
58129
|
timer.split("scene done");
|