AvaloniaPdfViewer icon indicating copy to clipboard operation
AvaloniaPdfViewer copied to clipboard

Zoom In button breaks when zooming to a non-default value

Open tom-broadbent opened this issue 10 months ago • 0 comments

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:

  1. Zoom to 200%
  2. Press the zoom in button to zoom to 225%

Expected behavior It should zoom to 225%

Screenshots

Image

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.

tom-broadbent avatar Feb 11 '25 16:02 tom-broadbent