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

Fractional Zoom using WinForms version #46

Open
TAlecksen opened this issue Mar 16, 2017 · 5 comments
Open

Fractional Zoom using WinForms version #46

TAlecksen opened this issue Mar 16, 2017 · 5 comments

Comments

@TAlecksen
Copy link

It appears the fractional zoom capability is not working as stated in the code itself. I have attempted to resolve this for a few days now with no luck. Although it works fine when zooming from a 'centered' location, once the map is panned a little and then I attempt to zoom in (with fractional zoom on) the map appears to be off center until the zoom level reaches a whole number again, at which point it gets centered to the correct location.

Does anyone have any insight on how to resolve this? I suspect the fix is in the DrawGraphics method, but I still have a long way to go to understand how the Core.renderOffset is utilized in order to resolve the problem itself.

@radioman
Copy link
Owner

..yes its a tricky business, offset and scaling matrix is at play

@TAlecksen
Copy link
Author

Fantastic control by the way!

Based on what I can see, it looks like the panning is handled by the TranslateTransform. The scaling is handled by the two lines in FromLatLngToLocal:

ret.X = (int)(Core.renderOffset.X + ((Core.renderOffset.X - ret.X) * -MapRenderTransform.Value));
ret.Y = (int)(Core.renderOffset.Y + ((Core.renderOffset.Y - ret.Y) * -MapRenderTransform.Value));

The thing I have not yet figured out is why the Core.renderOffset gets updated correctly when zooming in whole number, but not when the zooming is fractional. Anyone get anywhere with this?

@radioman
Copy link
Owner

check https://github.com/radioman/greatmaps/blob/master/GMap.NET.Core/GMap.NET.Internals/Core.cs#L670

compensationOffset is equal positionPixel on zoom

@AliFlux
Copy link

AliFlux commented Mar 23, 2017

@TAlecksen, please do share your work if you come across any solution. I've the same issue, and trying to use ScaleTransform but it's tricky and only limited to WPF.

@TAlecksen
Copy link
Author

@AliFlux I most certainly will if I manage to get anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants