-
Notifications
You must be signed in to change notification settings - Fork 191
Description
The unison function (change brightness in unison) has been a function to sync delta (amount of movement) of multiple sliders while keeping the gap between sliders. This gap is necessary to absorb the difference between monitors. When this function was added in an earlier version of this app, the range function did not exist.
To keep the gap unchanged, this function is designed to conform the deltas of multiple sliders. The algorithm to conform the deltas is the key to this function but it has been the fundamental source of trouble. It tries to prevent a delta from being accumulated while conveying it among sliders and it results in unexpected complexity. In addition, the gap can be easily changed when the movement is sluggish. As long as this function relies on the delta, these issues remain.
On the other hand, after the range function was added, the difference between monitors can be better handled by that function than the gap of unison function.
Therefore, I decided to redefine the behavior of the unison function. In newer version, it syncs the level of slider instead of the delta. This level is calculated from the value and the range of the range function.
- If the range is not limited (0-100), the level matches the value devided by 100.
- If the range is limited like 20-80, the level indicates the rate within this range. Let's say the value is 32, it is transformed into the level 0.2 by following formula: (32 - 20) / (80 - 20) = 0.2
In newer version, all sliders in the group of unison share the same level. If the level of a slider in the group is different from the shared level, it will be forcibly conformed to the shared level when this function is triggered. In such case, the level of focused slider supercedes those of other sliders.
This way, the unison function is greatly simplified and becomes robust. The rigid logic to prevent the accumulation is no longer necessary. The link between sliders no longer needs to be recreated when broken.