From: nds Date: Tue, 24 Dec 2013 13:55:05 +0000 (+0000) Subject: Refs #277 - New point is added during selection operation X-Git-Tag: BR_hydro_v_0_7~66 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3b45bf936bc90bbdb55ef15d444669110ded7189;p=modules%2Fhydro.git Refs #277 - New point is added during selection operation --- diff --git a/src/HYDROCurveCreator/CurveCreator_Widget.cxx b/src/HYDROCurveCreator/CurveCreator_Widget.cxx index dc2aff37..e4df186f 100644 --- a/src/HYDROCurveCreator/CurveCreator_Widget.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Widget.cxx @@ -952,6 +952,9 @@ void CurveCreator_Widget::onMousePress( SUIT_ViewWindow*, QMouseEvent* theEvent if ( theEvent->button() != Qt::LeftButton ) return; + myPressedX = theEvent->x(); + myPressedY = theEvent->y(); + switch( getActionMode() ) { case ModificationMode: { //store initial cursor position for Drag&Drop @@ -1047,7 +1050,12 @@ void CurveCreator_Widget::onMouseRelease( SUIT_ViewWindow*, QMouseEvent* theEven } } else // check whether the segment is clicked an a new point should be added to the segment - insertPointToSelectedSegment( theEvent->pos().x(), theEvent->pos().y() ); + { + int aReleasedX = theEvent->x(); + int aReleasedY = theEvent->y(); + if ( myPressedX == aReleasedX && myPressedY == aReleasedY ) + insertPointToSelectedSegment( aReleasedX, aReleasedY ); + } // updates the input panel table to show the selected point coordinates updateLocalPointView(); diff --git a/src/HYDROCurveCreator/CurveCreator_Widget.h b/src/HYDROCurveCreator/CurveCreator_Widget.h index 7ab17331..f3fba8a1 100644 --- a/src/HYDROCurveCreator/CurveCreator_Widget.h +++ b/src/HYDROCurveCreator/CurveCreator_Widget.h @@ -218,6 +218,8 @@ private: QMap myInitialDragPointsCoords; bool myDragged; QByteArray myGuiState; + int myPressedX; + int myPressedY; }; #endif // CURVECREATOR_WIDGET_H