Skip to content

Commit

Permalink
Update #255 : better graph size calculation when graph is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecopperwhite committed Nov 2, 2015
1 parent 5da231f commit 6b80497
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/display_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,14 +413,14 @@ GRAPHSTUDIO_NAMESPACE_START // cf stdafx.h for explanation
CRect DisplayGraph::GetGraphSize()
{
// find out the rectangle
CRect rect(10000000, 10000000, 0, 0);
CRect rect(0, 0, 0, 0);

for (int i=0; i<filters.GetCount(); i++) {
Filter *filter = filters[i];
if (filter->posx < rect.left) rect.left = filter->posx;
if (filter->posy < rect.top) rect.top = filter->posy;
if (filter->posx + filter->width > rect.right) rect.right = filter->posx+filter->width;
if (filter->posy + filter->height > rect.bottom) rect.bottom = filter->posy+filter->height;
rect.left = (i==0 || filter->posx < rect.left) ? filter->posx : rect.left ;
rect.top = (i==0 || filter->posy < rect.top) ? filter->posy : rect.top ;
rect.right = (i==0 || filter->posx + filter->width > rect.right) ? filter->posx+filter->width : rect.right ;
rect.bottom = (i==0 || filter->posy + filter->height > rect.bottom) ? filter->posy+filter->height : rect.bottom ;
}

// Round outwards and add an extra grid of border
Expand Down

0 comments on commit 6b80497

Please sign in to comment.