-
Notifications
You must be signed in to change notification settings - Fork 65
feat: Fit window to image #720
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
base: master
Are you sure you want to change the base?
Conversation
|
I'm not entirely sure on this feature. I'm not really sure who it's for, a good use case for it, and how well this will work between Windows, Mac, Linux, BSD. I'm already currently unable to run this PR under Sway (uses wayland). To me this feature feels weird to have but I also don't really have a use case for this. Is there anything in particular that makes this feature useful for you? A few examples would be great so I can get an understanding! Notan will likely end up being dropped sometime soon. The reasoning behind this is that it's being deprecated. There's also some things that have been a bit of a headache like not being able to update egui until recently because Notan has been very slow in development for a while. Woelper was invited to be an admin of the Notan repo so he could maintain it if he wanted, but we are instead considering either going with Bevy, or completely on our own since we believe it will be easier in the long run.
Some ideas we've had are caching an entire directory (not sure if we want a flag, keybind, or what), and allow "cache ahead" as an option. If you in interested in this, it should be a separate PR. |
This feature's intended for people that use floating window managers, I don't see why it wouldn't work well across platforms, qView manages that just fine. I obviously wouldn't enable it by default normally, hence the:
On floating window managers, it's nice to have the a program's window be as small and space-efficient as possible, especially when browsing images, it just looks nice and saves space 🤷. I personally prefer not to resize my window, or have it be the full size of my screen when it's unnecessary. This feature was one of the main reasons I chose to use qView in the first place. I'm not using qView or Oculante to do much editing, even if they can do it, just to view an image (gallery).
When working on an image in Photoshop (I pretty much always use it maximized, as it doesn't scale very well to smaller dimensions), I often set an image viewer window to always on top through my wm, and save an image as a snapshot of the past. It's useful to me for comparing what I'm working on, to it's past state at a glance. This avoids having to potentially overwrite, and/or fiddle with a very long undo history. Having the window auto-sized to it's smallest possible without scaling, and even when it's still too big, I'd recommend trying out qView's approach, if you want to see how it'd be better implemented.
Yea, one thought I had when writing this, was maybe storing the pre-computed window dimensions+positions queued per image, and then just apply them as a cached property, I'm unsure how much it'd help, but it's an idea I had regardless. Each time |
I say this because some window managers may have issues with this. For example, Hyprland is anything but stable and is filled with weird bugs that no other window manager has. A good example is right-click context menus just disappearing all together sometimes and requiring a complete restart of the application, or them just appearing in random spots around the screen. Even on Sway, qView seems to like to resize the window towards the left side of the screen (or maybe this is intentional on qviews part?) instead of being in the centre. Nor can I get Oculante to run with this PR under Sway.
This would mean just expanding the current caching option we currently have. This works by caching to memory, not disk. Caching ahead would basically just cache the next x amount of images, caching the entire directory would be self explanatory. I'm assuming you're concern means that it would have to update if the user changes the fitting percentage? |
Ah sorry, not concerned, just thinking out loud. I'm not really sure of how to improve the performance in a meaningful way right now, caching dimensions+position may help just a little bit, but I really don't think that they're what's causing the lag (I even tried disabling position calculation altogether, and testing was still just as laggy). I tried to move the execution of the
Hmm I wonder why, it could be related to it not liking that I'm setting a max window size, other than that I don't really see why it wouldn't work. I initialize max to |
If you feel up to a bit of refactoring, see how well it works against #666 since the Notan update brings egui up to date. It's currently pretty outdated (over a year). Beware that this branch is very buggy, not at all ready to daily drive in its current state.
|
|
Thanks for this! Generally, for new features like this I would love if we could discuss the need for it before implementation is done so we make sure your time is valued. Nonetheless thank you for your work! Am I understanding correctly that you just want the image to fit to the window at all times when a setting is active? The image is just a texture, so resizing it every frame even should not be a performance issue. I could see that the resize signals might not be coming in fast enough to make it appear smoothly though. |
Here's a video of the behaviour in qView that the user is wanting to replicate in Oculante: 1754069617.mp4 |
No, only when you first open the image. I want to be able to resize it after, intended to be used with |
This is a feature from qView I use, and really like.

notan's, oregui's tbh. I actually can't get holding a folder direction (scrubbing) at all to really be as fast as qView (when on a fast drive; however, Oculante seems much faster when viewing things off a NAS, disregarding this PR), relative to qView'sPreloading = Extended, and Oculante'sNumber of images to cache = 1000. I'm open to ideas here, and if that should be done in a separate PR, that's perfectly fine and understandable too.notan. qView doesn't resize maximized windows, and realistically this feature shouldn't either, but I haven't found a way to do that yet.screen_sizewould be determined before any windows were initialized, this isn't possible withnotan. If it was, that'd remove the code in theupdatefunction, and avoid repeating the branch. I thinkglutinmay support this, but I wasn't going to add a dependency for no reason here.max_window_sizeis determined by the launched monitor. Launching the program on a monitor's currently required to set this automatically.