If wxGrid has hidden columns, then a DPI change occurs, XYToCell stops working correctly and some rendering artifacts appear when scrolling.
This can be traced down to this code:
Hidden columns have negative width, so due to the condition if ( width <= 0 ), m_colRights values are not updated which breaks binary search in wxGrid::PosToLinePos.
IMO, negative values in m_colWidths should be scaled too.
KiCad issue: https://gitlab.com/kicad/code/kicad/-/issues/15641
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I see, thanks. Would just this fix the problem?
diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index f33c9fc1a3..1ee736f306 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -6225,14 +6225,16 @@ void wxGrid::OnDPIChanged(wxDPIChangedEvent& event) { int height = m_rowHeights[i]; - // Skip hidden rows. - if ( height <= 0 ) - continue; - + // Note that even hidden rows heights must be scaled to ensure that + // they appear in the expected size if they are shown again. height = event.ScaleY(height); - total += height; m_rowHeights[i] = height; + + // But don't count hidden rows for the total height. + if ( height > 0 ) + total += height; + m_rowBottoms[i] = total; } } @@ -6249,13 +6251,13 @@ void wxGrid::OnDPIChanged(wxDPIChangedEvent& event) { int width = m_colWidths[i]; - if ( width <= 0 ) - continue; - width = event.ScaleX(width); - total += width; m_colWidths[i] = width; + + if ( width > 0 ) + total += width; + m_colRights[i] = total; if ( colHeader )
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Thanks, looks like this should fix it.
(can't test in KiCad currently)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I'll push this soon and will backport this to 3.2 later if you can confirm that this fixes the problem in KiCad. TIA!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()