@visactor/vrender-core 1.0.13-alpha.1 → 1.0.14-alpha.0
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/cjs/common/color-utils.d.ts +9 -0
- package/cjs/common/color-utils.js +29 -12
- package/cjs/common/color-utils.js.map +1 -1
- package/cjs/core/contributions/textMeasure/AtextMeasure.d.ts +1 -0
- package/cjs/core/contributions/textMeasure/AtextMeasure.js +3 -0
- package/cjs/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/cjs/core/contributions/textMeasure/textMeasure-contribution.d.ts +1 -0
- package/cjs/core/contributions/textMeasure/textMeasure-contribution.js +5 -1
- package/cjs/core/contributions/textMeasure/textMeasure-contribution.js.map +1 -1
- package/cjs/core/graphic-utils.d.ts +2 -0
- package/cjs/core/graphic-utils.js +7 -2
- package/cjs/core/graphic-utils.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +1 -0
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/richtext.js +2 -1
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/graphic/text.js +9 -9
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/graphic/wrap-text.js +3 -3
- package/cjs/graphic/wrap-text.js.map +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +15 -14
- package/cjs/index.js.map +1 -1
- package/cjs/interface/core.d.ts +1 -0
- package/cjs/interface/core.js.map +1 -1
- package/cjs/interface/text.d.ts +1 -0
- package/cjs/interface/text.js.map +1 -1
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +18 -4
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/dist/index.es.js +96 -38
- package/es/common/color-utils.d.ts +9 -0
- package/es/common/color-utils.js +29 -12
- package/es/common/color-utils.js.map +1 -1
- package/es/core/contributions/textMeasure/AtextMeasure.d.ts +1 -0
- package/es/core/contributions/textMeasure/AtextMeasure.js +3 -0
- package/es/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/es/core/contributions/textMeasure/textMeasure-contribution.d.ts +1 -0
- package/es/core/contributions/textMeasure/textMeasure-contribution.js +5 -1
- package/es/core/contributions/textMeasure/textMeasure-contribution.js.map +1 -1
- package/es/core/graphic-utils.d.ts +2 -0
- package/es/core/graphic-utils.js +7 -2
- package/es/core/graphic-utils.js.map +1 -1
- package/es/graphic/graphic.d.ts +1 -0
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/richtext.js +2 -1
- package/es/graphic/richtext.js.map +1 -1
- package/es/graphic/text.js +9 -9
- package/es/graphic/text.js.map +1 -1
- package/es/graphic/wrap-text.js +3 -3
- package/es/graphic/wrap-text.js.map +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/es/interface/core.d.ts +1 -0
- package/es/interface/core.js.map +1 -1
- package/es/interface/text.d.ts +1 -0
- package/es/interface/text.js.map +1 -1
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js +18 -4
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/package.json +3 -3
package/cjs/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './resource-loader/loader';
|
|
|
17
17
|
export * from './color-string';
|
|
18
18
|
export * from './factory';
|
|
19
19
|
export * from './common/text';
|
|
20
|
+
export * from './common/color-utils';
|
|
20
21
|
export * from './common/bezier-utils';
|
|
21
22
|
export * from './common/bounds-context';
|
|
22
23
|
export * from './common/seg-context';
|
package/cjs/index.js
CHANGED
|
@@ -26,20 +26,21 @@ __exportStar(require("./canvas"), exports), __exportStar(require("./core"), expo
|
|
|
26
26
|
__exportStar(require("./core/light"), exports), __exportStar(require("./core/camera"), exports),
|
|
27
27
|
__exportStar(require("./picker"), exports), __exportStar(require("./resource-loader/loader"), exports),
|
|
28
28
|
__exportStar(require("./color-string"), exports), __exportStar(require("./factory"), exports),
|
|
29
|
-
__exportStar(require("./common/text"), exports), __exportStar(require("./common/
|
|
30
|
-
__exportStar(require("./common/
|
|
31
|
-
__exportStar(require("./common/
|
|
32
|
-
__exportStar(require("./common/
|
|
33
|
-
__exportStar(require("./common/
|
|
34
|
-
__exportStar(require("./common/
|
|
35
|
-
__exportStar(require("./common/
|
|
36
|
-
__exportStar(require("./common/
|
|
37
|
-
__exportStar(require("./common/
|
|
38
|
-
__exportStar(require("./common/render-
|
|
39
|
-
__exportStar(require("./common/
|
|
40
|
-
__exportStar(require("./common/
|
|
41
|
-
__exportStar(require("./common/
|
|
42
|
-
__exportStar(require("./
|
|
29
|
+
__exportStar(require("./common/text"), exports), __exportStar(require("./common/color-utils"), exports),
|
|
30
|
+
__exportStar(require("./common/bezier-utils"), exports), __exportStar(require("./common/bounds-context"), exports),
|
|
31
|
+
__exportStar(require("./common/seg-context"), exports), __exportStar(require("./common/custom-path2d"), exports),
|
|
32
|
+
__exportStar(require("./common/segment"), exports), __exportStar(require("./common/canvas-utils"), exports),
|
|
33
|
+
__exportStar(require("./common/contribution-provider"), exports), __exportStar(require("./common/generator"), exports),
|
|
34
|
+
__exportStar(require("./common/utils"), exports), __exportStar(require("./common/shape/arc"), exports),
|
|
35
|
+
__exportStar(require("./common/shape/rect"), exports), __exportStar(require("./common/matrix"), exports),
|
|
36
|
+
__exportStar(require("./common/simplify"), exports), __exportStar(require("./common/diff"), exports),
|
|
37
|
+
__exportStar(require("./common/path-svg"), exports), __exportStar(require("./common/render-curve"), exports),
|
|
38
|
+
__exportStar(require("./common/render-area"), exports), __exportStar(require("./common/render-command-list"), exports),
|
|
39
|
+
__exportStar(require("./common/sort"), exports), __exportStar(require("./common/morphing-utils"), exports),
|
|
40
|
+
__exportStar(require("./common/split-path"), exports), __exportStar(require("./common/enums"), exports),
|
|
41
|
+
__exportStar(require("./common/generator"), exports), __exportStar(require("./common/performance-raf"), exports),
|
|
42
|
+
__exportStar(require("./common/event-transformer"), exports), __exportStar(require("./plugins/constants"), exports),
|
|
43
|
+
__exportStar(require("./plugins/builtin-plugin/richtext-edit-plugin"), exports),
|
|
43
44
|
__exportStar(require("./allocator/matrix-allocate"), exports), __exportStar(require("./allocator/canvas-allocate"), exports),
|
|
44
45
|
__exportStar(require("./allocator/graphic-allocate"), exports), __exportStar(require("./common/contribution-provider"), exports);
|
|
45
46
|
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,qBAAmB;AAEnB,8CAA4B;AAC5B,gDAA8B;AAC9B,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,4EAA0D;AAC1D,2CAAyB;AACzB,yCAAuB;AACvB,+CAA6B;AAC7B,gDAA8B;AAC9B,2CAAyB;AACzB,2DAAyC;AACzC,iDAA+B;AAC/B,4CAA0B;AAG1B,gDAA8B;AAC9B,wDAAsC;AACtC,0DAAwC;AACxC,uDAAqC;AACrC,yDAAuC;AACvC,mDAAiC;AACjC,wDAAsC;AACtC,iEAA+C;AAC/C,qDAAmC;AACnC,iDAA+B;AAC/B,qDAAmC;AACnC,sDAAoC;AACpC,kDAAgC;AAChC,oDAAkC;AAClC,gDAA8B;AAE9B,oDAAkC;AAClC,wDAAsC;AACtC,uDAAqC;AACrC,+DAA6C;AAC7C,gDAA8B;AAC9B,0DAAwC;AACxC,sDAAoC;AACpC,iDAA+B;AAC/B,qDAAmC;AACnC,2DAAyC;AACzC,6DAA2C;AAC3C,sDAAoC;AACpC,gFAA8D;AAC9D,8DAA4C;AAC5C,8DAA4C;AAC5C,+DAA6C;AAC7C,iEAA+C;AAE/C,sCAAwD;AAA/C,kGAAA,UAAU,OAAA;AAAE,mGAAA,WAAW,OAAA;AAChC,+CAA6B;AAC7B,0DAAwC;AACxC,8CAA4B;AAC5B,gDAA8B;AAC9B,8CAA4B;AAE5B,2EAAyD;AACzD,4EAA0D;AAC1D,4EAA0D;AAC1D,4EAA0D;AAC1D,8EAA4D;AAC5D,8EAA4D;AAC5D,4EAA0D;AAC1D,4EAA0D;AAC1D,+EAA6D;AAC7D,4EAA0D;AAC1D,6EAA2D;AAC3D,gFAA8D;AAC9D,6EAA2D;AAC3D,8EAA4D;AAC5D,6EAA2D;AAC3D,iFAA+D;AAE/D,0DAAwC;AACxC,4DAA0C;AAC1C,2DAAyC;AACzC,6DAA2C;AAC3C,4DAA0C;AAC1C,4DAA0C;AAC1C,4DAA0C;AAC1C,2DAAyC;AACzC,2DAAyC;AACzC,8DAA4C;AAC5C,2DAAyC;AACzC,gEAA8C;AAC9C,2DAAyC;AACzC,6DAA2C;AAC3C,+DAA6C;AAC7C,6DAA2C;AAC3C,2DAAyC;AACzC,iEAA+C;AAC/C,+DAA6C;AAG7C,iFAA+D;AAC/D,kFAAgE;AAChE,mFAAiE;AACjE,8EAA4D;AAE5D,uEAAqD","file":"index.js","sourcesContent":["// import 'core-js/proposals/reflect-metadata';\nimport './modules';\n\nexport * from './container';\nexport * from './core/global';\nexport * from './graphic';\nexport * from './modules';\nexport * from './create';\nexport * from './event';\nexport * from './interface';\nexport * from './render';\nexport * from './render/contributions/render/base-render';\nexport * from './canvas';\nexport * from './core';\nexport * from './core/light';\nexport * from './core/camera';\nexport * from './picker';\nexport * from './resource-loader/loader';\nexport * from './color-string';\nexport * from './factory';\n\n/* export common */\nexport * from './common/text';\nexport * from './common/bezier-utils';\nexport * from './common/bounds-context';\nexport * from './common/seg-context';\nexport * from './common/custom-path2d';\nexport * from './common/segment';\nexport * from './common/canvas-utils';\nexport * from './common/contribution-provider';\nexport * from './common/generator';\nexport * from './common/utils';\nexport * from './common/shape/arc';\nexport * from './common/shape/rect';\nexport * from './common/matrix';\nexport * from './common/simplify';\nexport * from './common/diff';\n\nexport * from './common/path-svg';\nexport * from './common/render-curve';\nexport * from './common/render-area';\nexport * from './common/render-command-list';\nexport * from './common/sort';\nexport * from './common/morphing-utils';\nexport * from './common/split-path';\nexport * from './common/enums';\nexport * from './common/generator';\nexport * from './common/performance-raf';\nexport * from './common/event-transformer';\nexport * from './plugins/constants';\nexport * from './plugins/builtin-plugin/richtext-edit-plugin';\nexport * from './allocator/matrix-allocate';\nexport * from './allocator/canvas-allocate';\nexport * from './allocator/graphic-allocate';\nexport * from './common/contribution-provider';\n\nexport { wrapCanvas, wrapContext } from './canvas/util';\nexport * from './common/xml';\nexport * from './common/inversify-lite';\nexport * from './constants';\nexport * from './application';\nexport * from './env-check';\n\nexport * from './render/contributions/render/arc-module';\nexport * from './render/contributions/render/rect-module';\nexport * from './render/contributions/render/line-module';\nexport * from './render/contributions/render/area-module';\nexport * from './render/contributions/render/symbol-module';\nexport * from './render/contributions/render/circle-module';\nexport * from './render/contributions/render/text-module';\nexport * from './render/contributions/render/path-module';\nexport * from './render/contributions/render/polygon-module';\nexport * from './render/contributions/render/star-module';\nexport * from './render/contributions/render/glyph-module';\nexport * from './render/contributions/render/richtext-module';\nexport * from './render/contributions/render/image-module';\nexport * from './render/contributions/render/rect3d-module';\nexport * from './render/contributions/render/arc3d-module';\nexport * from './render/contributions/render/pyramid3d-module';\n\nexport * from './register/register-arc';\nexport * from './register/register-arc3d';\nexport * from './register/register-area';\nexport * from './register/register-circle';\nexport * from './register/register-glyph';\nexport * from './register/register-group';\nexport * from './register/register-image';\nexport * from './register/register-line';\nexport * from './register/register-path';\nexport * from './register/register-polygon';\nexport * from './register/register-star';\nexport * from './register/register-pyramid3d';\nexport * from './register/register-rect';\nexport * from './register/register-rect3d';\nexport * from './register/register-richtext';\nexport * from './register/register-symbol';\nexport * from './register/register-text';\nexport * from './register/register-shadowRoot';\nexport * from './register/register-wraptext';\n\n// plugin\nexport * from './plugins/builtin-plugin/html-attribute-plugin';\nexport * from './plugins/builtin-plugin/react-attribute-plugin';\nexport * from './plugins/builtin-plugin/3dview-transform-plugin';\nexport * from './plugins/builtin-plugin/flex-layout-plugin';\n\nexport * from './plugins/builtin-plugin/edit-module';\n\n// export const morphPath = {};\n// export const multiToOneMorph = {};\n// export const oneToMultiMorph = {};\n// export class ACustomAnimate {}\n// export const AnimateGroup = {};\n// export const Animate = {};\n// export const defaultTicker = {};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,qBAAmB;AAEnB,8CAA4B;AAC5B,gDAA8B;AAC9B,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,4EAA0D;AAC1D,2CAAyB;AACzB,yCAAuB;AACvB,+CAA6B;AAC7B,gDAA8B;AAC9B,2CAAyB;AACzB,2DAAyC;AACzC,iDAA+B;AAC/B,4CAA0B;AAG1B,gDAA8B;AAC9B,uDAAqC;AACrC,wDAAsC;AACtC,0DAAwC;AACxC,uDAAqC;AACrC,yDAAuC;AACvC,mDAAiC;AACjC,wDAAsC;AACtC,iEAA+C;AAC/C,qDAAmC;AACnC,iDAA+B;AAC/B,qDAAmC;AACnC,sDAAoC;AACpC,kDAAgC;AAChC,oDAAkC;AAClC,gDAA8B;AAE9B,oDAAkC;AAClC,wDAAsC;AACtC,uDAAqC;AACrC,+DAA6C;AAC7C,gDAA8B;AAC9B,0DAAwC;AACxC,sDAAoC;AACpC,iDAA+B;AAC/B,qDAAmC;AACnC,2DAAyC;AACzC,6DAA2C;AAC3C,sDAAoC;AACpC,gFAA8D;AAC9D,8DAA4C;AAC5C,8DAA4C;AAC5C,+DAA6C;AAC7C,iEAA+C;AAE/C,sCAAwD;AAA/C,kGAAA,UAAU,OAAA;AAAE,mGAAA,WAAW,OAAA;AAChC,+CAA6B;AAC7B,0DAAwC;AACxC,8CAA4B;AAC5B,gDAA8B;AAC9B,8CAA4B;AAE5B,2EAAyD;AACzD,4EAA0D;AAC1D,4EAA0D;AAC1D,4EAA0D;AAC1D,8EAA4D;AAC5D,8EAA4D;AAC5D,4EAA0D;AAC1D,4EAA0D;AAC1D,+EAA6D;AAC7D,4EAA0D;AAC1D,6EAA2D;AAC3D,gFAA8D;AAC9D,6EAA2D;AAC3D,8EAA4D;AAC5D,6EAA2D;AAC3D,iFAA+D;AAE/D,0DAAwC;AACxC,4DAA0C;AAC1C,2DAAyC;AACzC,6DAA2C;AAC3C,4DAA0C;AAC1C,4DAA0C;AAC1C,4DAA0C;AAC1C,2DAAyC;AACzC,2DAAyC;AACzC,8DAA4C;AAC5C,2DAAyC;AACzC,gEAA8C;AAC9C,2DAAyC;AACzC,6DAA2C;AAC3C,+DAA6C;AAC7C,6DAA2C;AAC3C,2DAAyC;AACzC,iEAA+C;AAC/C,+DAA6C;AAG7C,iFAA+D;AAC/D,kFAAgE;AAChE,mFAAiE;AACjE,8EAA4D;AAE5D,uEAAqD","file":"index.js","sourcesContent":["// import 'core-js/proposals/reflect-metadata';\nimport './modules';\n\nexport * from './container';\nexport * from './core/global';\nexport * from './graphic';\nexport * from './modules';\nexport * from './create';\nexport * from './event';\nexport * from './interface';\nexport * from './render';\nexport * from './render/contributions/render/base-render';\nexport * from './canvas';\nexport * from './core';\nexport * from './core/light';\nexport * from './core/camera';\nexport * from './picker';\nexport * from './resource-loader/loader';\nexport * from './color-string';\nexport * from './factory';\n\n/* export common */\nexport * from './common/text';\nexport * from './common/color-utils';\nexport * from './common/bezier-utils';\nexport * from './common/bounds-context';\nexport * from './common/seg-context';\nexport * from './common/custom-path2d';\nexport * from './common/segment';\nexport * from './common/canvas-utils';\nexport * from './common/contribution-provider';\nexport * from './common/generator';\nexport * from './common/utils';\nexport * from './common/shape/arc';\nexport * from './common/shape/rect';\nexport * from './common/matrix';\nexport * from './common/simplify';\nexport * from './common/diff';\n\nexport * from './common/path-svg';\nexport * from './common/render-curve';\nexport * from './common/render-area';\nexport * from './common/render-command-list';\nexport * from './common/sort';\nexport * from './common/morphing-utils';\nexport * from './common/split-path';\nexport * from './common/enums';\nexport * from './common/generator';\nexport * from './common/performance-raf';\nexport * from './common/event-transformer';\nexport * from './plugins/constants';\nexport * from './plugins/builtin-plugin/richtext-edit-plugin';\nexport * from './allocator/matrix-allocate';\nexport * from './allocator/canvas-allocate';\nexport * from './allocator/graphic-allocate';\nexport * from './common/contribution-provider';\n\nexport { wrapCanvas, wrapContext } from './canvas/util';\nexport * from './common/xml';\nexport * from './common/inversify-lite';\nexport * from './constants';\nexport * from './application';\nexport * from './env-check';\n\nexport * from './render/contributions/render/arc-module';\nexport * from './render/contributions/render/rect-module';\nexport * from './render/contributions/render/line-module';\nexport * from './render/contributions/render/area-module';\nexport * from './render/contributions/render/symbol-module';\nexport * from './render/contributions/render/circle-module';\nexport * from './render/contributions/render/text-module';\nexport * from './render/contributions/render/path-module';\nexport * from './render/contributions/render/polygon-module';\nexport * from './render/contributions/render/star-module';\nexport * from './render/contributions/render/glyph-module';\nexport * from './render/contributions/render/richtext-module';\nexport * from './render/contributions/render/image-module';\nexport * from './render/contributions/render/rect3d-module';\nexport * from './render/contributions/render/arc3d-module';\nexport * from './render/contributions/render/pyramid3d-module';\n\nexport * from './register/register-arc';\nexport * from './register/register-arc3d';\nexport * from './register/register-area';\nexport * from './register/register-circle';\nexport * from './register/register-glyph';\nexport * from './register/register-group';\nexport * from './register/register-image';\nexport * from './register/register-line';\nexport * from './register/register-path';\nexport * from './register/register-polygon';\nexport * from './register/register-star';\nexport * from './register/register-pyramid3d';\nexport * from './register/register-rect';\nexport * from './register/register-rect3d';\nexport * from './register/register-richtext';\nexport * from './register/register-symbol';\nexport * from './register/register-text';\nexport * from './register/register-shadowRoot';\nexport * from './register/register-wraptext';\n\n// plugin\nexport * from './plugins/builtin-plugin/html-attribute-plugin';\nexport * from './plugins/builtin-plugin/react-attribute-plugin';\nexport * from './plugins/builtin-plugin/3dview-transform-plugin';\nexport * from './plugins/builtin-plugin/flex-layout-plugin';\n\nexport * from './plugins/builtin-plugin/edit-module';\n\n// export const morphPath = {};\n// export const multiToOneMorph = {};\n// export const oneToMultiMorph = {};\n// export class ACustomAnimate {}\n// export const AnimateGroup = {};\n// export const Animate = {};\n// export const defaultTicker = {};\n"]}
|
package/cjs/interface/core.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface IGraphicUtil {
|
|
|
10
10
|
canvas?: ICanvas;
|
|
11
11
|
context?: IContext2d | null;
|
|
12
12
|
textMeasure: ITextMeasure;
|
|
13
|
+
getTextMeasureInstance: (textMeasureId?: string) => ITextMeasure;
|
|
13
14
|
measureText: (text: string, tc: TextOptionsType) => {
|
|
14
15
|
width: number;
|
|
15
16
|
height: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interface/core.ts"],"names":[],"mappings":"","file":"core.js","sourcesContent":["import type { ICanvas } from './canvas';\nimport type { IContext2d } from './context';\nimport type { IGraphic, IGraphicAttribute } from './graphic';\nimport type { ITextAttribute } from './graphic/text';\nimport type { ILayer, ILayerParams } from './layer';\nimport type { IStage } from './stage';\nimport type { ITextMeasure, TextOptionsType } from './text';\nimport type { IMatrix, IPointLike, ITextMeasureOption, TextMeasure } from '@visactor/vutils';\n\nexport interface IGraphicUtil {\n canvas?: ICanvas;\n context?: IContext2d | null;\n textMeasure: ITextMeasure;\n measureText: (text: string, tc: TextOptionsType) => { width: number; height: number };\n bindTextMeasure: (tm: ITextMeasure) => void;\n createTextMeasureInstance: (\n textSpec?: Partial<ITextAttribute>,\n option?: Partial<ITextMeasureOption>,\n getCanvasForMeasure?: () => any\n ) => TextMeasure<ITextAttribute>;\n drawGraphicToCanvas: (\n graphic: IGraphic,\n stage: IStage\n ) => HTMLCanvasElement | null | Promise<HTMLCanvasElement | null>;\n}\n\nexport type TransformType = Pick<IGraphicAttribute, 'x' | 'y' | 'scaleX' | 'scaleY' | 'angle' | 'dx' | 'dy'> & {\n anchor?: IGraphicAttribute['anchor'];\n};\nexport interface ITransformUtil {\n init: (origin: TransformType) => ITransformUtil;\n fromMatrix: (source: IMatrix, target: IMatrix) => ITransformUtil;\n scale: (sx: number, sy: number, center?: IPointLike) => ITransformUtil;\n rotate: (angle: number, center?: IPointLike) => ITransformUtil;\n translate: (dx: number, dy: number) => ITransformUtil;\n}\n\nexport interface ILayerService {\n createLayer: (stage: IStage, options?: Partial<ILayerParams>) => ILayer;\n // stage绘制前调用\n prepareStageLayer: (stage: IStage) => void;\n releaseLayer: (stage: IStage, layer: ILayer) => void;\n restLayerCount: (stage: IStage) => number;\n getStageLayer: (stage: IStage) => ILayer[];\n layerCount: (stage: IStage) => number;\n releaseStage: (stage: IStage) => void;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interface/core.ts"],"names":[],"mappings":"","file":"core.js","sourcesContent":["import type { ICanvas } from './canvas';\nimport type { IContext2d } from './context';\nimport type { IGraphic, IGraphicAttribute } from './graphic';\nimport type { ITextAttribute } from './graphic/text';\nimport type { ILayer, ILayerParams } from './layer';\nimport type { IStage } from './stage';\nimport type { ITextMeasure, TextOptionsType } from './text';\nimport type { IMatrix, IPointLike, ITextMeasureOption, TextMeasure } from '@visactor/vutils';\n\nexport interface IGraphicUtil {\n canvas?: ICanvas;\n context?: IContext2d | null;\n textMeasure: ITextMeasure;\n getTextMeasureInstance: (textMeasureId?: string) => ITextMeasure;\n measureText: (text: string, tc: TextOptionsType) => { width: number; height: number };\n bindTextMeasure: (tm: ITextMeasure) => void;\n createTextMeasureInstance: (\n textSpec?: Partial<ITextAttribute>,\n option?: Partial<ITextMeasureOption>,\n getCanvasForMeasure?: () => any\n ) => TextMeasure<ITextAttribute>;\n drawGraphicToCanvas: (\n graphic: IGraphic,\n stage: IStage\n ) => HTMLCanvasElement | null | Promise<HTMLCanvasElement | null>;\n}\n\nexport type TransformType = Pick<IGraphicAttribute, 'x' | 'y' | 'scaleX' | 'scaleY' | 'angle' | 'dx' | 'dy'> & {\n anchor?: IGraphicAttribute['anchor'];\n};\nexport interface ITransformUtil {\n init: (origin: TransformType) => ITransformUtil;\n fromMatrix: (source: IMatrix, target: IMatrix) => ITransformUtil;\n scale: (sx: number, sy: number, center?: IPointLike) => ITransformUtil;\n rotate: (angle: number, center?: IPointLike) => ITransformUtil;\n translate: (dx: number, dy: number) => ITransformUtil;\n}\n\nexport interface ILayerService {\n createLayer: (stage: IStage, options?: Partial<ILayerParams>) => ILayer;\n // stage绘制前调用\n prepareStageLayer: (stage: IStage) => void;\n releaseLayer: (stage: IStage, layer: ILayer) => void;\n restLayerCount: (stage: IStage) => number;\n getStageLayer: (stage: IStage) => ILayer[];\n layerCount: (stage: IStage) => number;\n releaseStage: (stage: IStage) => void;\n}\n"]}
|
package/cjs/interface/text.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface TextOptionsType {
|
|
|
12
12
|
textAlign?: 'left' | 'center' | 'right' | 'start' | 'end';
|
|
13
13
|
}
|
|
14
14
|
export interface ITextMeasure extends IContribution<IGraphicUtil> {
|
|
15
|
+
id: string;
|
|
15
16
|
measureTextWidth: (text: string, options: TextOptionsType) => number;
|
|
16
17
|
measureTextPixelHeight: (text: string, options: TextOptionsType) => number;
|
|
17
18
|
measureTextBoundHieght: (text: string, options: TextOptionsType) => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interface/text.ts"],"names":[],"mappings":"","file":"text.js","sourcesContent":["import type { IContribution } from './contribution';\nimport type { IGraphicUtil } from './core';\nimport type { MeasureModeEnum } from './graphic/text';\n\nexport interface TextOptionsType {\n fontSize?: number;\n fontWeight?: string | number;\n fontFamily?: string;\n fontStyle?: string;\n fontVariant?: string;\n lineHeight?: number;\n textBaseline?: 'alphabetic' | 'top' | 'middle' | 'bottom';\n textAlign?: 'left' | 'center' | 'right' | 'start' | 'end';\n}\n\nexport interface ITextMeasure extends IContribution<IGraphicUtil> {\n measureTextWidth: (text: string, options: TextOptionsType) => number;\n measureTextPixelHeight: (text: string, options: TextOptionsType) => number;\n measureTextBoundHieght: (text: string, options: TextOptionsType) => number;\n measureTextPixelADscentAndWidth: (\n text: string,\n options: TextOptionsType,\n mode: MeasureModeEnum\n ) => { width: number; ascent: number; descent: number };\n clipText: (\n text: string,\n options: TextOptionsType,\n width: number,\n wordBreak: boolean,\n keepAllBreak?: boolean\n ) => { str: string; width: number; wordBreaked?: number };\n clipTextVertical: (\n verticalList: { text: string; width?: number; direction: number }[],\n options: TextOptionsType,\n width: number,\n wordBreak: boolean\n ) => { verticalList: { text: string; width?: number; direction: number }[]; width: number };\n clipTextWithSuffix: (\n text: string,\n options: TextOptionsType,\n width: number,\n suffix: string | boolean,\n wordBreak: boolean,\n position: 'start' | 'end' | 'middle',\n forceSuffix?: boolean\n ) => { str: string; width: number };\n clipTextWithSuffixVertical: (\n verticalList: { text: string; width?: number; direction: number }[],\n options: TextOptionsType,\n width: number,\n suffix: string,\n wordBreak: boolean,\n suffixPosition: 'start' | 'end' | 'middle'\n ) => { verticalList: { text: string; width?: number; direction: number }[]; width: number };\n measureText: (text: string, options: TextOptionsType) => { width: number };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interface/text.ts"],"names":[],"mappings":"","file":"text.js","sourcesContent":["import type { IContribution } from './contribution';\nimport type { IGraphicUtil } from './core';\nimport type { MeasureModeEnum } from './graphic/text';\n\nexport interface TextOptionsType {\n fontSize?: number;\n fontWeight?: string | number;\n fontFamily?: string;\n fontStyle?: string;\n fontVariant?: string;\n lineHeight?: number;\n textBaseline?: 'alphabetic' | 'top' | 'middle' | 'bottom';\n textAlign?: 'left' | 'center' | 'right' | 'start' | 'end';\n}\n\nexport interface ITextMeasure extends IContribution<IGraphicUtil> {\n id: string;\n measureTextWidth: (text: string, options: TextOptionsType) => number;\n measureTextPixelHeight: (text: string, options: TextOptionsType) => number;\n measureTextBoundHieght: (text: string, options: TextOptionsType) => number;\n measureTextPixelADscentAndWidth: (\n text: string,\n options: TextOptionsType,\n mode: MeasureModeEnum\n ) => { width: number; ascent: number; descent: number };\n clipText: (\n text: string,\n options: TextOptionsType,\n width: number,\n wordBreak: boolean,\n keepAllBreak?: boolean\n ) => { str: string; width: number; wordBreaked?: number };\n clipTextVertical: (\n verticalList: { text: string; width?: number; direction: number }[],\n options: TextOptionsType,\n width: number,\n wordBreak: boolean\n ) => { verticalList: { text: string; width?: number; direction: number }[]; width: number };\n clipTextWithSuffix: (\n text: string,\n options: TextOptionsType,\n width: number,\n suffix: string | boolean,\n wordBreak: boolean,\n position: 'start' | 'end' | 'middle',\n forceSuffix?: boolean\n ) => { str: string; width: number };\n clipTextWithSuffixVertical: (\n verticalList: { text: string; width?: number; direction: number }[],\n options: TextOptionsType,\n width: number,\n suffix: string,\n wordBreak: boolean,\n suffixPosition: 'start' | 'end' | 'middle'\n ) => { verticalList: { text: string; width?: number; direction: number }[]; width: number };\n measureText: (text: string, options: TextOptionsType) => { width: number };\n}\n"]}
|
|
@@ -272,6 +272,7 @@ class RichTextEditPlugin {
|
|
|
272
272
|
}));
|
|
273
273
|
}
|
|
274
274
|
tryShowInputBounds() {
|
|
275
|
+
var _a, _b;
|
|
275
276
|
if (!this.currRt || !this.focusing) return;
|
|
276
277
|
const {editOptions: editOptions = {}} = this.currRt.attribute, {boundsStrokeWhenInput: boundsStrokeWhenInput} = editOptions;
|
|
277
278
|
if (!editOptions || !boundsStrokeWhenInput) return;
|
|
@@ -280,6 +281,8 @@ class RichTextEditPlugin {
|
|
|
280
281
|
this.shadowBounds = this.shadowBounds || (0, graphic_1.createRect)({}), this.shadowBounds.setAttributes({
|
|
281
282
|
x: 0,
|
|
282
283
|
y: 0,
|
|
284
|
+
scaleX: 1 / (null !== (_a = this.currRt.attribute.scaleX) && void 0 !== _a ? _a : 1),
|
|
285
|
+
scaleY: 1 / (null !== (_b = this.currRt.attribute.scaleY) && void 0 !== _b ? _b : 1),
|
|
283
286
|
width: width,
|
|
284
287
|
height: height,
|
|
285
288
|
fill: !1,
|
|
@@ -369,7 +372,9 @@ class RichTextEditPlugin {
|
|
|
369
372
|
const x = 0, y1 = 0, y2 = (0, graphic_1.getRichTextBounds)(Object.assign(Object.assign({}, target.attribute), {
|
|
370
373
|
textConfig: [ {
|
|
371
374
|
text: "a"
|
|
372
|
-
} ]
|
|
375
|
+
} ],
|
|
376
|
+
scaleX: 1,
|
|
377
|
+
scaleY: 1
|
|
373
378
|
})).height();
|
|
374
379
|
this.startCursorPos = {
|
|
375
380
|
x: x,
|
|
@@ -400,7 +405,10 @@ class RichTextEditPlugin {
|
|
|
400
405
|
textConfig: [ {
|
|
401
406
|
text: "a"
|
|
402
407
|
} ]
|
|
403
|
-
})), b = (0, graphic_1.getRichTextBounds)(
|
|
408
|
+
})), b = (0, graphic_1.getRichTextBounds)(Object.assign(Object.assign({}, attr), {
|
|
409
|
+
scaleX: 1,
|
|
410
|
+
scaleY: 1
|
|
411
|
+
}))), "middle" === textBaseline ? dy = -b.height() / 2 : "bottom" === textBaseline && (dy = -b.height()),
|
|
404
412
|
this.editLine && this.editLine.setAttributes({
|
|
405
413
|
dy: dy
|
|
406
414
|
}), this.editBg && this.editBg.setAttributes({
|
|
@@ -591,9 +599,15 @@ class RichTextEditPlugin {
|
|
|
591
599
|
const rt = this.currRt, {textBaseline: textBaseline} = rt.attribute;
|
|
592
600
|
let dy = 0;
|
|
593
601
|
if ("middle" === textBaseline) {
|
|
594
|
-
dy = (0, graphic_1.getRichTextBounds)(rt.attribute)
|
|
602
|
+
dy = (0, graphic_1.getRichTextBounds)(Object.assign(Object.assign({}, rt.attribute), {
|
|
603
|
+
scaleX: 1,
|
|
604
|
+
scaleY: 1
|
|
605
|
+
})).height() / 2;
|
|
595
606
|
} else if ("bottom" === textBaseline) {
|
|
596
|
-
dy = (0, graphic_1.getRichTextBounds)(rt.attribute)
|
|
607
|
+
dy = (0, graphic_1.getRichTextBounds)(Object.assign(Object.assign({}, rt.attribute), {
|
|
608
|
+
scaleX: 1,
|
|
609
|
+
scaleY: 1
|
|
610
|
+
})).height();
|
|
597
611
|
}
|
|
598
612
|
return p1.y += dy, p1;
|
|
599
613
|
}
|