summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-06-15 11:52:38 +0200
committerThomas White <taw@physics.org>2019-06-15 11:52:38 +0200
commit98a1c21c18d94e3354df6f3cc30cfbf8cdcfebd4 (patch)
tree6466934a7685347114ef978929b9741dffd91197
parent1d36406d88766d5e54a1f4a27ce6f6d90e1d163a (diff)
Tidy up stop handling
-rw-r--r--src/nanolight.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nanolight.c b/src/nanolight.c
index 246cce1..cd9f369 100644
--- a/src/nanolight.c
+++ b/src/nanolight.c
@@ -474,15 +474,15 @@ static void change_stop_attr(struct nanolight *nl, signed int inc)
int n;
if ( find_attribute(fix, nl->sel_attr, &n) ) {
+ signed int nv;
if ( !(fix->cls->attrs[n].props & ATTR_STOP) ) {
printf("Can't change continuous attr with keys\n");
continue;
}
- if ( (fix->attr_vals[n] == 0) && (inc < 0) ) continue;
- if ( (fix->attr_vals[n] == fix->cls->attrs[n].n_stops-1) && (inc > 0) ) {
- continue;
+ nv = fix->attr_vals[n] + inc;
+ if ( (nv>=0) && (nv<fix->cls->attrs[n].n_stops) ) {
+ fix->attr_vals[n] = nv;
}
- fix->attr_vals[n] += inc;
}
}