three-cad-viewer 1.5.5 → 1.5.8
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 -0
- package/dist/three-cad-viewer.css +17 -3
- package/dist/three-cad-viewer.esm.css +17 -3
- package/dist/three-cad-viewer.esm.js +173 -79
- package/dist/three-cad-viewer.esm.min.css +17 -3
- package/dist/three-cad-viewer.esm.min.js +1 -1
- package/dist/three-cad-viewer.js +173 -79
- package/dist/three-cad-viewer.min.css +17 -3
- package/dist/three-cad-viewer.min.js +1 -1
- package/package.json +1 -1
- package/src/display.js +96 -69
- package/src/treeview.js +2 -2
- package/src/viewer.js +75 -8
package/Readme.md
CHANGED
|
@@ -117,3 +117,14 @@ yarn run start
|
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
For the deployment, see [Release.md](./Release.md)
|
|
120
|
+
|
|
121
|
+
# Changes
|
|
122
|
+
|
|
123
|
+
v1.5.7
|
|
124
|
+
|
|
125
|
+
- fixed ids of checkboxes to be unique across the document
|
|
126
|
+
|
|
127
|
+
v1.5.8
|
|
128
|
+
|
|
129
|
+
- fixed glass and tools paramewter handling
|
|
130
|
+
- fixed initial zoom for wide cad views with low height
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -51284,37 +51284,38 @@ function getIconBackground(theme, name) {
|
|
|
51284
51284
|
return `url(data:image/svg+xml;utf8,${escape(icons[name][theme])});`;
|
|
51285
51285
|
}
|
|
51286
51286
|
|
|
51287
|
-
|
|
51287
|
+
function TEMPLATE(id) {
|
|
51288
|
+
return `
|
|
51288
51289
|
<div class="tcv_cad_viewer">
|
|
51289
51290
|
<div class="tcv_cad_toolbar tcv_round">
|
|
51290
51291
|
<span class="tcv_tooltip" data-tooltip="Show coordinate axis">
|
|
51291
|
-
<input class='tcv_axes tcv_check' id='
|
|
51292
|
-
<label for='
|
|
51292
|
+
<input class='tcv_axes tcv_check' id='tcv_axes_${id}' type="checkbox" />
|
|
51293
|
+
<label for='tcv_axes_${id}' class="tcv_label">Axes</label>
|
|
51293
51294
|
</span>
|
|
51294
51295
|
<div class="tcv_grid-dropdown">
|
|
51295
51296
|
<input class='tcv_grid tcv_check' id='tcv_grid' type="checkbox" /><label for='tcv_grid'
|
|
51296
51297
|
class="tcv_label">Grid</label>
|
|
51297
51298
|
<div class="tcv_grid-content tcv_dropdown-content">
|
|
51298
51299
|
<div class="tcv_tooltip" data-tooltip="Show xy grid">
|
|
51299
|
-
<input class='tcv_grid-xy tcv_check tcv_dropdown-entry' id='tcv_grid-
|
|
51300
|
-
<label for='tcv_grid-
|
|
51300
|
+
<input class='tcv_grid-xy tcv_check tcv_dropdown-entry' id='tcv_grid-xy_${id}' type="checkbox">
|
|
51301
|
+
<label for='tcv_grid-xy_${id}' class="tcv_label tcv_dropdown-entry">xy</label>
|
|
51301
51302
|
</div>
|
|
51302
51303
|
<div class="tcv_tooltip" data-tooltip="Show xz grid">
|
|
51303
|
-
<input class='tcv_grid-xz tcv_check tcv_dropdown-entry' id='tcv_grid-
|
|
51304
|
-
<label for='tcv_grid-
|
|
51304
|
+
<input class='tcv_grid-xz tcv_check tcv_dropdown-entry' id='tcv_grid-xz_${id}' type="checkbox">
|
|
51305
|
+
<label for='tcv_grid-xz_${id}' class="tcv_label tcv_dropdown-entry">xz</label>
|
|
51305
51306
|
</div>
|
|
51306
51307
|
<div class="tcv_tooltip" data-tooltip="Show yz grid">
|
|
51307
|
-
<input class='tcv_grid-yz tcv_check tcv_dropdown-entry' id='tcv_grid-
|
|
51308
|
-
<label for='tcv_grid-
|
|
51308
|
+
<input class='tcv_grid-yz tcv_check tcv_dropdown-entry' id='tcv_grid-yz_${id}' type="checkbox">
|
|
51309
|
+
<label for='tcv_grid-yz_${id}' class="tcv_label tcv_dropdown-entry">yz</label>
|
|
51309
51310
|
</div>
|
|
51310
51311
|
</div>
|
|
51311
51312
|
</div>
|
|
51312
51313
|
<span class="tcv_tooltip" data-tooltip="Move center of axis and grid to (0,0,0)">
|
|
51313
|
-
<input class='tcv_axes0 tcv_check' id='
|
|
51314
|
+
<input class='tcv_axes0 tcv_check' id='tcv_axes0_${id}' type="checkbox" /><label for='tcv_axes0_${id}'
|
|
51314
51315
|
class="tcv_label">@0</label>
|
|
51315
51316
|
</span>
|
|
51316
51317
|
<span class="tcv_tooltip" data-tooltip="Toggle camera between orthographic and perspective view">
|
|
51317
|
-
<input class='tcv_ortho tcv_check' id='
|
|
51318
|
+
<input class='tcv_ortho tcv_check' id='tcv_ortho_${id}' type="checkbox" /><label for='tcv_ortho_${id}'
|
|
51318
51319
|
class="tcv_label">Ortho</label>
|
|
51319
51320
|
</span>
|
|
51320
51321
|
<span class="tcv_tooltip" data-tooltip="Reset view">
|
|
@@ -51348,17 +51349,17 @@ const TEMPLATE = `
|
|
|
51348
51349
|
<button class="tcv_more-btn">More<span class="tcv_more_icon">\u25BC</span></button>
|
|
51349
51350
|
<div class="tcv_more-content tcv_dropdown-content">
|
|
51350
51351
|
<div class="tcv_tooltip" data-tooltip="Toggle transparent objects">
|
|
51351
|
-
<input class='tcv_transparent tcv_check tcv_dropdown-entry' id='
|
|
51352
|
-
<label for='
|
|
51352
|
+
<input class='tcv_transparent tcv_check tcv_dropdown-entry' id='tcv_transparent_${id}' type="checkbox" />
|
|
51353
|
+
<label for='tcv_transparent_${id}' class="tcv_label tcv_dropdown-entry">Transparent</label>
|
|
51353
51354
|
</div>
|
|
51354
51355
|
<div class="tcv_tooltip" data-tooltip="Toggle black edges">
|
|
51355
|
-
<input class='tcv_black_edges tcv_check tcv_dropdown-entry' id='
|
|
51356
|
-
<label for='
|
|
51356
|
+
<input class='tcv_black_edges tcv_check tcv_dropdown-entry' id='tcv_black_edges_${id}' type="checkbox" />
|
|
51357
|
+
<label for='tcv_black_edges_${id}' class="tcv_label tcv_dropdown-entry">Black edges</label>
|
|
51357
51358
|
</div>
|
|
51358
51359
|
<div class="tcv_explode_widget tcv_tooltip"
|
|
51359
51360
|
data-tooltip="Explode assembly (@0 determines explosion center)">
|
|
51360
|
-
<input class='tcv_explode tcv_check tcv_dropdown-entry' id='
|
|
51361
|
-
<label for='
|
|
51361
|
+
<input class='tcv_explode tcv_check tcv_dropdown-entry' id='tcv_explode_${id}' type="checkbox" />
|
|
51362
|
+
<label for='tcv_explode_${id}' class="tcv_label tcv_dropdown-entry">Explode</label>
|
|
51362
51363
|
</div>
|
|
51363
51364
|
</div>
|
|
51364
51365
|
</div>
|
|
@@ -51535,6 +51536,7 @@ const TEMPLATE = `
|
|
|
51535
51536
|
</div>
|
|
51536
51537
|
</div>
|
|
51537
51538
|
`;
|
|
51539
|
+
}
|
|
51538
51540
|
|
|
51539
51541
|
function px(val) {
|
|
51540
51542
|
return `${val}px`;
|
|
@@ -51636,7 +51638,7 @@ class Display {
|
|
|
51636
51638
|
constructor(container, options) {
|
|
51637
51639
|
this.container = container;
|
|
51638
51640
|
|
|
51639
|
-
this.container.innerHTML = TEMPLATE;
|
|
51641
|
+
this.container.innerHTML = TEMPLATE(this.container.id);
|
|
51640
51642
|
this.cadBody = this._getElement("tcv_cad_body");
|
|
51641
51643
|
this.cadTool = this._getElement("tcv_cad_toolbar");
|
|
51642
51644
|
this.cadView = this._getElement("tcv_cad_view");
|
|
@@ -51656,11 +51658,14 @@ class Display {
|
|
|
51656
51658
|
}
|
|
51657
51659
|
|
|
51658
51660
|
this.viewer = null;
|
|
51659
|
-
this.
|
|
51660
|
-
this.
|
|
51661
|
+
this.glass = options.glass;
|
|
51662
|
+
this.tools = options.tools;
|
|
51661
51663
|
this.cadWidth = options.cadWidth;
|
|
51662
51664
|
this.height = options.height;
|
|
51663
51665
|
this.treeWidth = options.treeWidth;
|
|
51666
|
+
|
|
51667
|
+
this._events = [];
|
|
51668
|
+
|
|
51664
51669
|
this.setSizes(options);
|
|
51665
51670
|
|
|
51666
51671
|
this.activeTab = "tree";
|
|
@@ -51754,14 +51759,22 @@ class Display {
|
|
|
51754
51759
|
options.treeWidth,
|
|
51755
51760
|
);
|
|
51756
51761
|
}
|
|
51757
|
-
|
|
51758
|
-
|
|
51759
|
-
|
|
51760
|
-
|
|
51761
|
-
|
|
51762
|
+
if (!options.glass) {
|
|
51763
|
+
const treeHeight = Math.round(options.height * ratio);
|
|
51764
|
+
this.cadTree.parentElement.parentElement.style.height = px(treeHeight);
|
|
51765
|
+
this.cadInfo.parentElement.parentElement.style.height = px(
|
|
51766
|
+
options.height - treeHeight - 4,
|
|
51767
|
+
);
|
|
51768
|
+
}
|
|
51769
|
+
|
|
51770
|
+
if (options.tools && !options.glass) {
|
|
51771
|
+
this.cadTool.style.width = px(options.treeWidth + options.cadWidth + 4);
|
|
51772
|
+
this.cadBody.style.width = px(options.treeWidth + options.cadWidth + 4);
|
|
51773
|
+
} else {
|
|
51774
|
+
this.cadTool.style.width = px(options.cadWidth + 2);
|
|
51775
|
+
this.cadBody.style.width = px(options.cadWidth + 2);
|
|
51776
|
+
}
|
|
51762
51777
|
|
|
51763
|
-
this.cadTool.style.width = px(options.treeWidth + options.cadWidth + 4);
|
|
51764
|
-
this.cadBody.style.width = px(options.treeWidth + options.cadWidth + 4);
|
|
51765
51778
|
this.cadBody.style.height = px(options.height + 4);
|
|
51766
51779
|
}
|
|
51767
51780
|
|
|
@@ -51808,16 +51821,16 @@ class Display {
|
|
|
51808
51821
|
this._setupClickEvent(name, this.setView);
|
|
51809
51822
|
});
|
|
51810
51823
|
|
|
51811
|
-
this._setupClickEvent("tcv_collapse_singles", this.
|
|
51812
|
-
this._setupClickEvent("tcv_collapse_all", this.
|
|
51813
|
-
this._setupClickEvent("tcv_expand", this.
|
|
51824
|
+
this._setupClickEvent("tcv_collapse_singles", this.handleCollapseNodes);
|
|
51825
|
+
this._setupClickEvent("tcv_collapse_all", this.handleCollapseNodes);
|
|
51826
|
+
this._setupClickEvent("tcv_expand", this.handleCollapseNodes);
|
|
51814
51827
|
|
|
51815
51828
|
this._setupClickEvent("tcv_toggle_info", this.toggleInfo);
|
|
51816
51829
|
|
|
51817
51830
|
this._setupClickEvent("tcv_pin", this.pinAsPng);
|
|
51818
51831
|
this._setupClickEvent("tcv_help", this.toggleHelp);
|
|
51819
51832
|
this.help_shown = true;
|
|
51820
|
-
this.info_shown = !this.
|
|
51833
|
+
this.info_shown = !this.glass;
|
|
51821
51834
|
|
|
51822
51835
|
const tabs = ["tcv_tab_tree", "tcv_tab_clip"];
|
|
51823
51836
|
tabs.forEach((name) => {
|
|
@@ -51868,17 +51881,18 @@ class Display {
|
|
|
51868
51881
|
* @property {boolean} [ortho = true] - use an orthographic (true) or perspective camera (false)
|
|
51869
51882
|
* @property {boolean} [transparent = false] - show CAD object transparent.
|
|
51870
51883
|
* @property {boolean} [blackEdges = false] - show edges in black and not in edgeColor.
|
|
51871
|
-
* @property {boolean} [
|
|
51872
|
-
* @property {boolean} [
|
|
51873
|
-
* @property {boolean} [tools = true] - Show/hide all tools.
|
|
51884
|
+
* @property {boolean} [tools = true] - show CAD tools.
|
|
51885
|
+
* @property {boolean} [glass = false] - use glass mode, i.e. CAD navigation as overlay.
|
|
51874
51886
|
*/
|
|
51875
|
-
updateUI(axes, axes0, ortho, transparent, blackEdges, tools) {
|
|
51887
|
+
updateUI(axes, axes0, ortho, transparent, blackEdges, tools, glass) {
|
|
51876
51888
|
this.checkElement("tcv_axes", axes);
|
|
51877
51889
|
this.checkElement("tcv_axes0", axes0);
|
|
51878
51890
|
this.checkElement("tcv_ortho", ortho);
|
|
51879
51891
|
this.checkElement("tcv_transparent", transparent);
|
|
51880
51892
|
this.checkElement("tcv_black_edges", blackEdges);
|
|
51893
|
+
|
|
51881
51894
|
this.showTools(tools);
|
|
51895
|
+
this.glassMode(glass);
|
|
51882
51896
|
}
|
|
51883
51897
|
// setup functions
|
|
51884
51898
|
|
|
@@ -52093,6 +52107,11 @@ class Display {
|
|
|
52093
52107
|
* @param {boolean} flag - whether to show or hide the CAD tools
|
|
52094
52108
|
*/
|
|
52095
52109
|
showTools = (flag) => {
|
|
52110
|
+
this.tools = flag;
|
|
52111
|
+
if (this.viewer) {
|
|
52112
|
+
// not available at first call
|
|
52113
|
+
this.viewer.tools = flag;
|
|
52114
|
+
}
|
|
52096
52115
|
var tb = this._getElement("tcv_cad_toolbar");
|
|
52097
52116
|
var cn = this._getElement("tcv_cad_navigation");
|
|
52098
52117
|
for (var el of [cn, tb]) {
|
|
@@ -52272,35 +52291,28 @@ class Display {
|
|
|
52272
52291
|
}
|
|
52273
52292
|
|
|
52274
52293
|
/**
|
|
52275
|
-
* Collapse
|
|
52276
|
-
* @function
|
|
52277
|
-
* @param {Event} e - a DOM click event
|
|
52278
|
-
*/
|
|
52279
|
-
// eslint-disable-next-line no-unused-vars
|
|
52280
|
-
collapseNodes1 = (e) => {
|
|
52281
|
-
this.viewer.treeview.expandNodes(2);
|
|
52282
|
-
this.viewer.treeview.collapseNodes(1);
|
|
52283
|
-
};
|
|
52284
|
-
|
|
52285
|
-
/**
|
|
52286
|
-
* Collapse all nodes
|
|
52294
|
+
* Collapse nodes handler
|
|
52287
52295
|
* @function
|
|
52288
52296
|
* @param {Event} e - a DOM click event
|
|
52289
52297
|
*/
|
|
52290
|
-
|
|
52291
|
-
|
|
52292
|
-
this.viewer.treeview.collapseNodes(2);
|
|
52298
|
+
handleCollapseNodes = (e) => {
|
|
52299
|
+
this.collapseNodes(e.target.value);
|
|
52293
52300
|
};
|
|
52294
52301
|
|
|
52295
52302
|
/**
|
|
52296
|
-
*
|
|
52297
|
-
* @
|
|
52298
|
-
* @param {Event} e - a DOM click event
|
|
52303
|
+
* Collapse nodes handler
|
|
52304
|
+
* @param {string} value - 1: collapse all leaf nodes, 2: collapse all nodes, "E": expand all nodes
|
|
52299
52305
|
*/
|
|
52300
|
-
|
|
52301
|
-
|
|
52302
|
-
|
|
52303
|
-
|
|
52306
|
+
collapseNodes(value) {
|
|
52307
|
+
if (value === "1") {
|
|
52308
|
+
this.viewer.treeview.expandNodes();
|
|
52309
|
+
this.viewer.treeview.collapseNodes(1);
|
|
52310
|
+
} else if (value === "C") {
|
|
52311
|
+
this.viewer.treeview.collapseNodes(2);
|
|
52312
|
+
} else if (value === "E") {
|
|
52313
|
+
this.viewer.treeview.expandNodes();
|
|
52314
|
+
}
|
|
52315
|
+
}
|
|
52304
52316
|
|
|
52305
52317
|
/**
|
|
52306
52318
|
* Set minimum and maximum of the sliders
|
|
@@ -52412,6 +52424,18 @@ class Display {
|
|
|
52412
52424
|
this.showInfo(!this.info_shown);
|
|
52413
52425
|
};
|
|
52414
52426
|
|
|
52427
|
+
/**
|
|
52428
|
+
* Auto collapse tree nodes, when cad width < 600
|
|
52429
|
+
* @function
|
|
52430
|
+
* @param {boolean} flag - whether to enable/disable glass mode
|
|
52431
|
+
*/
|
|
52432
|
+
autoCollapse() {
|
|
52433
|
+
if (this.cadWidth < 600 && this.glass) {
|
|
52434
|
+
console.info("Small view, collapsing tree");
|
|
52435
|
+
this.collapseNodes("C");
|
|
52436
|
+
}
|
|
52437
|
+
}
|
|
52438
|
+
|
|
52415
52439
|
/**
|
|
52416
52440
|
* Enable/disable glass mode
|
|
52417
52441
|
* @function
|
|
@@ -52428,13 +52452,11 @@ class Display {
|
|
|
52428
52452
|
this._getElement("tcv_cad_info").classList.add("tcv_cad_info_glass");
|
|
52429
52453
|
this._getElement("tcv_cad_view").classList.add("tcv_cad_view_glass");
|
|
52430
52454
|
|
|
52431
|
-
this._getElement("tcv_cad_toolbar").style.width = px(this.cadWidth);
|
|
52432
|
-
this._getElement("tcv_cad_body").style.width = px(this.cadWidth);
|
|
52433
|
-
|
|
52434
52455
|
this._getElement("tcv_toggle_info_wrapper").style.display = "block";
|
|
52435
52456
|
|
|
52436
52457
|
this.showInfo(false);
|
|
52437
|
-
this.
|
|
52458
|
+
this.glass = true;
|
|
52459
|
+
this.autoCollapse();
|
|
52438
52460
|
} else {
|
|
52439
52461
|
this._getElement("tcv_cad_tree").classList.remove("tcv_cad_tree_glass");
|
|
52440
52462
|
this._getElement("tcv_cad_tree").style["max-height"] = null;
|
|
@@ -52444,18 +52466,23 @@ class Display {
|
|
|
52444
52466
|
this._getElement("tcv_cad_info").classList.remove("tcv_cad_info_glass");
|
|
52445
52467
|
this._getElement("tcv_cad_view").classList.remove("tcv_cad_view_glass");
|
|
52446
52468
|
|
|
52447
|
-
this._getElement("tcv_cad_toolbar").style.width = px(
|
|
52448
|
-
this.cadWidth + this.treeWidth,
|
|
52449
|
-
);
|
|
52450
|
-
this._getElement("tcv_cad_body").style.width = px(
|
|
52451
|
-
this.cadWidth + this.treeWidth + 4,
|
|
52452
|
-
);
|
|
52453
|
-
|
|
52454
52469
|
this._getElement("tcv_toggle_info_wrapper").style.display = "none";
|
|
52455
52470
|
|
|
52456
52471
|
this.showInfo(true);
|
|
52457
|
-
this.
|
|
52472
|
+
this.glass = false;
|
|
52458
52473
|
}
|
|
52474
|
+
if (this.viewer) {
|
|
52475
|
+
// not available at first call
|
|
52476
|
+
this.viewer.glass = false;
|
|
52477
|
+
}
|
|
52478
|
+
const options = {
|
|
52479
|
+
cadWidth: this.cadWidth,
|
|
52480
|
+
glass: this.glass,
|
|
52481
|
+
height: this.height,
|
|
52482
|
+
tools: this.tools,
|
|
52483
|
+
treeWidth: flag ? 0 : this.treeWidth,
|
|
52484
|
+
};
|
|
52485
|
+
this.setSizes(options);
|
|
52459
52486
|
}
|
|
52460
52487
|
}
|
|
52461
52488
|
|
|
@@ -54962,8 +54989,8 @@ class TreeView {
|
|
|
54962
54989
|
this._toggleNodes(mode, true);
|
|
54963
54990
|
}
|
|
54964
54991
|
|
|
54965
|
-
expandNodes(
|
|
54966
|
-
this._toggleNodes(
|
|
54992
|
+
expandNodes() {
|
|
54993
|
+
this._toggleNodes(2, false);
|
|
54967
54994
|
}
|
|
54968
54995
|
|
|
54969
54996
|
getIcon(icon_id, state) {
|
|
@@ -57387,15 +57414,16 @@ class Viewer {
|
|
|
57387
57414
|
this.hasAnimationLoop = false;
|
|
57388
57415
|
|
|
57389
57416
|
this.setDisplayDefaults(options);
|
|
57390
|
-
this.theme = options.theme;
|
|
57391
57417
|
|
|
57392
|
-
this.display = new Display(container,
|
|
57393
|
-
|
|
57418
|
+
this.display = new Display(container, {
|
|
57419
|
+
theme: this.theme,
|
|
57394
57420
|
cadWidth: this.cadWidth,
|
|
57395
|
-
height: this.height,
|
|
57396
57421
|
treeWidth: this.treeWidth,
|
|
57422
|
+
height: this.height,
|
|
57423
|
+
pinning: this.pinning,
|
|
57424
|
+
glass: this.glass,
|
|
57425
|
+
tools: this.tools,
|
|
57397
57426
|
});
|
|
57398
|
-
this.display.glassMode(options.glass);
|
|
57399
57427
|
|
|
57400
57428
|
window.THREE = THREE;
|
|
57401
57429
|
|
|
@@ -57464,6 +57492,7 @@ class Viewer {
|
|
|
57464
57492
|
this.height = 600;
|
|
57465
57493
|
this.pinning = false;
|
|
57466
57494
|
this.glass = false;
|
|
57495
|
+
this.tools = true;
|
|
57467
57496
|
|
|
57468
57497
|
for (var option in options) {
|
|
57469
57498
|
if (this[option] == null) {
|
|
@@ -57516,16 +57545,18 @@ class Viewer {
|
|
|
57516
57545
|
this.clipSlider0 = -1;
|
|
57517
57546
|
this.clipSlider1 = -1;
|
|
57518
57547
|
this.clipSlider2 = -1;
|
|
57519
|
-
this.tools = true;
|
|
57520
57548
|
this.control = "orbit";
|
|
57521
|
-
this.glass = false;
|
|
57522
57549
|
this.ticks = 10;
|
|
57523
57550
|
|
|
57524
57551
|
this.position = null;
|
|
57525
57552
|
this.quaternion = null;
|
|
57526
57553
|
this.target = null;
|
|
57527
57554
|
this.zoom = null;
|
|
57528
|
-
this.
|
|
57555
|
+
if (this.cadWidth >= this.height) {
|
|
57556
|
+
this.zoom0 = (4 / 3) * (this.height / this.cadWidth);
|
|
57557
|
+
} else {
|
|
57558
|
+
this.zoom0 = 4 / 3;
|
|
57559
|
+
}
|
|
57529
57560
|
|
|
57530
57561
|
this.panSpeed = 0.5;
|
|
57531
57562
|
this.rotateSpeed = 1.0;
|
|
@@ -57921,6 +57952,7 @@ class Viewer {
|
|
|
57921
57952
|
* @param {ViewerOptions} options - the Viewer options
|
|
57922
57953
|
*/
|
|
57923
57954
|
render(group, tree, states, options) {
|
|
57955
|
+
console.log(options);
|
|
57924
57956
|
this.setViewerDefaults(options);
|
|
57925
57957
|
|
|
57926
57958
|
this.animation.cleanBackup();
|
|
@@ -58139,8 +58171,12 @@ class Viewer {
|
|
|
58139
58171
|
this.transparent,
|
|
58140
58172
|
this.blackEdges,
|
|
58141
58173
|
this.tools,
|
|
58174
|
+
this.glass,
|
|
58142
58175
|
);
|
|
58143
58176
|
|
|
58177
|
+
this.display.autoCollapse();
|
|
58178
|
+
this.resize();
|
|
58179
|
+
|
|
58144
58180
|
//
|
|
58145
58181
|
// show the rendering
|
|
58146
58182
|
//
|
|
@@ -59073,6 +59109,13 @@ class Viewer {
|
|
|
59073
59109
|
});
|
|
59074
59110
|
};
|
|
59075
59111
|
|
|
59112
|
+
/**
|
|
59113
|
+
* Calculate explode trajectories and initiate the animation
|
|
59114
|
+
*
|
|
59115
|
+
* @param {number} [duration=2] - duration of animation.
|
|
59116
|
+
* @param {number} [speed=1] - speed of animation.
|
|
59117
|
+
* @param {number} [multiplier=2.5] - multiplier for length of trajectories.
|
|
59118
|
+
*/
|
|
59076
59119
|
explode(duration = 2, speed = 1, multiplier = 2.5) {
|
|
59077
59120
|
this.clearAnimation();
|
|
59078
59121
|
|
|
@@ -59131,6 +59174,57 @@ class Viewer {
|
|
|
59131
59174
|
}
|
|
59132
59175
|
this.initAnimation(duration, speed, "E", false);
|
|
59133
59176
|
}
|
|
59177
|
+
|
|
59178
|
+
/**
|
|
59179
|
+
* Calculate explode trajectories and initiate the animation
|
|
59180
|
+
*
|
|
59181
|
+
* @param {string[]} tags - e.g. ["axes", "axes0", "grid", "ortho", "more", "help"]
|
|
59182
|
+
* @param {boolean} flag - whether to turn on or off the UI elements.
|
|
59183
|
+
*/
|
|
59184
|
+
trimUI(tags, flag) {
|
|
59185
|
+
var display = flag ? "inline-block" : "none";
|
|
59186
|
+
for (var tag of tags) {
|
|
59187
|
+
var el;
|
|
59188
|
+
if (["axes", "axes0", "grid", "ortho", "more", "help"].includes(tag)) {
|
|
59189
|
+
if (tag != "more") {
|
|
59190
|
+
el = this.display._getElement(`tcv_${tag}`);
|
|
59191
|
+
el.style.display = display;
|
|
59192
|
+
if (tag !== "help") {
|
|
59193
|
+
el.nextElementSibling.style.display = display;
|
|
59194
|
+
}
|
|
59195
|
+
} else {
|
|
59196
|
+
el = this.display._getElement(`tcv_${tag}-dropdown`);
|
|
59197
|
+
el.style.display = display;
|
|
59198
|
+
}
|
|
59199
|
+
}
|
|
59200
|
+
}
|
|
59201
|
+
}
|
|
59202
|
+
|
|
59203
|
+
//
|
|
59204
|
+
// DOESN'T WORK DUE TO CAMERA CANNOT BE CHANGED EASILY
|
|
59205
|
+
//
|
|
59206
|
+
// /**
|
|
59207
|
+
// * Resize cadWidth, treeWidth and height of thew viewer
|
|
59208
|
+
// *
|
|
59209
|
+
// * @param {cadWidth} tags - e.g. ["axes", "axes0", "grid", "ortho", "more", "help"]
|
|
59210
|
+
// * @param {treeWidth} flag - whether to turn on or off the UI elements.
|
|
59211
|
+
// * @param {height} flag - whether to turn on or off the UI elements.
|
|
59212
|
+
// */
|
|
59213
|
+
// resetUISize(cadWidth, treeWidth, height) {
|
|
59214
|
+
// this.cadWidth = cadWidth;
|
|
59215
|
+
// this.treeWidth = treeWidth;
|
|
59216
|
+
// this.height = height;
|
|
59217
|
+
// this.display.setSizes({
|
|
59218
|
+
// cadWidth: cadWidth,
|
|
59219
|
+
// treeWidth: treeWidth,
|
|
59220
|
+
// height: height,
|
|
59221
|
+
// tools: this.tools,
|
|
59222
|
+
// glass: this.glass,
|
|
59223
|
+
// });
|
|
59224
|
+
// this.display.autoCollapse();
|
|
59225
|
+
// this.renderer.setSize(cadWidth, height);
|
|
59226
|
+
// this.update(true);
|
|
59227
|
+
// }
|
|
59134
59228
|
}
|
|
59135
59229
|
|
|
59136
59230
|
export { Display, Timer, Viewer };
|
|
@@ -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;
|