Zoom In button breaks when zooming to a non-default value
Describe the bug When you press the zoom in button to go to a non-default zoom value, the zoom functionality breaks and the value in the combobox is cleared.
To Reproduce Steps to reproduce the behavior:
- Zoom to 200%
- Press the zoom in button to zoom to 225%
Expected behavior It should zoom to 225%
Screenshots
Desktop (please complete the following information):
- OS: Both Windows 11 and Linux
Additional context
I have tried to debug this issue myself but haven't figured out a nice solution. It appears to come from PdfViewer.axaml.cs, line 252:
_zoomLevelsCache.Add(zoom);
There appears to be some async issue here. The program moves on to the next line ZoomCombobox.SelectedIndex = ZoomLevels.IndexOf(zoom); before the new zoom level has been added to ZoomLevels. I found a hacky workaround was to introduce a 50ms delay but this is obviously not a good solution.