Revert "Clean up paste transformed and constrain operations a bit."
This reverts commit 14e837a45f
.
Fixes a regression described here:
https://github.com/solvespace/solvespace/issues/875
This commit is contained in:
parent
222c80e4c1
commit
3e3ccdca8d
@ -257,18 +257,27 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) {
|
|||||||
c.valA *= fabs(scale);
|
c.valA *= fabs(scale);
|
||||||
break;
|
break;
|
||||||
case Constraint::Type::ARC_LINE_TANGENT: {
|
case Constraint::Type::ARC_LINE_TANGENT: {
|
||||||
Constraint::ConstrainArcLineTangent(&c, SK.GetEntity(c.entityB),
|
Entity *line = SK.GetEntity(c.entityB),
|
||||||
SK.GetEntity(c.entityA));
|
*arc = SK.GetEntity(c.entityA);
|
||||||
|
if(line->type == Entity::Type::ARC_OF_CIRCLE) {
|
||||||
|
swap(line, arc);
|
||||||
|
}
|
||||||
|
Constraint::ConstrainArcLineTangent(&c, line, arc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Constraint::Type::CUBIC_LINE_TANGENT: {
|
case Constraint::Type::CUBIC_LINE_TANGENT: {
|
||||||
Constraint::ConstrainCubicLineTangent(&c, SK.GetEntity(c.entityB),
|
Entity *line = SK.GetEntity(c.entityB),
|
||||||
SK.GetEntity(c.entityA));
|
*cubic = SK.GetEntity(c.entityA);
|
||||||
|
if(line->type == Entity::Type::CUBIC) {
|
||||||
|
swap(line, cubic);
|
||||||
|
}
|
||||||
|
Constraint::ConstrainCubicLineTangent(&c, line, cubic);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Constraint::Type::CURVE_CURVE_TANGENT: {
|
case Constraint::Type::CURVE_CURVE_TANGENT: {
|
||||||
Constraint::ConstrainCurveCurveTangent(&c, SK.GetEntity(c.entityA),
|
Entity *eA = SK.GetEntity(c.entityA),
|
||||||
SK.GetEntity(c.entityB));
|
*eB = SK.GetEntity(c.entityB);
|
||||||
|
Constraint::ConstrainCurveCurveTangent(&c, eA, eB);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Constraint::Type::HORIZONTAL:
|
case Constraint::Type::HORIZONTAL:
|
||||||
|
@ -128,15 +128,10 @@ hConstraint Constraint::ConstrainCoincident(hEntity ptA, hEntity ptB) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Constraint::ConstrainArcLineTangent(Constraint *c, Entity *line, Entity *arc) {
|
void Constraint::ConstrainArcLineTangent(Constraint *c, Entity *line, Entity *arc) {
|
||||||
if(line->type == Entity::Type::ARC_OF_CIRCLE) {
|
|
||||||
swap(line, arc);
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector l0 = SK.GetEntity(line->point[0])->PointGetNum(),
|
Vector l0 = SK.GetEntity(line->point[0])->PointGetNum(),
|
||||||
l1 = SK.GetEntity(line->point[1])->PointGetNum();
|
l1 = SK.GetEntity(line->point[1])->PointGetNum();
|
||||||
Vector a1 = SK.GetEntity(arc->point[1])->PointGetNum(),
|
Vector a1 = SK.GetEntity(arc->point[1])->PointGetNum(),
|
||||||
a2 = SK.GetEntity(arc->point[2])->PointGetNum();
|
a2 = SK.GetEntity(arc->point[2])->PointGetNum();
|
||||||
|
|
||||||
if(l0.Equals(a1) || l1.Equals(a1)) {
|
if(l0.Equals(a1) || l1.Equals(a1)) {
|
||||||
c->other = false;
|
c->other = false;
|
||||||
} else if(l0.Equals(a2) || l1.Equals(a2)) {
|
} else if(l0.Equals(a2) || l1.Equals(a2)) {
|
||||||
@ -150,10 +145,6 @@ void Constraint::ConstrainArcLineTangent(Constraint *c, Entity *line, Entity *ar
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Constraint::ConstrainCubicLineTangent(Constraint *c, Entity *line, Entity *cubic) {
|
void Constraint::ConstrainCubicLineTangent(Constraint *c, Entity *line, Entity *cubic) {
|
||||||
if(line->type == Entity::Type::CUBIC) {
|
|
||||||
swap(line, cubic);
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector l0 = SK.GetEntity(line->point[0])->PointGetNum(),
|
Vector l0 = SK.GetEntity(line->point[0])->PointGetNum(),
|
||||||
l1 = SK.GetEntity(line->point[1])->PointGetNum();
|
l1 = SK.GetEntity(line->point[1])->PointGetNum();
|
||||||
Vector as = cubic->CubicGetStartNum(),
|
Vector as = cubic->CubicGetStartNum(),
|
||||||
@ -688,6 +679,9 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
} else if(gs.lineSegments == 1 && gs.arcs == 1 && gs.n == 2) {
|
} else if(gs.lineSegments == 1 && gs.arcs == 1 && gs.n == 2) {
|
||||||
Entity *line = SK.GetEntity(gs.entity[0]),
|
Entity *line = SK.GetEntity(gs.entity[0]),
|
||||||
*arc = SK.GetEntity(gs.entity[1]);
|
*arc = SK.GetEntity(gs.entity[1]);
|
||||||
|
if(line->type == Entity::Type::ARC_OF_CIRCLE) {
|
||||||
|
swap(line, arc);
|
||||||
|
}
|
||||||
ConstrainArcLineTangent(&c, line, arc);
|
ConstrainArcLineTangent(&c, line, arc);
|
||||||
c.type = Type::ARC_LINE_TANGENT;
|
c.type = Type::ARC_LINE_TANGENT;
|
||||||
c.entityA = arc->h;
|
c.entityA = arc->h;
|
||||||
@ -695,6 +689,9 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
} else if(gs.lineSegments == 1 && gs.cubics == 1 && gs.n == 2) {
|
} else if(gs.lineSegments == 1 && gs.cubics == 1 && gs.n == 2) {
|
||||||
Entity *line = SK.GetEntity(gs.entity[0]),
|
Entity *line = SK.GetEntity(gs.entity[0]),
|
||||||
*cubic = SK.GetEntity(gs.entity[1]);
|
*cubic = SK.GetEntity(gs.entity[1]);
|
||||||
|
if(line->type == Entity::Type::CUBIC) {
|
||||||
|
swap(line, cubic);
|
||||||
|
}
|
||||||
ConstrainCubicLineTangent(&c, line, cubic);
|
ConstrainCubicLineTangent(&c, line, cubic);
|
||||||
c.type = Type::CUBIC_LINE_TANGENT;
|
c.type = Type::CUBIC_LINE_TANGENT;
|
||||||
c.entityA = cubic->h;
|
c.entityA = cubic->h;
|
||||||
|
Loading…
Reference in New Issue
Block a user