myToAllowZFocus (true),
myToAllowHighlight (true),
myToAllowDragging (true),
+ myToStickToRayOnZoom (true),
+ myToStickToRayOnRotation (true),
//
myWalkSpeedAbsolute (1.5f),
myWalkSpeedRelative (0.1f),
Graphic3d_Vec2i aWinSize;
theView->Window()->Size (aWinSize.x(), aWinSize.y());
const Graphic3d_Vec2d aPanFromCenterPx (double(theParams.Point.x()) - 0.5 * double(aWinSize.x()),
- double(theParams.Point.y()) - 0.5 * double(aWinSize.y()));
+ double(aWinSize.y() - theParams.Point.y() - 1) - 0.5 * double(aWinSize.y()));
aDxy.x() += -aViewDims1.X() * aPanFromCenterPx.x() / double(aWinSize.x());
- aDxy.y() += aViewDims1.X() * aPanFromCenterPx.y() / double(aWinSize.x());
+ aDxy.y() += -aViewDims1.Y() * aPanFromCenterPx.y() / double(aWinSize.y());
}
//theView->Translate (aCam, aDxy.x(), aDxy.y());
}
gp_Pnt aPnt;
- if (PickPoint (aPnt, theCtx, theView, aCursor, false))
+ if (PickPoint (aPnt, theCtx, theView, aCursor, myToStickToRayOnRotation))
{
return aPnt;
}
if (!theView->Camera()->IsOrthographic())
{
- // what is more natural to user - point on ray or point exactly on geometry in corner cases?
- const bool toStickToRay = false; // true;
-
gp_Pnt aPnt;
if (aZoomParams.HasPoint()
- && PickPoint (aPnt, theCtx, theView, aZoomParams.Point, toStickToRay))
+ && PickPoint (aPnt, theCtx, theView, aZoomParams.Point, myToStickToRayOnZoom))
{
handleZoom (theView, aZoomParams, &aPnt);
continue;
Graphic3d_Vec2i aWinSize;
theView->Window()->Size (aWinSize.x(), aWinSize.y());
- if (PickPoint (aPnt, theCtx, theView, aWinSize / 2, toStickToRay))
+ if (PickPoint (aPnt, theCtx, theView, aWinSize / 2, myToStickToRayOnZoom))
{
aZoomParams.ResetPoint(); // do not pretend to zoom at 'nothing'
handleZoom (theView, aZoomParams, &aPnt);
//! Set if dynamic highlight on mouse move is allowed.
void SetAllowDragging (bool theToEnable) { myToAllowDragging = theToEnable; }
+ //! Return TRUE if picked point should be projected to picking ray on zooming at point; TRUE by default.
+ bool ToStickToRayOnZoom() const { return myToStickToRayOnZoom; }
+
+ //! Set if picked point should be projected to picking ray on zooming at point.
+ void SetStickToRayOnZoom (bool theToEnable) { myToStickToRayOnZoom = theToEnable; }
+
+ //! Return TRUE if picked point should be projected to picking ray on rotating around point; TRUE by default.
+ bool ToStickToRayOnRotation() const { return myToStickToRayOnRotation; }
+
+ //! Set if picked point should be projected to picking ray on rotating around point.
+ void SetStickToRayOnRotation (bool theToEnable) { myToStickToRayOnRotation = theToEnable; }
+
//! Return TRUE if pitch direction should be inverted while processing Aspect_VKey_NavLookUp/Aspect_VKey_NavLookDown; FALSE by default.
bool ToInvertPitch() const { return myToInvertPitch; }
Standard_Boolean myToAllowZFocus; //!< enable ZFocus change; TRUE by default
Standard_Boolean myToAllowHighlight; //!< enable dynamic highlight on mouse move; TRUE by default
Standard_Boolean myToAllowDragging; //!< enable dragging object; TRUE by default
+ Standard_Boolean myToStickToRayOnZoom; //!< project picked point to ray while zooming at point, TRUE by default
+ Standard_Boolean myToStickToRayOnRotation; //!< project picked point to ray while rotating around point; TRUE by default
Standard_ShortReal myWalkSpeedAbsolute; //!< normal walking speed, in m/s; 1.5 by default
Standard_ShortReal myWalkSpeedRelative; //!< walking speed relative to scene bounding box; 0.1 by default