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

Endless onScroll calls #164

Closed
hakami1024 opened this issue Oct 5, 2015 · 14 comments
Closed

Endless onScroll calls #164

hakami1024 opened this issue Oct 5, 2015 · 14 comments

Comments

@hakami1024
Copy link

The problem is quite similar to this one: https://code.google.com/p/android/issues/detail?id=43120
so I downloaded and adapted for osm it's sample: https://github.com/hakami1024/computescrollbug/blob/master/app/src/main/java/biz/thomaskeller/android/computescrollbug/MainActivity.java.
The difference is that the zooming itself doesn't cause the problem. The endless onScroll calls begin only if zoom was after animating to some location (maybe exactly MyLocation). And the calls stop after real scrolling.

@spyhunter99
Copy link
Collaborator

is this on 4.3 or off of master?

@hakami1024
Copy link
Author

on 4.3

@hakami1024
Copy link
Author

On both. Made for master version: https://github.com/hakami1024/osmdroid

@spyhunter99
Copy link
Collaborator

Ahh i see you mean. Looks like the map listener is being called a number of times when mMapView.getController().animateTo(...); is called...

is this really a "problem"?

@hakami1024
Copy link
Author

After clicking only "My location" there is some calls, that is not a problem. If you click "My location" and then one of zoom buttons (and nothing more), does then the onScroll stop being called after some time?

@spyhunter99
Copy link
Collaborator

so here's what the stack trace looks like. not clear was going on...

D/MapFragment(28578): onScroll
W/System.err(28578): java.lang.Throwable: stack dump
W/System.err(28578):    at java.lang.Thread.dumpStack(Thread.java:490)
W/System.err(28578):    at org.osmdroid.MapFragment$2.onScroll(MapFragment.java:168)
W/System.err(28578):    at org.osmdroid.views.MapView.scrollTo(MapView.java:947)
W/System.err(28578):    at org.osmdroid.views.MapView.computeScroll(MapView.java:880)
W/System.err(28578):    at android.view.View.updateDisplayListIfDirty(View.java:15383)
W/System.err(28578):    at android.view.View.getDisplayList(View.java:15418)
W/System.err(28578):    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
W/System.err(28578):    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
W/System.err(28578):    at android.view.View.updateDisplayListIfDirty(View.java:15356)
W/System.err(28578):    at android.view.View.getDisplayList(View.java:15418)
W/System.err(28578):    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
W/System.err(28578):    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
W/System.err(28578):    at android.view.View.updateDisplayListIfDirty(View.java:15356)
W/System.err(28578):    at android.view.View.getDisplayList(View.java:15418)
W/System.err(28578):    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
W/System.err(28578):    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
W/System.err(28578):    at android.view.View.updateDisplayListIfDirty(View.java:15356)
W/System.err(28578):    at android.view.View.getDisplayList(View.java:15418)
W/System.err(28578):    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
W/System.err(28578):    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
W/System.err(28578):    at android.view.View.updateDisplayListIfDirty(View.java:15356)
W/System.err(28578):    at android.view.View.getDisplayList(View.java:15418)
W/System.err(28578):    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
W/System.err(28578):    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
W/System.err(28578):    at android.view.View.updateDisplayListIfDirty(View.java:15356)
W/System.err(28578):    at android.view.View.getDisplayList(View.java:15418)
W/System.err(28578):    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
W/System.err(28578):    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
W/System.err(28578):    at android.view.View.updateDisplayListIfDirty(View.java:15356)
W/System.err(28578):    at android.view.View.getDisplayList(View.java:15418)
W/System.err(28578):    at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:310)
W/System.err(28578):    at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:316)
W/System.err(28578):    at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:355)
W/System.err(28578):    at android.view.ViewRootImpl.draw(ViewRootImpl.java:2889)
W/System.err(28578):    at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2683)
W/System.err(28578):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2270)
W/System.err(28578):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1264)
W/System.err(28578):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6942)
W/System.err(28578):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
W/System.err(28578):    at android.view.Choreographer.doCallbacks(Choreographer.java:590)
W/System.err(28578):    at android.view.Choreographer.doFrame(Choreographer.java:560)
W/System.err(28578):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
W/System.err(28578):    at android.os.Handler.handleCallback(Handler.java:739)
W/System.err(28578):    at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err(28578):    at android.os.Looper.loop(Looper.java:145)
W/System.err(28578):    at android.app.ActivityThread.main(ActivityThread.java:6840)
W/System.err(28578):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(28578):    at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err(28578):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
W/System.err(28578):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

@spyhunter99
Copy link
Collaborator

the on scroll events appear to stop if you pan the map around, however the ui appears to hang for at least a few seconds or several touch events. I also tried with MapController.setCenter, same behavior

@spyhunter99
Copy link
Collaborator

looks like @kurtzmarc wrote most of the code related to this. Maybe he has some insight as to what's going on

@kurtzmarc
Copy link
Contributor

I haven't had a chance to debug this so I haven't witnessed it myself yet.

So this is triggered by an animateTo() followed by pressing one of the zoom buttons. Are the maps "settled" from the animation when you hit the zoom button or are they still animating? Does it matter whether you zoom in or zoom out? Are the endless onScroll() calls originating from computeScroll() (a function of the Scroller and animation) or are they just onScroll()?

@hakami1024
Copy link
Author

Endless onScroll() calls are originating from computeScroll(). Animation state and zoom direction didn't make any difference.

@spyhunter99
Copy link
Collaborator

@hakami1024 i just pushed a driver for this issue. I know at one point i was able to reproduce, but i can't reproduce right now with the emulator. Can you check out and see if you can reproduce it when the new driver? pushed to master

@windmly
Copy link

windmly commented Oct 19, 2016

I have got the problem of endless onScroll() calls.
SampleFollowMeExt.zip
Try this test fragment in OpenStreetMapViewer,
(1)when GpsMyLocationProvider gets a location, click the followMe button, make sure "mLocationOverlay.enableFollowLocation();" is executed;
(2)click one of the zoom buttons. Then you will see the endless onScroll() calls originating.

I have found that, MyLocationNewOverlay-->setLocation, "mMapView.getProjection().toProjectedPixels((int) (mLocation.getLatitude() * 1E6), (int) (mLocation.getLongitude() * 1E6), mMapCoordsProjected);", once this code is executed, the zoom in/out action can cause the endless onScroll calls problem.

@monsieurtanuki
Copy link
Collaborator

@hakami1024 @windmly osmdroid's management of zoom levels, animations and projections dramatically changed in the past months. Is this issue still relevant or can we close it?

@hakami1024
Copy link
Author

I edited my "Proof-of-bug" application for osmdroid 6.0.2 and tested on Android 4.4.2. No bug. Thanks!

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

5 participants