Set ViewBBox to viewitem size

Limit the bbox size of origin view item to item size.  This prevents
excessive redraw.

This also side-steps a degeneracy in the RTree calculation under certain
conditions in i386 where multiple, maximum-sized items are degenerate.

Fixes: lp:1774316
* https://bugs.launchpad.net/kicad/+bug/1774316
This commit is contained in:
Seth Hillbrand 2018-06-03 16:44:13 -07:00
parent 9e4511eb11
commit 7d62f14dd0
1 changed files with 8 additions and 1 deletions

View File

@ -53,7 +53,14 @@ ORIGIN_VIEWITEM* ORIGIN_VIEWITEM::Clone() const
const BOX2I ORIGIN_VIEWITEM::ViewBBox() const
{
BOX2I bbox;
bbox.SetMaximum();
if( m_drawAtZero )
bbox.SetOrigin( VECTOR2I( -m_size / 2, -m_size / 2 ) );
else
bbox.SetOrigin( VECTOR2I( m_position.x, m_position.y ) - VECTOR2I( m_size / 2, m_size / 2 ) );
bbox.SetSize( VECTOR2I( m_size, m_size ) );
return bbox;
}