diff --git a/src/mouse.cpp b/src/mouse.cpp index 1df0896..352c17e 100644 --- a/src/mouse.cpp +++ b/src/mouse.cpp @@ -906,7 +906,8 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { v = v.Plus(projRight.ScaledBy(mx/scale)); v = v.Plus(projUp.ScaledBy(my/scale)); - hRequest hr; + hRequest hr = {}; + hConstraint hc = {}; switch(pending.operation) { case MNU_DATUM_POINT: hr = AddRequest(Request::DATUM_POINT); @@ -961,6 +962,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { pending.operation = DRAGGING_NEW_POINT; pending.point = lns[1].entity(2); pending.description = "click to place other corner of rectangle"; + hr = lns[0]; break; } case MNU_CIRCLE: @@ -1063,7 +1065,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { c.type = Constraint::COMMENT; c.disp.offset = v; c.comment = "NEW COMMENT -- DOUBLE-CLICK TO EDIT"; - Constraint::AddConstraint(&c); + hc = Constraint::AddConstraint(&c); break; } @@ -1188,6 +1190,20 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { break; } + // Activate group with newly created request/constraint + Group *g = NULL; + if(hr.v != 0) { + Request *req = SK.GetRequest(hr); + g = SK.GetGroup(req->group); + } + if(hc.v != 0) { + Constraint *c = SK.GetConstraint(hc); + g = SK.GetGroup(c->group); + } + if(g != NULL) { + g->visible = true; + } + SS.ScheduleShowTW(); InvalidateGraphics(); }