venkivenkat / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

press a button in the same moment as zoom in button brings you to Norway #448

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.create a button which animates to your position
2.activate the Built In Zoom Controls
3.Press zoom + button while pressing your button

What is the expected output? What do you see instead?
It should zoom in while animating to your position but it centers the view 
north from Norway

What version of the product are you using? On what operating system?
3.0.10 with Android 4.0.4 on Galaxy s2 but also tried with other devices

Please provide any additional information below.

code for the button:
      Button btnPos = (Button) findViewById(R.id.btnPos);
      btnPos.setBackgroundResource(R.drawable.ic_menu_mylocation);
      btnPos.setOnClickListener(new OnClickListener() {

         @Override
         public void onClick(View v) {
             // TODO Auto-generated method stub
         mapController.animateTo(myLoc.getMyLocation());
         }
      });

Original issue reported on code.google.com by armellin...@gmail.com on 9 Jul 2013 at 2:26

GoogleCodeExporter commented 9 years ago
Hi,

I was at a similar situation - conflict between map view animateTo and zoom 
animation.
You can find a temporary solution at
http://code.google.com/p/osmdroid/issues/detail?id=391

Regards.

Original comment by devemu...@gmail.com on 9 Jul 2013 at 4:05

GoogleCodeExporter commented 9 years ago
Maybe we should cancel any running map panning animations when we start a zoom 
animation.

We could alternately adjust the final destination of the pan animation to be 
valid for the new zoom level, however if zooming in you would lose some 
resolution and might not land in the exact right spot.

Original comment by kurtzm...@gmail.com on 9 Jul 2013 at 6:04

GoogleCodeExporter commented 9 years ago
Interestingly - this should be handled properly. When zooming in:

1. The animation starts. The maps stay at the current zoom level.
2. The view increases in scale until it is at 2.0x. The animation ends.
3. The maps call setZoomLevel() to the new zoom level.
4. setZoomLevel() halts all panning animation where it is at.
5. setZoomLevel() adjusts the scroll position for the new zoom level.

So what *should* happen in the situation you describe is something along the 
lines of:
1. The onLocationChanged() fires, and the maps start to pan towards your 
current location.
2. During the animation you tap the zoom-in button.
3. The scroller stops panning where it is at.
4. The maps zoom in.
5. You end up half-way in between your starting location and your destination 
location.

But it sounds like you end up completely in the wrong location that isn't along 
the path between your starting and destination location correct? That sounds 
like the scroll values are not getting translated from the old zoom level to 
the new zoom level, but it could be something else.

I wonder if you remove lines 979 and 981 from MapView.computeScroll():

                scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
                setZoomLevel(mZoomLevel);

Does that fix the problem? There is a chance that the last scrollTo() puts 
those x/y values for the old zoom level into the new zoom level.

Original comment by kurtzm...@gmail.com on 10 Jul 2013 at 9:51

GoogleCodeExporter commented 9 years ago
Issue 391 has been merged into this issue.

Original comment by kurtzm...@gmail.com on 10 Jul 2013 at 9:53

GoogleCodeExporter commented 9 years ago
Hi kurtzmarc,

You propably mean lines 967 and 969 at MapView.computeScroll() from the latest 
trunk.
I removed them but the problem still exists.

Regards.

Original comment by devemu...@gmail.com on 11 Jul 2013 at 6:49

GoogleCodeExporter commented 9 years ago
Please take a look at the patch in issue 453. It changes the way we do zoom in 
and out animations and it may affect the issue here. I think the new code is 
simpler and hopefully as a side-effect, it fixes this issue.

Original comment by kurtzm...@gmail.com on 6 Aug 2013 at 7:16