origin viewitem needs to account for size zoom

The origin item doesn't have a fixed size.  It is constant on the screen but
changes the effective BBox size based on the zoom level.
But we can't simply set it to the maximum size as this causes a splitting degeneracy
when compiling for Debian i386.  By modestly adjusting the bbox, we avoid the degeneracy
while keeping the origin visible at all zoom levels

Fixes: lp:1777379
* https://bugs.launchpad.net/kicad/+bug/1777379
This commit is contained in:
Seth Hillbrand 2018-06-19 22:10:01 -07:00
parent 8394e2b71e
commit a1ef441dd9
1 changed files with 7 additions and 6 deletions

View File

@ -54,12 +54,13 @@ const BOX2I ORIGIN_VIEWITEM::ViewBBox() const
{
BOX2I bbox;
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 ) );
// The origin item doesn't have a fixed size. It is constant on the screen but
// changes the effective BBox size based on the zoom level.
// But we can't simply set it to the maximum size as this causes a splitting degeneracy
// when compiling for Debian i386. By modestly adjusting the bbox, we avoid the degeneracy
// while keeping the origin visible at all zoom levels
bbox.SetSize( VECTOR2I( INT_MAX - 2, INT_MAX - 2 ) );
bbox.SetOrigin( VECTOR2I( INT_MIN / 2 + 1, INT_MIN / 2 + 1 ) );
return bbox;
}