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

Line breaks with \n or \r not working properly for symbol layers with line or line-center placements #3814

Closed
DanielForniessoria-TomTom opened this issue Mar 8, 2024 · 2 comments · Fixed by #4124
Labels
bug Something isn't working enhancement New feature or request PR is more than welcomed Extra attention is needed

Comments

@DanielForniessoria-TomTom
Copy link
Contributor

maplibre-gl-js version: 4+

browser: chrome (probably any)

Steps to Trigger Behavior

  1. Create a GeoJSON source and symbol layer
  2. Show a piece of text with "text-field" containing a line break in it \n
  3. Start with "symbol-placement": "point", give it some coordinates
  4. The text should appear correctly in 2 lines
  5. Now change the source to a line string, draw a basic line
  6. Change the symbol placement to "line" or "line-center"
  7. BUG: the text now appears in one line
  8. GLITCH: if you zoom all the way out, wait a moment, and zoom back in, now the text might appear in 2 lines

Expected Behavior

Symbol layers with "line" or "line-center" placement containing "text-field" values with line breaks should display such texts in multiple lines.

Actual Behavior

Symbol layers with "line" or "line-center" placement containing "text-field" values with line breaks are displaying the text on a single line.

@HarelM HarelM added bug Something isn't working enhancement New feature or request PR is more than welcomed Extra attention is needed labels Mar 8, 2024
@HarelM
Copy link
Member

HarelM commented Mar 8, 2024

JSbin/codepen link would be great to show the problem I believe.
Thanks for taking the time to open this issue!

@naogify
Copy link
Contributor

naogify commented May 10, 2024

Thank you for creating the issue.
I can reproduce the error. Here is the sample code.

symbol-placement: line

https://codepen.io/naogify/pen/XWwWYyz

symbol-placement: point

https://codepen.io/naogify/pen/MWdWBYE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request PR is more than welcomed Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants