diff options
author | Thomas White <taw@physics.org> | 2019-06-15 11:52:38 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2019-06-15 11:52:38 +0200 |
commit | 98a1c21c18d94e3354df6f3cc30cfbf8cdcfebd4 (patch) | |
tree | 6466934a7685347114ef978929b9741dffd91197 /src/nanolight.c | |
parent | 1d36406d88766d5e54a1f4a27ce6f6d90e1d163a (diff) |
Tidy up stop handling
Diffstat (limited to 'src/nanolight.c')
-rw-r--r-- | src/nanolight.c | 8 |
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; } } |