-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
refactor(): cache state => rm isTextObject
#8952
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
|
ShaMan123
left a comment
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.
DONE
src/shapes/Text/Text.ts
Outdated
| // IMHO in these lines we are using zoomX and zoomY not the this version. | ||
| const additionalWidth = | ||
| data.additionalSize.width + this.getHeightOfLine(0) * this.zoomX!; | ||
| const additionalHeight = | ||
| data.additionalSize.height + this.getHeightOfLine(0) * this.zoomY!; |
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 is a comment you left here
ShaMan123
left a comment
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.
DONE after porting
| // eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
| export interface Text< | ||
| Props extends TProps<TextProps> = Partial<TextProps>, | ||
| SProps extends SerializedTextProps = SerializedTextProps, | ||
| EventSpec extends ObjectEvents = ObjectEvents | ||
| > extends TextSVGExportMixin {} |
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.
typed the svg mixin
| getSVGFontList() { | ||
| const fontList: Record<string, boolean> = { [this.fontFamily]: true }; | ||
| this.styles && | ||
| Object.values(this.styles).forEach((styleRow) => { | ||
| Object.values(styleRow).forEach(({ fontFamily = '' }) => { | ||
| fontList[fontFamily] = true; | ||
| }); | ||
| }); | ||
| return fontList; | ||
| } |
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.
ported from #8954
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs 😔. Thank you for your contributions. |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs 😔. Thank you for your contributions. |
|
We disagreed on this so closing |
Motivation
#8931
Description
The last part of type assertion to handle.
I had to refactor the messy logic of
_updateCacheCanvasand extract from it a method that has no side effectsgetCacheStateso Text can override it.Apart from that is is only one more use of
isTextObjectfabric.js/src/canvas/StaticCanvas.ts
Lines 1319 to 1321 in a1f94b2
I extracted that logic to the text svg mixin =>
getSVGFontListChanges
Gist
In Action