From 8435c27f11ddbf621936b63e3ced2a4836bde6c2 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 16 Jun 2016 12:40:43 +0300 Subject: [PATCH] Selection sensitivity for edges --- src/ModuleBase/ModuleBase_Preferences.cpp | 18 +++++++++++------- src/XGUI/SHAPER.xml | 1 + src/XGUI/XGUI_Displayer.cpp | 3 +++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/ModuleBase/ModuleBase_Preferences.cpp b/src/ModuleBase/ModuleBase_Preferences.cpp index 3a8d0badc..641a1bc59 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, 220); + setMinimumSize(800, 240); } ModuleBase_PreferencesDlg::~ModuleBase_PreferencesDlg() @@ -291,20 +291,24 @@ void ModuleBase_PreferencesDlg::createViewerPage(int thePageId) myPreferences->setItemProperty("image_formats", aImgFiles, bgId); // Create other parameters group in viewer tab - int otherGroup = myPreferences->addItem(tr("Default selection"), viewTab); - myPreferences->setItemProperty("columns", 3, otherGroup); - myPreferences->addItem(tr("Faces"), otherGroup, + int selectionGroup = myPreferences->addItem(tr("Default selection"), viewTab); + myPreferences->setItemProperty("columns", 3, selectionGroup); + myPreferences->addItem(tr("Faces"), selectionGroup, SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "face-selection"); - myPreferences->addItem(tr("Edges"), otherGroup, + myPreferences->addItem(tr("Edges"), selectionGroup, SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "edge-selection"); - myPreferences->addItem(tr("Vertices"), otherGroup, + myPreferences->addItem(tr("Vertices"), selectionGroup, SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "vertex-selection"); - myPreferences->addItem(tr("Vertex selection sensitivity"), otherGroup, SUIT_PreferenceMgr::Double, + int sensitivityGroup = myPreferences->addItem(tr("Selection sensitivity"), viewTab); + myPreferences->setItemProperty("columns", 2, sensitivityGroup); + myPreferences->addItem(tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "point-selection-sensitivity"); + myPreferences->addItem(tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::Double, + ModuleBase_Preferences::VIEWER_SECTION, "edge-selection-sensitivity"); } void ModuleBase_PreferencesDlg::createMenuPage(int thePageId) diff --git a/src/XGUI/SHAPER.xml b/src/XGUI/SHAPER.xml index 39e2b85c5..92f21fb35 100644 --- a/src/XGUI/SHAPER.xml +++ b/src/XGUI/SHAPER.xml @@ -15,6 +15,7 @@ +
diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index da86ce04f..48559568c 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -901,6 +901,9 @@ void XGUI_Displayer::activateAIS(const Handle(AIS_InteractiveObject)& theIO, double aPrecision = theIO->Width() + 2; if (theMode == getSelectionMode(TopAbs_VERTEX)) aPrecision = ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer", "point-selection-sensitivity", 20); + else if ((theMode == getSelectionMode(TopAbs_EDGE)) || (theMode == getSelectionMode(TopAbs_WIRE))) + aPrecision = theIO->Width() + + ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer", "edge-selection-sensitivity", 2); aContext->SetSelectionSensitivity(theIO, theMode, aPrecision); ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::activateAIS -- Activate"); -- 2.39.2