From 383021cb51c4720904096ca851db5ee79255b402 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 16 Jun 2016 12:29:34 +0300 Subject: [PATCH] Task "Make the size of the selection area even bigger, especially for points" --- src/ModuleBase/ModuleBase_Preferences.cpp | 5 ++++- src/XGUI/SHAPER.xml | 1 + src/XGUI/XGUI_Displayer.cpp | 25 ++++++++--------------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/ModuleBase/ModuleBase_Preferences.cpp b/src/ModuleBase/ModuleBase_Preferences.cpp index d63554647..3a8d0badc 100644 --- a/src/ModuleBase/ModuleBase_Preferences.cpp +++ b/src/ModuleBase/ModuleBase_Preferences.cpp @@ -239,7 +239,7 @@ ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurc createEditors(); myPreferences->retrieve(); - setMinimumSize(800, 200); + setMinimumSize(800, 220); } ModuleBase_PreferencesDlg::~ModuleBase_PreferencesDlg() @@ -302,6 +302,9 @@ void ModuleBase_PreferencesDlg::createViewerPage(int thePageId) myPreferences->addItem(tr("Vertices"), otherGroup, SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "vertex-selection"); + + myPreferences->addItem(tr("Vertex selection sensitivity"), otherGroup, SUIT_PreferenceMgr::Double, + ModuleBase_Preferences::VIEWER_SECTION, "point-selection-sensitivity"); } void ModuleBase_PreferencesDlg::createMenuPage(int thePageId) diff --git a/src/XGUI/SHAPER.xml b/src/XGUI/SHAPER.xml index f43451026..39e2b85c5 100644 --- a/src/XGUI/SHAPER.xml +++ b/src/XGUI/SHAPER.xml @@ -14,6 +14,7 @@ +
diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 851f977a1..da86ce04f 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -26,11 +26,14 @@ #include #include #include +#include #include #include #include +#include + #include #include #include @@ -240,15 +243,6 @@ bool XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS, emit objectDisplayed(theObject, theAIS); activate(anAISIO, myActiveSelectionModes, theUpdateViewer); - // the fix from VPA for more suitable selection of sketcher lines - if(anAISIO->Width() > 1) { - for(int aModeIdx = 0; aModeIdx < myActiveSelectionModes.length(); ++aModeIdx) { - int aMode = myActiveSelectionModes.value(aModeIdx); - double aPrecision = (aMode == getSelectionMode(TopAbs_VERTEX))? 20 : - (anAISIO->Width() + 2); - aContext->SetSelectionSensitivity(anAISIO, aMode, aPrecision); - } - } } if (theUpdateViewer) updateViewer(); @@ -587,13 +581,6 @@ void XGUI_Displayer::activateObjects(const QIntList& theModes, const QObjectPtrL if (activate(anAISIO, myActiveSelectionModes, false)) isActivationChanged = true; } - if (!aTrihedron.IsNull()) { - foreach(int aMode, myActiveSelectionModes) - aContext->SetSelectionSensitivity(aTrihedron, aMode, 20); - } - // VSV It seems that there is no necessity to update viewer on activation - //if (theUpdateViewer && isActivationChanged) - // updateViewer(); } bool XGUI_Displayer::isActive(ObjectPtr theObject) const @@ -910,6 +897,12 @@ void XGUI_Displayer::activateAIS(const Handle(AIS_InteractiveObject)& theIO, } else aContext->Activate(theIO, theMode, false); + // the fix from VPA for more suitable selection of sketcher lines + double aPrecision = theIO->Width() + 2; + if (theMode == getSelectionMode(TopAbs_VERTEX)) + aPrecision = ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer", "point-selection-sensitivity", 20); + aContext->SetSelectionSensitivity(theIO, theMode, aPrecision); + ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::activateAIS -- Activate"); #ifdef DEBUG_ACTIVATE_AIS -- 2.39.2