From 0b997e4c17416066c00bc71ffa259c6a21dd4b6b Mon Sep 17 00:00:00 2001 From: EvilSpirit Date: Sun, 7 Aug 2016 19:59:51 +0700 Subject: [PATCH] Forcibly show the current group once we start a drawing operation --- src/mouse.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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(); }