Improve navigator performance.

This commit is contained in:
kovacsv 2021-11-26 12:38:20 +01:00
parent 86589648bc
commit 1b20aa4235
2 changed files with 26 additions and 12 deletions

View File

@ -214,12 +214,12 @@ OV.Navigator = class
function SetEntitySelection (navigator, selection, select) function SetEntitySelection (navigator, selection, select)
{ {
if (selection.type === OV.SelectionType.Material) { if (selection.type === OV.SelectionType.Material) {
if (select) { if (select && navigator.panelSet.IsPanelsVisible ()) {
navigator.panelSet.ShowPanel (navigator.materialsPanel); navigator.panelSet.ShowPanel (navigator.materialsPanel);
} }
navigator.materialsPanel.SelectMaterialItem (selection.materialIndex, select); navigator.materialsPanel.SelectMaterialItem (selection.materialIndex, select);
} else if (selection.type === OV.SelectionType.Mesh) { } else if (selection.type === OV.SelectionType.Mesh) {
if (select) { if (select && navigator.panelSet.IsPanelsVisible ()) {
navigator.panelSet.ShowPanel (navigator.meshesPanel); navigator.panelSet.ShowPanel (navigator.meshesPanel);
} }
navigator.meshesPanel.GetMeshItem (selection.meshInstanceId).SetSelected (select); navigator.meshesPanel.GetMeshItem (selection.meshInstanceId).SetSelected (select);

View File

@ -110,8 +110,11 @@ OV.PanelSet = class
this.contentDiv.show (); this.contentDiv.show ();
this.parentDiv.outerWidth (this.menuDiv.outerWidth (true) + this.panelsPrevWidth, true); this.parentDiv.outerWidth (this.menuDiv.outerWidth (true) + this.panelsPrevWidth, true);
} else { } else {
for (let otherPanelButton of this.panelButtons) { for (let panelButton of this.panelButtons) {
otherPanelButton.removeClass ('selected'); panelButton.removeClass ('selected');
}
for (let panel of this.panels) {
panel.Show (false);
} }
this.panelsPrevWidth = this.contentDiv.outerWidth (true); this.panelsPrevWidth = this.contentDiv.outerWidth (true);
this.parentDiv.outerWidth (this.menuDiv.outerWidth (true), true); this.parentDiv.outerWidth (this.menuDiv.outerWidth (true), true);
@ -124,17 +127,23 @@ OV.PanelSet = class
ShowPanel (panel) ShowPanel (panel)
{ {
for (let otherPanel of this.panels) { if (panel === this.GetVisiblePanel ()) {
otherPanel.Show (false); return;
}
for (let otherPanelButton of this.panelButtons) {
otherPanelButton.removeClass ('selected');
} }
let panelButton = this.GetPanelButton (panel); let panelButton = this.GetPanelButton (panel);
for (let otherPanelButton of this.panelButtons) {
if (otherPanelButton !== panelButton) {
otherPanelButton.removeClass ('selected');
}
}
panelButton.addClass ('selected'); panelButton.addClass ('selected');
for (let otherPanel of this.panels) {
if (otherPanel !== panel) {
otherPanel.Show (false);
}
}
panel.Show (true); panel.Show (true);
panel.Resize (); panel.Resize ();
} }
@ -168,12 +177,17 @@ OV.PanelSet = class
{ {
if (this.requestedPanelsVisible !== this.panelsVisible) { if (this.requestedPanelsVisible !== this.panelsVisible) {
this.ShowPanels (this.requestedPanelsVisible); this.ShowPanels (this.requestedPanelsVisible);
return;
} }
let height = this.parentDiv.height (); let height = this.parentDiv.height ();
this.menuDiv.outerHeight (height, true); this.menuDiv.outerHeight (height, true);
this.contentDiv.outerHeight (height, true); this.contentDiv.outerHeight (height, true);
for (let panel of this.panels) { if (this.panelsVisible) {
panel.Resize (); for (let panel of this.panels) {
if (panel.IsVisible ()) {
panel.Resize ();
}
}
} }
} }