Skip to content

Fix: Image Previews Have Constant Size #2079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thecoolwinter
Copy link
Collaborator

Description

Right now, CodeEdit attempts to display image previews at image's native resolution. This is done by restricting the view's size to the image's size. However, the preview view is scrollable and zoomable. This leads to issues like brought up in #2066 where the image is small.

This change removes the restricted size for image previews. This means they now fill the available editor space by default. They can still be zoomed, and their resolution is still listed in the status bar.

Detailed Changes

  • Removed ImageFileView as it was redundant after removing the image size restriction.
  • Adjusted a nested if statement in NonTextFileView after removing ImageFileView.

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

Before, image is displayed at native resolution but has inset scroll bars and doesn't correctly zoom:

Screen.Recording.2025-07-07.at.3.02.01.PM.mov

With change, image is zoomed to fit width but has correct scrolling and zooming UI and UX:

Screen.Recording.2025-07-07.at.3.02.20.PM.mov

@thecoolwinter thecoolwinter changed the title Fix Image Previews Have Constant Size Fix: Image Previews Have Constant Size Jul 7, 2025
@austincondiff
Copy link
Collaborator

Some images are small. Filing the space would mean a very pixelated image. Ideally there would be a threshold of some kind so smaller images show actual pixels but still are zoom-able.

@thecoolwinter
Copy link
Collaborator Author

Some images are small. Filing the space would mean a very pixelated image. Ideally there would be a threshold of some kind so smaller images show actual pixels but still are zoom-able.

I agree, that's annoying. The issue is we can't control the zoom level. If we could even set the initial zoom level it'd be a different story. I just found that the QLPreviewController takes a delegate that lets us do exactly that. I'll see if I can refactor this to use QLPreviewController instead of QLPreviewView and make the changes to set the initial zoom level.

@thecoolwinter thecoolwinter marked this pull request as draft July 11, 2025 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐞 Image Zoom Doesnt Increase Image Size in Editor
2 participants