From 83ea1b79e7e49c76aace20ce9c172e04764ed35e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 16 Jul 2007 20:04:13 +0000 Subject: [PATCH] fix rounding errors in stretchable items size calculation (patch 1754785) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47506 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/sizer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 6cc1207d8e..b5eb76ee65 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -1651,6 +1651,7 @@ void wxBoxSizer::RecalcSizes() wxPoint pt( m_position ); + int stretchable = m_stretchable; wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); while (node) { @@ -1667,7 +1668,9 @@ void wxBoxSizer::RecalcSizes() { // Because of at least one visible item has non-zero // proportion then m_stretchable is not zero - height = (delta * item->GetProportion()) / m_stretchable; + height = (delta * item->GetProportion()) / stretchable; + delta -= height; + stretchable -= item->GetProportion(); } wxPoint child_pos( pt ); @@ -1693,7 +1696,9 @@ void wxBoxSizer::RecalcSizes() { // Because of at least one visible item has non-zero // proportion then m_stretchable is not zero - width = (delta * item->GetProportion()) / m_stretchable; + width = (delta * item->GetProportion()) / stretchable; + delta -= width; + stretchable -= item->GetProportion(); } wxPoint child_pos( pt );