Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Add anchor to MarkerView #5079

Closed
tobrun opened this issue May 20, 2016 · 6 comments · Fixed by #5132
Closed

Add anchor to MarkerView #5079

tobrun opened this issue May 20, 2016 · 6 comments · Fixed by #5132
Assignees
Labels
Android Mapbox Maps SDK for Android annotations Annotations on iOS and macOS or markers on Android feature

Comments

@tobrun
Copy link
Member

tobrun commented May 20, 2016

Google exposes customization of Anchor:

The point on the image that will be placed at the LatLng position of the marker. This defaults to the middle of the bottom of the image.

Now that #3276 landed we can implement this in MarkerView/MarkerViewOptions (vs GL Marker #2916).

@tobrun tobrun added feature Android Mapbox Maps SDK for Android annotations Annotations on iOS and macOS or markers on Android labels May 20, 2016
@tobrun tobrun added this to the android-v4.1.0 milestone May 20, 2016
@tobrun
Copy link
Member Author

tobrun commented May 24, 2016

Note that Google maps also exposes this for InfoWindow

@tobrun
Copy link
Member Author

tobrun commented May 24, 2016

At this point we are exposing:

PointF centerOffset;
Point infoWindowOffset;

This should be replaced with Anchor API instead:

float anchorU;
float anchorV;
float infoWindowAnchorU;
float infoWindowAnchorV;

This is how Google exposes this in their javadoc:

screen shot 2016-05-24 at 14 58 52

@tobrun
Copy link
Member Author

tobrun commented May 24, 2016

This is how the default implementation works:
device-2016-05-24-160242

Note that the default values for u = 0.5 and v = 1.0 are used.
This results in anchoring the annotation to the bottom center.

@tobrun
Copy link
Member Author

tobrun commented May 24, 2016

This is the result for u = 0 and v = 0 aka topleft:

screen shot 2016-05-24 at 16 09 21

This is the result for u = 1 and v = 1 aka bottomright:

screen shot 2016-05-24 at 16 11 32

This is the result for u = 0.5 and v = 0.5 aka center:

screen shot 2016-05-24 at 16 13 05

This is the result for u = 0 and v = 0.5:

screen shot 2016-05-24 at 16 06 46

@tobrun
Copy link
Member Author

tobrun commented May 24, 2016

It seems that InfoWindow anchoring needs some extra work. Our current setup doesn't match how Google maps was setup. This will require some extra code to not break current exposed logic for GL based annotations.

@tobrun
Copy link
Member Author

tobrun commented May 25, 2016

I was able to get the old InfoWindow logic working with the newer anchoring. This is currently introducing some unneeded overhead but this can only be resolved if we implement anchoring of GL based markers (else we would have a breaking API change for users using the GL based annotations).

Here you see a screenshot with anchoring in action:

  • bottom left has infoWindowAnchor(1.0f, 1.0f)
  • center has infoWindowAnchor(0.5f, 0.0f) (default value)
  • right has infowWindowAnchor(0.0f, 0.0f)

device-2016-05-25-103200

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android annotations Annotations on iOS and macOS or markers on Android feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant