{
AIS_MouseGesture_NONE, //!< no active gesture
//
- AIS_MouseGesture_SelectRectangle, //!< rectangular selection
- AIS_MouseGesture_SelectLasso, //!< polygonal selection
+ AIS_MouseGesture_SelectRectangle, //!< rectangular selection;
+ //! press button to start, move mouse to define rectangle, release to finish
+ AIS_MouseGesture_SelectLasso, //!< polygonal selection;
+ //! press button to start, move mouse to define polygonal path, release to finish
//
- AIS_MouseGesture_Zoom, //!< view zoom gesture
+ AIS_MouseGesture_Zoom, //!< view zoom gesture;
+ //! move mouse left to zoom-out, and to the right to zoom-in
+ AIS_MouseGesture_ZoomWindow, //!< view zoom by window gesture;
+ //! press button to start, move mouse to define rectangle, release to finish
AIS_MouseGesture_Pan, //!< view panning gesture
AIS_MouseGesture_RotateOrbit, //!< orbit rotation gesture
AIS_MouseGesture_RotateView, //!< view rotation gesture
break;
}
case AIS_MouseGesture_Zoom:
+ case AIS_MouseGesture_ZoomWindow:
{
if (!myToAllowZooming)
{
if (aPrevGesture != myMouseActiveGesture)
{
if (aPrevGesture == AIS_MouseGesture_SelectRectangle
- || aPrevGesture == AIS_MouseGesture_SelectLasso)
+ || aPrevGesture == AIS_MouseGesture_SelectLasso
+ || aPrevGesture == AIS_MouseGesture_ZoomWindow)
{
myUI.Selection.ToApplyTool = true;
}
switch (myMouseActiveGesture)
{
case AIS_MouseGesture_SelectRectangle:
+ case AIS_MouseGesture_ZoomWindow:
{
UpdateRubberBand (myMousePressPoint, thePoint);
+ if (myMouseActiveGesture == AIS_MouseGesture_ZoomWindow)
+ {
+ myUI.Selection.Tool = AIS_ViewSelectionTool_ZoomWindow;
+ }
toUpdateView = true;
break;
}
{
// rubber-band & window polygon selection
if (myGL.Selection.Tool == AIS_ViewSelectionTool_RubberBand
- || myGL.Selection.Tool == AIS_ViewSelectionTool_Polygon)
+ || myGL.Selection.Tool == AIS_ViewSelectionTool_Polygon
+ || myGL.Selection.Tool == AIS_ViewSelectionTool_ZoomWindow)
{
if (!myGL.Selection.Points.IsEmpty())
{
myRubberBand->ClearPoints();
myRubberBand->SetToUpdate();
- const bool anIsRubber = myGL.Selection.Tool == AIS_ViewSelectionTool_RubberBand;
+ const bool anIsRubber = myGL.Selection.Tool == AIS_ViewSelectionTool_RubberBand
+ || myGL.Selection.Tool == AIS_ViewSelectionTool_ZoomWindow;
if (anIsRubber)
{
myRubberBand->SetRectangle (myGL.Selection.Points.First().x(), -myGL.Selection.Points.First().y(),
{
const Graphic3d_Vec2i aPnt1 (aPoints.Value (1).x(), -aPoints.Value (1).y());
const Graphic3d_Vec2i aPnt2 (aPoints.Value (3).x(), -aPoints.Value (3).y());
- theCtx->MainSelector()->AllowOverlapDetection (aPnt1.y() != Min (aPnt1.y(), aPnt2.y()));
- if (myGL.Selection.IsXOR)
+ if (myGL.Selection.Tool == AIS_ViewSelectionTool_ZoomWindow)
{
- theCtx->ShiftSelect (Min (aPnt1.x(), aPnt2.x()), Min (aPnt1.y(), aPnt2.y()),
- Max (aPnt1.x(), aPnt2.x()), Max (aPnt1.y(), aPnt2.y()),
- theView, false);
+ theView->WindowFitAll (aPnt1.x(), aPnt1.y(), aPnt2.x(), aPnt2.y());
+ theView->Invalidate();
}
else
{
- theCtx->Select (Min (aPnt1.x(), aPnt2.x()), Min (aPnt1.y(), aPnt2.y()),
- Max (aPnt1.x(), aPnt2.x()), Max (aPnt1.y(), aPnt2.y()),
- theView, false);
+ theCtx->MainSelector()->AllowOverlapDetection (aPnt1.y() != Min (aPnt1.y(), aPnt2.y()));
+ if (myGL.Selection.IsXOR)
+ {
+ theCtx->ShiftSelect (Min (aPnt1.x(), aPnt2.x()), Min (aPnt1.y(), aPnt2.y()),
+ Max (aPnt1.x(), aPnt2.x()), Max (aPnt1.y(), aPnt2.y()),
+ theView, false);
+ }
+ else
+ {
+ theCtx->Select (Min (aPnt1.x(), aPnt2.x()), Min (aPnt1.y(), aPnt2.y()),
+ Max (aPnt1.x(), aPnt2.x()), Max (aPnt1.y(), aPnt2.y()),
+ theView, false);
+ }
+ theCtx->MainSelector()->AllowOverlapDetection (false);
}
- theCtx->MainSelector()->AllowOverlapDetection (false);
}
else if (aPoints.Length() >= 3)
{
}
}
- // selection affects all Views
- theView->Viewer()->Invalidate();
-
myRubberBand->ClearPoints();
- OnSelectionChanged (theCtx, theView);
+ if (myGL.Selection.Tool != AIS_ViewSelectionTool_ZoomWindow)
+ {
+ // selection affects all Views
+ theView->Viewer()->Invalidate();
+ OnSelectionChanged (theCtx, theView);
+ }
}
}
}