From 6d739ca9da638a95a84ceadcdf921c7566975261 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 12 Dec 2021 01:05:55 +0300 Subject: [PATCH] Improve handling of long distances --- common/eda_shape.cpp | 4 ++-- common/preview_items/two_point_assistant.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/eda_shape.cpp b/common/eda_shape.cpp index 1ad7a2fe2d..e3015099ed 100644 --- a/common/eda_shape.cpp +++ b/common/eda_shape.cpp @@ -705,7 +705,7 @@ bool EDA_SHAPE::hitTest( const VECTOR2I& aPosition, int aAccuracy ) const case SHAPE_T::CIRCLE: { int radius = GetRadius(); - int dist = KiROUND( EuclideanNorm( aPosition - getCenter() ) ); + long dist = KiROUND( EuclideanNorm( aPosition - getCenter() ) ); if( IsFilled() ) return dist <= radius + maxdist; // Filled circle hit-test @@ -723,7 +723,7 @@ bool EDA_SHAPE::hitTest( const VECTOR2I& aPosition, int aAccuracy ) const VECTOR2I relPos = aPosition - getCenter(); int radius = GetRadius(); - int dist = KiROUND( EuclideanNorm( relPos ) ); + long dist = KiROUND( EuclideanNorm( relPos ) ); if( IsFilled() ) { diff --git a/common/preview_items/two_point_assistant.cpp b/common/preview_items/two_point_assistant.cpp index 7e9d997da5..2e818d3400 100644 --- a/common/preview_items/two_point_assistant.cpp +++ b/common/preview_items/two_point_assistant.cpp @@ -62,9 +62,9 @@ void TWO_POINT_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const if( m_constructMan.IsReset() ) return; - const VECTOR2I origin = m_constructMan.GetOrigin(); - const VECTOR2I end = m_constructMan.GetEnd(); - const VECTOR2I radVec = end - origin; + const VECTOR2I origin = m_constructMan.GetOrigin(); + const VECTOR2I end = m_constructMan.GetEnd(); + const VECTOR2D radVec = end - origin; // Ensures that +90° is up and -90° is down in pcbnew const EDA_ANGLE deltaAngle( VECTOR2I( radVec.x, -radVec.y ) );