1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

0024777: Visualization - AIS_InteractiveContext::MoveTo() doesn't keep detected object at first call

Draw Harness, ViewerTest - ignore rectangular selection for empty rectangle
This commit is contained in:
kgv 2014-04-03 16:24:28 +04:00 committed by apn
parent 7da5f7b1c2
commit 8abada55ca
3 changed files with 17 additions and 20 deletions

View File

@ -179,7 +179,9 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
// does nothing if previously detected object is equal to the current one // does nothing if previously detected object is equal to the current one
if (myMainSel->OnePicked()->Selectable() == myLastPicked) if (myMainSel->OnePicked()->Selectable() == myLastPicked)
{ {
return AIS_SOD_OnlyOneDetected; return myLastPicked->State() == 1
? AIS_SOD_Selected
: AIS_SOD_OnlyOneDetected;
} }
// Previously detected object is unhilighted if it is not selected or hilighted // Previously detected object is unhilighted if it is not selected or hilighted
@ -216,10 +218,9 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
toUpdateViewer = Standard_True; toUpdateViewer = Standard_True;
} }
if (myLastPicked->State() == 1) aStatus = myLastPicked->State() == 1
{ ? AIS_SOD_Selected
aStatus = AIS_SOD_Selected; : AIS_SOD_OnlyOneDetected;
}
} }
} }
else else
@ -243,6 +244,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
} }
myLastinMain.Nullify(); myLastinMain.Nullify();
myLastPicked.Nullify();
} }
if (toUpdateViewer) if (toUpdateViewer)
@ -257,7 +259,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
} }
} }
myLastPicked.Nullify();
mylastmoveview = theView; mylastmoveview = theView;
return aStatus; return aStatus;
} }

View File

@ -90,7 +90,9 @@ void ViewerTest_EventManager::Select (const Standard_Integer theXPMin,
const Standard_Integer theYPMax) const Standard_Integer theYPMax)
{ {
#define IS_FULL_INCLUSION Standard_True #define IS_FULL_INCLUSION Standard_True
if (myView.IsNull()) if (myView.IsNull()
|| Abs (theXPMax - theXPMin) < 2
|| Abs (theYPMax - theYPMin) < 2)
{ {
return; return;
} }
@ -117,7 +119,9 @@ void ViewerTest_EventManager::ShiftSelect (const Standard_Integer theXPMin,
const Standard_Integer theXPMax, const Standard_Integer theXPMax,
const Standard_Integer theYPMax) const Standard_Integer theYPMax)
{ {
if (myView.IsNull()) if (myView.IsNull()
|| Abs (theXPMax - theXPMin) < 2
|| Abs (theYPMax - theYPMin) < 2)
{ {
return; return;
} }

View File

@ -193,7 +193,7 @@ int Y_Motion = 0;
int X_ButtonPress = 0; // Last ButtonPress position int X_ButtonPress = 0; // Last ButtonPress position
int Y_ButtonPress = 0; int Y_ButtonPress = 0;
Standard_Boolean IsDragged = Standard_False; Standard_Boolean IsDragged = Standard_False;
Standard_Boolean DragFirst; Standard_Boolean DragFirst = Standard_False;
//============================================================================== //==============================================================================
@ -1891,24 +1891,16 @@ static LRESULT WINAPI AdvViewerWindowProc( HWND hwnd,
} }
break; break;
case WM_LBUTTONUP: case WM_LBUTTONUP:
IsDragged = Standard_False; if (!DragFirst)
if( !DragFirst )
{ {
HDC hdc = GetDC( hwnd ); HDC hdc = GetDC( hwnd );
SelectObject( hdc, GetStockObject( HOLLOW_BRUSH ) ); SelectObject( hdc, GetStockObject( HOLLOW_BRUSH ) );
SetROP2( hdc, R2_NOT ); SetROP2( hdc, R2_NOT );
Rectangle( hdc, X_ButtonPress, Y_ButtonPress, X_Motion, Y_Motion ); Rectangle( hdc, X_ButtonPress, Y_ButtonPress, X_Motion, Y_Motion );
ReleaseDC( hwnd, hdc ); ReleaseDC( hwnd, hdc );
VT_ProcessButton1Release (fwKeys & MK_SHIFT);
const Handle(ViewerTest_EventManager) EM =
ViewerTest::CurrentEventManager();
if ( fwKeys & MK_SHIFT )
EM->ShiftSelect( min( X_ButtonPress, X_Motion ), max( Y_ButtonPress, Y_Motion ),
max( X_ButtonPress, X_Motion ), min( Y_ButtonPress, Y_Motion ));
else
EM->Select( min( X_ButtonPress, X_Motion ), max( Y_ButtonPress, Y_Motion ),
max( X_ButtonPress, X_Motion ), min( Y_ButtonPress, Y_Motion ));
} }
IsDragged = Standard_False;
return ViewerWindowProc( hwnd, Msg, wParam, lParam ); return ViewerWindowProc( hwnd, Msg, wParam, lParam );
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN: