You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Tilt map around x axis (i.e. pitch) using two-finger shove gesture.
Rotate map around z axis (i.e. bearing, aka direction) using two-finger rotate gesture.
Expected behavior
Actual behavior
Discussion
The 3D transformation calculation for MyLocationView is
incorrect - the compass bearing / direction rotation is applied as M' = R(degrees) * M using Matrix#postRotate(float), whereas it should be calculated as M' = M * R(degrees), e.g. by using Matrix#preRotate(float).
incomplete - map rotation around the z axis, i.e. map bearing / direction, is not taken into account. The compass bearing indicator is therefore incorrect when the map is not pointing north. Map rotation gestures should be propagated to MyLocationView, similar to how tilt is, and accounted for when calculating the transformation.
needlessly complex - it uses both the Camera and Matrix classes, whereas the entire transformation could be calculated using just Camera and applied using Camera#applyToCanvas(canvas).
@justasm thank you for writing this up. I was able to reproduce the issue shown in the screenshot and patch it up by applying Matrix#preRotate(float) instead of Matrix#postRotate(float) in 0fd450e. I'm now looking into your suggestions from 2) and 3).
Also noticing that when compass bearing is active and we don't have a tracking mode active. That the rotate gesture is disabled, while it should be enabled.
getMeterPerPixelAtLatitude is called for each onDraw which is not good for performance.
I'm thinking about caching this value, a not 100% correct value will not have that much impact since the value is used for the accuracy circle.
The MyLocationView is sometimes stuck in an invalidation loop. Resulting in constantly invalidating through JNI. While the map is actually not changing and is stable.
The MyLocationView is sometimes stuck in an invalidation loop.
This occurred only when we receive a location update and were trying to animate the location update through an animator. For non-tracking behaviour we don't need to invalidate the map, we only need to invalidate the MyLocationView.
Looking into this issue has resulted me going into the rabbit hole and finding/fixing multiple things. To limit impact/regressions for the release we are planning next week I'm going to patch up a few things and revisit this issue after release.
This ticket seems to be tracking multiple issues with the location view, If they haven't been fixed yet can we ticket them out separately and close this one @tobrun?
Activity
tobrun commentedon Jun 24, 2016
@justasm thank you for writing this up. I was able to reproduce the issue shown in the screenshot and patch it up by applying
Matrix#preRotate(float)instead ofMatrix#postRotate(float)in 0fd450e. I'm now looking into your suggestions from 2) and 3).[android] #5438 - apply rotation to with preRotate instead of postRotate
tobrun commentedon Jun 24, 2016
Also noticing that when compass bearing is active and we don't have a tracking mode active. That the rotate gesture is disabled, while it should be enabled.
tobrun commentedon Jun 24, 2016
Noticing 2 JNI related items:
getMeterPerPixelAtLatitudeis called for each onDraw which is not good for performance.tobrun commentedon Jun 24, 2016
This occurred only when we receive a location update and were trying to animate the location update through an animator. For non-tracking behaviour we don't need to invalidate the map, we only need to invalidate the MyLocationView.
tobrun commentedon Jun 24, 2016
I was wrong here because
getMetersPerPixelAtLatitudeuses current zoom level. I'm going try moving it to another place in the code than theonDraw.[android] #5438 - don't disable rotation gestures when bearing tracki…
[android] #5438 - remove unused params
[android] #5438 - remove duplicate direction/bearing integration in M…
[android] #5438 - update test utils to handle change from direction t…
[android] #5438 - integrate mbgl camera direction into MyLocationView
[android] #5438 - Remove old update method and replace it with an inv…
[android] #5438 - limit amount of JNI calls for MyLocationView
1 remaining item
tobrun commentedon Jun 24, 2016
Here you can see the less optimal UX but with improved performance since we are no longer calling a JNI method directly in onDraw.
tobrun commentedon Jun 25, 2016
Looking into this issue has resulted me going into the rabbit hole and finding/fixing multiple things. To limit impact/regressions for the release we are planning next week I'm going to patch up a few things and revisit this issue after release.
-> simplified version of this ticket in: #5479
tobrun commentedon Jul 11, 2016
I'm running back at this issue, starting this off by cherry picking some ideas from #5468
[android] #5438 - add bearing to MyLocationView for the SDK camera ob…
[android] #5438 - integrate MyLocationView set bearing inside the Map…
[android] #5438 - invalidate the MapView instead of calling update fr…
[android] #5438 - add bearing MyLocationView to setBearing focal poin…
[android] #5438 - Get correct bearing when camera object is rotated a…
[android] #5438 - fixes compass tracking
[android] #5438 - add bearing to MyLocationView for the SDK camera ob…
cammace commentedon Aug 9, 2016
This ticket seems to be tracking multiple issues with the location view, If they haven't been fixed yet can we ticket them out separately and close this one @tobrun?