Improve EDIT_LINE position calculations beyond INT_MIN/2 ~ INT_MAX/2

This commit is contained in:
dsa-t 2021-12-07 21:24:09 +00:00 committed by Seth Hillbrand
parent fbdb2bd91f
commit 51eac3ba04
1 changed files with 4 additions and 4 deletions

View File

@ -220,9 +220,9 @@ public:
* @param aEnd is the end of EDIT_LINE.
*/
EDIT_LINE( EDIT_POINT& aOrigin, EDIT_POINT& aEnd ) :
EDIT_POINT( aOrigin.GetPosition() + ( aEnd.GetPosition() - aOrigin.GetPosition() ) / 2 ),
m_origin( aOrigin ),
m_end( aEnd )
EDIT_POINT( aOrigin.GetPosition()
+ ( aEnd.GetPosition() / 2 - aOrigin.GetPosition() / 2 ) ),
m_origin( aOrigin ), m_end( aEnd )
{
SetGridConstraint( SNAP_BY_GRID );
}
@ -230,7 +230,7 @@ public:
///< @copydoc EDIT_POINT::GetPosition()
virtual VECTOR2I GetPosition() const override
{
return ( m_origin.GetPosition() + m_end.GetPosition() ) / 2;
return m_origin.GetPosition() / 2 + m_end.GetPosition() / 2;
}
///< @copydoc EDIT_POINT::GetPosition()