Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
hw3d
Commits
e7e22eda
Commit
e7e22eda
authored
Jun 26, 2019
by
chili
Browse files
selecting non-expanded nodes
parent
eb218095
Changes
1
Hide whitespace changes
Inline
Side-by-side
hw3d/Mesh.cpp
View file @
e7e22eda
...
...
@@ -106,16 +106,19 @@ void Node::ShowTree( int& nodeIndexTracked,std::optional<int>& selectedIndex,Nod
const
auto
node_flags
=
ImGuiTreeNodeFlags_OpenOnArrow
|
((
currentNodeIndex
==
selectedIndex
.
value_or
(
-
1
))
?
ImGuiTreeNodeFlags_Selected
:
0
)
|
((
childPtrs
.
size
()
==
0
)
?
ImGuiTreeNodeFlags_Leaf
:
0
);
// if tree node expanded, recursively render all children
if
(
ImGui
::
TreeNodeEx
(
(
void
*
)(
intptr_t
)
currentNodeIndex
,
node_flags
,
name
.
c_str
()
)
)
// render this node
const
auto
expanded
=
ImGui
::
TreeNodeEx
(
(
void
*
)(
intptr_t
)
currentNodeIndex
,
node_flags
,
name
.
c_str
()
);
// processing for selecting node
if
(
ImGui
::
IsItemClicked
()
)
{
selectedIndex
=
currentNodeIndex
;
pSelectedNode
=
const_cast
<
Node
*>
(
this
);
}
// recursive rendering of open node's children
if
(
expanded
)
{
// detecting / setting selected node
if
(
ImGui
::
IsItemClicked
()
)
{
selectedIndex
=
currentNodeIndex
;
pSelectedNode
=
const_cast
<
Node
*>
(
this
);
}
for
(
const
auto
&
pChild
:
childPtrs
)
{
pChild
->
ShowTree
(
nodeIndexTracked
,
selectedIndex
,
pSelectedNode
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment