diff --git a/src/AIS/AIS_DragAction.hxx b/src/AIS/AIS_DragAction.hxx index cf3bf238ba..f74c9922b6 100644 --- a/src/AIS/AIS_DragAction.hxx +++ b/src/AIS/AIS_DragAction.hxx @@ -17,10 +17,11 @@ //! Dragging action. enum AIS_DragAction { - AIS_DragAction_Start, //!< (try) start dragging object - AIS_DragAction_Update, //!< perform dragging (update position) - AIS_DragAction_Stop, //!< stop dragging (save position) - AIS_DragAction_Abort, //!< abort dragging (restore initial position) + AIS_DragAction_Start, //!< (try) start dragging object + AIS_DragAction_Confirmed, //!< dragging interaction is confirmed. + AIS_DragAction_Update, //!< perform dragging (update position) + AIS_DragAction_Stop, //!< stop dragging (save position) + AIS_DragAction_Abort, //!< abort dragging (restore initial position) }; #endif // _AIS_DragAction_HeaderFile diff --git a/src/AIS/AIS_LightSource.cxx b/src/AIS/AIS_LightSource.cxx index f70f4e70d8..3a375992c7 100644 --- a/src/AIS/AIS_LightSource.cxx +++ b/src/AIS/AIS_LightSource.cxx @@ -259,6 +259,10 @@ Standard_Boolean AIS_LightSource::ProcessDragging (const Handle(AIS_InteractiveC myLocTrsfStart = LocalTransformation(); return Standard_True; } + case AIS_DragAction_Confirmed: + { + return Standard_True; + } case AIS_DragAction_Update: { mySensSphere->ResetLastDetectedPoint(); diff --git a/src/AIS/AIS_Manipulator.cxx b/src/AIS/AIS_Manipulator.cxx index 4cd43844b8..21491cc35a 100644 --- a/src/AIS/AIS_Manipulator.cxx +++ b/src/AIS/AIS_Manipulator.cxx @@ -661,6 +661,10 @@ Standard_Boolean AIS_Manipulator::ProcessDragging (const Handle(AIS_InteractiveC } break; } + case AIS_DragAction_Confirmed: + { + return Standard_True; + } case AIS_DragAction_Update: { Transform (theDragTo.x(), theDragTo.y(), theView); diff --git a/src/AIS/AIS_ViewController.cxx b/src/AIS/AIS_ViewController.cxx index a19519456d..78e7007471 100644 --- a/src/AIS/AIS_ViewController.cxx +++ b/src/AIS/AIS_ViewController.cxx @@ -332,6 +332,11 @@ void AIS_ViewController::flushBuffers (const Handle(AIS_InteractiveContext)& , myGL.Dragging.ToStart = true; myGL.Dragging.PointStart = myUI.Dragging.PointStart; } + if (myUI.Dragging.ToConfirm) + { + myUI.Dragging.ToConfirm = false; + myGL.Dragging.ToConfirm = true; + } if (myUI.Dragging.ToMove) { myUI.Dragging.ToMove = false; @@ -928,6 +933,7 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint, myMouseClickCounter = 0; myMouseSingleButton = -1; myMouseStopDragOnUnclick = true; + myUI.Dragging.ToConfirm = true; } } @@ -2738,6 +2744,17 @@ void AIS_ViewController::OnObjectDragged (const Handle(AIS_InteractiveContext)& } return; } + case AIS_DragAction_Confirmed: + { + if (myDragObject.IsNull()) + { + return; + } + + myDragObject->ProcessDragging (theCtx, theView, myDragOwner, myGL.Dragging.PointStart, + myGL.Dragging.PointTo, theAction); + return; + } case AIS_DragAction_Update: { if (myDragObject.IsNull()) @@ -3057,6 +3074,10 @@ void AIS_ViewController::handleDynamicHighlight (const Handle(AIS_InteractiveCon } else if (myGL.Dragging.ToMove) { + if (myGL.Dragging.ToConfirm) + { + OnObjectDragged (theCtx, theView, AIS_DragAction_Confirmed); + } OnObjectDragged (theCtx, theView, AIS_DragAction_Update); myGL.OrbitRotation.ToRotate = false; myGL.ViewRotation .ToRotate = false; diff --git a/src/AIS/AIS_ViewInputBuffer.hxx b/src/AIS/AIS_ViewInputBuffer.hxx index afcc4feb0d..c009e9f65e 100644 --- a/src/AIS/AIS_ViewInputBuffer.hxx +++ b/src/AIS/AIS_ViewInputBuffer.hxx @@ -87,13 +87,14 @@ public: struct _draggingParams { bool ToStart; //!< start dragging + bool ToConfirm; //!< confirm dragging bool ToMove; //!< perform dragging bool ToStop; //!< stop dragging bool ToAbort; //!< abort dragging (restore previous position) Graphic3d_Vec2i PointStart; //!< drag start point Graphic3d_Vec2i PointTo; //!< drag end point - _draggingParams() : ToStart (false), ToMove (false), ToStop (false), ToAbort (false) {} + _draggingParams() : ToStart (false), ToConfirm (false), ToMove (false), ToStop (false), ToAbort (false) {} } Dragging; struct _orbitRotation @@ -139,12 +140,13 @@ public: Selection.ToApplyTool = false; IsNewGesture = false; ZoomActions.Clear(); - Panning.ToStart = false; - Panning.ToPan = false; - Dragging.ToStart = false; - Dragging.ToMove = false; - Dragging.ToStop = false; - Dragging.ToAbort = false; + Panning.ToStart = false; + Panning.ToPan = false; + Dragging.ToStart = false; + Dragging.ToConfirm = false; + Dragging.ToMove = false; + Dragging.ToStop = false; + Dragging.ToAbort = false; OrbitRotation.ToStart = false; OrbitRotation.ToRotate = false; ViewRotation.ToStart = false;