Repository navigation
Fix map panning during marker drag and support vector marker icons - #61
Merged
Merged
Conversation
- Measure the marker drag threshold from the touch-down point and do not pan the map while a draggable marker is pressed below the threshold - Load fromResource() icons through Drawable so vector drawables render instead of falling back to the default pin - Cache decoded resource and asset icons instead of decoding them on every draw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Marker drag pans the map
OpenMapView.onTouchEventmeasured the drag threshold from the previous MOVE event. While a draggable marker was pressed but not yet dragged, the event fell through to the pan code, which also reset that reference point. Each MOVE delta stayed under 10 px, so the drag rarely started and the map followed the finger instead (about 140 px in a test run).TAP_SLOP_PXconstant, also used for tap detectionfromResource() ignores vector drawables
BitmapFactory.decodeResourcereturns null for vector and other XML drawables, so the default pin was shown. The resource was also decoded again on every draw and hit test.ContextCompat.getDrawable(...).toBitmap()(existingcore-ktxdependency), rendered at intrinsic sizeTests
MarkerDragTest: small steps on a draggable marker drag it without panning, moves within the slop do nothing, a drag on empty map still pans. The first two fail without the fix.MarkerIconLoadingTest: an XML drawable renders at its intrinsic size, resource bitmaps are decoded once, missing resources and assets fall back to the default pin.