After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 699871 - Centering before zooming-in changes the center of the view
Centering before zooming-in changes the center of the view
Status: RESOLVED FIXED
Product: libchamplain
Classification: Core
Component: view
unspecified
Other Linux
: Normal normal
: ---
Assigned To: libchamplain-maint
libchamplain-maint
Depends on:
Blocks:
 
 
Reported: 2013-05-07 20:07 UTC by Zeeshan Ali
Modified: 2013-05-08 11:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot of the problem (717.47 KB, image/png)
2013-05-07 20:15 UTC, Zeeshan Ali
Details
Screenshot of correct behavior (676.55 KB, image/png)
2013-05-07 20:16 UTC, Zeeshan Ali
Details

Description Zeeshan Ali 2013-05-07 20:07:41 UTC
Centering the view on coordinates before zooming-in takes the view a bit off. centering *after* zooming in works as expected. i-e this doesn't work:

            this._view.center_on(this.latitude, this.longitude);
            this._view.set_zoom_level(zoom);

but this does:

            this._view.set_zoom_level(zoom);
            this._view.center_on(this.latitude, this.longitude);

Attaching screenshots to show the diff in action.
Comment 1 Zeeshan Ali 2013-05-07 20:15:50 UTC
Created attachment 243535 [details]
Screenshot of the problem
Comment 2 Zeeshan Ali 2013-05-07 20:16:24 UTC
Created attachment 243536 [details]
Screenshot of correct behavior
Comment 3 Jiri Techet 2013-05-07 22:20:33 UTC
Would you try now? I think it was because of rounding errors of int vs double (the difference was multiplied by 2^deltazoom, which could be quite large). I haven't tested the result of the patch much and maybe something more has to be adjusted so please let me know if it works.
Comment 4 Zeeshan Ali 2013-05-07 23:18:16 UTC
(In reply to comment #3)
> Would you try now? I think it was because of rounding errors of int vs double
> (the difference was multiplied by 2^deltazoom, which could be quite large). I
> haven't tested the result of the patch much and maybe something more has to be
> adjusted so please let me know if it works.

Nope, I can still reproduce. :( One thing I noticed is that it seems to be the first-time zoom somehow that causes this and seems pretty unrelated to centering the map.
Comment 5 Zeeshan Ali 2013-05-07 23:21:32 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Would you try now? I think it was because of rounding errors of int vs double
> > (the difference was multiplied by 2^deltazoom, which could be quite large). I
> > haven't tested the result of the patch much and maybe something more has to be
> > adjusted so please let me know if it works.
> 
> Nope, I can still reproduce. :( One thing I noticed is that it seems to be the
> first-time zoom somehow that causes this and seems pretty unrelated to
> centering the map.

Yup. If I init the view to zoom-level '10', i can not reproduce this. Seems to only happen when going from small zoom (1-3) to bigger zoom.
Comment 6 Jiri Techet 2013-05-07 23:47:39 UTC
Yeah, still the same problem I think. Try now - I've discovered one more case where the integer precision might not be enough.
Comment 7 Jiri Techet 2013-05-07 23:49:56 UTC
Ouch, the patch has broken zooming completely - I have to investigate more.
Comment 8 Jiri Techet 2013-05-07 23:57:54 UTC
Alright, stupid 2AM-coding bug. Fixed the previous commit.
Comment 9 Zeeshan Ali 2013-05-08 00:54:23 UTC
Sorry, its still broken. :(
Comment 10 Jiri Techet 2013-05-08 11:32:05 UTC
Yeah, one should really test things before blind coding :-). Fixed now (and fix tested).