diff --git a/src/sketch.h b/src/sketch.h index 50347be..65d9c15 100644 --- a/src/sketch.h +++ b/src/sketch.h @@ -189,6 +189,7 @@ public: struct { SolveResult how; int dof; + bool timeout; List remove; } solved; diff --git a/src/system.cpp b/src/system.cpp index 933f153..2b471e4 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -355,10 +355,17 @@ void System::WriteEquationsExceptFor(hConstraint hc, Group *g) { } void System::FindWhichToRemoveToFixJacobian(Group *g, List *bad, bool forceDofCheck) { + auto time = GetMilliseconds(); + g->solved.timeout = false; int a; for(a = 0; a < 2; a++) { for(auto &con : SK.constraint) { + if((GetMilliseconds() - time) > 1500) { // todo: make timeout configurable + g->solved.timeout = true; + return; + } + ConstraintBase *c = &con; if(c->group != g->h) continue; if((c->type == Constraint::Type::POINTS_COINCIDENT && a == 0) || diff --git a/src/textscreens.cpp b/src/textscreens.cpp index d4cce98..aac2703 100644 --- a/src/textscreens.cpp +++ b/src/textscreens.cpp @@ -578,6 +578,11 @@ void TextWindow::ShowGroupSolveInfo() { c->DescriptionString().c_str()); } + if(g->solved.timeout) { + Printf(true, "%FxSome items in list have been ommitted%Fd"); + Printf(false, "%Fxbecause the operation timed out.%Fd"); + } + Printf(true, "It may be possible to fix the problem "); Printf(false, "by selecting Edit -> Undo.");