Oops, don't allow the user to type a zero or negative scale in the

view screen.

[git-p4: depot-paths = "//depot/solvespace/": change = 2104]
solver
Jonathan Westhues 2010-01-10 16:44:11 -08:00
parent 5302aad1cc
commit e8b0cd1f9d
1 changed files with 6 additions and 1 deletions

View File

@ -62,7 +62,12 @@ bool TextWindow::EditControlDoneForView(char *s) {
case EDIT_VIEW_SCALE: {
Expr *e = Expr::From(s, true);
if(e) {
SS.GW.scale = e->Eval() / SS.MmPerUnit();
double v = e->Eval() / SS.MmPerUnit();
if(v > LENGTH_EPS) {
SS.GW.scale = v;
} else {
Error("Scale cannot be zero or negative.");
}
}
break;
}