From: vsv Date: Mon, 26 Oct 2015 11:39:14 +0000 (+0300) Subject: Increase sensitivity for vertexes selection X-Git-Tag: V_2.0.0_alfa1~67 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=580f1752efd9d3e8c2890c4016b04dafd639bab7;p=modules%2Fshaper.git Increase sensitivity for vertexes selection --- diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index b68df4408..a3a39a870 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -220,8 +220,10 @@ bool XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS, // the fix from VPA for more suitable selection of sketcher lines if(anAISIO->Width() > 1) { for(int aModeIdx = 0; aModeIdx < myActiveSelectionModes.length(); ++aModeIdx) { - aContext->SetSelectionSensitivity(anAISIO, - myActiveSelectionModes.value(aModeIdx), anAISIO->Width() + 2); + int aMode = myActiveSelectionModes.value(aModeIdx); + double aPrecision = (aMode == getSelectionMode(TopAbs_VERTEX))? 15 : + (anAISIO->Width() + 2); + aContext->SetSelectionSensitivity(anAISIO, aMode, aPrecision); } } } @@ -390,16 +392,19 @@ void XGUI_Displayer::getModesOfActivation(ObjectPtr theObject, QIntList& theMode } } +int XGUI_Displayer::getSelectionMode(int theShapeType) +{ + return (theShapeType >= TopAbs_SHAPE)? theShapeType : + AIS_Shape::SelectionMode((TopAbs_ShapeEnum)theShapeType); +} + void XGUI_Displayer::activateObjects(const QIntList& theModes, const QObjectPtrList& theObjList, const bool theUpdateViewer) { // Convert shape types to selection types QIntList aModes; foreach(int aType, theModes) { - if (aType >= TopAbs_SHAPE) - aModes.append(aType); - else - aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)aType)); + aModes.append(getSelectionMode(aType)); } #ifdef DEBUG_ACTIVATE_OBJECTS diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index 3cd6f9c73..91129ece6 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -226,6 +226,10 @@ class XGUI_EXPORT XGUI_Displayer: public QObject /// \param theUpdateViewer update viewer flag /// \return previously defined color on the object QColor setObjectColor(ObjectPtr theObject, const QColor& theColor, bool theUpdateViewer = true); + + /// Converts shape type (TopAbs_ShapeEnum) to selection mode + /// \param theShapeType a shape type from TopAbs_ShapeEnum + static int getSelectionMode(int theShapeType); signals: /// Signal on object display