-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
fix(Controls) avoid sliding with stroke uniform #9458
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
Conversation
|
Build Stats
|
|
MIssing code cleanup and interaction test. |
…js into polyline-stroke-uniform
|
also polygons with skew do not work ok. |
|
You blocked that fix |
|
I have given a quick read |
it wasn't linked in the issue or mentioned, can you point me to it? |
This the wrong approach imho. strokeUniform is a weird functionality to support, the real fix would be removing strokeUniform, so stroke can stay happily in calculation. |
|
This is a discussion to conduct thoroughly. |
|
It is a major part of the design of fabric and the coords/layout system |
|
strokeUniform will not be that much of a pain if stroke is not part of layout |
|
oh now i understand what you mean. Yes i still think skewing is an edge case and if you want to support it with polygon editing you are better off merging skew in the points every time you apply it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a two points horizontal polyline with strokeWidth = 0, it's height will be 0. Does the divide in below got NaN?
const newPositionNormalized = anchorPoint
.subtract(poly.pathOffset)
.divide(poly._getNonTransformedDimensions())
.multiply(adjustFlip);
| // do all calculation without strokeWidth | ||
| // to avoid scaling issues between dimensions and scaling factors | ||
| // when strokeUniform is set as true | ||
| poly.strokeWidth = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getStrokeWidthVector(strokeWidth = this.strokeWidth) {
const strokeWidthFactor = new fabric.Point(strokeWidth, strokeWidth);
return this.strokeUniform
? strokeWidthFactor.divide(this.getObjectScaling())
: strokeWidthFactor;
}|
this is obsolete |
Motivation
As reported in #9423 , there is an issue in determining the correct anchor point when strokeUniform is used.
This PR propose a fix by excluding strokeWidth by the calculations when determining the anchor point.
closes #9423
Description
Changes
Gist
In Action