-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Markers are not drawn correctly #10077
Comments
@dnapolloteam could you add some code how you are creating the icon? I'm guessing you create an Icon for each update? You need to optimise your icon management separate from your location updates. This will be faster and will also remove issues as shown above. |
I'm sorry I still don't understand your mean could you help me explain more detail. We update icon when location and heading will change this is my code :
|
The issue is that you are creating a new bitmap every time the heading changes. This is not performant and should be optimised as mentioned before. You need to create all possible Icon upfront and storing them in a LongSparseArray where the key = azimuth (to not having to create 360 images I would suggest clamping your values to 5 from eachother). Your code will look something:
While this is a working around for your issue. What you are actually looking for is way to rotate the icon. So you set the icon once and just change rotation. While we do not expose an API for that atm on Marker you can do this with a SymbolLayer. An example of this is shown in the LocationLayer plugin https://github.com/mapbox/mapbox-plugins-android/tree/master/plugins/locationlayer. Let us know if you have more questions, I'm going ahead and close this issue, this is a known issue for which we have a workaround. |
I try this solution but It has same issues. (save all icon each azimuth). |
I was only mentioning LocationLayer as a reference to look up code on how that UX was achieved. |
This issue still happen when we try with your solution. We try to init all icon in array and then get it respected with heading change and update current location marker. I thinks this issue happen when we call update marker too much. So do you have some another idea for this case. |
Would you be able to retest with a 5.2.0-SNASPHOT build? To use snapshots, add the snapshots repo in the root build.gradle file: allprojects {
repositories {
jcenter()
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
}
} In you app build.gradle replace current dependency with: compile(com.mapbox.mapboxsdk:mapbox-android-sdk:5.2.0-SNAPSHOT@aar) {
transitive = true
} This PR #9213 should have solved this issue. |
Platform: Android
Mapbox SDK version: 5.1.4
Steps to trigger behavior
2.Readd current location when user have change location and heading also
3.Marker render wrong.
Expected behavior
Can be draw when location and heading update.
Actual behavior
Black marker happen
The text was updated successfully, but these errors were encountered: