Tyrrrz / LightBulb

Reduces eye strain by adjusting screen gamma based on the current time
MIT License
2.23k stars 141 forks source link

Broken color temperature text input behavior in Settings screen #288

Closed ZGorlock closed 4 months ago

ZGorlock commented 4 months ago

Version

2.4.11

Platform

Windows 10

Steps to reproduce

Try to enter a specific color temperature in the settings using keyboard input

Details

This only started happening after I updated to 2.4.10 (also happening on 2.4.11). When trying to set the 'Day-time color temperature' or 'Night-time color temperature' when using the keyboard the values jump all over the place.

It seems to be locked to the values 500, 2500, 6600, and 20000 with no room for adjustment in between. Note that setting via the slider works as expected, this only happens when trying to type in a value.

An example starting with 3200 and trying to get to 2850: Input Value
3‸200
Bksp ‸2500
-> 2‸500
Del 5‸00
<- ‸500
2 2‸500
8 66‸00
5 200‸00
Bksp 25‸00

This makes these inputs completely unusable and it is faster to give up and try to do it with the sliders instead. The time based inputs also behave in a similar way.

I believe the solution would be to hold off on bounding the inputs until the user is finished with their input (clicks off of the input element or presses Enter).

Checklist

Tyrrrz commented 4 months ago

Thanks for reporting. I didn't notice it during testing, but it looks like the issue is that Avalonia (the framework the code was migrated to, in v2.4.8) does not yet support UpdateSourceTrigger, which would allow specifying when the binding is propagated (i.e. not immediately, but on lost focus). It seems it was added as part of a beta pre-release, but I couldn't get it working, so I'll wait for a stable release for now.

Tyrrrz commented 4 months ago

Actually, I found a way to work around it using behaviors, so I can apply a fix without waiting for a stable release.