-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
DashArray wrong with strokeUniform #5939
Comments
I found a (partial) workaround: Divide the DashArray parameters by the
It works well for Circle, Triangle, Ellipse. Not so well for Rect. This hint might also help with bugfixing. |
I will try to fix it as a part of PR #5950, since it touches a common area of problems. |
Deleted my comment, the bug here is that i have no memory of why the strokeWidth is playing a role in the stroke dash array. I hope there are some comments in the code or in the PR that introduced the feature |
This is the code. |
i think the idea of that code was to avoid having strokeDashes of 1 with big stroke width that would look awful, but eventually that is not a problem of the strokeUniform, nor a problem of fabricJS. I'll meet the guy that wrote that code later, i ll ask him if he remember |
@korzo89 opene a separate PR, this is an easier fix, while i have no idea what we should do with the other one. Start with removing the code i linked, and let's see what is the end result. |
asturur, I think you are right. The length of the strokes / dashes schould fit to the strokeWidth. But this should be handled in the application not in fabrcs.js, I think. For strokeWidth between 0.5px and 30px I came up with a squareroot relation. Including the workaround that I mentioned above, this is my code. `
` |
Version
3.4.0
(also in version 2.7.0)
Test Case
https://jsfiddle.net/awehring/osv8Lr2k/23/
Information about environment
Firefox 70.0
Edge 44.18362.387.0
Steps to reproduce
Define a DashArray for a Stroke of a Rect, Circle, Triangle or other object with
strokeUniform = false
.Define a DashArray for a Stroke of an identical object with
strokeUniform = true
.Compare the two objects.
Expected Behavior
The strokes for both objects should look the same.
Actual Behavior
The strokes for the second object (yellow) are about 5 times as long as for the first (green).
The text was updated successfully, but these errors were encountered: