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

Restore support for breaks along line labels #12377

Merged
merged 6 commits into from
Nov 17, 2022
Merged

Conversation

mourner
Copy link
Member

@mourner mourner commented Nov 12, 2022

Restores support for line breaks on labels placed along lines, which was (possibly unintentionally) removed in #8706. It's a useful feature, and it brings GL JS on par with both GL Native, and the way map renders in Studio, because it loads RTL text plugin by default (so line breaks handling is delegated to the plugin which does support them).

Closes #7203, closes #9743, ref GLJS-228.

At the moment we can't test this with a render test, because all render tests run with the RTL Text plugin loaded globally:

mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js');

We can try addressing this in a different PR. To prove that this PR fixes breaks along lines, I added a commit that disables RTL in tests to show how the multiline tests fail (disregarding RTL tests), then a commit return the fix in this PR with RTL still disabled to show that previously failing multiline tests pass, then finally restoring RTL to make the PR green. Example test:

before after
image image

Launch Checklist

  • briefly describe the changes in this PR
  • include before/after visuals or gifs if this PR includes visual changes
  • write tests for all new functionality
  • post benchmark scores
  • manually test the debug page
  • tagged @mapbox/map-design-team @mapbox/static-apis if this PR includes style spec API or visual changes — cc @tristen
  • apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'
  • add an entry inside this element for inclusion in the mapbox-gl-js changelog: <changelog>Fix line breaks not working on labels along lines</changelog>

@mourner mourner requested a review from a team as a code owner November 12, 2022 20:00
@mourner mourner merged commit 2167e5f into main Nov 17, 2022
@mourner mourner deleted the restore-breaks-along-line branch November 17, 2022 19:33
ansis pushed a commit that referenced this pull request Nov 21, 2022
* restore support for breaks in line labels

* remove RTL plugin in tests; revert line breaks

* restore line breaks to see relevant tests pass without RTL

* reenable RTL in tests

* add a test for shaping with line placement + breaks

* remove unused placement param from shapeText
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Newline in Mapbox Studio Text Field still no worky New line in labels on polygons with Mapbox client
2 participants