quick-picture-viewer icon indicating copy to clipboard operation
quick-picture-viewer copied to clipboard

Fix autozoom mode

Open dy opened this issue 5 years ago • 2 comments

Now autozoom resets every time next/prev image is clicked: image image Which makes jagged slideshow experience in fullscreen. Is there a way to force zoom level for all images?

dy avatar Mar 06 '21 14:03 dy

this never gonna be fixed?

Znunu avatar Jan 26 '22 05:01 Znunu

I might be missing something, but passing auto instead of 100% in the first else in CheckAutoZoomNeeded makes it auto-zoom new images by default:

	private void CheckAutoZoomNeeded()
	{
		if (originalImage != null)
		{
			if (!fullscreen && (originalImage.Width < picturePanel.Width - 32) && (originalImage.Height < picturePanel.Height - 32))
			{
				if (zoomTextBox.Text == "100%") setZoomFactor(100);
				else setZoomText(LangMan.Get("auto")); // was setZoomFactor(100);
			}
			else
			{
				setZoomText(LangMan.Get("auto"));
			}
		}
		else
		{
			setZoomText(LangMan.Get("auto"));
		}
	}

Seems like a typo to me, because the if doesn't really make sense, if you set 100% in the else, too.

I'd also simplify the method to something like this:

    private void CheckAutoZoomNeeded()
    {
        if (originalImage != null && !fullscreen && originalImage.Width < picturePanel.Width - 32 && originalImage.Height < picturePanel.Height - 32 && zoomTextBox.Text == "100%")
            setZoomFactor( 100 );
        else
            setZoomText( LangMan.Get( "auto" ) );
    }

No need for three else with the same body.

Haukinger avatar May 22 '23 13:05 Haukinger