From 95512b16482062b851109925074d77c7bca74cce Mon Sep 17 00:00:00 2001 From: vsv Date: Sat, 27 Dec 2014 11:07:10 +0300 Subject: [PATCH] Dragging selected vertex of a line --- src/PartSet/PartSet_Module.cpp | 10 +--------- src/PartSet/PartSet_SketcherMgr.cpp | 14 ++++++++------ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 5898c252d..c1348168e 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -254,17 +254,9 @@ void PartSet_Module::onSelectionChanged() } } } - } else if (mySketchMgr->sketchOperationIdList().contains(aOperation->id()) && - aOperation->isEditOperation()) { - // if this is sketch operation in edit mode - - ModuleBase_ISelection* aSelect = myWorkshop->selection(); - //aSelect->selectedShapes(); - } + } } - // after movement the solver will call the update event: optimization - void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent) { XGUI_ModuleConnector* aConnector = dynamic_cast(workshop()); diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index a2303017c..fd8a22ee0 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -148,7 +148,7 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE aOperation->abort(); return; } - if ((aHighlighted.size() == 1) && (aSelected.size() == 0)) { + if (aSelObjects.size() == 1) { // Move by selected shape (vertex). Can be used only for single selection foreach(ModuleBase_ViewerPrs aPrs, aHighlighted) { FeaturePtr aFeature = ModelAPI_Feature::feature(aHighlighted.first().object()); @@ -219,17 +219,19 @@ void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouse aOp->commit(); myEditingFeatures.clear(); myEditingAttr.clear(); + + // Reselect edited object + aViewer->AISContext()->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView()); + if (theEvent->modifiers() & Qt::ShiftModifier) + aViewer->AISContext()->ShiftSelect(); + else + aViewer->AISContext()->Select(); return; } } if (!aViewer->isMultiSelectionEnabled()) { aViewer->enableMultiselection(true); } - //aViewer->AISContext()->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView()); - //if (theEvent->modifiers() & Qt::ShiftModifier) - // aViewer->AISContext()->ShiftSelect(); - //else - // aViewer->AISContext()->Select(); } void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) -- 2.39.2