Rename AddButton to AppendButton in tree view.

This commit is contained in:
kovacsv 2021-11-04 18:57:23 +01:00
parent 73fece6a4a
commit a106c58c74
3 changed files with 30 additions and 19 deletions

View File

@ -184,7 +184,7 @@ OV.Navigator = class
browseButton.OnClick (() => {
this.callbacks.openFileBrowserDialog ();
});
item.AddButton (browseButton);
item.AppendButton (browseButton);
missingFilesItem.AddChild (item);
}
}
@ -203,13 +203,14 @@ OV.Navigator = class
materialsItem.AddChild (materialItem);
}
this.FillMeshTree (model);
const isFlat = !OV.FeatureSet.NavigatorTree;
this.FillMeshTree (model, isFlat);
this.UpdateInfoPanel ();
this.Resize ();
}
FillMeshTree (model)
FillMeshTree (model, isFlat)
{
function AddMeshToNodeTree (navigator, model, node, meshIndex, parentItem)
{
@ -247,15 +248,15 @@ OV.Navigator = class
return nodeItem;
}
function AddModelNodeToTree (navigator, model, node, parentItem)
function AddModelNodeToTree (navigator, model, node, parentItem, isFlat)
{
for (let childNode of node.GetChildNodes ()) {
if (OV.FeatureSet.NavigatorTree) {
if (isFlat) {
AddModelNodeToTree (navigator, model, childNode, parentItem, isFlat);
} else {
let nodeItem = CreateNodeItem (navigator, node.GetName (), null, childNode);
parentItem.AddChild (nodeItem);
AddModelNodeToTree (navigator, model, childNode, nodeItem);
} else {
AddModelNodeToTree (navigator, model, childNode, parentItem);
AddModelNodeToTree (navigator, model, childNode, nodeItem, isFlat);
}
}
@ -269,7 +270,7 @@ OV.Navigator = class
this.treeView.AddItem (meshesItem);
meshesItem.ShowChildren (true, null);
AddModelNodeToTree (this, model, rootNode, meshesItem);
AddModelNodeToTree (this, model, rootNode, meshesItem, isFlat);
}
MeshItemCount ()

View File

@ -22,13 +22,13 @@ OV.MeshItem = class extends OV.TreeViewButtonItem
this.fitToWindowButton.OnClick (() => {
callbacks.onFitToWindow (this.meshInstanceId);
});
this.AddButton (this.fitToWindowButton);
this.AppendButton (this.fitToWindowButton);
this.showHideButton = new OV.TreeViewButton ('visible');
this.showHideButton.OnClick (() => {
callbacks.onShowHide (this.meshInstanceId);
});
this.AddButton (this.showHideButton);
this.AppendButton (this.showHideButton);
this.OnClick (() => {
callbacks.onSelected (this.meshInstanceId);
@ -69,13 +69,13 @@ OV.NodeItem = class extends OV.TreeViewGroupButtonItem
this.fitToWindowButton.OnClick (() => {
callbacks.onFitToWindow (nodeId);
});
this.AddButton (this.fitToWindowButton);
this.AppendButton (this.fitToWindowButton);
this.showHideButton = new OV.TreeViewButton ('visible');
this.showHideButton.OnClick (() => {
callbacks.onShowHide (nodeId);
});
this.AddButton (this.showHideButton);
this.AppendButton (this.showHideButton);
}
IsVisible ()

View File

@ -29,9 +29,9 @@ OV.TreeViewButton = class
});
}
AddDomElements (parentDiv)
GetDomElement ()
{
this.mainElement.appendTo (parentDiv);
return this.mainElement;
}
};
@ -102,9 +102,14 @@ OV.TreeViewButtonItem = class extends OV.TreeViewSingleItem
this.buttonsDiv = $('<div>').addClass ('ov_tree_item_button_container').insertBefore (this.nameElement);
}
AddButton (button)
AppendButton (button)
{
button.AddDomElements (this.buttonsDiv);
button.GetDomElement ().appendTo (this.buttonsDiv);
}
PrependButton (button)
{
button.GetDomElement ().prependTo (this.buttonsDiv);
}
};
@ -176,9 +181,14 @@ OV.TreeViewGroupButtonItem = class extends OV.TreeViewGroupItem
this.buttonsDiv = $('<div>').addClass ('ov_tree_item_button_container').insertBefore (this.nameElement);
}
AddButton (button)
AppendButton (button)
{
button.AddDomElements (this.buttonsDiv);
button.GetDomElement ().appendTo (this.buttonsDiv);
}
PrependButton (button)
{
button.GetDomElement ().prependTo (this.buttonsDiv);
}
};