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

TextLayer Styling #4579

Closed
5 tasks
btbritz opened this issue May 8, 2020 · 7 comments
Closed
5 tasks

TextLayer Styling #4579

btbritz opened this issue May 8, 2020 · 7 comments
Labels
Milestone

Comments

@btbritz
Copy link

btbritz commented May 8, 2020

Target Use case

Add a cleaner look and feel of the text out of the box rather than trying to make a new custom layer altogether. Padding, border-radius, and a separate alpha channel on the background prop thats already there (Rather than it being linked to color or opacity). Maybe a slight drop shadow? Nothing crazy, just something that isn't so ridged...

Proposed feature

Something in the vain of:
Screen Shot 2020-05-08 at 4 00 39 PM

To Do List

  • Add label and assign to milestone
  • Coding
  • Doc update
  • What’s new update
  • Test
@jfuehner
Copy link

jfuehner commented Nov 27, 2020

Along the same line with regards to @btbritz suggested enhancements to the TextLayer styling. It would be great if support was added for styling the border color and border width around the text label's bounding box...

ArcGIS Feature Service JSON has a esriTS type for TextSymbol's. The TextSymbol object supports both borderLineColor and borderLineSize properties which provide the ability style the border around the text label bounding box...

https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol.html

@jfuehner
Copy link

jfuehner commented Dec 8, 2020

To add-on to this request. It would also be great if the TextLayer would provide the ability to add a stroke/outline to the text characters.

@Jojocaster
Copy link

Jojocaster commented Jan 18, 2021

While having a dedicated alpha channel shouldn't be hard (one line to change here and there) I'm struggling a bit to figure out how to get to the background itself - maybe padding could be handled here, and maybe handle the border radius in the shader?
I'm not the best when it comes to shaders, but as far as I get it alphaCutOff seems to be determining whether we're painting the background or the text - there might be something to do there.
I assume adding a border shouldn't be too hard, a simple vec2 border = step(vec2(borderSize), uv); float pct = borders.x * borders.y; gl_FragColor = vec4(color, whateverAlpha) should do the trick.

@Pessimistress
Copy link
Collaborator

The following new props are now available in 8.5.0-alpha.1:

  • background
  • backgroundPadding
  • outlineWidth
  • outlineColor
  • getBackgroundColor
  • getBorderWidth
  • getBorderColor

See https://github.com/visgl/deck.gl/blob/master/docs/api-reference/layers/text-layer.md for details.

@rammoozz
Copy link
Contributor

rammoozz commented Feb 26, 2021

@Pessimistress thanks for the update, may I recommend backgroundPadding accept 4 parameters? similar to CSS, this would allow more control for each side.

I think getBorderRadius would benefit from the same.

@rammoozz
Copy link
Contributor

Related: #5598

@Pessimistress
Copy link
Collaborator

v8.5.0 is published. Please open a new issue for any additional feature requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants