Skip to content

Commit

Permalink
Handle overlapping controls for screenshot function
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake-Madden committed Aug 9, 2024
1 parent b6b43de commit e360e99
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/util/screenshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,14 +726,14 @@ bool Screenshot::SaveScreenshot(const wxString& filePath,
cutoffPoint += cutoffWindowParent->GetPosition();
cutoffWindowParent = cutoffWindowParent->GetParent();
}
wxPoint cutOffEndPoint(cutoffPoint.x + cutoffWindow->GetSize().GetWidth(),
cutoffPoint.y + cutoffWindow->GetSize().GetHeight());
const wxPoint cutOffEndPoint(cutoffPoint.x + cutoffWindow->GetSize().GetWidth(),
cutoffPoint.y + cutoffWindow->GetSize().GetHeight());

// if cutoff is at the starting point (or above it),
// then crop above the first highlighted control
if (startPoint.y >= cutoffPoint.y)
if (startPoint.y >= cutOffEndPoint.y)
{
const wxCoord yStart = cutoffPoint.y - wxSizerFlags::GetDefaultBorder();
const wxCoord yStart = cutOffEndPoint.y - wxSizerFlags::GetDefaultBorder();
bitmap = bitmap.GetSubBitmap(
wxRect(0, yStart, bitmap.GetWidth(), bitmap.GetHeight() - yStart));
}
Expand Down

0 comments on commit e360e99

Please sign in to comment.