From 26177efba028dff470e381af566b0fd4c972e7eb Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Fri, 3 Aug 2018 13:59:15 +0200 Subject: [PATCH] VIEW_GROUP: correctly calculate group extents --- common/view/view_group.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/common/view/view_group.cpp b/common/view/view_group.cpp index 6f7ab4b7f1..65526870cd 100644 --- a/common/view/view_group.cpp +++ b/common/view/view_group.cpp @@ -91,10 +91,26 @@ VIEW_ITEM *VIEW_GROUP::GetItem( unsigned int idx ) const const BOX2I VIEW_GROUP::ViewBBox() const { - BOX2I maxBox; + BOX2I bb; + bool first; - maxBox.SetMaximum(); - return maxBox; + if( !m_groupItems.size() ) + { + bb.SetMaximum(); + } else { + for( auto item : m_groupItems ) + { + if( first ) + { + bb = item->ViewBBox(); + first = false; + } else { + bb.Merge( item->ViewBBox() ); + } + } + } + + return bb; }