maplibre / maplibre-native

MapLibre Native - Interactive vector tile maps for iOS, Android and other platforms.
https://maplibre.org
BSD 2-Clause "Simplified" License
1.03k stars 299 forks source link

Could not call onMove with parameters 0.0,0.0 #2575

Closed kodebach closed 2 months ago

kodebach commented 3 months ago

Describe the bug We are seeing lots of automatic error report from our app with the message "Could not call onMove with parameters 0.0,0.0" coming from MapLibre. We get these report, because both our app and MapLibre use Timber for logging, and we use a Timber to automatically send error level logs to Sentry.

At first we thought these were somewhat random and there is some odd edge case that produces these messages, however, we are now able to consistently reproduce the issue.

To Reproduce Steps to reproduce the behavior:

  1. Rotate the map without moving it

Expected behavior No error level log messages when performing legitimate actions like rotating the map.

Ideally MapLibre would let us configure logging via a custom logging interface instead of using Timber directly, but that is a different issue.

Platform information (please complete the following information):

Additional context This is where the error is logged:

https://github.com/maplibre/maplibre-native/blob/5d5bd84d95f3692fa1bf05931cbf2fd1e222a6ce/platform/android/MapLibreAndroid/src/main/java/org/maplibre/android/maps/MapGestureDetector.java#L490-L509

There is even a comment, that a move event without distance is expected and a check against 0. But then the error is still logged, if both distanceX and distanceY are zero. So unless there is a reason why the function should never be called with 0, 0, the solution seems to be to change else into

else if (distanceX != 0 || distanceY != 0)
louwers commented 3 months ago

Thanks for the report. Makes sense, could you make a PR?

Ideally MapLibre would let us configure logging via a custom logging interface instead of using Timber directly

Feel feel to create an issue for this as well if this is important for you.

kodebach commented 3 months ago

Makes sense, could you make a PR?

See #2580

Feel feel to create an issue for this as well

I'll open an issue, but currently its not important, if the "Could not call onMove" goes away. We've not seen any other log messages that were problematic.