-
-
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
chore(TS): Text SVG export mixin #8486
Conversation
Build Stats
|
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.
READY
renamed src/mixins/itext.svg_export.ts
to src/mixins/text.svg_export.ts
Github doesn't pick it up because the diff is too large. Revert at will, ebbbffd
@@ -170,25 +177,6 @@ export class FabricObjectSVGExportMixin { | |||
return `${svgTransform}${additionalTransform}" `; | |||
} | |||
|
|||
_setSVGBg(textBgRects: string[]) { |
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.
used by text, refactored into text svg export mixin
src/mixins/object.svg_export.ts
Outdated
* @param value | ||
* @returns | ||
*/ | ||
export function getSvgColorString(prop: string, value?: any) { |
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.
now used by Text instead of _getFillAttributes
index.js
Outdated
@@ -55,8 +55,8 @@ import './src/filters/gamma_filter.class'; // optional image_filters | |||
import './src/filters/composed_filter.class'; // optional image_filters | |||
import './src/filters/hue_rotation.class'; // optional image_filters | |||
import './src/shapes/text.class'; // optional text | |||
import './src/mixins/itext.svg_export'; // optional svg |
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.
Naming is wrong, it is a Text mixin. So it should be applied before subclassing IText
src/mixins/itext.svg_export.ts
Outdated
textAndBg = this._getSVGTextAndBg(offsets.textTop, offsets.textLeft); | ||
return this._wrapSVGTextAndBg(textAndBg); | ||
}, | ||
function createSVGRect( |
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.
formally _setSVGBg
and _pushTextBgRect
|
||
/* _TO_SVG_START_ */ | ||
|
||
function getSvgColorString(prop: string, value?: any) { |
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.
extracted to util and renamed to colorPropToSVG
/** | ||
* @deprecated unused | ||
*/ | ||
_getSVGLineTopOffset(lineIndex: number) { |
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 method is dead
can we remove 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.
READY
Motivation
Description
Last file accept canvas files
Changes
src/mixins/itext.svg_export.ts
:The diff is very harsh... Perhaps better to view commit by commit? Since the first commit is the transfomer's work and the second is just generic migration and moving a method or 2.
Renamed to
src/mixins/text.svg_export.ts
since Github doesn't pick it up because the diff is too large. Revert at will, ebbbffdsrc/mixins/object.svg_export.ts
: cleanupsrc/shapes/itext.class.ts
: jsdocsrc/util/misc/svgParsing.ts
: extract utils to hereGist
In Action