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]
This commit is contained in:
Jonathan Westhues 2010-01-10 16:44:11 -08:00
parent 5302aad1cc
commit e8b0cd1f9d

View File

@ -62,7 +62,12 @@ bool TextWindow::EditControlDoneForView(char *s) {
case EDIT_VIEW_SCALE: { case EDIT_VIEW_SCALE: {
Expr *e = Expr::From(s, true); Expr *e = Expr::From(s, true);
if(e) { 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; break;
} }