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

Add support for dotted/dashed border styles #1146

Closed
wants to merge 2 commits into from

Conversation

eKoopmans
Copy link
Contributor

Feature: Dotted/dashed border styles

Until now, dotted/dashed borders were rendered as solid borders. This should now render them correctly.

Implementation

The default border-rendering is left untouched: it is rendered as a shape and filled with a solid color.

However, when a border is detected as 'dotted' or 'dashed', rendering now switches to a path-based approach, which draws the path of the border and applies the appropriate style using ctx.setLineDash().

Thanks to @Rodris in #210 for getting things started.

Related issues/pull requests

#96, #210, #366, #413, #414, #589, #984, #1036, #1117

@eKoopmans
Copy link
Contributor Author

For anyone looking for a version of html2canvas with this pull request merged in, feel free to grab a copy at this fork (it also has my other recent pull requests merged).

@niklasvh niklasvh added this to Backlog in Backlog Jul 28, 2017
@niklasvh niklasvh force-pushed the master branch 3 times, most recently from 932773c to 1584357 Compare December 3, 2017 10:23
@eKoopmans
Copy link
Contributor Author

Not yet merged - looking at the new build, this approach could still be plugged into renderBorder. The particulars of how I implemented this aren't very pretty (mostly because of my limited understanding of curvePoints, etc), but the idea is to create a path instead of drawing a shape, then ctx.stroke() it with the appropriate ctx.strokeStyle.

@thedeany
Copy link

thedeany commented Apr 2, 2019

Any chance of this being merged any time soon?

@gamesover
Copy link

any progress for this MR?

@chaosJS
Copy link

chaosJS commented Jul 25, 2019

border dashed style still rendered as solid version 1.0.0-rc.3 @niklasvh

@LeiFu88
Copy link

LeiFu88 commented Jul 30, 2019

Any update for this PR?

@codefactor
Copy link

@niklasvh ,

Looks like this PR might be solving an issue, where in my case we use dashed/dotted borders to draw lines in a chart. We are getting a customer issue where they complain these dashed lines in the chart are coming as solid lines.

I haven't tested this myself - but if this PR works, then we are considering using the fix in this PR, but it would be great if this were merged and part of an official new production release of html2canvas

I wonder what is the hold-up, I understand that this issue might not be a priority, but I would like to get a sense of how stable this fix is before I recommend my team to pick up this change and use it in production.

@thedeany
Copy link

@niklasvh Any thoughts or updates on getting this merged?

@locvnhub
Copy link

Please fix this issue.

@niklasvh
Copy link
Owner

Support for other border styles was added in #2531

@niklasvh niklasvh closed this Jul 12, 2021
@codefactor
Copy link

@niklasvh awesome to see updates on this old ticket!

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

Successfully merging this pull request may close these issues.

None yet

8 participants