1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-08 18:40:55 +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
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
@ -216,10 +218,9 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
toUpdateViewer = Standard_True;
}
if (myLastPicked->State() == 1)
{
aStatus = AIS_SOD_Selected;
}
aStatus = myLastPicked->State() == 1
? AIS_SOD_Selected
: AIS_SOD_OnlyOneDetected;
}
}
else
@ -243,6 +244,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
}
myLastinMain.Nullify();
myLastPicked.Nullify();
}
if (toUpdateViewer)
@ -257,7 +259,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
}
}
myLastPicked.Nullify();
mylastmoveview = theView;
return aStatus;
}

View File

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

View File

@ -193,7 +193,7 @@ int Y_Motion = 0;
int X_ButtonPress = 0; // Last ButtonPress position
int Y_ButtonPress = 0;
Standard_Boolean IsDragged = Standard_False;
Standard_Boolean DragFirst;
Standard_Boolean DragFirst = Standard_False;
//==============================================================================
@ -1891,24 +1891,16 @@ static LRESULT WINAPI AdvViewerWindowProc( HWND hwnd,
}
break;
case WM_LBUTTONUP:
IsDragged = Standard_False;
if( !DragFirst )
if (!DragFirst)
{
HDC hdc = GetDC( hwnd );
SelectObject( hdc, GetStockObject( HOLLOW_BRUSH ) );
SetROP2( hdc, R2_NOT );
Rectangle( hdc, X_ButtonPress, Y_ButtonPress, X_Motion, Y_Motion );
ReleaseDC( hwnd, hdc );
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 ));
VT_ProcessButton1Release (fwKeys & MK_SHIFT);
}
IsDragged = Standard_False;
return ViewerWindowProc( hwnd, Msg, wParam, lParam );
case WM_LBUTTONDOWN: