Add show all meshes to the context menu.
This commit is contained in:
parent
3f94a0793a
commit
87ff35b794
@ -220,6 +220,33 @@ OV.Navigator = class
|
|||||||
return meshData.IsVisible ();
|
return meshData.IsVisible ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HasHiddenMesh ()
|
||||||
|
{
|
||||||
|
for (let i = 0; i < this.modelData.MeshCount (); i++) {
|
||||||
|
let meshData = this.modelData.GetMeshData (i);
|
||||||
|
if (!meshData.IsVisible ()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowAllMeshes ()
|
||||||
|
{
|
||||||
|
for (let i = 0; i < this.modelData.MeshCount (); i++) {
|
||||||
|
let meshData = this.modelData.GetMeshData (i);
|
||||||
|
meshData.SetVisible (true);
|
||||||
|
}
|
||||||
|
this.callbacks.updateMeshesVisibility ();
|
||||||
|
}
|
||||||
|
|
||||||
|
ToggleMeshVisibility (meshIndex)
|
||||||
|
{
|
||||||
|
let meshData = this.modelData.GetMeshData (meshIndex);
|
||||||
|
meshData.SetVisible (!meshData.IsVisible ());
|
||||||
|
this.callbacks.updateMeshesVisibility ();
|
||||||
|
}
|
||||||
|
|
||||||
IsMeshIsolated (meshIndex)
|
IsMeshIsolated (meshIndex)
|
||||||
{
|
{
|
||||||
for (let i = 0; i < this.modelData.MeshCount (); i++) {
|
for (let i = 0; i < this.modelData.MeshCount (); i++) {
|
||||||
@ -245,13 +272,6 @@ OV.Navigator = class
|
|||||||
this.callbacks.updateMeshesVisibility ();
|
this.callbacks.updateMeshesVisibility ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ToggleMeshVisibility (meshIndex)
|
|
||||||
{
|
|
||||||
let meshData = this.modelData.GetMeshData (meshIndex);
|
|
||||||
meshData.SetVisible (!meshData.IsVisible ());
|
|
||||||
this.callbacks.updateMeshesVisibility ();
|
|
||||||
}
|
|
||||||
|
|
||||||
GetSelectedMeshIndex ()
|
GetSelectedMeshIndex ()
|
||||||
{
|
{
|
||||||
if (this.tempSelectedMeshIndex !== null) {
|
if (this.tempSelectedMeshIndex !== null) {
|
||||||
|
|||||||
@ -151,44 +151,41 @@ OV.Website = class
|
|||||||
let meshUserData = this.viewer.GetMeshUserDataUnderMouse (mouseCoordinates);
|
let meshUserData = this.viewer.GetMeshUserDataUnderMouse (mouseCoordinates);
|
||||||
let items = [];
|
let items = [];
|
||||||
if (meshUserData === null) {
|
if (meshUserData === null) {
|
||||||
items = [
|
items.push ({
|
||||||
{
|
name : 'Fit model to window',
|
||||||
name : 'Fit model to window',
|
onClick : () => {
|
||||||
onClick : () => {
|
this.FitModelToWindow (false);
|
||||||
this.FitModelToWindow (false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
];
|
});
|
||||||
|
if (this.navigator.HasHiddenMesh ()) {
|
||||||
|
items.push ({
|
||||||
|
name : 'Show all meshes',
|
||||||
|
onClick : () => {
|
||||||
|
this.navigator.ShowAllMeshes ();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let meshIndex = meshUserData.originalMeshIndex;
|
let meshIndex = meshUserData.originalMeshIndex;
|
||||||
let isSelectedMesh = (meshIndex === this.navigator.GetSelectedMeshIndex ());
|
|
||||||
let isMeshIsolated = this.navigator.IsMeshIsolated (meshIndex);
|
let isMeshIsolated = this.navigator.IsMeshIsolated (meshIndex);
|
||||||
items = [
|
items.push ({
|
||||||
{
|
name : 'Hide mesh',
|
||||||
name : isSelectedMesh ? 'Deselect mesh' : 'Select mesh',
|
onClick : () => {
|
||||||
onClick : () => {
|
this.navigator.ToggleMeshVisibility (meshIndex);
|
||||||
this.navigator.SetSelection (new OV.Selection (OV.SelectionType.Mesh, meshIndex));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name : 'Hide mesh',
|
|
||||||
onClick : () => {
|
|
||||||
this.navigator.ToggleMeshVisibility (meshIndex);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name : 'Fit mesh to window',
|
|
||||||
onClick : () => {
|
|
||||||
this.navigator.FitMeshToWindow (meshIndex);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name : isMeshIsolated ? 'Remove isolation' : 'Isolate mesh',
|
|
||||||
onClick : () => {
|
|
||||||
this.navigator.IsolateMesh (meshIndex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
];
|
});
|
||||||
|
items.push ({
|
||||||
|
name : 'Fit mesh to window',
|
||||||
|
onClick : () => {
|
||||||
|
this.navigator.FitMeshToWindow (meshIndex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
items.push ({
|
||||||
|
name : isMeshIsolated ? 'Remove isolation' : 'Isolate mesh',
|
||||||
|
onClick : () => {
|
||||||
|
this.navigator.IsolateMesh (meshIndex);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.dialog = OV.ShowListPopup (items, {
|
this.dialog = OV.ShowListPopup (items, {
|
||||||
calculatePosition : (contentDiv) => {
|
calculatePosition : (contentDiv) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user