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

Behavior of line-cap + line-dasharray #884

Closed
nickidlugash opened this issue Dec 12, 2014 · 6 comments
Closed

Behavior of line-cap + line-dasharray #884

nickidlugash opened this issue Dec 12, 2014 · 6 comments

Comments

@nickidlugash
Copy link

Currently, line caps do not control the caps of line segments in lines using line-dasharray. They do in carto, and I think they should in GL, too.

In carto:

screen shot 2014-12-12 at 1 35 54 pm

In mapbox-gl-js:

screen shot 2014-12-12 at 1 36 53 pm

  {
    "id": "BicycleLane",
    "type": "line",
    "source": "Bike Lanes DC",
    "source-layer": "BicycleLane",
    "layout": {
      "line-cap": "round",
      "line-join": "round"
    },
    "paint": {
      "line-color": "#942192",
      "line-width": "6",
     "line-dasharray": [6, 2]
    }
  }
@peterqliu
Copy link
Contributor

What would happen if the dash were shorter than the radius of the cap?
Long dashes would look fine as "( )", but they'd become this fish-shaped wedge when short "()"

@jfirebaugh
Copy link
Contributor

This is part of #649.

@nickidlugash
Copy link
Author

@jfirebaugh awesome – really looking forward to all those dasharray improvements being merged in.

What would happen if the dash were shorter than the radius of the cap?

@peterqliu I'm not sure how @ansis implemented this, but in most styling programs, the dash shape tends to a perfect circle as the dash length tends to 0, since at 0, the two semi-circle caps join up to form a circle. Carto does this too, although it doesn't seem to actually render a value of 0 (but you could do 0.01).

@peterqliu
Copy link
Contributor

the two semi-circle caps join up to form a circle

@nickidlugash this is interesting, because that would mean the length of a dash is really the dash, plus two end caps. Since a round cap gets longer as you thicken a stroke, that means each dash gets slightly longer as the line gets thicker?

@nickidlugash
Copy link
Author

@nickidlugash this is interesting, because that would mean the length of a dash is really the dash, plus two end caps. Since a round cap gets longer as you thicken a stroke, that means each dash gets slightly longer as the line gets thicker?

y, it should. In the PR linked above, the line-dasharray values will be scale factors of the line-width, so the dash array should stay proportional.

@ansis
Copy link
Contributor

ansis commented Jan 23, 2015

done in #938

@ansis ansis closed this as completed Jan 23, 2015
zjp369 pushed a commit to zjp369/mapbox-gl-js that referenced this issue May 22, 2022
@zjp369 zjp369 mentioned this issue May 22, 2022
10 tasks
zjp369 pushed a commit to zjp369/mapbox-gl-js that referenced this issue May 22, 2022
zjp369 pushed a commit to zjp369/mapbox-gl-js that referenced this issue May 22, 2022
zjp369 pushed a commit to zjp369/mapbox-gl-js that referenced this issue May 22, 2022
zjp369 pushed a commit to zjp369/mapbox-gl-js that referenced this issue May 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants