Mouse scroll can only zoom out occasionally

Environment Information

Avogadro version: Latest Nightly
Operating system and version: Windows 11 Pro 10.0.26200

Expected Behavior

Scroll wheel follows desired setting in Navigate tool options, e.g. scrolling down zooms out, scrolling up zooms in, can do reverse if enabled.

Actual Behavior

Sometimes the scroll wheel can seem to get locked into zooming out.

Steps to Reproduce

It’s not easy to reproduce consistently, but one way that seems to work for me is opening up the attached file and dragging the molecule so that it is centered in the screen, then the scrolling only zooms out.

I’m not sure about this one, but I’ve seen some weird things with zooming out and never being able to re-center.

I’m going to add a command to copy the current camera / viewport, which should make this a bit easier to debug.

But I’ll take a look at the file as well.

1 Like

Out of curiosity, is this with orthographic or perspective projection or both?

I’m finding more problems with orthographic…

I’m having a hard time reproducing the bug on my desktop, but I know that on my laptop it definitely occurs in orthographic. I rarely ever use perspective so I’m not sure about that.

Edit: Just tried on my laptop. I can’t reproduce it with perspective, only orthographic.

1 Like

Yes, there seems to be something buggy in the orthographic projection camera code. I’ll sort through it. (This may also be the root cause of the selection bug in orthographic mode.)

For what it’s worth, in my experiments, it seems like View => Center or View => Align to Axes before anything else prevents the problem.

Put another way, the initial camera matrix seems prone to this issue in orthographic projection, while the code in resetview.cpp sets up a better camera transform. I’ll now work towards:

  • migrating the “Align to Axes” code to be the default camera
  • tweaking the default zoom level .. sometimes it’s a bit off

I’ll also add in some code to copy / paste the camera e.g., “Copy View” and “Paste View” to avogadroapp

1 Like

Okay, this should be fixed now by a patch to avogadroapp … basically it wasn’t properly resetting the camera when you actually read a molecule, so it was stuck on the default for zero atoms. Oops.

I still need to sort out a better default zoom for orthographic projection (and make sure it resets accordingly with Center and Align to Axes menu items).

Should show up in the continuous releases soon.

And a related patch to avogadrolibs should do it. Please check out a continuous release and let me know what you think.

1 Like

Windows build just finished. Looks good to me so far, will do some more testing tomorrow morning with my laptop. I do like that switching to orthographic doesn’t just zoom in beyond belief anymore.

1 Like

Yeah, I fixed up a few other bits because zoom in orthographic mode is different than perspective, so the “Center” and other commands in the View menu now reset the zoom.

I can’t reproduce the error anymore on my laptop, so I’m going to consider this solved!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.