Skip to content
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

Improve zoom #870

Merged
merged 6 commits into from
Feb 6, 2022
Merged

Improve zoom #870

merged 6 commits into from
Feb 6, 2022

Conversation

lmoureaux
Copy link
Contributor

@lmoureaux lmoureaux commented Feb 6, 2022

It no longer reloads the tileset every time, resulting in much faster zooms. Instead, zoom is handled at the mapview level by pretending that the canvas is smaller (or larger) than it really is, and scaling the drawn canvas afterwards. The main drawback is that drawing the map when zoomed out is rather slow. It is, however, quite fast when zoomed in.

City names and production aren't as sharp as they used to be when zooming. Text layers will need to be taken into account when designing the next-gen renderer.

This started as a test to see how far it could go but it turned out to be rather easy so I went ahead.

Closes #295.
Closes #296.
Closes #729.
Closes #864
(I think).

Test plan

  • Play with zoom in and zoom out.
  • Watch out for possible offsets between the tile hovered with the mouse and the tile picked up by the client.
  • Check trade route lines, in particular trade planner lines.

Instead of reloading the tileset, draw the map on a canvas whose dimensions are
adjusted to match the zoom level, and draw the canvas scaled. This results in a
lower drawing quality for vector elements (city descriptions) but is much
faster.
Reloading the tileset for every zoom change was never a good idea.
This is almost a joke because rendering is too slow to see more than a few
frames, but it's also a motivation to speed it up.
@jwrober
Copy link
Collaborator

jwrober commented Feb 6, 2022

Middle-click popup window moves away as you zoom out

  1. default zoom
    image

  2. one zoom out
    image

  3. a second zoom out
    image

@jwrober
Copy link
Collaborator

jwrober commented Feb 6, 2022

Inside the city, the panel does not move when you zoom in

  1. default zoom
    image

  2. zoom in a couple times
    image

@jwrober
Copy link
Collaborator

jwrober commented Feb 6, 2022

Other than those two issues, rest looks fine to me.

Also make sure that it's inside the screen when on the left of the map, where
it could previously be partially hidden.

(info_tile is better known as the middle click tooltip.)

See longturn#870.
@lmoureaux
Copy link
Contributor Author

Good catch, fixed both!

@lmoureaux lmoureaux merged commit 42196dc into longturn:master Feb 6, 2022
@lmoureaux lmoureaux deleted the feature/better-zoom branch February 6, 2022 19:32
lmoureaux added a commit that referenced this pull request Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants