Browse Source

Fix preferential coordinates in rule display

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11546

(cherry picked from commit eb89d7ffcc)
9.0
Seth Hillbrand 2 months ago
parent
commit
f60f0394be
  1. 7
      common/preview_items/ruler_item.cpp

7
common/preview_items/ruler_item.cpp

@ -339,8 +339,8 @@ void RULER_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
// Choose a text quadrant that keeps the measurement text on-screen while avoiding
// overlapping the ruler geometry. Start with the preferred direction (away from the
// origin) and fall back to other quadrants as needed to keep the label visible.
int prefX = rulerVec.y < 0.0 ? 1 : -1;
int prefY = rulerVec.x < 0.0 ? -1 : 1;
int prefX = rulerVec.y < 0.0 ? -1 : 1;
int prefY = rulerVec.x < 0.0 ? 1 : -1;
double scale = gal->GetWorldScale();
@ -366,7 +366,6 @@ void RULER_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
auto fits = [&]( int sx, int sy )
{
double left, right, top, bottom;
double xStart = cursorScreen.x + ( sx < 0 ? offsetX : -offsetX );
if( sx < 0 )
@ -399,7 +398,6 @@ void RULER_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
VECTOR2I chosen = candidates[0];
double bestDot = -1.0;
bool found = false;
for( const VECTOR2I& c : candidates )
{
@ -411,7 +409,6 @@ void RULER_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
{
bestDot = dot;
chosen = c;
found = true;
}
}
}

Loading…
Cancel
Save