diff --git a/src/draw.cpp b/src/draw.cpp index b9fe1a8f..46f664d4 100644 --- a/src/draw.cpp +++ b/src/draw.cpp @@ -336,6 +336,10 @@ GraphicsWindow::Selection GraphicsWindow::ChooseFromHoverToSelect() { for(const Hover &hov : hoverList) { hGroup hg = {}; if(hov.selection.entity.v != 0) { + hEntity he = hov.selection.entity; + if(he.isFromRequest() && IsFromPending(he.request())) { + continue; + } hg = SK.GetEntity(hov.selection.entity)->group; } else if(hov.selection.constraint.v != 0) { hg = SK.GetConstraint(hov.selection.constraint)->group; diff --git a/src/mouse.cpp b/src/mouse.cpp index 2fcd6eea..480a53f1 100644 --- a/src/mouse.cpp +++ b/src/mouse.cpp @@ -463,10 +463,22 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown, void GraphicsWindow::ClearPending() { pending.points.Clear(); + pending.requests.Clear(); pending = {}; SS.ScheduleShowTW(); } +bool GraphicsWindow::IsFromPending(hRequest r) { + for(auto &req : pending.requests) { + if(req.v == r.v) return true; + } + return false; +} + +void GraphicsWindow::AddToPending(hRequest r) { + pending.requests.Add(&r); +} + void GraphicsWindow::MouseMiddleOrRightDown(double x, double y) { if(GraphicsEditControlIsVisible()) return; @@ -936,6 +948,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { case Command::LINE_SEGMENT: case Command::CONSTR_SEGMENT: hr = AddRequest(Request::Type::LINE_SEGMENT); + AddToPending(hr); SK.GetRequest(hr)->construction = (pending.command == Command::CONSTR_SEGMENT); SK.GetEntity(hr.entity(1))->PointForceTo(v); ConstrainPointByHovered(hr.entity(1)); @@ -961,6 +974,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { SS.UndoRemember(); for(i = 0; i < 4; i++) { lns[i] = AddRequest(Request::Type::LINE_SEGMENT, /*rememberForUndo=*/false); + AddToPending(lns[i]); } for(i = 0; i < 4; i++) { Constraint::ConstrainCoincident( @@ -1009,6 +1023,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { break; } hr = AddRequest(Request::Type::ARC_OF_CIRCLE); + AddToPending(hr); // This fudge factor stops us from immediately failing to solve // because of the arc's implicit (equal radius) tangent. Vector adj = SS.GW.projRight.WithMagnitude(2/SS.GW.scale); @@ -1026,6 +1041,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { } case Command::CUBIC: hr = AddRequest(Request::Type::CUBIC); + AddToPending(hr); SK.GetEntity(hr.entity(1))->PointForceTo(v); SK.GetEntity(hr.entity(2))->PointForceTo(v); SK.GetEntity(hr.entity(3))->PointForceTo(v); diff --git a/src/ui.h b/src/ui.h index fdcb1ec7..fab86715 100644 --- a/src/ui.h +++ b/src/ui.h @@ -706,6 +706,7 @@ public: hRequest request; hEntity point; List points; + List requests; hEntity circle; hEntity normal; hConstraint constraint; @@ -716,6 +717,9 @@ public: Constraint::Type suggestion; } pending; void ClearPending(); + bool IsFromPending(hRequest r); + void AddToPending(hRequest r); + // The constraint that is being edited with the on-screen textbox. hConstraint constraintBeingEdited;