mrkite / minutor

Mapping for Minecraft
http://seancode.com/minutor
BSD 2-Clause "Simplified" License
277 stars 51 forks source link

Zooming by scrolling should center the zoom on the cursor location #294

Closed afontenot closed 2 years ago

afontenot commented 2 years ago

Currently, no matter how you initiate a zoom, the zoom takes you towards or away from the center of the current view. This is undesirable when using a mouse / cursor, because you tend to be poking around with it looking at different things (e.g. by hovering), and start a zoom when you want to look at the thing you're hovering over more closely.

The desirable behavior is to keep the pixel that the cursor is currently touching still, and zoom everything else around it as before.

This would mirror the behavior of just about every mapping application in the world, try OpenStreetMap as an example of what I mean.

I think the way to go here in terms of implementation would be to add bool followCursor to adjustZoom. Non-scroll wheel based zooms would always call this with false, scroll wheel zooms would call it with true or optionally call it with the value of a setting, if it's desired to make this behavior configurable. Doing the zoom would be easy, you just recenter the map as appropriate right before the redraw().

Thoughts? If this would get merged, I might try working on it if no one else wants to do it.

EtlamGit commented 2 years ago

This feature is also on my very long list of things that have to be tackled when some free time is available. => Start with it, I will assist with code reviews and debugging.

I could imagine a reason to make it configurable: When you have jumped to a specific Block location this is centered in the middle of the window. This position would be preserved with current zoom behavior. But I have no idea, if someone is using Minutor in this way. So you might want to implement it with the optional parameter, but we could add the configuration dialog later.

You can also use this "forum" for discussion and questions.