From eb89d7ffcc2373b263da2cd1a5e02a24fb972910 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Mon, 18 Aug 2025 06:29:03 -0700 Subject: [PATCH] Fix preferential coordinates in rule display Fixes https://gitlab.com/kicad/code/kicad/-/issues/11546 --- common/preview_items/ruler_item.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/preview_items/ruler_item.cpp b/common/preview_items/ruler_item.cpp index a8554a49f5..c8d4130d63 100644 --- a/common/preview_items/ruler_item.cpp +++ b/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 )