The new set_range method updates an attribute's range and sets the attribute's value so that the new range gets applied. This new addition also exposed a bug with attributes that set allow_repetitions::no: the attribute's range was not taken into account while checking whether the new value was a repetition. The Add a test that shows that ranges aren't applied correctly before filtering out repetitions commit shows the bug.
The fix required the new args to be constrained before passing them into compare_to_current_value. However, the constrain method was called much later and did alter the atoms in-place. Therefore, we couldn't really use the constrain method as it was. Now, instead of altering the atoms in-place, the constrain method returns the constrained atoms. This change also allows us to make the set method's arguments const.
Finally, the scale function didn't work properly when the in_low and out_low arguments were equal.
The new
set_range
method updates an attribute's range and sets the attribute's value so that the new range gets applied. This new addition also exposed a bug with attributes that setallow_repetitions::no
: the attribute's range was not taken into account while checking whether the new value was a repetition. TheAdd a test that shows that ranges aren't applied correctly before filtering out repetitions
commit shows the bug.The fix required the new args to be constrained before passing them into
compare_to_current_value
. However, the constrain method was called much later and did alter the atoms in-place. Therefore, we couldn't really use the constrain method as it was. Now, instead of altering the atoms in-place, the constrain method returns the constrained atoms. This change also allows us to make the set method's arguments const.Finally, the
scale
function didn't work properly when thein_low
andout_low
arguments were equal.