ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
ModuleBase_IViewer* aViewer = aWorkshop->viewer();
+ myPreviousSelectionEnabled = aViewer->isSelectionEnabled();
+
connect(aViewer, SIGNAL(mousePress(ModuleBase_IViewWindow*, QMouseEvent*)),
this, SLOT(onMousePressed(ModuleBase_IViewWindow*, QMouseEvent*)));
if (isSketcher) {
myIsDragging = true;
+
get2dPoint(theWnd, theEvent, myCurX, myCurY);
myDragDone = false;
aWorkshop->viewer()->enableMultiselection(false);
// Only for sketcher operations
ModuleBase_IViewer* aViewer = aWorkshop->viewer();
if (myIsDragging) {
+ aWorkshop->viewer()->enableSelection(myPreviousSelectionEnabled);
myIsDragging = false;
if (myDragDone) {
aViewer->enableMultiselection(true);
//aOp->commit();
myFeature2AttributeMap.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;
}
}
void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
{
if (myIsDragging) {
+ // the selection should be switched off in order to do not deselect moved objects by the
+ // mouse release
+ ModuleBase_IViewer* aViewer = myModule->workshop()->viewer();
+ aViewer->enableSelection(false);
+
ModuleBase_Operation* aOperation = myModule->workshop()->currentOperation();
if (aOperation->id().toStdString() == SketchPlugin_Sketch::ID())
return; // No edit operation activated
void onMouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*);
private:
- /// Converts mouse position to 2d coordinates.
- /// Member myCurrentSketch has to be correctly defined
+ /// Converts mouse position to 2d coordinates.
+ /// Member myCurrentSketch has to be correctly defined
void get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent,
double& theX, double& theY);
private:
PartSet_Module* myModule;
+ bool myPreviousSelectionEnabled; // the previous selection enabled state in the viewer
bool myIsDragging;
bool myDragDone;
double myCurX, myCurY;