fabric 6.4.2 → 6.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +10 -4
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.cjs +10 -4
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +10 -4
- package/dist/index.node.mjs.map +1 -1
- package/dist/package.json.min.mjs +1 -1
- package/dist/package.json.mjs +1 -1
- package/dist/src/controls/changeWidth.d.ts.map +1 -1
- package/dist/src/controls/changeWidth.min.mjs +1 -1
- package/dist/src/controls/changeWidth.min.mjs.map +1 -1
- package/dist/src/controls/changeWidth.mjs +2 -2
- package/dist/src/controls/changeWidth.mjs.map +1 -1
- package/dist/src/shapes/Text/Text.d.ts +4 -0
- package/dist/src/shapes/Text/Text.d.ts.map +1 -1
- package/dist/src/shapes/Text/Text.min.mjs +1 -1
- package/dist/src/shapes/Text/Text.min.mjs.map +1 -1
- package/dist/src/shapes/Text/Text.mjs +7 -1
- package/dist/src/shapes/Text/Text.mjs.map +1 -1
- package/dist-extensions/src/controls/changeWidth.d.ts.map +1 -1
- package/dist-extensions/src/shapes/Text/Text.d.ts +4 -0
- package/dist-extensions/src/shapes/Text/Text.d.ts.map +1 -1
- package/package.json +1 -3
- package/rollup.config.mjs +2 -1
- package/src/controls/changeWidth.test.ts +9 -0
- package/src/controls/changeWidth.ts +3 -4
- package/src/shapes/Text/Text.ts +14 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var r="6.4.
|
|
1
|
+
var r="6.4.3";export{r as version};
|
|
2
2
|
//# sourceMappingURL=package.json.min.mjs.map
|
package/dist/package.json.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changeWidth.d.ts","sourceRoot":"","sources":["../../../src/controls/changeWidth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAO/D;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"changeWidth.d.ts","sourceRoot":"","sources":["../../../src/controls/changeWidth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAO/D;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,EAAE,sBAiC/B,CAAC;AAEF,eAAO,MAAM,WAAW,8DAGvB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{RESIZING as i,CENTER as r,RIGHT as t,LEFT as o}from"../constants.min.mjs";import{resolveOrigin as m}from"../util/misc/resolveOrigin.min.mjs";import{getLocalPoint as n,isTransformCentered as s}from"./util.min.mjs";import{wrapWithFireEvent as e}from"./wrapWithFireEvent.min.mjs";import{wrapWithFixedAnchor as a}from"./wrapWithFixedAnchor.min.mjs";const h=(i,e,a,h)=>{const c=n(e,e.originX,e.originY,a,h);if(m(e.originX)===m(r)||m(e.originX)===m(t)&&c.x<0||m(e.originX)===m(o)&&c.x>0){const{target:i}=e,r=i.strokeWidth/(i.strokeUniform?i.scaleX:1),t=s(e)?2:1,o=i.width,m=Math.
|
|
1
|
+
import{RESIZING as i,CENTER as r,RIGHT as t,LEFT as o}from"../constants.min.mjs";import{resolveOrigin as m}from"../util/misc/resolveOrigin.min.mjs";import{getLocalPoint as n,isTransformCentered as s}from"./util.min.mjs";import{wrapWithFireEvent as e}from"./wrapWithFireEvent.min.mjs";import{wrapWithFixedAnchor as a}from"./wrapWithFixedAnchor.min.mjs";const h=(i,e,a,h)=>{const c=n(e,e.originX,e.originY,a,h);if(m(e.originX)===m(r)||m(e.originX)===m(t)&&c.x<0||m(e.originX)===m(o)&&c.x>0){const{target:i}=e,r=i.strokeWidth/(i.strokeUniform?i.scaleX:1),t=s(e)?2:1,o=i.width,m=Math.abs(c.x*t/i.scaleX)-r;return i.set("width",Math.max(m,1)),o!==i.width}return!1},c=e(i,a(h));export{h as changeObjectWidth,c as changeWidth};
|
|
2
2
|
//# sourceMappingURL=changeWidth.min.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changeWidth.min.mjs","sources":["../../../src/controls/changeWidth.ts"],"sourcesContent":["import type { TransformActionHandler } from '../EventTypeDefs';\nimport { CENTER, LEFT, RESIZING, RIGHT } from '../constants';\nimport { resolveOrigin } from '../util/misc/resolveOrigin';\nimport { getLocalPoint, isTransformCentered } from './util';\nimport { wrapWithFireEvent } from './wrapWithFireEvent';\nimport { wrapWithFixedAnchor } from './wrapWithFixedAnchor';\n\n/**\n * Action handler to change object's width\n * Needs to be wrapped with `wrapWithFixedAnchor` to be effective\n * @param {Event} eventData javascript event that is doing the transform\n * @param {Object} transform javascript object containing a series of information around the current transform\n * @param {number} x current mouse x position, canvas normalized\n * @param {number} y current mouse y position, canvas normalized\n * @return {Boolean} true if some change happened\n */\nexport const changeObjectWidth: TransformActionHandler = (\n eventData,\n transform,\n x,\n y,\n) => {\n const localPoint = getLocalPoint(\n transform,\n transform.originX,\n transform.originY,\n x,\n y,\n );\n // make sure the control changes width ONLY from it's side of target\n if (\n resolveOrigin(transform.originX) === resolveOrigin(CENTER) ||\n (resolveOrigin(transform.originX) === resolveOrigin(RIGHT) &&\n localPoint.x < 0) ||\n (resolveOrigin(transform.originX) === resolveOrigin(LEFT) &&\n localPoint.x > 0)\n ) {\n const { target } = transform,\n strokePadding =\n target.strokeWidth / (target.strokeUniform ? target.scaleX : 1),\n multiplier = isTransformCentered(transform) ? 2 : 1,\n oldWidth = target.width,\n newWidth
|
|
1
|
+
{"version":3,"file":"changeWidth.min.mjs","sources":["../../../src/controls/changeWidth.ts"],"sourcesContent":["import type { TransformActionHandler } from '../EventTypeDefs';\nimport { CENTER, LEFT, RESIZING, RIGHT } from '../constants';\nimport { resolveOrigin } from '../util/misc/resolveOrigin';\nimport { getLocalPoint, isTransformCentered } from './util';\nimport { wrapWithFireEvent } from './wrapWithFireEvent';\nimport { wrapWithFixedAnchor } from './wrapWithFixedAnchor';\n\n/**\n * Action handler to change object's width\n * Needs to be wrapped with `wrapWithFixedAnchor` to be effective\n * @param {Event} eventData javascript event that is doing the transform\n * @param {Object} transform javascript object containing a series of information around the current transform\n * @param {number} x current mouse x position, canvas normalized\n * @param {number} y current mouse y position, canvas normalized\n * @return {Boolean} true if some change happened\n */\nexport const changeObjectWidth: TransformActionHandler = (\n eventData,\n transform,\n x,\n y,\n) => {\n const localPoint = getLocalPoint(\n transform,\n transform.originX,\n transform.originY,\n x,\n y,\n );\n // make sure the control changes width ONLY from it's side of target\n if (\n resolveOrigin(transform.originX) === resolveOrigin(CENTER) ||\n (resolveOrigin(transform.originX) === resolveOrigin(RIGHT) &&\n localPoint.x < 0) ||\n (resolveOrigin(transform.originX) === resolveOrigin(LEFT) &&\n localPoint.x > 0)\n ) {\n const { target } = transform,\n strokePadding =\n target.strokeWidth / (target.strokeUniform ? target.scaleX : 1),\n multiplier = isTransformCentered(transform) ? 2 : 1,\n oldWidth = target.width,\n newWidth =\n Math.abs((localPoint.x * multiplier) / target.scaleX) - strokePadding;\n target.set('width', Math.max(newWidth, 1));\n // check against actual target width in case `newWidth` was rejected\n return oldWidth !== target.width;\n }\n return false;\n};\n\nexport const changeWidth = wrapWithFireEvent(\n RESIZING,\n wrapWithFixedAnchor(changeObjectWidth),\n);\n"],"names":["changeObjectWidth","eventData","transform","x","y","localPoint","getLocalPoint","originX","originY","resolveOrigin","CENTER","RIGHT","LEFT","target","strokePadding","strokeWidth","strokeUniform","scaleX","multiplier","isTransformCentered","oldWidth","width","newWidth","Math","abs","set","max","changeWidth","wrapWithFireEvent","RESIZING","wrapWithFixedAnchor"],"mappings":"gWAgBO,MAAMA,EAA4CA,CACvDC,EACAC,EACAC,EACAC,KAEA,MAAMC,EAAaC,EACjBJ,EACAA,EAAUK,QACVL,EAAUM,QACVL,EACAC,GAGF,GACEK,EAAcP,EAAUK,WAAaE,EAAcC,IAClDD,EAAcP,EAAUK,WAAaE,EAAcE,IAClDN,EAAWF,EAAI,GAChBM,EAAcP,EAAUK,WAAaE,EAAcG,IAClDP,EAAWF,EAAI,EACjB,CACA,MAAMU,OAAEA,GAAWX,EACjBY,EACED,EAAOE,aAAeF,EAAOG,cAAgBH,EAAOI,OAAS,GAC/DC,EAAaC,EAAoBjB,GAAa,EAAI,EAClDkB,EAAWP,EAAOQ,MAClBC,EACEC,KAAKC,IAAKnB,EAAWF,EAAIe,EAAcL,EAAOI,QAAUH,EAG5D,OAFAD,EAAOY,IAAI,QAASF,KAAKG,IAAIJ,EAAU,IAEhCF,IAAaP,EAAOQ,KAC7B,CACA,OAAO,CAAK,EAGDM,EAAcC,EACzBC,EACAC,EAAoB9B"}
|
|
@@ -23,8 +23,8 @@ const changeObjectWidth = (eventData, transform, x, y) => {
|
|
|
23
23
|
strokePadding = target.strokeWidth / (target.strokeUniform ? target.scaleX : 1),
|
|
24
24
|
multiplier = isTransformCentered(transform) ? 2 : 1,
|
|
25
25
|
oldWidth = target.width,
|
|
26
|
-
newWidth = Math.
|
|
27
|
-
target.set('width', Math.max(newWidth,
|
|
26
|
+
newWidth = Math.abs(localPoint.x * multiplier / target.scaleX) - strokePadding;
|
|
27
|
+
target.set('width', Math.max(newWidth, 1));
|
|
28
28
|
// check against actual target width in case `newWidth` was rejected
|
|
29
29
|
return oldWidth !== target.width;
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changeWidth.mjs","sources":["../../../src/controls/changeWidth.ts"],"sourcesContent":["import type { TransformActionHandler } from '../EventTypeDefs';\nimport { CENTER, LEFT, RESIZING, RIGHT } from '../constants';\nimport { resolveOrigin } from '../util/misc/resolveOrigin';\nimport { getLocalPoint, isTransformCentered } from './util';\nimport { wrapWithFireEvent } from './wrapWithFireEvent';\nimport { wrapWithFixedAnchor } from './wrapWithFixedAnchor';\n\n/**\n * Action handler to change object's width\n * Needs to be wrapped with `wrapWithFixedAnchor` to be effective\n * @param {Event} eventData javascript event that is doing the transform\n * @param {Object} transform javascript object containing a series of information around the current transform\n * @param {number} x current mouse x position, canvas normalized\n * @param {number} y current mouse y position, canvas normalized\n * @return {Boolean} true if some change happened\n */\nexport const changeObjectWidth: TransformActionHandler = (\n eventData,\n transform,\n x,\n y,\n) => {\n const localPoint = getLocalPoint(\n transform,\n transform.originX,\n transform.originY,\n x,\n y,\n );\n // make sure the control changes width ONLY from it's side of target\n if (\n resolveOrigin(transform.originX) === resolveOrigin(CENTER) ||\n (resolveOrigin(transform.originX) === resolveOrigin(RIGHT) &&\n localPoint.x < 0) ||\n (resolveOrigin(transform.originX) === resolveOrigin(LEFT) &&\n localPoint.x > 0)\n ) {\n const { target } = transform,\n strokePadding =\n target.strokeWidth / (target.strokeUniform ? target.scaleX : 1),\n multiplier = isTransformCentered(transform) ? 2 : 1,\n oldWidth = target.width,\n newWidth
|
|
1
|
+
{"version":3,"file":"changeWidth.mjs","sources":["../../../src/controls/changeWidth.ts"],"sourcesContent":["import type { TransformActionHandler } from '../EventTypeDefs';\nimport { CENTER, LEFT, RESIZING, RIGHT } from '../constants';\nimport { resolveOrigin } from '../util/misc/resolveOrigin';\nimport { getLocalPoint, isTransformCentered } from './util';\nimport { wrapWithFireEvent } from './wrapWithFireEvent';\nimport { wrapWithFixedAnchor } from './wrapWithFixedAnchor';\n\n/**\n * Action handler to change object's width\n * Needs to be wrapped with `wrapWithFixedAnchor` to be effective\n * @param {Event} eventData javascript event that is doing the transform\n * @param {Object} transform javascript object containing a series of information around the current transform\n * @param {number} x current mouse x position, canvas normalized\n * @param {number} y current mouse y position, canvas normalized\n * @return {Boolean} true if some change happened\n */\nexport const changeObjectWidth: TransformActionHandler = (\n eventData,\n transform,\n x,\n y,\n) => {\n const localPoint = getLocalPoint(\n transform,\n transform.originX,\n transform.originY,\n x,\n y,\n );\n // make sure the control changes width ONLY from it's side of target\n if (\n resolveOrigin(transform.originX) === resolveOrigin(CENTER) ||\n (resolveOrigin(transform.originX) === resolveOrigin(RIGHT) &&\n localPoint.x < 0) ||\n (resolveOrigin(transform.originX) === resolveOrigin(LEFT) &&\n localPoint.x > 0)\n ) {\n const { target } = transform,\n strokePadding =\n target.strokeWidth / (target.strokeUniform ? target.scaleX : 1),\n multiplier = isTransformCentered(transform) ? 2 : 1,\n oldWidth = target.width,\n newWidth =\n Math.abs((localPoint.x * multiplier) / target.scaleX) - strokePadding;\n target.set('width', Math.max(newWidth, 1));\n // check against actual target width in case `newWidth` was rejected\n return oldWidth !== target.width;\n }\n return false;\n};\n\nexport const changeWidth = wrapWithFireEvent(\n RESIZING,\n wrapWithFixedAnchor(changeObjectWidth),\n);\n"],"names":["changeObjectWidth","eventData","transform","x","y","localPoint","getLocalPoint","originX","originY","resolveOrigin","CENTER","RIGHT","LEFT","target","strokePadding","strokeWidth","strokeUniform","scaleX","multiplier","isTransformCentered","oldWidth","width","newWidth","Math","abs","set","max","changeWidth","wrapWithFireEvent","RESIZING","wrapWithFixedAnchor"],"mappings":";;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,iBAAyC,GAAGA,CACvDC,SAAS,EACTC,SAAS,EACTC,CAAC,EACDC,CAAC,KACE;AACH,EAAA,MAAMC,UAAU,GAAGC,aAAa,CAC9BJ,SAAS,EACTA,SAAS,CAACK,OAAO,EACjBL,SAAS,CAACM,OAAO,EACjBL,CAAC,EACDC,CACF,CAAC,CAAA;AACD;EACA,IACEK,aAAa,CAACP,SAAS,CAACK,OAAO,CAAC,KAAKE,aAAa,CAACC,MAAM,CAAC,IACzDD,aAAa,CAACP,SAAS,CAACK,OAAO,CAAC,KAAKE,aAAa,CAACE,KAAK,CAAC,IACxDN,UAAU,CAACF,CAAC,GAAG,CAAE,IAClBM,aAAa,CAACP,SAAS,CAACK,OAAO,CAAC,KAAKE,aAAa,CAACG,IAAI,CAAC,IACvDP,UAAU,CAACF,CAAC,GAAG,CAAE,EACnB;IACA,MAAM;AAAEU,QAAAA,MAAAA;AAAO,OAAC,GAAGX,SAAS;AAC1BY,MAAAA,aAAa,GACXD,MAAM,CAACE,WAAW,IAAIF,MAAM,CAACG,aAAa,GAAGH,MAAM,CAACI,MAAM,GAAG,CAAC,CAAC;MACjEC,UAAU,GAAGC,mBAAmB,CAACjB,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC;MACnDkB,QAAQ,GAAGP,MAAM,CAACQ,KAAK;AACvBC,MAAAA,QAAQ,GACNC,IAAI,CAACC,GAAG,CAAEnB,UAAU,CAACF,CAAC,GAAGe,UAAU,GAAIL,MAAM,CAACI,MAAM,CAAC,GAAGH,aAAa,CAAA;AACzED,IAAAA,MAAM,CAACY,GAAG,CAAC,OAAO,EAAEF,IAAI,CAACG,GAAG,CAACJ,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;AAC1C;AACA,IAAA,OAAOF,QAAQ,KAAKP,MAAM,CAACQ,KAAK,CAAA;AAClC,GAAA;AACA,EAAA,OAAO,KAAK,CAAA;AACd,EAAC;AAEM,MAAMM,WAAW,GAAGC,iBAAiB,CAC1CC,QAAQ,EACRC,mBAAmB,CAAC9B,iBAAiB,CACvC;;;;"}
|
|
@@ -661,6 +661,10 @@ export declare class FabricText<Props extends TOptions<TextProps> = Partial<Text
|
|
|
661
661
|
* @return {Number} complexity
|
|
662
662
|
*/
|
|
663
663
|
complexity(): number;
|
|
664
|
+
/**
|
|
665
|
+
* List of generic font families
|
|
666
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#generic-name
|
|
667
|
+
*/
|
|
664
668
|
static genericFonts: string[];
|
|
665
669
|
/**
|
|
666
670
|
* List of attribute names to account for when parsing SVG element (used by {@link FabricText.fromElement})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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ACH,MAAM,CAAC,eAAe,WAYpB;IAEF;;;;;;OAMG;WACU,WAAW,CACtB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,SAAS,EAClB,QAAQ,CAAC,EAAE,QAAQ;;;;;;;;;;IAqErB;;;;OAIG;IACH,MAAM,CAAC,UAAU,CACf,CAAC,SAAS,QAAQ,CAAC,mBAAmB,CAAC,EACvC,CAAC,SAAS,UAAU,EACpB,MAAM,EAAE,CAAC;CAWZ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{defineProperty as t,objectSpread2 as e,objectWithoutProperties as i}from"../../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{cache as s}from"../../cache.min.mjs";import{STROKE as n,BOTTOM as h,TOP as r,CENTER as o,RIGHT as l,FILL as a,LEFT as d,DEFAULT_SVG_FONT_SIZE as f}from"../../constants.min.mjs";import{StyledText as c}from"./StyledText.min.mjs";import{SHARED_ATTRIBUTES as g}from"../../parser/attributes.min.mjs";import{parseAttributes as p}from"../../parser/parseAttributes.min.mjs";import{classRegistry as _}from"../../ClassRegistry.min.mjs";import{graphemeSplit as m}from"../../util/lang_string.min.mjs";import{createCanvasElement as u}from"../../util/misc/dom.min.mjs";import{hasStyleChanged as x,stylesToArray as S,stylesFromArray as y}from"../../util/misc/textStyles.min.mjs";import{getPathSegmentsInfo as T,getPointOnPath as L}from"../../util/path/index.min.mjs";import"../Object/FabricObject.min.mjs";import{TextSVGExportMixin as O}from"./TextSVGExportMixin.min.mjs";import{applyMixins as w}from"../../util/applyMixins.min.mjs";import{JUSTIFY as C,JUSTIFY_CENTER as k,JUSTIFY_RIGHT as W,JUSTIFY_LEFT as v,additionalProps as H,textLayoutProperties as A,textDefaultValues as D}from"./constants.min.mjs";import{isFiller as P}from"../../util/typeAssertions.min.mjs";import{cacheProperties as b}from"../Object/defaultValues.min.mjs";const j=["textAnchor","textDecoration","dx","dy","top","left","fontSize","strokeWidth"];let z;class F extends c{static getDefaults(){return e(e({},super.getDefaults()),F.ownDefaults)}constructor(e,i){super(),t(this,"__charBounds",[]),Object.assign(this,F.ownDefaults),this.setOptions(i),this.styles||(this.styles={}),this.text=e,this.initialized=!0,this.path&&this.setPathInfo(),this.initDimensions(),this.setCoords()}setPathInfo(){const t=this.path;t&&(t.segmentsInfo=T(t.path))}_splitText(){const t=this._splitTextIntoLines(this.text);return this.textLines=t.lines,this._textLines=t.graphemeLines,this._unwrappedTextLines=t._unwrappedLines,this._text=t.graphemeText,t}initDimensions(){this._splitText(),this._clearCache(),this.dirty=!0,this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),this.textAlign.includes(C)&&this.enlargeSpaces()}enlargeSpaces(){let t,e,i,s,n,h,r;for(let o=0,l=this._textLines.length;o<l;o++)if((this.textAlign===C||o!==l-1&&!this.isEndOfWrapping(o))&&(s=0,n=this._textLines[o],e=this.getLineWidth(o),e<this.width&&(r=this.textLines[o].match(this._reSpacesAndTabs)))){i=r.length,t=(this.width-e)/i;for(let e=0;e<=n.length;e++)h=this.__charBounds[o][e],this._reSpaceAndTab.test(n[e])?(h.width+=t,h.kernedWidth+=t,h.left+=s,s+=t):h.left+=s}}isEndOfWrapping(t){return t===this._textLines.length-1}missingNewlineOffset(t){return 1}get2DCursorLocation(t,e){const i=e?this._unwrappedTextLines:this._textLines;let s;for(s=0;s<i.length;s++){if(t<=i[s].length)return{lineIndex:s,charIndex:t};t-=i[s].length+this.missingNewlineOffset(s,e)}return{lineIndex:s-1,charIndex:i[s-1].length<t?i[s-1].length:t}}toString(){return"#<Text (".concat(this.complexity(),'): { "text": "').concat(this.text,'", "fontFamily": "').concat(this.fontFamily,'" }>')}_getCacheCanvasDimensions(){const t=super._getCacheCanvasDimensions(),e=this.fontSize;return t.width+=e*t.zoomX,t.height+=e*t.zoomY,t}_render(t){const e=this.path;e&&!e.isNotVisible()&&e._render(t),this._setTextStyles(t),this._renderTextLinesBackground(t),this._renderTextDecoration(t,"underline"),this._renderText(t),this._renderTextDecoration(t,"overline"),this._renderTextDecoration(t,"linethrough")}_renderText(t){this.paintFirst===n?(this._renderTextStroke(t),this._renderTextFill(t)):(this._renderTextFill(t),this._renderTextStroke(t))}_setTextStyles(t,e,i){if(t.textBaseline="alphabetic",this.path)switch(this.pathAlign){case o:t.textBaseline="middle";break;case"ascender":t.textBaseline=r;break;case"descender":t.textBaseline=h}t.font=this._getFontDeclaration(e,i)}calcTextWidth(){let t=this.getLineWidth(0);for(let e=1,i=this._textLines.length;e<i;e++){const i=this.getLineWidth(e);i>t&&(t=i)}return t}_renderTextLine(t,e,i,s,n,h){this._renderChars(t,e,i,s,n,h)}_renderTextLinesBackground(t){if(!this.textBackgroundColor&&!this.styleHas("textBackgroundColor"))return;const e=t.fillStyle,i=this._getLeftOffset();let s=this._getTopOffset();for(let e=0,n=this._textLines.length;e<n;e++){const n=this.getHeightOfLine(e);if(!this.textBackgroundColor&&!this.styleHas("textBackgroundColor",e)){s+=n;continue}const h=this._textLines[e].length,r=this._getLineLeftOffset(e);let o,l,a=0,d=0,f=this.getValueOfPropertyAt(e,0,"textBackgroundColor");for(let c=0;c<h;c++){const h=this.__charBounds[e][c];l=this.getValueOfPropertyAt(e,c,"textBackgroundColor"),this.path?(t.save(),t.translate(h.renderLeft,h.renderTop),t.rotate(h.angle),t.fillStyle=l,l&&t.fillRect(-h.width/2,-n/this.lineHeight*(1-this._fontSizeFraction),h.width,n/this.lineHeight),t.restore()):l!==f?(o=i+r+d,"rtl"===this.direction&&(o=this.width-o-a),t.fillStyle=f,f&&t.fillRect(o,s,a,n/this.lineHeight),d=h.left,a=h.width,f=l):a+=h.kernedWidth}l&&!this.path&&(o=i+r+d,"rtl"===this.direction&&(o=this.width-o-a),t.fillStyle=l,t.fillRect(o,s,a,n/this.lineHeight)),s+=n}t.fillStyle=e,this._removeShadow(t)}_measureChar(t,e,i,n){const h=s.getFontCache(e),r=this._getFontDeclaration(e),o=i+t,l=i&&r===this._getFontDeclaration(n),a=e.fontSize/this.CACHE_FONT_SIZE;let d,f,c,g;if(i&&void 0!==h[i]&&(c=h[i]),void 0!==h[t]&&(g=d=h[t]),l&&void 0!==h[o]&&(f=h[o],g=f-c),void 0===d||void 0===c||void 0===f){const s=function(){if(!z){const t=u();t.width=t.height=0,z=t.getContext("2d")}return z}();this._setTextStyles(s,e,!0),void 0===d&&(g=d=s.measureText(t).width,h[t]=d),void 0===c&&l&&i&&(c=s.measureText(i).width,h[i]=c),l&&void 0===f&&(f=s.measureText(o).width,h[o]=f,g=f-c)}return{width:d*a,kernedWidth:g*a}}getHeightOfChar(t,e){return this.getValueOfPropertyAt(t,e,"fontSize")}measureLine(t){const e=this._measureLine(t);return 0!==this.charSpacing&&(e.width-=this._getWidthOfCharSpacing()),e.width<0&&(e.width=0),e}_measureLine(t){let e,i,s=0;const n=this.pathSide===l,h=this.path,r=this._textLines[t],a=r.length,f=new Array(a);this.__charBounds[t]=f;for(let n=0;n<a;n++){const h=r[n];i=this._getGraphemeBox(h,t,n,e),f[n]=i,s+=i.kernedWidth,e=h}if(f[a]={left:i?i.left+i.width:0,width:0,kernedWidth:0,height:this.fontSize,deltaY:0},h&&h.segmentsInfo){let t=0;const e=h.segmentsInfo[h.segmentsInfo.length-1].length;switch(this.textAlign){case d:t=n?e-s:0;break;case o:t=(e-s)/2;break;case l:t=n?0:e-s}t+=this.pathStartOffset*(n?-1:1);for(let s=n?a-1:0;n?s>=0:s<a;n?s--:s++)i=f[s],t>e?t%=e:t<0&&(t+=e),this._setGraphemeOnPath(t,i),t+=i.kernedWidth}return{width:s,numOfSpaces:0}}_setGraphemeOnPath(t,e){const i=t+e.kernedWidth/2,s=this.path,n=L(s.path,i,s.segmentsInfo);e.renderLeft=n.x-s.pathOffset.x,e.renderTop=n.y-s.pathOffset.y,e.angle=n.angle+(this.pathSide===l?Math.PI:0)}_getGraphemeBox(t,e,i,s,n){const h=this.getCompleteStyleDeclaration(e,i),r=s?this.getCompleteStyleDeclaration(e,i-1):{},o=this._measureChar(t,h,s,r);let l,a=o.kernedWidth,d=o.width;0!==this.charSpacing&&(l=this._getWidthOfCharSpacing(),d+=l,a+=l);const f={width:d,left:0,height:h.fontSize,kernedWidth:a,deltaY:h.deltaY};if(i>0&&!n){const t=this.__charBounds[e][i-1];f.left=t.left+t.width+o.kernedWidth-o.width}return f}getHeightOfLine(t){if(this.__lineHeights[t])return this.__lineHeights[t];let e=this.getHeightOfChar(t,0);for(let i=1,s=this._textLines[t].length;i<s;i++)e=Math.max(this.getHeightOfChar(t,i),e);return this.__lineHeights[t]=e*this.lineHeight*this._fontSizeMult}calcTextHeight(){let t,e=0;for(let i=0,s=this._textLines.length;i<s;i++)t=this.getHeightOfLine(i),e+=i===s-1?t/this.lineHeight:t;return e}_getLeftOffset(){return"ltr"===this.direction?-this.width/2:this.width/2}_getTopOffset(){return-this.height/2}_renderTextCommon(t,e){t.save();let i=0;const s=this._getLeftOffset(),n=this._getTopOffset();for(let h=0,r=this._textLines.length;h<r;h++){const r=this.getHeightOfLine(h),o=r/this.lineHeight,l=this._getLineLeftOffset(h);this._renderTextLine(e,t,this._textLines[h],s+l,n+i+o,h),i+=r}t.restore()}_renderTextFill(t){(this.fill||this.styleHas(a))&&this._renderTextCommon(t,"fillText")}_renderTextStroke(t){(this.stroke&&0!==this.strokeWidth||!this.isEmptyStyles())&&(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this._setLineDash(t,this.strokeDashArray),t.beginPath(),this._renderTextCommon(t,"strokeText"),t.closePath(),t.restore())}_renderChars(t,e,i,s,n,h){const r=this.getHeightOfLine(h),o=this.textAlign.includes(C),a=this.path,f=!o&&0===this.charSpacing&&this.isEmptyStyles(h)&&!a,c="ltr"===this.direction,g="ltr"===this.direction?1:-1,p=e.direction;let _,m,u,S,y,T="",L=0;if(e.save(),p!==this.direction&&(e.canvas.setAttribute("dir",c?"ltr":"rtl"),e.direction=c?"ltr":"rtl",e.textAlign=c?d:l),n-=r*this._fontSizeFraction/this.lineHeight,f)return this._renderChar(t,e,h,0,i.join(""),s,n),void e.restore();for(let r=0,l=i.length-1;r<=l;r++)S=r===l||this.charSpacing||a,T+=i[r],u=this.__charBounds[h][r],0===L?(s+=g*(u.kernedWidth-u.width),L+=u.width):L+=u.kernedWidth,o&&!S&&this._reSpaceAndTab.test(i[r])&&(S=!0),S||(_=_||this.getCompleteStyleDeclaration(h,r),m=this.getCompleteStyleDeclaration(h,r+1),S=x(_,m,!1)),S&&(a?(e.save(),e.translate(u.renderLeft,u.renderTop),e.rotate(u.angle),this._renderChar(t,e,h,r,T,-L/2,0),e.restore()):(y=s,this._renderChar(t,e,h,r,T,y,n)),T="",_=m,s+=g*L,L=0);e.restore()}_applyPatternGradientTransformText(t){const e=u(),i=this.width+this.strokeWidth,s=this.height+this.strokeWidth,n=e.getContext("2d");return e.width=i,e.height=s,n.beginPath(),n.moveTo(0,0),n.lineTo(i,0),n.lineTo(i,s),n.lineTo(0,s),n.closePath(),n.translate(i/2,s/2),n.fillStyle=t.toLive(n),this._applyPatternGradientTransform(n,t),n.fill(),n.createPattern(e,"no-repeat")}handleFiller(t,e,i){let s,n;return P(i)?"percentage"===i.gradientUnits||i.gradientTransform||i.patternTransform?(s=-this.width/2,n=-this.height/2,t.translate(s,n),t[e]=this._applyPatternGradientTransformText(i),{offsetX:s,offsetY:n}):(t[e]=i.toLive(t),this._applyPatternGradientTransform(t,i)):(t[e]=i,{offsetX:0,offsetY:0})}_setStrokeStyles(t,e){let{stroke:i,strokeWidth:s}=e;return t.lineWidth=s,t.lineCap=this.strokeLineCap,t.lineDashOffset=this.strokeDashOffset,t.lineJoin=this.strokeLineJoin,t.miterLimit=this.strokeMiterLimit,this.handleFiller(t,"strokeStyle",i)}_setFillStyles(t,e){let{fill:i}=e;return this.handleFiller(t,"fillStyle",i)}_renderChar(t,e,i,s,n,h,r){const o=this._getStyleDeclaration(i,s),l=this.getCompleteStyleDeclaration(i,s),a="fillText"===t&&l.fill,d="strokeText"===t&&l.stroke&&l.strokeWidth;if(d||a){if(e.save(),e.font=this._getFontDeclaration(l),o.textBackgroundColor&&this._removeShadow(e),o.deltaY&&(r+=o.deltaY),a){const t=this._setFillStyles(e,l);e.fillText(n,h-t.offsetX,r-t.offsetY)}if(d){const t=this._setStrokeStyles(e,l);e.strokeText(n,h-t.offsetX,r-t.offsetY)}e.restore()}}setSuperscript(t,e){this._setScript(t,e,this.superscript)}setSubscript(t,e){this._setScript(t,e,this.subscript)}_setScript(t,e,i){const s=this.get2DCursorLocation(t,!0),n=this.getValueOfPropertyAt(s.lineIndex,s.charIndex,"fontSize"),h=this.getValueOfPropertyAt(s.lineIndex,s.charIndex,"deltaY"),r={fontSize:n*i.size,deltaY:h+n*i.baseline};this.setSelectionStyles(r,t,e)}_getLineLeftOffset(t){const e=this.getLineWidth(t),i=this.width-e,s=this.textAlign,n=this.direction,h=this.isEndOfWrapping(t);let r=0;return s===C||s===k&&!h||s===W&&!h||s===v&&!h?0:(s===o&&(r=i/2),s===l&&(r=i),s===k&&(r=i/2),s===W&&(r=i),"rtl"===n&&(s===l||s===C||s===W?r=0:s===d||s===v?r=-i:s!==o&&s!==k||(r=-i/2)),r)}_clearCache(){this._forceClearCache=!1,this.__lineWidths=[],this.__lineHeights=[],this.__charBounds=[]}getLineWidth(t){if(void 0!==this.__lineWidths[t])return this.__lineWidths[t];const{width:e}=this.measureLine(t);return this.__lineWidths[t]=e,e}_getWidthOfCharSpacing(){return 0!==this.charSpacing?this.fontSize*this.charSpacing/1e3:0}getValueOfPropertyAt(t,e,i){var s;return null!==(s=this._getStyleDeclaration(t,e)[i])&&void 0!==s?s:this[i]}_renderTextDecoration(t,e){if(!this[e]&&!this.styleHas(e))return;let i=this._getTopOffset();const s=this._getLeftOffset(),n=this.path,h=this._getWidthOfCharSpacing(),r=this.offsets[e];for(let o=0,l=this._textLines.length;o<l;o++){const l=this.getHeightOfLine(o);if(!this[e]&&!this.styleHas(e,o)){i+=l;continue}const d=this._textLines[o],f=l/this.lineHeight,c=this._getLineLeftOffset(o);let g,p,_=0,m=0,u=this.getValueOfPropertyAt(o,0,e),x=this.getValueOfPropertyAt(o,0,a);const S=i+f*(1-this._fontSizeFraction);let y=this.getHeightOfChar(o,0),T=this.getValueOfPropertyAt(o,0,"deltaY");for(let i=0,h=d.length;i<h;i++){const h=this.__charBounds[o][i];g=this.getValueOfPropertyAt(o,i,e),p=this.getValueOfPropertyAt(o,i,a);const l=this.getHeightOfChar(o,i),d=this.getValueOfPropertyAt(o,i,"deltaY");if(n&&g&&p)t.save(),t.fillStyle=x,t.translate(h.renderLeft,h.renderTop),t.rotate(h.angle),t.fillRect(-h.kernedWidth/2,r*l+d,h.kernedWidth,this.fontSize/15),t.restore();else if((g!==u||p!==x||l!==y||d!==T)&&m>0){let e=s+c+_;"rtl"===this.direction&&(e=this.width-e-m),u&&x&&(t.fillStyle=x,t.fillRect(e,S+r*y+T,m,this.fontSize/15)),_=h.left,m=h.width,u=g,x=p,y=l,T=d}else m+=h.kernedWidth}let L=s+c+_;"rtl"===this.direction&&(L=this.width-L-m),t.fillStyle=p,g&&p&&t.fillRect(L,S+r*y+T,m-h,this.fontSize/15),i+=l}this._removeShadow(t)}_getFontDeclaration(){let{fontFamily:t=this.fontFamily,fontStyle:e=this.fontStyle,fontWeight:i=this.fontWeight,fontSize:s=this.fontSize}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;const h=t.includes("'")||t.includes('"')||t.includes(",")||F.genericFonts.includes(t.toLowerCase())?t:'"'.concat(t,'"');return[e,i,"".concat(n?this.CACHE_FONT_SIZE:s,"px"),h].join(" ")}render(t){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._forceClearCache&&this.initDimensions(),super.render(t)))}graphemeSplit(t){return m(t)}_splitTextIntoLines(t){const e=t.split(this._reNewline),i=new Array(e.length),s=["\n"];let n=[];for(let t=0;t<e.length;t++)i[t]=this.graphemeSplit(e[t]),n=n.concat(i[t],s);return n.pop(),{_unwrappedLines:i,lines:e,graphemeText:n,graphemeLines:i}}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e(e({},super.toObject([...H,...t])),{},{styles:S(this.styles,this.text)},this.path?{path:this.path.toObject()}:{})}set(t,e){const{textLayoutProperties:i}=this.constructor;super.set(t,e);let s=!1,n=!1;if("object"==typeof t)for(const e in t)"path"===e&&this.setPathInfo(),s=s||i.includes(e),n=n||"path"===e;else s=i.includes(t),n="path"===t;return n&&this.setPathInfo(),s&&this.initialized&&(this.initDimensions(),this.setCoords()),this}complexity(){return 1}static async fromElement(t,s,n){const h=p(t,F.ATTRIBUTE_NAMES,n),r=e(e({},s),h),{textAnchor:a=d,textDecoration:c="",dx:g=0,dy:_=0,top:m=0,left:u=0,fontSize:x=f,strokeWidth:S=1}=r,y=i(r,j),T=new this((t.textContent||"").replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," "),e({left:u+g,top:m+_,underline:c.includes("underline"),overline:c.includes("overline"),linethrough:c.includes("line-through"),strokeWidth:0,fontSize:x},y)),L=T.getScaledHeight()/T.height,O=((T.height+T.strokeWidth)*T.lineHeight-T.height)*L,w=T.getScaledHeight()+O;let C=0;return a===o&&(C=T.getScaledWidth()/2),a===l&&(C=T.getScaledWidth()),T.set({left:T.left-C,top:T.top-(w-T.fontSize*(.07+T._fontSizeFraction))/T.lineHeight,strokeWidth:S}),T}static fromObject(t){return this._fromObject(e(e({},t),{},{styles:y(t.styles||{},t.text)}),{extraParam:"text"})}}t(F,"textLayoutProperties",A),t(F,"cacheProperties",[...b,...H]),t(F,"ownDefaults",D),t(F,"type","Text"),t(F,"genericFonts",["sans-serif","serif","cursive","fantasy","monospace"]),t(F,"ATTRIBUTE_NAMES",g.concat("x","y","dx","dy","font-family","font-style","font-weight","font-size","letter-spacing","text-decoration","text-anchor")),w(F,[O]),_.setClass(F),_.setSVGClass(F);export{F as FabricText};
|
|
1
|
+
import{defineProperty as t,objectSpread2 as e,objectWithoutProperties as i}from"../../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{cache as s}from"../../cache.min.mjs";import{STROKE as n,BOTTOM as h,TOP as r,CENTER as o,RIGHT as l,FILL as a,LEFT as d,DEFAULT_SVG_FONT_SIZE as f}from"../../constants.min.mjs";import{StyledText as c}from"./StyledText.min.mjs";import{SHARED_ATTRIBUTES as g}from"../../parser/attributes.min.mjs";import{parseAttributes as p}from"../../parser/parseAttributes.min.mjs";import{classRegistry as _}from"../../ClassRegistry.min.mjs";import{graphemeSplit as m}from"../../util/lang_string.min.mjs";import{createCanvasElement as u}from"../../util/misc/dom.min.mjs";import{hasStyleChanged as x,stylesToArray as S,stylesFromArray as y}from"../../util/misc/textStyles.min.mjs";import{getPathSegmentsInfo as T,getPointOnPath as L}from"../../util/path/index.min.mjs";import"../Object/FabricObject.min.mjs";import{TextSVGExportMixin as O}from"./TextSVGExportMixin.min.mjs";import{applyMixins as w}from"../../util/applyMixins.min.mjs";import{JUSTIFY as C,JUSTIFY_CENTER as k,JUSTIFY_RIGHT as W,JUSTIFY_LEFT as v,additionalProps as H,textLayoutProperties as A,textDefaultValues as D}from"./constants.min.mjs";import{isFiller as P}from"../../util/typeAssertions.min.mjs";import{cacheProperties as b}from"../Object/defaultValues.min.mjs";const j=["textAnchor","textDecoration","dx","dy","top","left","fontSize","strokeWidth"];let z;class F extends c{static getDefaults(){return e(e({},super.getDefaults()),F.ownDefaults)}constructor(e,i){super(),t(this,"__charBounds",[]),Object.assign(this,F.ownDefaults),this.setOptions(i),this.styles||(this.styles={}),this.text=e,this.initialized=!0,this.path&&this.setPathInfo(),this.initDimensions(),this.setCoords()}setPathInfo(){const t=this.path;t&&(t.segmentsInfo=T(t.path))}_splitText(){const t=this._splitTextIntoLines(this.text);return this.textLines=t.lines,this._textLines=t.graphemeLines,this._unwrappedTextLines=t._unwrappedLines,this._text=t.graphemeText,t}initDimensions(){this._splitText(),this._clearCache(),this.dirty=!0,this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),this.textAlign.includes(C)&&this.enlargeSpaces()}enlargeSpaces(){let t,e,i,s,n,h,r;for(let o=0,l=this._textLines.length;o<l;o++)if((this.textAlign===C||o!==l-1&&!this.isEndOfWrapping(o))&&(s=0,n=this._textLines[o],e=this.getLineWidth(o),e<this.width&&(r=this.textLines[o].match(this._reSpacesAndTabs)))){i=r.length,t=(this.width-e)/i;for(let e=0;e<=n.length;e++)h=this.__charBounds[o][e],this._reSpaceAndTab.test(n[e])?(h.width+=t,h.kernedWidth+=t,h.left+=s,s+=t):h.left+=s}}isEndOfWrapping(t){return t===this._textLines.length-1}missingNewlineOffset(t){return 1}get2DCursorLocation(t,e){const i=e?this._unwrappedTextLines:this._textLines;let s;for(s=0;s<i.length;s++){if(t<=i[s].length)return{lineIndex:s,charIndex:t};t-=i[s].length+this.missingNewlineOffset(s,e)}return{lineIndex:s-1,charIndex:i[s-1].length<t?i[s-1].length:t}}toString(){return"#<Text (".concat(this.complexity(),'): { "text": "').concat(this.text,'", "fontFamily": "').concat(this.fontFamily,'" }>')}_getCacheCanvasDimensions(){const t=super._getCacheCanvasDimensions(),e=this.fontSize;return t.width+=e*t.zoomX,t.height+=e*t.zoomY,t}_render(t){const e=this.path;e&&!e.isNotVisible()&&e._render(t),this._setTextStyles(t),this._renderTextLinesBackground(t),this._renderTextDecoration(t,"underline"),this._renderText(t),this._renderTextDecoration(t,"overline"),this._renderTextDecoration(t,"linethrough")}_renderText(t){this.paintFirst===n?(this._renderTextStroke(t),this._renderTextFill(t)):(this._renderTextFill(t),this._renderTextStroke(t))}_setTextStyles(t,e,i){if(t.textBaseline="alphabetic",this.path)switch(this.pathAlign){case o:t.textBaseline="middle";break;case"ascender":t.textBaseline=r;break;case"descender":t.textBaseline=h}t.font=this._getFontDeclaration(e,i)}calcTextWidth(){let t=this.getLineWidth(0);for(let e=1,i=this._textLines.length;e<i;e++){const i=this.getLineWidth(e);i>t&&(t=i)}return t}_renderTextLine(t,e,i,s,n,h){this._renderChars(t,e,i,s,n,h)}_renderTextLinesBackground(t){if(!this.textBackgroundColor&&!this.styleHas("textBackgroundColor"))return;const e=t.fillStyle,i=this._getLeftOffset();let s=this._getTopOffset();for(let e=0,n=this._textLines.length;e<n;e++){const n=this.getHeightOfLine(e);if(!this.textBackgroundColor&&!this.styleHas("textBackgroundColor",e)){s+=n;continue}const h=this._textLines[e].length,r=this._getLineLeftOffset(e);let o,l,a=0,d=0,f=this.getValueOfPropertyAt(e,0,"textBackgroundColor");for(let c=0;c<h;c++){const h=this.__charBounds[e][c];l=this.getValueOfPropertyAt(e,c,"textBackgroundColor"),this.path?(t.save(),t.translate(h.renderLeft,h.renderTop),t.rotate(h.angle),t.fillStyle=l,l&&t.fillRect(-h.width/2,-n/this.lineHeight*(1-this._fontSizeFraction),h.width,n/this.lineHeight),t.restore()):l!==f?(o=i+r+d,"rtl"===this.direction&&(o=this.width-o-a),t.fillStyle=f,f&&t.fillRect(o,s,a,n/this.lineHeight),d=h.left,a=h.width,f=l):a+=h.kernedWidth}l&&!this.path&&(o=i+r+d,"rtl"===this.direction&&(o=this.width-o-a),t.fillStyle=l,t.fillRect(o,s,a,n/this.lineHeight)),s+=n}t.fillStyle=e,this._removeShadow(t)}_measureChar(t,e,i,n){const h=s.getFontCache(e),r=this._getFontDeclaration(e),o=i+t,l=i&&r===this._getFontDeclaration(n),a=e.fontSize/this.CACHE_FONT_SIZE;let d,f,c,g;if(i&&void 0!==h[i]&&(c=h[i]),void 0!==h[t]&&(g=d=h[t]),l&&void 0!==h[o]&&(f=h[o],g=f-c),void 0===d||void 0===c||void 0===f){const s=function(){if(!z){const t=u();t.width=t.height=0,z=t.getContext("2d")}return z}();this._setTextStyles(s,e,!0),void 0===d&&(g=d=s.measureText(t).width,h[t]=d),void 0===c&&l&&i&&(c=s.measureText(i).width,h[i]=c),l&&void 0===f&&(f=s.measureText(o).width,h[o]=f,g=f-c)}return{width:d*a,kernedWidth:g*a}}getHeightOfChar(t,e){return this.getValueOfPropertyAt(t,e,"fontSize")}measureLine(t){const e=this._measureLine(t);return 0!==this.charSpacing&&(e.width-=this._getWidthOfCharSpacing()),e.width<0&&(e.width=0),e}_measureLine(t){let e,i,s=0;const n=this.pathSide===l,h=this.path,r=this._textLines[t],a=r.length,f=new Array(a);this.__charBounds[t]=f;for(let n=0;n<a;n++){const h=r[n];i=this._getGraphemeBox(h,t,n,e),f[n]=i,s+=i.kernedWidth,e=h}if(f[a]={left:i?i.left+i.width:0,width:0,kernedWidth:0,height:this.fontSize,deltaY:0},h&&h.segmentsInfo){let t=0;const e=h.segmentsInfo[h.segmentsInfo.length-1].length;switch(this.textAlign){case d:t=n?e-s:0;break;case o:t=(e-s)/2;break;case l:t=n?0:e-s}t+=this.pathStartOffset*(n?-1:1);for(let s=n?a-1:0;n?s>=0:s<a;n?s--:s++)i=f[s],t>e?t%=e:t<0&&(t+=e),this._setGraphemeOnPath(t,i),t+=i.kernedWidth}return{width:s,numOfSpaces:0}}_setGraphemeOnPath(t,e){const i=t+e.kernedWidth/2,s=this.path,n=L(s.path,i,s.segmentsInfo);e.renderLeft=n.x-s.pathOffset.x,e.renderTop=n.y-s.pathOffset.y,e.angle=n.angle+(this.pathSide===l?Math.PI:0)}_getGraphemeBox(t,e,i,s,n){const h=this.getCompleteStyleDeclaration(e,i),r=s?this.getCompleteStyleDeclaration(e,i-1):{},o=this._measureChar(t,h,s,r);let l,a=o.kernedWidth,d=o.width;0!==this.charSpacing&&(l=this._getWidthOfCharSpacing(),d+=l,a+=l);const f={width:d,left:0,height:h.fontSize,kernedWidth:a,deltaY:h.deltaY};if(i>0&&!n){const t=this.__charBounds[e][i-1];f.left=t.left+t.width+o.kernedWidth-o.width}return f}getHeightOfLine(t){if(this.__lineHeights[t])return this.__lineHeights[t];let e=this.getHeightOfChar(t,0);for(let i=1,s=this._textLines[t].length;i<s;i++)e=Math.max(this.getHeightOfChar(t,i),e);return this.__lineHeights[t]=e*this.lineHeight*this._fontSizeMult}calcTextHeight(){let t,e=0;for(let i=0,s=this._textLines.length;i<s;i++)t=this.getHeightOfLine(i),e+=i===s-1?t/this.lineHeight:t;return e}_getLeftOffset(){return"ltr"===this.direction?-this.width/2:this.width/2}_getTopOffset(){return-this.height/2}_renderTextCommon(t,e){t.save();let i=0;const s=this._getLeftOffset(),n=this._getTopOffset();for(let h=0,r=this._textLines.length;h<r;h++){const r=this.getHeightOfLine(h),o=r/this.lineHeight,l=this._getLineLeftOffset(h);this._renderTextLine(e,t,this._textLines[h],s+l,n+i+o,h),i+=r}t.restore()}_renderTextFill(t){(this.fill||this.styleHas(a))&&this._renderTextCommon(t,"fillText")}_renderTextStroke(t){(this.stroke&&0!==this.strokeWidth||!this.isEmptyStyles())&&(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this._setLineDash(t,this.strokeDashArray),t.beginPath(),this._renderTextCommon(t,"strokeText"),t.closePath(),t.restore())}_renderChars(t,e,i,s,n,h){const r=this.getHeightOfLine(h),o=this.textAlign.includes(C),a=this.path,f=!o&&0===this.charSpacing&&this.isEmptyStyles(h)&&!a,c="ltr"===this.direction,g="ltr"===this.direction?1:-1,p=e.direction;let _,m,u,S,y,T="",L=0;if(e.save(),p!==this.direction&&(e.canvas.setAttribute("dir",c?"ltr":"rtl"),e.direction=c?"ltr":"rtl",e.textAlign=c?d:l),n-=r*this._fontSizeFraction/this.lineHeight,f)return this._renderChar(t,e,h,0,i.join(""),s,n),void e.restore();for(let r=0,l=i.length-1;r<=l;r++)S=r===l||this.charSpacing||a,T+=i[r],u=this.__charBounds[h][r],0===L?(s+=g*(u.kernedWidth-u.width),L+=u.width):L+=u.kernedWidth,o&&!S&&this._reSpaceAndTab.test(i[r])&&(S=!0),S||(_=_||this.getCompleteStyleDeclaration(h,r),m=this.getCompleteStyleDeclaration(h,r+1),S=x(_,m,!1)),S&&(a?(e.save(),e.translate(u.renderLeft,u.renderTop),e.rotate(u.angle),this._renderChar(t,e,h,r,T,-L/2,0),e.restore()):(y=s,this._renderChar(t,e,h,r,T,y,n)),T="",_=m,s+=g*L,L=0);e.restore()}_applyPatternGradientTransformText(t){const e=u(),i=this.width+this.strokeWidth,s=this.height+this.strokeWidth,n=e.getContext("2d");return e.width=i,e.height=s,n.beginPath(),n.moveTo(0,0),n.lineTo(i,0),n.lineTo(i,s),n.lineTo(0,s),n.closePath(),n.translate(i/2,s/2),n.fillStyle=t.toLive(n),this._applyPatternGradientTransform(n,t),n.fill(),n.createPattern(e,"no-repeat")}handleFiller(t,e,i){let s,n;return P(i)?"percentage"===i.gradientUnits||i.gradientTransform||i.patternTransform?(s=-this.width/2,n=-this.height/2,t.translate(s,n),t[e]=this._applyPatternGradientTransformText(i),{offsetX:s,offsetY:n}):(t[e]=i.toLive(t),this._applyPatternGradientTransform(t,i)):(t[e]=i,{offsetX:0,offsetY:0})}_setStrokeStyles(t,e){let{stroke:i,strokeWidth:s}=e;return t.lineWidth=s,t.lineCap=this.strokeLineCap,t.lineDashOffset=this.strokeDashOffset,t.lineJoin=this.strokeLineJoin,t.miterLimit=this.strokeMiterLimit,this.handleFiller(t,"strokeStyle",i)}_setFillStyles(t,e){let{fill:i}=e;return this.handleFiller(t,"fillStyle",i)}_renderChar(t,e,i,s,n,h,r){const o=this._getStyleDeclaration(i,s),l=this.getCompleteStyleDeclaration(i,s),a="fillText"===t&&l.fill,d="strokeText"===t&&l.stroke&&l.strokeWidth;if(d||a){if(e.save(),e.font=this._getFontDeclaration(l),o.textBackgroundColor&&this._removeShadow(e),o.deltaY&&(r+=o.deltaY),a){const t=this._setFillStyles(e,l);e.fillText(n,h-t.offsetX,r-t.offsetY)}if(d){const t=this._setStrokeStyles(e,l);e.strokeText(n,h-t.offsetX,r-t.offsetY)}e.restore()}}setSuperscript(t,e){this._setScript(t,e,this.superscript)}setSubscript(t,e){this._setScript(t,e,this.subscript)}_setScript(t,e,i){const s=this.get2DCursorLocation(t,!0),n=this.getValueOfPropertyAt(s.lineIndex,s.charIndex,"fontSize"),h=this.getValueOfPropertyAt(s.lineIndex,s.charIndex,"deltaY"),r={fontSize:n*i.size,deltaY:h+n*i.baseline};this.setSelectionStyles(r,t,e)}_getLineLeftOffset(t){const e=this.getLineWidth(t),i=this.width-e,s=this.textAlign,n=this.direction,h=this.isEndOfWrapping(t);let r=0;return s===C||s===k&&!h||s===W&&!h||s===v&&!h?0:(s===o&&(r=i/2),s===l&&(r=i),s===k&&(r=i/2),s===W&&(r=i),"rtl"===n&&(s===l||s===C||s===W?r=0:s===d||s===v?r=-i:s!==o&&s!==k||(r=-i/2)),r)}_clearCache(){this._forceClearCache=!1,this.__lineWidths=[],this.__lineHeights=[],this.__charBounds=[]}getLineWidth(t){if(void 0!==this.__lineWidths[t])return this.__lineWidths[t];const{width:e}=this.measureLine(t);return this.__lineWidths[t]=e,e}_getWidthOfCharSpacing(){return 0!==this.charSpacing?this.fontSize*this.charSpacing/1e3:0}getValueOfPropertyAt(t,e,i){var s;return null!==(s=this._getStyleDeclaration(t,e)[i])&&void 0!==s?s:this[i]}_renderTextDecoration(t,e){if(!this[e]&&!this.styleHas(e))return;let i=this._getTopOffset();const s=this._getLeftOffset(),n=this.path,h=this._getWidthOfCharSpacing(),r=this.offsets[e];for(let o=0,l=this._textLines.length;o<l;o++){const l=this.getHeightOfLine(o);if(!this[e]&&!this.styleHas(e,o)){i+=l;continue}const d=this._textLines[o],f=l/this.lineHeight,c=this._getLineLeftOffset(o);let g,p,_=0,m=0,u=this.getValueOfPropertyAt(o,0,e),x=this.getValueOfPropertyAt(o,0,a);const S=i+f*(1-this._fontSizeFraction);let y=this.getHeightOfChar(o,0),T=this.getValueOfPropertyAt(o,0,"deltaY");for(let i=0,h=d.length;i<h;i++){const h=this.__charBounds[o][i];g=this.getValueOfPropertyAt(o,i,e),p=this.getValueOfPropertyAt(o,i,a);const l=this.getHeightOfChar(o,i),d=this.getValueOfPropertyAt(o,i,"deltaY");if(n&&g&&p)t.save(),t.fillStyle=x,t.translate(h.renderLeft,h.renderTop),t.rotate(h.angle),t.fillRect(-h.kernedWidth/2,r*l+d,h.kernedWidth,this.fontSize/15),t.restore();else if((g!==u||p!==x||l!==y||d!==T)&&m>0){let e=s+c+_;"rtl"===this.direction&&(e=this.width-e-m),u&&x&&(t.fillStyle=x,t.fillRect(e,S+r*y+T,m,this.fontSize/15)),_=h.left,m=h.width,u=g,x=p,y=l,T=d}else m+=h.kernedWidth}let L=s+c+_;"rtl"===this.direction&&(L=this.width-L-m),t.fillStyle=p,g&&p&&t.fillRect(L,S+r*y+T,m-h,this.fontSize/15),i+=l}this._removeShadow(t)}_getFontDeclaration(){let{fontFamily:t=this.fontFamily,fontStyle:e=this.fontStyle,fontWeight:i=this.fontWeight,fontSize:s=this.fontSize}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;const h=t.includes("'")||t.includes('"')||t.includes(",")||F.genericFonts.includes(t.toLowerCase())?t:'"'.concat(t,'"');return[e,i,"".concat(n?this.CACHE_FONT_SIZE:s,"px"),h].join(" ")}render(t){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._forceClearCache&&this.initDimensions(),super.render(t)))}graphemeSplit(t){return m(t)}_splitTextIntoLines(t){const e=t.split(this._reNewline),i=new Array(e.length),s=["\n"];let n=[];for(let t=0;t<e.length;t++)i[t]=this.graphemeSplit(e[t]),n=n.concat(i[t],s);return n.pop(),{_unwrappedLines:i,lines:e,graphemeText:n,graphemeLines:i}}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e(e({},super.toObject([...H,...t])),{},{styles:S(this.styles,this.text)},this.path?{path:this.path.toObject()}:{})}set(t,e){const{textLayoutProperties:i}=this.constructor;super.set(t,e);let s=!1,n=!1;if("object"==typeof t)for(const e in t)"path"===e&&this.setPathInfo(),s=s||i.includes(e),n=n||"path"===e;else s=i.includes(t),n="path"===t;return n&&this.setPathInfo(),s&&this.initialized&&(this.initDimensions(),this.setCoords()),this}complexity(){return 1}static async fromElement(t,s,n){const h=p(t,F.ATTRIBUTE_NAMES,n),r=e(e({},s),h),{textAnchor:a=d,textDecoration:c="",dx:g=0,dy:_=0,top:m=0,left:u=0,fontSize:x=f,strokeWidth:S=1}=r,y=i(r,j),T=new this((t.textContent||"").replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," "),e({left:u+g,top:m+_,underline:c.includes("underline"),overline:c.includes("overline"),linethrough:c.includes("line-through"),strokeWidth:0,fontSize:x},y)),L=T.getScaledHeight()/T.height,O=((T.height+T.strokeWidth)*T.lineHeight-T.height)*L,w=T.getScaledHeight()+O;let C=0;return a===o&&(C=T.getScaledWidth()/2),a===l&&(C=T.getScaledWidth()),T.set({left:T.left-C,top:T.top-(w-T.fontSize*(.07+T._fontSizeFraction))/T.lineHeight,strokeWidth:S}),T}static fromObject(t){return this._fromObject(e(e({},t),{},{styles:y(t.styles||{},t.text)}),{extraParam:"text"})}}t(F,"textLayoutProperties",A),t(F,"cacheProperties",[...b,...H]),t(F,"ownDefaults",D),t(F,"type","Text"),t(F,"genericFonts",["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong"]),t(F,"ATTRIBUTE_NAMES",g.concat("x","y","dx","dy","font-family","font-style","font-weight","font-size","letter-spacing","text-decoration","text-anchor")),w(F,[O]),_.setClass(F),_.setSVGClass(F);export{F as FabricText};
|
|
2
2
|
//# sourceMappingURL=Text.min.mjs.map
|