Fixed overlapping text and floating objects by simplifying the available rectangle calculation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75362 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -5004,20 +5004,12 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
|
|
||||||
if (wxRichTextBuffer::GetFloatingLayoutMode() && collector)
|
if (wxRichTextBuffer::GetFloatingLayoutMode() && collector)
|
||||||
{
|
{
|
||||||
wxRect floatAvailableRect = collector->GetAvailableRect(rect.y + currentPosition.y, rect.y + currentPosition.y + lineHeight);
|
|
||||||
|
|
||||||
// Adjust availableRect to the space that is available when taking floating objects into account.
|
// Adjust availableRect to the space that is available when taking floating objects into account.
|
||||||
|
wxRect floatAvailableRect = collector->GetAvailableRect(rect.y + currentPosition.y, rect.y + currentPosition.y + lineHeight);
|
||||||
if (floatAvailableRect.x + startOffset > availableRect.x)
|
int x1 = wxMax(availableRect.x, (floatAvailableRect.x + startOffset));
|
||||||
{
|
int x2 = wxMin(availableRect.GetRight(), (floatAvailableRect.GetRight() - rightIndent));
|
||||||
int newX = floatAvailableRect.x + startOffset;
|
availableRect.x = x1;
|
||||||
int newW = availableRect.width - (newX - availableRect.x);
|
availableRect.width = x2 - x1 + 1;
|
||||||
availableRect.x = newX;
|
|
||||||
availableRect.width = newW;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (floatAvailableRect.width < availableRect.width)
|
|
||||||
availableRect.width = floatAvailableRect.width;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPosition.x = availableRect.x - rect.x;
|
currentPosition.x = availableRect.x - rect.x;
|
||||||
@@ -5226,20 +5218,12 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
// Take into account floating objects for the last line
|
// Take into account floating objects for the last line
|
||||||
if (wxRichTextBuffer::GetFloatingLayoutMode() && collector)
|
if (wxRichTextBuffer::GetFloatingLayoutMode() && collector)
|
||||||
{
|
{
|
||||||
wxRect floatAvailableRect = collector->GetAvailableRect(rect.y + currentPosition.y, rect.y + currentPosition.y + lineHeight);
|
|
||||||
|
|
||||||
// Adjust availableRect to the space that is available when taking floating objects into account.
|
// Adjust availableRect to the space that is available when taking floating objects into account.
|
||||||
|
wxRect floatAvailableRect = collector->GetAvailableRect(rect.y + currentPosition.y, rect.y + currentPosition.y + lineHeight);
|
||||||
if (floatAvailableRect.x + startOffset > availableRect.x)
|
int x1 = wxMax(availableRect.x, (floatAvailableRect.x + startOffset));
|
||||||
{
|
int x2 = wxMin(availableRect.GetRight(), (floatAvailableRect.GetRight() - rightIndent));
|
||||||
int newX = floatAvailableRect.x + startOffset;
|
availableRect.x = x1;
|
||||||
int newW = availableRect.width - (newX - availableRect.x);
|
availableRect.width = x2 - x1 + 1;
|
||||||
availableRect.x = newX;
|
|
||||||
availableRect.width = newW;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (floatAvailableRect.width < availableRect.width)
|
|
||||||
availableRect.width = floatAvailableRect.width;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPosition.x = availableRect.x - rect.x;
|
currentPosition.x = availableRect.x - rect.x;
|
||||||
|
Reference in New Issue
Block a user