From 065a0a8b0037566def076988fa9267ab2f9456be 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 | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/mouse.cpp b/src/mouse.cpp index 2aebbafb..ebd3b757 100644 --- a/src/mouse.cpp +++ b/src/mouse.cpp @@ -902,8 +902,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 Pending::COMMAND: switch(pending.command) { @@ -960,6 +960,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { pending.operation = Pending::DRAGGING_NEW_POINT; pending.point = lns[1].entity(2); pending.description = "click to place other corner of rectangle"; + hr = lns[0]; break; } case Command::CIRCLE: @@ -1062,7 +1063,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { c.type = Constraint::Type::COMMENT; c.disp.offset = v; c.comment = "NEW COMMENT -- DOUBLE-CLICK TO EDIT"; - Constraint::AddConstraint(&c); + hc = Constraint::AddConstraint(&c); break; } default: ssassert(false, "Unexpected pending menu id"); @@ -1190,6 +1191,18 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { break; } + // Activate group with newly created request/constraint + Group *g = NULL; + if(hr.v != 0) { + g = SK.GetGroup(SK.GetRequest(hr)->group); + } + if(hc.v != 0) { + g = SK.GetGroup(SK.GetConstraint(hc)->group); + } + if(g != NULL) { + g->visible = true; + } + SS.ScheduleShowTW(); InvalidateGraphics(); }