Salome HOME
Refs #277 - New point is added during selection operation
[modules/hydro.git] / src / HYDROCurveCreator / CurveCreator_Widget.cxx
index dc2aff372fe74bc9bd5d2cb5350693d558321b81..e4df186f745a85e4644df01d6ef12740a5b6cc96 100644 (file)
@@ -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();