Skip to content

Commit

Permalink
Fixed layout bug which occured when leftmost node had no inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
joern274 committed Jul 11, 2024
1 parent 06ea7cb commit 31e1bcc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
* added backward compatibility for view management
* bugfixes
* fixed incompatibility between shipped zlib and QuaZip libraries
* fixed layout bug which occured when leftmost node had no inputs

## [4.3.0](v4.3.0) - 2024-07-02 13:42:55+02:00 (urgency: medium)
* **WARNING:** this release breaks compatibility with Ubuntu 20.04 LTS
Expand Down
6 changes: 6 additions & 0 deletions plugins/gui/src/graph_widget/contexts/graph_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,12 @@ namespace hal
}
}

if (nodesToPlace.isEmpty())
{
log_warning("gui", "Cannot restore view id={}, there are no nodes to place.", mId);
return false;
}

mModules.clear();
mGates.clear();
for (const QPair<Node,QPoint>& box : nodesToPlace)
Expand Down
6 changes: 6 additions & 0 deletions plugins/gui/src/graph_widget/layouters/graph_layouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,12 @@ namespace hal
mCoordY[pnt.y()].testMinMax(rect.bottom());
}

// add topmost and leftmost coordinate entry (unless it already exists)
if (!mCoordX.contains(mNodeBoundingBox.left()))
mCoordX[mNodeBoundingBox.left()].testMinMax(0);
if (!mCoordY.contains(mNodeBoundingBox.top()))
mCoordY[mNodeBoundingBox.top()].testMinMax(0);

// fill gaps in coordinate system if any
if (!mCoordX.isEmpty())
{
Expand Down

0 comments on commit 31e1bcc

Please sign in to comment.