Ruben2776 / PicView

Fast, free and customizable image viewer for Windows 10 and 11.

Home Page:https://picview.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot Navigate to First Image in Folder

Yevrag35 opened this issue · comments

Describe the bug
When opening a folder with at least 2 pictures in it, using the left arrow navigation (keyboard arrow or the arrow in the GUI) will not load the first image in the folder after going to any image that is NOT the first image. No error or crash happens; just no action takes place.

IF looping is enabled, however, it works as expected.

To Reproduce
Steps to reproduce the behavior:

  1. Load a folder with at least 2 pictures in it with the app.
  2. The app will successfully load and display the first image in the folder.
  3. Use the right navigation arrows to go to the right just one picture.
  4. After the next image has loaded, attempt to use the navigations button to go back to the first image again.

Expected behavior
The first image in the folder should be loaded and displayed.

Additional context
The problem comes from the logic in Navigation.cs around lines 95 and 96:

int newIndex = FolderIndex + indexChange;

if (newIndex <= 0 || newIndex >= Pics.Count) return; // Don't load same image because that causes the UI to blink

When the first image in a folder is the target destination, newIndex will be calculated to be 0. Because of the if logic on line 96, when newIndex is less than or equal to 0, the operation will be cancelled.

I think it should be okay to change the comparison to a "less than" instead, but I saw your note about the UI blink so not sure if it's as simple as that.

Cheers.

commented

Thanks for pointing it out. The note is old and the newer code/newer version of .NET changed it so it no longer applies. It will be fixed in the new version soon.