Highlight mesh in the model, too.
This commit is contained in:
parent
694dcccf27
commit
1d538ec6ef
@ -468,11 +468,7 @@ ImporterApp.prototype.SetView = function (viewType)
|
||||
ImporterApp.prototype.ShowHideMesh = function (meshIndex)
|
||||
{
|
||||
this.meshVisibility[meshIndex] = !this.meshVisibility[meshIndex];
|
||||
if (this.meshVisibility[meshIndex]) {
|
||||
this.viewer.ShowMesh (meshIndex);
|
||||
} else {
|
||||
this.viewer.HideMesh (meshIndex);
|
||||
}
|
||||
this.viewer.ShowMesh (meshIndex, this.meshVisibility[meshIndex]);
|
||||
return this.meshVisibility[meshIndex];
|
||||
};
|
||||
|
||||
@ -544,18 +540,27 @@ ImporterApp.prototype.RegisterCanvasClick = function (canvasName)
|
||||
|
||||
ImporterApp.prototype.HighlightMesh = function (meshIndex)
|
||||
{
|
||||
var i, menuItem;
|
||||
function HighlightMeshInModel (viewer, meshIndex, highlight)
|
||||
{
|
||||
viewer.HighlightMesh (meshIndex, highlight);
|
||||
}
|
||||
|
||||
var i, menuItem, highlight;
|
||||
for (i = 0; i < this.meshMenuItems.length; i++) {
|
||||
menuItem = this.meshMenuItems[i];
|
||||
highlight = false;
|
||||
if (i == meshIndex) {
|
||||
if (!menuItem.IsHighlighted ()) {
|
||||
menuItem.Highlight (true);
|
||||
menuItem.menuItemDiv.get (0).scrollIntoView ();
|
||||
HighlightMeshInModel (this.viewer, i, true);
|
||||
} else {
|
||||
menuItem.Highlight (false);
|
||||
HighlightMeshInModel (this.viewer, i, false);
|
||||
}
|
||||
} else {
|
||||
} else if (menuItem.IsHighlighted ()) {
|
||||
menuItem.Highlight (false);
|
||||
HighlightMeshInModel (this.viewer, i, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -83,26 +83,34 @@ ImporterViewer.prototype.GetMeshesUnderPosition = function (x, y)
|
||||
return meshes;
|
||||
};
|
||||
|
||||
ImporterViewer.prototype.ShowMesh = function (index)
|
||||
ImporterViewer.prototype.ShowMesh = function (index, show)
|
||||
{
|
||||
var myThis = this;
|
||||
this.viewer.scene.traverse (function (current) {
|
||||
if (current instanceof THREE.Mesh) {
|
||||
if (current.originalJsonIndex == index) {
|
||||
myThis.viewer.ShowMesh (current);
|
||||
if (show) {
|
||||
myThis.viewer.ShowMesh (current);
|
||||
} else {
|
||||
myThis.viewer.HideMesh (current);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.viewer.Draw ();
|
||||
};
|
||||
|
||||
ImporterViewer.prototype.HideMesh = function (index)
|
||||
ImporterViewer.prototype.HighlightMesh = function (index, highlight)
|
||||
{
|
||||
var myThis = this;
|
||||
this.viewer.scene.traverse (function (current) {
|
||||
if (current instanceof THREE.Mesh) {
|
||||
if (current.originalJsonIndex == index) {
|
||||
myThis.viewer.HideMesh (current);
|
||||
if (highlight) {
|
||||
current.material.emissive.setHex (0x555555);
|
||||
} else {
|
||||
current.material.emissive.setHex (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user