-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
feat: Add exponential interpolation map zooming [skip ci] #2373
Conversation
With this PR done, @magicus, how do you think we should account for zooming in MapData? We have two options:
|
common/src/main/java/com/wynntils/utils/render/MapRenderer.java
Outdated
Show resolved
Hide resolved
common/src/main/java/com/wynntils/screens/maps/AbstractMapScreen.java
Outdated
Show resolved
Hide resolved
@magicus Any chance you can find time to get this reviewed? |
Sorry for the slow input on this. I tested this branch, and discovered that the zoom of the map is dependent on the GUI scale. This means that on GUI scale 1, when max zoomed out, the entire continent is just like 25% of the visible space which is way too much zoomed out, and contrary, it is hard to zoom in enough to see all details. And conversely, at GUI scale 5, when max zoomed out, you can hardly see the entire Province of Wynn, and when zooming in you get to absurd levels where you see like 20 blocks across. I think that needs to be fixed as part of this PR, so there is a clear understanding what zoom level 1 and zoom level 100 means, e.g. on zoom level 1 you should see like (almost) the entire continent, and on zoom level 100 you should see a quarter of Detlas. |
I'm also not happy with the naming. I think the new 1-100 scale should be what we use everywhere except when finally rendering, so it should just be called "zoom" (not anything with "steps"). To get a value we can send into the rendering engine, we can use something like "zoom factor". But right now, I think we are calculating this in multiple steps, where at some point we invert this using 1/zoom etc. I would like to see us send the "zoom" (1-100) value as far down as possible in the call stack, until we actually need to convert this into something that makes sense for the rendering. edit: We could also call it "zoom level"; I realize that is how I think of it. |
On the positive side, however, is that the zooming feels very good. It has a natural feel, and is just perfectly tuned to be fast enough while still being precise enough. I tried looking for how the GUI scale comes into play, but did not figure it out. In the worst case, we can't do anything about it (which would be a shame); if so we might have to set our expectations based on a supposed commonly used value (2-3?). |
I added functionality to show the current zoom level when pressing shift. |
Agree. My hack of showing the zoom level as an overlay is kind of a step on the way. Presenting it as a slider instead of a number is clearer, and it will also allow direct manipulation. It's just much more work to implement a slider widget in Minecraft. If you feel up to it, please go ahead! You can create a new branch based on this, so you can use the new 1-100 zoom levels. |
Might save it for when the map screen gets redone. I've seen a few suggestions and have some ideas of my own for improvements but after the filter screen I'm taking a small break from ui work to do some of the fuy.gg features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a bunch of changes. Now I am happy with this PR. Are you okay with it?
Do you know what would be required to add this in reality too? I guess it needs some digging into GLFW... |
It seems to be stuck here glfw/glfw#90 (since 2013), with a solution here: glfw/glfw#2419 that has not been merged since 2023. :-( |
I think we talk about a different thing. I mainly tested Mac's double finger scrolling. Not sure how to support real pinching (I forgot how pinching was supposed to work..) |
Ah, I see. Yes, the double-finger scroll works fine. And I guess we'll have to wait another decade or so for pinch-zooming to be implemented in GLFW :-). |
@kristofbolyai To be clear, I am awaiting a review from you as well, since I changed so much in the end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
* feat: Increase maximum zoom limit to 5x * feat: Add exponential interpolation (log scale) map zooming * feat: Also add the new zooming to the minimap * refactor: Allow a bit more steps, add a constant default * feat: Second iteration of map zooming logic * feat: Allow float-steps * fix: make mouse-scrolling a bit more sensitive * fix: fix MinimapOverlay onConfigUpdate logic * chore: remove outdated comment * fix: fix CustomSeaskipperScreen zooming * fix: add separate setZoomStep function * feat: Add rendering of zoom level when pressing shift * feat: Make the zoom ratio constant for every GUI scale * chore: Rename zoom steps to zoom level * chore: Change "zoom step" to "zoom level" in several places * ci: spotless formatting * chore: Fix scaleSteps as well * fix: Clamp minimap zoom level for key bindings * chore: Small refactorings * ci: spotless formatting * fix: Improve default zoom level and centering * chore: Reorder for consistency --------- Co-authored-by: Magnus Ihse Bursie <mag@icus.se> Co-authored-by: magicus <magicus@users.noreply.github.com>
I wonder which PR's perquisite is this change.
Touchpad demo:
Screen.Recording.2024-03-17.at.11.41.44.mov