Sketcher: Support auto-constraints with root cross elements and swap axes colors
This commit is contained in:
@@ -141,25 +141,37 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
||||
// Get Preselection
|
||||
int preSelPnt = sketchgui->getPreselectPoint();
|
||||
int preSelCrv = sketchgui->getPreselectCurve();
|
||||
int preSelCrs = sketchgui->getPreselectCross();
|
||||
int GeoId = Constraint::GeoUndef;
|
||||
Sketcher::PointPos PosId = Sketcher::none;
|
||||
if (preSelPnt != -1)
|
||||
sketchgui->getSketchObject()->getGeoVertexIndex(preSelPnt, GeoId, PosId);
|
||||
else if (preSelCrv != -1)
|
||||
GeoId = preSelCrv;
|
||||
else if (preSelCrs == 0) { // root point
|
||||
GeoId = -1;
|
||||
PosId = Sketcher::start;
|
||||
}
|
||||
else if (preSelCrs == 1) // x axis
|
||||
GeoId = -1;
|
||||
else if (preSelCrs == 2) // y axis
|
||||
GeoId = -2;
|
||||
|
||||
if (GeoId == Constraint::GeoUndef)
|
||||
return suggestedConstraints.size();
|
||||
|
||||
// Currently only considers objects in current Sketcher
|
||||
AutoConstraint constr;
|
||||
constr.Type = Sketcher::None;
|
||||
constr.GeoId = GeoId;
|
||||
constr.PosId = PosId;
|
||||
if (type == AutoConstraint::VERTEX && preSelPnt != -1)
|
||||
if (type == AutoConstraint::VERTEX && PosId != Sketcher::none)
|
||||
constr.Type = Sketcher::Coincident;
|
||||
else if (type == AutoConstraint::CURVE && preSelPnt != -1)
|
||||
else if (type == AutoConstraint::CURVE && PosId != Sketcher::none)
|
||||
constr.Type = Sketcher::PointOnObject;
|
||||
else if (type == AutoConstraint::VERTEX && preSelCrv != -1)
|
||||
else if (type == AutoConstraint::VERTEX && PosId == Sketcher::none)
|
||||
constr.Type = Sketcher::PointOnObject;
|
||||
else if (type == AutoConstraint::CURVE && preSelCrv != -1)
|
||||
else if (type == AutoConstraint::CURVE && PosId == Sketcher::none)
|
||||
constr.Type = Sketcher::Tangent;
|
||||
|
||||
if (constr.Type != Sketcher::None)
|
||||
|
||||
Reference in New Issue
Block a user