Don't reset showFaces every time a group is activated

Instead store the state separately for drawing and non-drawing group
types, and set showFaces to one of those, whenever a group is activated.
pull/1090/head
Tom Sutcliffe 2021-08-01 11:34:55 +01:00 committed by phkahler
parent 1b8e1dec65
commit 56719415de
3 changed files with 15 additions and 4 deletions

View File

@ -407,6 +407,8 @@ void GraphicsWindow::Init() {
showEdges = true;
showMesh = false;
showOutlines = false;
showFacesDrawing = false;
showFacesNonDrawing = true;
drawOccludedAs = DrawOccludedAs::INVISIBLE;
showTextWindow = true;
@ -1366,6 +1368,14 @@ void GraphicsWindow::ToggleBool(bool *v) {
SS.GenerateAll(SolveSpaceUI::Generate::UNTIL_ACTIVE);
}
if(v == &showFaces) {
if(g->type == Group::Type::DRAWING_WORKPLANE || g->type == Group::Type::DRAWING_3D) {
showFacesDrawing = showFaces;
} else {
showFacesNonDrawing = showFaces;
}
}
Invalidate(/*clearPersistent=*/true);
SS.ScheduleShowTW();
}

View File

@ -416,11 +416,10 @@ std::string Group::DescriptionString() {
}
void Group::Activate() {
if(type == Type::EXTRUDE || type == Type::LINKED || type == Type::LATHE ||
type == Type::REVOLVE || type == Type::HELIX || type == Type::TRANSLATE || type == Type::ROTATE) {
SS.GW.showFaces = true;
if(type == Type::DRAWING_WORKPLANE || type == Type::DRAWING_3D) {
SS.GW.showFaces = SS.GW.showFacesDrawing;
} else {
SS.GW.showFaces = false;
SS.GW.showFaces = SS.GW.showFacesNonDrawing;
}
SS.MarkGroupDirty(h); // for good measure; shouldn't be needed
SS.ScheduleShowTW();

View File

@ -802,6 +802,8 @@ public:
bool showEdges;
bool showOutlines;
bool showFaces;
bool showFacesDrawing;
bool showFacesNonDrawing;
bool showMesh;
void ToggleBool(bool *v);