DragNewBrush: when no testselestion: offset based on gridsize to handle big grid

This commit is contained in:
Garux 2018-04-10 18:02:34 +03:00
parent 1eff801967
commit 417051921e

View File

@ -744,9 +744,9 @@ void Transform( const Matrix4& manip2object, const Matrix4& device2manip, const
if( snap || snapbbox ){ if( snap || snapbbox ){
const float squaresize = std::max( fabs( diff.x() ), fabs( diff.y() ) ); const float squaresize = std::max( fabs( diff.x() ), fabs( diff.y() ) );
diff.x() = diff.x() > 0? squaresize : -squaresize; diff.x() = diff.x() > 0? squaresize : -squaresize; //square
diff.y() = diff.y() > 0? squaresize : -squaresize; diff.y() = diff.y() > 0? squaresize : -squaresize;
if( snapbbox && !alt ) if( snapbbox && !alt ) //cube
diff.z() = diff.z() > 0? squaresize : -squaresize; diff.z() = diff.z() > 0? squaresize : -squaresize;
} }
@ -3641,7 +3641,7 @@ void testSelect( const View& view, const Matrix4& pivot2world ){
else{ else{
const Vector3 near = vector4_projected( matrix4_transformed_vector4( test.getScreen2world(), Vector4( 0, 0, -1, 1 ) ) ); const Vector3 near = vector4_projected( matrix4_transformed_vector4( test.getScreen2world(), Vector4( 0, 0, -1, 1 ) ) );
const Vector3 far = vector4_projected( matrix4_transformed_vector4( test.getScreen2world(), Vector4( 0, 0, 1, 1 ) ) ); const Vector3 far = vector4_projected( matrix4_transformed_vector4( test.getScreen2world(), Vector4( 0, 0, 1, 1 ) ) );
start = vector3_normalised( far - near ) * 256.f + near; start = vector3_normalised( far - near ) * ( 256.f + GetGridSize() ) + near;
} }
vector3_snap( start, GetSnapGridSize() ); vector3_snap( start, GetSnapGridSize() );
m_dragNewBrush.set0( start ); m_dragNewBrush.set0( start );