Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom map style makes current road name label too tall, route shield too big #2355

Closed
JThramer opened this issue Mar 31, 2020 · 1 comment · Fixed by #2357
Closed

Custom map style makes current road name label too tall, route shield too big #2355

JThramer opened this issue Mar 31, 2020 · 1 comment · Fixed by #2357
Assignees
Labels
bug Something isn’t working UI Work related to visual components, Android Auto, Camera, 3D, voice, etc.

Comments

@JThramer
Copy link
Contributor

When using a custom style, the way name can apparently become enlarged, which is undesirable.

Investigate and fix.

/cc @mapbox/navigation-ios

@JThramer JThramer added bug Something isn’t working user: support UI Work related to visual components, Android Auto, Camera, 3D, voice, etc. labels Mar 31, 2020
@1ec5 1ec5 self-assigned this Apr 7, 2020
@1ec5
Copy link
Contributor

1ec5 commented Apr 8, 2020

There’s an issue with the navigation SDK’s integration with custom styles built using style components in Studio.

Background

Here’s how the current road name feature works: in response to each user location update, the navigation SDK queries the currently visible vector tiles for the features at the coordinate at the current user location. It figures out which of the returned features is the road corresponding to the road that the user is on, then fashions a label with a name and shield image based on that feature’s properties.

The name comes from the feature’s {name} property, while the shield image is the style image (sprite) with a name in the format {shield}-{reflen}, based on the {shield} and {reflen} properties. The image and name are placed into an attributed string, then that attributed string goes into a UILabel for display.

Diagnosis

Shield icons in the Navigation Guidance Day v4 style’s sprite sheet are sized for display:

navigation-guidance-day-v4

By contrast, shield icons in a custom style’s sprite sheet are much larger:

custom

At the original scale, the icons in the custom style’s sprite sheet would be too large to comfortably display in the label. On the map, however, the icons appear roughly the same size because of the icon-size property in the style JSON:

  • In the custom style, the road-number-shield-navigation layer has icon-size set to an exponential interpolation expression with stops at 0.5 at z13 and at 1 at z22.
  • In Navigation Guidance Day v4, the road-shields-white and road-shields-black layers have icon-size set to a function (interpreted as a linear interpolation expression) with stops at 0.75 at z6 and 1 at z11.

#1576 assumes the style image is at full size and can be displayed without any downscaling. This is apparently no longer the case when it comes to styles created in Studio, now that style components have landed.

Affected customers

Any customer who creates a custom map style in Studio is affected. More likely than not, a customer who develops against the iOS navigation SDK will choose the Navigation template, which comes with these jumbo sprites by default.

Customers who are content with the v4 navigation styles are unaffected, because the sprites are the right size to begin with.

Next steps

As a failsafe, RoadNameLabelAttachment.getter:compositeImage should constrain the image size when calling UIImage.insert(text:color:font:atPoint:scale:) to something more reasonable, perhaps 1.2 times the attributed string’s paragraph style’s line height.

@1ec5 1ec5 changed the title Custom style causes waypoint label to be mis-sized Custom map style makes current road name label is too tall, route shield is too big Apr 8, 2020
@1ec5 1ec5 changed the title Custom map style makes current road name label is too tall, route shield is too big Custom map style makes current road name label too tall, route shield too big Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working UI Work related to visual components, Android Auto, Camera, 3D, voice, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants