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

Set Line shapeRendering to crispEdges if rectilinear #840

Merged
merged 1 commit into from
Oct 6, 2020

Conversation

kmiyashiro
Copy link
Contributor

Resolves cases where rectilinear lines on non-high DPI screens have an extra semi-opaque pixel added to the width because the line is set between pixels: #656

🚀 Enhancements

  • Automatically set shapeRendering to crispEdges if rectilinear (completely horizontal or vertical).

I think this is the safest setting because using crispEdges on non-rectilinear lines may disable anti-aliasing, depending on the user agent.

https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering

crispEdges
This value indicates that the user agent shall attempt to emphasize the contrast between clean edges of artwork over rendering speed and geometric precision. To achieve crisp edges, the user agent might turn off anti-aliasing for all lines and curves or possibly just for straight lines which are close to vertical or horizontal. Also, the user agent might adjust line positions and line widths to align edges with device pixels.

@coveralls
Copy link

coveralls commented Oct 4, 2020

Pull Request Test Coverage Report for Build 79

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.06%) to 55.318%

Totals Coverage Status
Change from base Build 283122090: 0.06%
Covered Lines: 1153
Relevant Lines: 2029

💛 - Coveralls

Copy link
Collaborator

@williaster williaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amazing, thanks for the addition @kmiyashiro! 🙌 I agree the rectilinear dependency makes sense.

@williaster williaster merged commit 806fb59 into airbnb:master Oct 6, 2020
@kmiyashiro kmiyashiro deleted the km/crisp-edges branch October 6, 2020 04:59
@williaster williaster added this to the 1.1.0 milestone Oct 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants