* 2D view new brush creation: do not stumble on one dimenstion resizing, when the other is 0
* 2D view new brush creation: preserve brush start world coordinate, when viewpoint is changed in the process
This commit is contained in:
parent
e1c814f600
commit
52a8b41229
|
|
@ -696,8 +696,7 @@ unsigned int NewBrushDrag_buttons(){
|
||||||
|
|
||||||
void XYWnd::NewBrushDrag_Begin( int x, int y ){
|
void XYWnd::NewBrushDrag_Begin( int x, int y ){
|
||||||
m_NewBrushDrag = 0;
|
m_NewBrushDrag = 0;
|
||||||
m_nNewBrushPressx = x;
|
m_nNewBrushPress = XY_ToPoint( x, y, true );
|
||||||
m_nNewBrushPressy = y;
|
|
||||||
|
|
||||||
m_bNewBrushDrag = true;
|
m_bNewBrushDrag = true;
|
||||||
}
|
}
|
||||||
|
|
@ -709,10 +708,19 @@ void XYWnd::NewBrushDrag_End( int x, int y ){
|
||||||
}
|
}
|
||||||
|
|
||||||
void XYWnd::NewBrushDrag( int x, int y, bool square, bool cube ){
|
void XYWnd::NewBrushDrag( int x, int y, bool square, bool cube ){
|
||||||
Vector3 mins = XY_ToPoint( m_nNewBrushPressx, m_nNewBrushPressy, true );
|
Vector3 mins = m_nNewBrushPress;
|
||||||
Vector3 maxs = XY_ToPoint( x, y, true );
|
Vector3 maxs = XY_ToPoint( x, y, true );
|
||||||
|
const Vector3 maxs_real = XY_ToPoint( x, y );
|
||||||
|
|
||||||
const int nDim = GetViewType();
|
const int nDim = GetViewType();
|
||||||
|
NDIM1NDIM2( nDim );
|
||||||
|
|
||||||
|
// avoid snapping to zero bounds
|
||||||
|
// if brush is already inserted or move is decent nuff
|
||||||
|
if( m_NewBrushDrag != nullptr || vector3_length( maxs_real - mins ) > GetSnapGridSize() / sqrt( 2.0 ) )
|
||||||
|
for( auto i : { nDim1, nDim2 } )
|
||||||
|
if( maxs[i] == mins[i] )
|
||||||
|
maxs[i] = mins[i] + std::copysign( GetSnapGridSize(), maxs_real[i] - mins[i] );
|
||||||
|
|
||||||
mins[nDim] = float_snapped( Select_getWorkZone().d_work_min[nDim], GetSnapGridSize() );
|
mins[nDim] = float_snapped( Select_getWorkZone().d_work_min[nDim], GetSnapGridSize() );
|
||||||
maxs[nDim] = float_snapped( Select_getWorkZone().d_work_max[nDim], GetSnapGridSize() );
|
maxs[nDim] = float_snapped( Select_getWorkZone().d_work_max[nDim], GetSnapGridSize() );
|
||||||
|
|
@ -722,7 +730,6 @@ void XYWnd::NewBrushDrag( int x, int y, bool square, bool cube ){
|
||||||
}
|
}
|
||||||
|
|
||||||
if( square || cube ){
|
if( square || cube ){
|
||||||
NDIM1NDIM2( nDim )
|
|
||||||
const float squaresize = std::max( fabs( maxs[nDim1] - mins[nDim1] ), fabs( maxs[nDim2] - mins[nDim2] ) );
|
const float squaresize = std::max( fabs( maxs[nDim1] - mins[nDim1] ), fabs( maxs[nDim2] - mins[nDim2] ) );
|
||||||
for( auto i : { nDim1, nDim2 } )
|
for( auto i : { nDim1, nDim2 } )
|
||||||
maxs[i] = mins[i] + std::copysign( squaresize, maxs[i] - mins[i] );
|
maxs[i] = mins[i] + std::copysign( squaresize, maxs[i] - mins[i] );
|
||||||
|
|
|
||||||
|
|
@ -187,8 +187,7 @@ private:
|
||||||
|
|
||||||
unsigned int m_buttonstate;
|
unsigned int m_buttonstate;
|
||||||
|
|
||||||
int m_nNewBrushPressx;
|
Vector3 m_nNewBrushPress;
|
||||||
int m_nNewBrushPressy;
|
|
||||||
scene::Node* m_NewBrushDrag;
|
scene::Node* m_NewBrushDrag;
|
||||||
bool m_bNewBrushDrag;
|
bool m_bNewBrushDrag;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user