Salome HOME
Merge branch 'Dev_2.1.0' of salome:modules/shaper into Dev_2.1.0
[modules/shaper.git] / src / PartSet / PartSet_WidgetPoint2d.cpp
index e8555daed568bdede8f07571dcff437dc0255852..477da7ae311970c93f373ce4b73df3fa5e2bde7d 100644 (file)
@@ -359,8 +359,8 @@ void PartSet_WidgetPoint2D::onMouseRelease(ModuleBase_IViewWindow* theWnd, QMous
   NCollection_List<TopoDS_Shape> aShapes;
   std::list<ObjectPtr> aObjects;
   aSelection->selectedShapes(aShapes, aObjects);
-  // if we have selection
-  if (aShapes.Extent() > 0) {
+  // if we have selection and use it
+  if (aShapes.Extent() > 0 && useSelectedShapes()) {
     TopoDS_Shape aShape = aShapes.First();
     ObjectPtr aObject = aObjects.front();
     FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(aObject);
@@ -368,11 +368,14 @@ void PartSet_WidgetPoint2D::onMouseRelease(ModuleBase_IViewWindow* theWnd, QMous
       std::shared_ptr<SketchPlugin_Feature> aSPFeature;
       if (aSelectedFeature.get() != NULL)
         aSPFeature = std::dynamic_pointer_cast<SketchPlugin_Feature>(aSelectedFeature);
-      if ((!aSPFeature) && (!aShape.IsNull())) {
+      if ((!aSPFeature && !aShape.IsNull()) ||
+          (aSPFeature.get() && aSPFeature->isExternal())) {
         anExternal = true;
         ResultPtr aFixedObject = PartSet_Tools::findFixedObjectByExternal(aShape, aObject, mySketch);
         if (!aFixedObject.get())
           aObject = PartSet_Tools::createFixedObjectByExternal(aShape, aObject, mySketch);
+        else
+          aObject = aFixedObject;
 
         double aX, aY;
         if (getPoint2d(aView, aShape, aX, aY) && isFeatureContainsPoint(myFeature, aX, aY)) {
@@ -541,6 +544,11 @@ bool PartSet_WidgetPoint2D::processEnter()
   return isModified;
 }
 
+bool PartSet_WidgetPoint2D::useSelectedShapes() const
+{
+  return true;
+}
+
 bool PartSet_WidgetPoint2D::isOrphanPoint(const FeaturePtr& theFeature,
                                           const CompositeFeaturePtr& theSketch,
                                           double theX, double theY)