From c00ab257407d1ee451c19c5cc14007b3c98ded54 Mon Sep 17 00:00:00 2001 From: EvilSpirit Date: Mon, 9 Jan 2017 23:57:45 +0700 Subject: [PATCH] Don't move points when automatically constraining coincident. This can change the sketch dramatically, e.g. extrude a rectangle and draw a line diagonally from the top to the bottom face. --- src/mouse.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mouse.cpp b/src/mouse.cpp index 9700b1c..1b6c3f0 100644 --- a/src/mouse.cpp +++ b/src/mouse.cpp @@ -885,6 +885,8 @@ bool GraphicsWindow::ConstrainPointByHovered(hEntity pt) { Entity *e = SK.GetEntity(hover.entity); if(e->IsPoint()) { + Entity *point = SK.GetEntity(pt); + point->PointForceTo(e->PointGetNum()); Constraint::ConstrainCoincident(e->h, pt); return true; } @@ -988,7 +990,13 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { Entity::NO_ENTITY, Entity::NO_ENTITY, lns[i].entity(0)); } - ConstrainPointByHovered(lns[2].entity(1)); + if(ConstrainPointByHovered(lns[2].entity(1))) { + Vector pos = SK.GetEntity(lns[2].entity(1))->PointGetNum(); + for(i = 0; i < 4; i++) { + SK.GetEntity(lns[i].entity(1))->PointForceTo(pos); + SK.GetEntity(lns[i].entity(2))->PointForceTo(pos); + } + } pending.operation = Pending::DRAGGING_NEW_POINT; pending.point = lns[1].entity(2);