diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index c0b437bf3..3360a9cf4 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -23,6 +23,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ +# include #endif #include @@ -2335,6 +2336,7 @@ public: virtual void activated(ViewProviderSketch *sketchgui) { + sketchgui->setAxisPickStyle(false); Gui::MDIView *mdi = Gui::Application::Instance->activeDocument()->getActiveView(); Gui::View3DInventorViewer *viewer; viewer = static_cast(mdi)->getViewer(); @@ -2348,6 +2350,11 @@ public: setCursor(QPixmap(cursor_external),7,7); } + virtual void deactivated(ViewProviderSketch *sketchgui) + { + sketchgui->setAxisPickStyle(true); + } + virtual void mouseMove(Base::Vector2D onSketchPos) { if (Gui::Selection().getPreselection().pObjectName) diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.h b/src/Mod/Sketcher/Gui/DrawSketchHandler.h index 84bf628c1..11d48049e 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.h @@ -68,6 +68,7 @@ public: virtual ~DrawSketchHandler(); virtual void activated(ViewProviderSketch *sketchgui){}; + virtual void deactivated(ViewProviderSketch *sketchgui){}; virtual void mouseMove(Base::Vector2D onSketchPos)=0; virtual bool pressButton(Base::Vector2D onSketchPos)=0; virtual bool releaseButton(Base::Vector2D onSketchPos)=0; diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 79e3076e9..6f3a3da0f 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -51,6 +51,7 @@ # include # include # include +# include # include # include @@ -147,7 +148,7 @@ struct EditData { PointsCoordinate(0), CurvesCoordinate(0), CurveSet(0), EditCurveSet(0), RootCrossSet(0), - PointSet(0) + PointSet(0), pickStyleAxes(0) {} // pointer to the active handler for new sketch objects @@ -200,6 +201,7 @@ struct EditData { SoTranslation *textPos; SoGroup *constrGroup; + SoPickStyle *pickStyleAxes; }; @@ -281,6 +283,7 @@ void ViewProviderSketch::deactivateHandler() { assert(edit); assert(edit->sketchHandler != 0); + edit->sketchHandler->deactivated(this); edit->sketchHandler->unsetCursor(); delete(edit->sketchHandler); edit->sketchHandler = 0; @@ -301,6 +304,15 @@ void ViewProviderSketch::purgeHandler(void) static_cast(root)->selectionRole.setValue(FALSE); } +void ViewProviderSketch::setAxisPickStyle(bool on) +{ + assert(edit); + if (on) + edit->pickStyleAxes->style = SoPickStyle::SHAPE; + else + edit->pickStyleAxes->style = SoPickStyle::UNPICKABLE; +} + // ********************************************************************************** bool ViewProviderSketch::keyPressed(bool pressed, int key) @@ -3173,6 +3185,9 @@ void ViewProviderSketch::createEditInventorNodes(void) // stuff for the RootCross lines +++++++++++++++++++++++++++++++++++++++ SoGroup* crossRoot = new Gui::SoSkipBoundingGroup; + edit->pickStyleAxes = new SoPickStyle(); + edit->pickStyleAxes->style = SoPickStyle::SHAPE; + crossRoot->addChild(edit->pickStyleAxes); edit->EditRoot->addChild(crossRoot); MtlBind = new SoMaterialBinding; MtlBind->setName("RootCrossMaterialBinding"); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.h b/src/Mod/Sketcher/Gui/ViewProviderSketch.h index 553c99451..0b7780bea 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.h +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.h @@ -106,6 +106,8 @@ public: void activateHandler(DrawSketchHandler *newHandler); /// removes the active handler void purgeHandler(void); + /// set the pick style of the sketch coordinate axes + void setAxisPickStyle(bool on); //@} /** @name modus handling */