From: sbh Date: Fri, 19 Sep 2014 13:28:57 +0000 (+0400) Subject: Issue #146 Do not start line creation if the existing point was selected X-Git-Tag: V_0.4.4~42 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7d9605ea37faad81b21335ef5a3aa79a049f4fdf;p=modules%2Fshaper.git Issue #146 Do not start line creation if the existing point was selected --- diff --git a/src/PartSet/PartSet_OperationFeatureCreate.cpp b/src/PartSet/PartSet_OperationFeatureCreate.cpp index 759356cd2..38768a0ca 100644 --- a/src/PartSet/PartSet_OperationFeatureCreate.cpp +++ b/src/PartSet/PartSet_OperationFeatureCreate.cpp @@ -106,24 +106,24 @@ void PartSet_OperationFeatureCreate::mouseReleased( { gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView); double aX = aPoint.X(), anY = aPoint.Y(); + bool isClosedContour = false; if (theSelected.empty()) { PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY); } else { ModuleBase_ViewerPrs aPrs = theSelected.front(); const TopoDS_Shape& aShape = aPrs.shape(); - if (!aShape.IsNull()) // the point is selected + if (!aShape.IsNull()) { - if (aShape.ShapeType() == TopAbs_VERTEX) { + if (aShape.ShapeType() == TopAbs_VERTEX) { // a point is selected const TopoDS_Vertex& aVertex = TopoDS::Vertex(aShape); if (!aVertex.IsNull()) { aPoint = BRep_Tool::Pnt(aVertex); PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY); - PartSet_Tools::setConstraints(sketch(), feature(), myActiveWidget->attributeID(), aX, anY); + isClosedContour = true; } - } else if (aShape.ShapeType() == TopAbs_EDGE) // the line is selected - { + } else if (aShape.ShapeType() == TopAbs_EDGE) { // a line is selected PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY); // move to selected line if (feature()->getKind() == SketchPlugin_Line::ID()) { @@ -146,7 +146,7 @@ void PartSet_OperationFeatureCreate::mouseReleased( emit activateNextWidget(myActiveWidget); } - if (commit()) { + if (commit() && !isClosedContour) { // if the point creation is finished, the next mouse release should commit the modification // the next release can happens by double click in the viewer restartOperation(feature()->getKind(), feature());