-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
chore(TS): Add more type-checks for remaining files #9097
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
774bafd
mess
asturur 3427416
update CHANGELOG.md
github-actions[bot] 3196a55
minor
asturur 30766a6
more type check
asturur ffcf439
fixed test
asturur 81ecadf
changelog
asturur 28d5b23
more types
asturur 08a98ee
progress
asturur 52cd316
need help
asturur a103c0c
restored import
asturur c18be78
Merge branch 'master' into finish-ts-nocheck
asturur 7c5072d
type passes
ShaMan123 ab2e9d5
cleanup
ShaMan123 e169015
only one line left
ShaMan123 75f7ccb
cleanup ElementsParser
ShaMan123 5027e00
Merge branch 'master' into finish-ts-nocheck
asturur 35b77ed
some textbox leftovers to do
asturur 786cabc
more parser
asturur 10b27da
more parser
asturur 9437578
less changes
asturur 9ff53ec
found the bug
asturur 02e9c08
toObject never works
asturur c68dcfb
prettier
asturur 696cc36
maybe save some code
asturur 6fc5206
fix
asturur 21f064b
fix
asturur 5c3df7d
slightly different expot
asturur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,41 @@ | ||
| //@ts-nocheck | ||
| import { Color } from '../color/Color'; | ||
| import { toFixed } from '../util/misc/toFixed'; | ||
| import { colorAttributes } from './constants'; | ||
| import { FabricObject } from '../shapes/Object/FabricObject'; | ||
|
|
||
| const colorAttributesMap = { | ||
| stroke: 'strokeOpacity', | ||
| fill: 'fillOpacity', | ||
| }; | ||
|
|
||
| /** | ||
| * @private | ||
| * @param {Object} attributes Array of attributes to parse | ||
| */ | ||
|
|
||
| export function setStrokeFillOpacity(attributes) { | ||
| for (const attr in colorAttributes) { | ||
| export function setStrokeFillOpacity( | ||
| attributes: Record<string, any> | ||
| ): Record<string, any> { | ||
| const defaults = FabricObject.getDefaults(); | ||
| Object.entries(colorAttributesMap).forEach(([attr, colorAttr]) => { | ||
| if ( | ||
| typeof attributes[colorAttributes[attr]] === 'undefined' || | ||
| typeof attributes[colorAttr] === 'undefined' || | ||
| attributes[attr] === '' | ||
| ) { | ||
| continue; | ||
| return; | ||
| } | ||
| const defaults = FabricObject.getDefaults(); | ||
| if (typeof attributes[attr] === 'undefined') { | ||
| if (!defaults[attr]) { | ||
| continue; | ||
| return; | ||
| } | ||
| attributes[attr] = defaults[attr]; | ||
| } | ||
|
|
||
| if (attributes[attr].indexOf('url(') === 0) { | ||
| continue; | ||
| return; | ||
| } | ||
|
|
||
| const color = new Color(attributes[attr]); | ||
| attributes[attr] = color | ||
| .setAlpha( | ||
| toFixed(color.getAlpha() * attributes[colorAttributes[attr]], 2) | ||
| ) | ||
| .setAlpha(toFixed(color.getAlpha() * attributes[colorAttr], 2)) | ||
| .toRgba(); | ||
| } | ||
| }); | ||
| return attributes; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
moved to the text svg export