Skip to content

Commit

Permalink
Expand/collapse all info panels on double-click on node id
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaldoshi committed Mar 19, 2024
1 parent 23c0f10 commit d64e0ec
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 11 deletions.
61 changes: 50 additions & 11 deletions Source/UI/GraphViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -864,10 +864,13 @@ void GraphNode::mouseDown (const MouseEvent& m)
{
AccessClass::getEditorViewport()->highlightEditor(editor);

if (processor->isMerger() || processor->isSplitter() || processor->isEmpty())
if (processor->isMerger()
|| processor->isSplitter()
|| processor->isEmpty()
|| processorParamComponent->heightInPixels == 0)
return;

if (m.getEventRelativeTo(this).y < 20)
if (m.getEventRelativeTo(this).y < 20 && m.getEventRelativeTo(this).x > 24)
{
if (processorInfoVisible)
{
Expand All @@ -886,6 +889,43 @@ void GraphNode::mouseDown (const MouseEvent& m)
}
}


void GraphNode::mouseDoubleClick (const MouseEvent& m)
{
// Expand/collapse all info panels on double click on node id

if (processor->isMerger() || processor->isSplitter() || processor->isEmpty())
return;

if (m.getEventRelativeTo(this).y < 20 && m.getEventRelativeTo(this).x <= 24)
{
bool makeVisible = true;

for (auto& it : streamInfoVisible)
{
if (it.second)
{
makeVisible = false;
break;
}
}

if (processorInfoVisible)
makeVisible = false;


processorInfoVisible = makeVisible;

for (auto& it : streamInfoVisible)
{
it.second = makeVisible;
streamParamsVisible[it.first] = makeVisible;
}

restorePanels();
}
}

void GraphNode::buttonClicked(Button* button)
{

Expand Down Expand Up @@ -1096,19 +1136,18 @@ void GraphNode::restorePanels()
{
LOGDD("Restoring panels for graph node: ", editor->getNameAndId());

if (processor->isMerger() || processor->isSplitter() || processor->isEmpty())
return;

updateBoundaries();
if (processorInfoVisible)
{
updateBoundaries();
infoPanel->expandPanelFully(processorParamComponent.get(), false);
}
else
infoPanel->setPanelSize(processorParamComponent.get(), 0, false);

for (auto info : dataStreamInfos)
{
if (streamInfoVisible[info->getStreamKey()])
{
info->restorePanels();
}
}
info->restorePanels();

}


Expand Down
3 changes: 3 additions & 0 deletions Source/UI/GraphViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ class GraphNode : public Component,
/** Behavior on mouse click */
void mouseDown (const MouseEvent& event) override;

/** Behavior on mouse double click */
void mouseDoubleClick(const MouseEvent& event) override;

/** Indicates whether node has an editor component */
bool hasEditor (GenericEditor* editor) const;

Expand Down

0 comments on commit d64e0ec

Please sign in to comment.