Sketcher: Snap: Add 'Snap at angle' support to DrawSketchHandler.

This commit is contained in:
Paddle
2023-03-15 11:09:09 +01:00
committed by abdullahtahiriyo
parent ecb1724bf1
commit 849fdd6956
2 changed files with 14 additions and 0 deletions

View File

@@ -114,6 +114,11 @@ inline int ViewProviderSketchDrawSketchHandlerAttorney::getPreselectCross(const
return vp.getPreselectCross();
}
inline void ViewProviderSketchDrawSketchHandlerAttorney::setAngleSnapping(ViewProviderSketch &vp, bool enable, Base::Vector2d referencePoint)
{
vp.setAngleSnapping(enable, referencePoint);
}
/**************************** CurveConverter **********************************************/
@@ -250,6 +255,7 @@ void DrawSketchHandler::deactivate()
drawEditMarkers(std::vector<Base::Vector2d>());
resetPositionText();
unsetCursor();
setAngleSnapping(false);
}
void DrawSketchHandler::preActivated()
@@ -992,3 +998,7 @@ Sketcher::SketchObject * DrawSketchHandler::getSketchObject()
return sketchgui->getSketchObject();
}
void DrawSketchHandler::setAngleSnapping(bool enable, Base::Vector2d referencePoint)
{
ViewProviderSketchDrawSketchHandlerAttorney::setAngleSnapping(*sketchgui, enable, referencePoint);
}

View File

@@ -86,11 +86,13 @@ private:
static inline void setAxisPickStyle(ViewProviderSketch &vp, bool on);
static inline void moveCursorToSketchPoint(ViewProviderSketch &vp, Base::Vector2d point);
static inline void preselectAtPoint(ViewProviderSketch &vp, Base::Vector2d point);
static inline void setAngleSnapping(ViewProviderSketch &vp, bool enable, Base::Vector2d referencePoint = Base::Vector2d(0., 0.));
static inline int getPreselectPoint(const ViewProviderSketch &vp);
static inline int getPreselectCurve(const ViewProviderSketch &vp);
static inline int getPreselectCross(const ViewProviderSketch &vp);
friend class DrawSketchHandler;
};
@@ -203,6 +205,8 @@ protected:
Sketcher::SketchObject * getSketchObject();
void setAngleSnapping(bool enable, Base::Vector2d referencePoint = Base::Vector2d(0., 0.));
private:
void setSvgCursor(const QString &svgName, int x, int y,
const std::map<unsigned long, unsigned long>& colorMapping = std::map<unsigned long, unsigned long>());