-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
Fix custom linear gradient angles #3109
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: a7c5661 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
const normalisedCos = Math.cos(normalizedAngleRad); | ||
scale = normalisedCos; | ||
} else { | ||
// FIXME: fallback, but might break paintStyleMatchesColorToken |
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.
Might break? Is there another safe fallback for this case, or a test to doublecheck?
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.
Node type check removed, so this is not relevant now. paintStyleMatchesColorToken
might fail until the nodes are updated (apply to selection/page is run), but the previous gradient should be treated as broken/incorrect I think until updated.
|
||
let scale = 1; | ||
|
||
if (['RECTANGLE', 'FRAME'].includes(node?.type || '')) { |
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.
This could be saved as a constant above, easier to find if there's other types that need to be added later?
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.
Have removed this as it seems to be unnecessary. Vector linear gradient scales were breaking because of this check.
|
||
const gradientTransformMatrix = inverse(transformationMatrix).to2DArray(); |
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.
inverse(...)
is not needed anymore?
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.
No, since new Matrix([...])
is being called inline now.
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.test.ts
Fixed
Show fixed
Hide fixed
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.test.ts
Fixed
Show fixed
Hide fixed
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.test.ts
Fixed
Show fixed
Hide fixed
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.test.ts
Fixed
Show fixed
Hide fixed
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.test.ts
Fixed
Show fixed
Hide fixed
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.ts
Fixed
Show fixed
Hide fixed
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.ts
Fixed
Show fixed
Hide fixed
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.ts
Fixed
Show fixed
Hide fixed
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.ts
Fixed
Show fixed
Hide fixed
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.ts
Fixed
Show fixed
Hide fixed
Commit SHA:11c54b5bb79d231532c8a89e6a162b368c8cc4de Test coverage results 🧪
|
Commit SHA:11c54b5bb79d231532c8a89e6a162b368c8cc4de |
@macintoshhelper linting seems to have failed here |
…okens-studio/figma-plugin into fix/2331-custom-angle-linear-gradients
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.test.ts
Fixed
Show fixed
Hide fixed
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.ts
Fixed
Show fixed
Hide fixed
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.ts
Fixed
Show fixed
Hide fixed
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.ts
Fixed
Show fixed
Hide fixed
packages/tokens-studio-for-figma/src/plugin/figmaTransforms/gradients.ts
Fixed
Show fixed
Hide fixed
…okens-studio/figma-plugin into fix/2331-custom-angle-linear-gradients
Fixed the ESLint errors |
Why does this PR exist?
Partial fix for #2331
What does this pull request do?
Before
After
Testing this change
Additional Notes (if any)