Skip to content

Commit 6aeca2e

Browse files
committed
Add optional function for compressing processors to the left
1 parent a39f407 commit 6aeca2e

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

Source/UI/GraphViewer.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,40 @@ void GraphViewer::updateNodeLocations()
158158
}
159159
}
160160

161+
// remove extra horizontal shift
162+
//for (auto& node : availableNodes)
163+
//{
164+
// if (node->getHorzShift() > 0)
165+
// {
166+
// for (int i = 0; i < 3; i++)
167+
// {
168+
// if (isEmptySpace(node->getLevel(), node->getHorzShift()-1))
169+
// {
170+
// node->setHorzShift(node->getHorzShift()-1);
171+
// }
172+
// }
173+
// }
174+
//}
175+
161176
repaint();
162177
}
163178

179+
bool GraphViewer::isEmptySpace(int level, int horzShift)
180+
{
181+
if (horzShift < 0)
182+
return false;
183+
184+
for (auto& node : availableNodes)
185+
{
186+
if (node->getHorzShift() == horzShift && node->getLevel() == level)
187+
{
188+
return false;
189+
}
190+
}
191+
192+
return true;
193+
}
194+
164195

165196
int GraphViewer::getIndexOfEditor (GenericEditor* editor) const
166197
{

Source/UI/GraphViewer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ class GraphViewer : public Component
154154
private:
155155
void connectNodes (int, int, Graphics&);
156156
void adjustBranchLayout(GraphNode*, int);
157+
bool isEmptySpace(int level, int horzShift);
157158

158159
int getLevel(GraphNode*);
159160
int getIndexOfEditor (GenericEditor* editor) const;

0 commit comments

Comments
 (0)