zagnut
11-07-2003, 06:27 PM
While no one probably cares, it always bugged me that the map zoomed in so much when going from 1x to 2x. Here's the code that seems to handle how much the map gets zoomed, from MapParameters::reAdjust() in mapcore.cpp:
int pxrat = ((mapSize.width()) / (m_zoom));
int pyrat = ((mapSize.height()) / (m_zoom));
So, at 2x the width and height get cut in half (x/2). In other words, the area of the map that is shown goes from 100% to 25% ((x/2)^2). Here are a few of the others:
zoom area
1x 100%
2x 25%
3x 11%
4x 6%
...
32x <1%
Ideally (for me), that first zoom wouldn't be so big while the we kept the ability to zoom way in quickly. I'm sure someone can think of something better, but my first stab is:
int pxrat = ((mapSize.width() * 2) / (m_zoom + 1));
int pyrat = ((mapSize.height() * 2) / (m_zoom + 1));
zoom area
1x 100%
2x 44%
3x 25%
4x 16%
5x 11%
...
32x <1%
That isn't perfect. On the plus side, the 1x-2x zoom is great and the next few zooms are fine. On the minus side, the maximum amount you can zoom in is reduced, and it takes more clicks to get there.
Anyway, a two-line patch is attached if you want to try it out. If someone else cares about this and can think of a better algorithm (shouldn't be hard, my math suxx0rs), lemme know.
Thanks
int pxrat = ((mapSize.width()) / (m_zoom));
int pyrat = ((mapSize.height()) / (m_zoom));
So, at 2x the width and height get cut in half (x/2). In other words, the area of the map that is shown goes from 100% to 25% ((x/2)^2). Here are a few of the others:
zoom area
1x 100%
2x 25%
3x 11%
4x 6%
...
32x <1%
Ideally (for me), that first zoom wouldn't be so big while the we kept the ability to zoom way in quickly. I'm sure someone can think of something better, but my first stab is:
int pxrat = ((mapSize.width() * 2) / (m_zoom + 1));
int pyrat = ((mapSize.height() * 2) / (m_zoom + 1));
zoom area
1x 100%
2x 44%
3x 25%
4x 16%
5x 11%
...
32x <1%
That isn't perfect. On the plus side, the 1x-2x zoom is great and the next few zooms are fine. On the minus side, the maximum amount you can zoom in is reduced, and it takes more clicks to get there.
Anyway, a two-line patch is attached if you want to try it out. If someone else cares about this and can think of a better algorithm (shouldn't be hard, my math suxx0rs), lemme know.
Thanks