@visactor/vrender-core 0.22.0-vstory.5 → 0.22.0-vstory.7

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.
Files changed (42) hide show
  1. package/cjs/animate/custom-animate.js +2 -1
  2. package/cjs/animate/index.js +1 -2
  3. package/cjs/graphic/builtin-symbol/utils.js +1 -1
  4. package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
  5. package/cjs/graphic/group.js +1 -1
  6. package/cjs/graphic/group.js.map +1 -1
  7. package/cjs/graphic/richtext/paragraph.js +4 -5
  8. package/cjs/graphic/richtext/paragraph.js.map +1 -1
  9. package/cjs/graphic/richtext.d.ts +2 -1
  10. package/cjs/graphic/richtext.js +6 -0
  11. package/cjs/graphic/richtext.js.map +1 -1
  12. package/cjs/interface/graphic/richText.d.ts +1 -0
  13. package/cjs/interface/graphic/richText.js.map +1 -1
  14. package/cjs/plugins/builtin-plugin/edit-module.js +2 -2
  15. package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -1
  16. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +3 -2
  17. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +87 -73
  18. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  19. package/cjs/render/contributions/render/draw-contribution.js +1 -1
  20. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  21. package/dist/index.es.js +56 -21
  22. package/es/animate/custom-animate.js +2 -1
  23. package/es/animate/index.js +1 -2
  24. package/es/graphic/builtin-symbol/utils.js +1 -1
  25. package/es/graphic/builtin-symbol/utils.js.map +1 -1
  26. package/es/graphic/group.js +1 -1
  27. package/es/graphic/group.js.map +1 -1
  28. package/es/graphic/richtext/paragraph.js +4 -5
  29. package/es/graphic/richtext/paragraph.js.map +1 -1
  30. package/es/graphic/richtext.d.ts +2 -1
  31. package/es/graphic/richtext.js +6 -0
  32. package/es/graphic/richtext.js.map +1 -1
  33. package/es/interface/graphic/richText.d.ts +1 -0
  34. package/es/interface/graphic/richText.js.map +1 -1
  35. package/es/plugins/builtin-plugin/edit-module.js +2 -2
  36. package/es/plugins/builtin-plugin/edit-module.js.map +1 -1
  37. package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +3 -2
  38. package/es/plugins/builtin-plugin/richtext-edit-plugin.js +85 -73
  39. package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  40. package/es/render/contributions/render/draw-contribution.js +1 -1
  41. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  42. package/package.json +1 -1
@@ -718,4 +718,5 @@ class AnimateGroup1 extends animate_1.ACustomAnimate {
718
718
  }
719
719
  }
720
720
 
721
- exports.AnimateGroup1 = AnimateGroup1;
721
+ exports.AnimateGroup1 = AnimateGroup1;
722
+ //# sourceMappingURL=custom-animate.js.map
@@ -20,5 +20,4 @@ Object.defineProperty(exports, "__esModule", {
20
20
  }), __exportStar(require("./Ticker"), exports), __exportStar(require("./animate"), exports),
21
21
  __exportStar(require("./config"), exports), __exportStar(require("./custom-animate"), exports),
22
22
  __exportStar(require("./morphing"), exports), __exportStar(require("./timeline"), exports),
23
- __exportStar(require("./group-fade"), exports), __exportStar(require("./easing"), exports);
24
- //# sourceMappingURL=index.js.map
23
+ __exportStar(require("./group-fade"), exports), __exportStar(require("./easing"), exports);
@@ -25,7 +25,7 @@ class CustomSymbolClass {
25
25
  return (0, vutils_1.isNumber)(size) ? size : Math.min(size[0], size[1]);
26
26
  }
27
27
  drawWithClipRange(ctx, size, x, y, clipRange, z, cb) {
28
- return this.isSvg ? !!this.svgCache && (this.svgCache.forEach((item => {
28
+ return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach((item => {
29
29
  item.path.drawWithClipRange(ctx, size, x, y, clipRange), cb && cb(item.path, item.attribute);
30
30
  })), !1) : (this.path.drawWithClipRange(ctx, size, x, y, clipRange), !1);
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/buil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AClC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClB,OAAO;aACR;YACD,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;gBACjC,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;gBACtC,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;gBACtC,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;gBACtC,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;gBACtC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;YACH,OAAO;SACR;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACrB,OAAO;SACR;QACD,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;QACvC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;QACvC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;QACvC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;IACzC,CAAC;CACF;AA9GD,8CA8GC","file":"utils.js","sourcesContent":["import { isArray, type IBounds, AABBBounds, isNumber } from '@visactor/vutils';\nimport { renderCommandList } from '../../common/render-command-list';\nimport type { IContext2d, ICustomPath2D, IGraphicAttribute, IPath2D, ISymbolClass } from '../../interface';\n\nconst tempBounds = new AABBBounds();\nexport class CustomSymbolClass implements ISymbolClass {\n type: string;\n path: ICustomPath2D;\n pathStr: string = '';\n isSvg: boolean;\n svgCache?: { path: ICustomPath2D; attribute: Partial<IGraphicAttribute> }[];\n\n constructor(\n type: string,\n path: ICustomPath2D | { path: ICustomPath2D; attribute: Partial<IGraphicAttribute> }[],\n isSvg: boolean = false\n ) {\n this.type = type;\n if (isArray(path)) {\n this.svgCache = path;\n } else {\n this.path = path;\n }\n this.isSvg = isSvg;\n }\n\n drawOffset(\n ctx: IContext2d,\n size: number,\n x: number,\n y: number,\n offset: number,\n z?: number,\n cb?: (path: ICustomPath2D, attribute?: Record<string, any>) => void\n ) {\n size = this.parseSize(size);\n if (this.isSvg) {\n if (!this.svgCache) {\n return false;\n }\n this.svgCache.forEach(item => {\n ctx.beginPath();\n renderCommandList(item.path.commandList, ctx, x, y, size, size);\n cb && cb(item.path, item.attribute);\n });\n return false;\n }\n renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset);\n return false;\n }\n\n draw(\n ctx: IContext2d,\n size: number,\n x: number,\n y: number,\n z?: number,\n cb?: (path: ICustomPath2D, attribute?: Record<string, any>) => void\n ) {\n size = this.parseSize(size);\n return this.drawOffset(ctx, size, x, y, 0, z, cb);\n }\n\n protected parseSize(size: number | [number, number]): number {\n return isNumber(size) ? size : Math.min(size[0], size[1]);\n }\n drawWithClipRange(\n ctx: IPath2D,\n size: number,\n x: number,\n y: number,\n clipRange: number,\n z?: number,\n cb?: (p: ICustomPath2D, a: any) => void\n ) {\n if (this.isSvg) {\n if (!this.svgCache) {\n return false;\n }\n this.svgCache.forEach(item => {\n item.path.drawWithClipRange(ctx, size, x, y, clipRange);\n cb && cb(item.path, item.attribute);\n });\n return false;\n }\n this.path.drawWithClipRange(ctx, size, x, y, clipRange);\n // this.path.drawWithClipRange && this.path.drawWithClipRange(ctx, clipRange);\n // renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset);\n return false;\n }\n\n bounds(size: number, bounds: IBounds) {\n size = this.parseSize(size);\n if (this.isSvg) {\n if (!this.svgCache) {\n return;\n }\n bounds.clear();\n this.svgCache.forEach(({ path }) => {\n tempBounds.x1 = path.bounds.x1 * size;\n tempBounds.y1 = path.bounds.y1 * size;\n tempBounds.x2 = path.bounds.x2 * size;\n tempBounds.y2 = path.bounds.y2 * size;\n bounds.union(tempBounds);\n });\n return;\n }\n if (!this.path.bounds) {\n return;\n }\n bounds.x1 = this.path.bounds.x1 * size;\n bounds.y1 = this.path.bounds.y1 * size;\n bounds.x2 = this.path.bounds.x2 * size;\n bounds.y2 = this.path.bounds.y2 * size;\n }\n}\n\n// export function CustomSymbol(): ISymbolClass {\n\n// }\n"]}
1
+ {"version":3,"sources":["../src/graphic/builtin-symbol/utils.ts"],"names":[],"mappings":";;;AAAA,6CAA+E;AAC/E,0EAAqE;AAGrE,MAAM,UAAU,GAAG,IAAI,mBAAU,EAAE,CAAC;AACpC,MAAa,iBAAiB;IAO5B,YACE,IAAY,EACZ,IAAsF,EACtF,QAAiB,KAAK;QAPxB,YAAO,GAAW,EAAE,CAAC;QASnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,IAAA,gBAAO,EAAC,IAAI,CAAC,EAAE;YACjB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;SACtB;aAAM;YACL,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;SAClB;QACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,UAAU,CACR,GAAe,EACf,IAAY,EACZ,CAAS,EACT,CAAS,EACT,MAAc,EACd,CAAU,EACV,EAAmE;QAEnE,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClB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YAC3B,CAAC,CAAC,CAAC;YACH,OAAO;SACR;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACrB,OAAO;SACR;QACD,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;QACvC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;QACvC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;QACvC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;IACzC,CAAC;CACF;AA/GD,8CA+GC","file":"utils.js","sourcesContent":["import { isArray, type IBounds, AABBBounds, isNumber } from '@visactor/vutils';\nimport { renderCommandList } from '../../common/render-command-list';\nimport type { IContext2d, ICustomPath2D, IGraphicAttribute, IPath2D, ISymbolClass } from '../../interface';\n\nconst tempBounds = new AABBBounds();\nexport class CustomSymbolClass implements ISymbolClass {\n type: string;\n path: ICustomPath2D;\n pathStr: string = '';\n isSvg: boolean;\n svgCache?: { path: ICustomPath2D; attribute: Partial<IGraphicAttribute> }[];\n\n constructor(\n type: string,\n path: ICustomPath2D | { path: ICustomPath2D; attribute: Partial<IGraphicAttribute> }[],\n isSvg: boolean = false\n ) {\n this.type = type;\n if (isArray(path)) {\n this.svgCache = path;\n } else {\n this.path = path;\n }\n this.isSvg = isSvg;\n }\n\n drawOffset(\n ctx: IContext2d,\n size: number,\n x: number,\n y: number,\n offset: number,\n z?: number,\n cb?: (path: ICustomPath2D, attribute?: Record<string, any>) => void\n ) {\n size = this.parseSize(size);\n if (this.isSvg) {\n if (!this.svgCache) {\n return false;\n }\n this.svgCache.forEach(item => {\n ctx.beginPath();\n renderCommandList(item.path.commandList, ctx, x, y, size, size);\n cb && cb(item.path, item.attribute);\n });\n return false;\n }\n renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset);\n return false;\n }\n\n draw(\n ctx: IContext2d,\n size: number,\n x: number,\n y: number,\n z?: number,\n cb?: (path: ICustomPath2D, attribute?: Record<string, any>) => void\n ) {\n size = this.parseSize(size);\n return this.drawOffset(ctx, size, x, y, 0, z, cb);\n }\n\n protected parseSize(size: number | [number, number]): number {\n return isNumber(size) ? size : Math.min(size[0], size[1]);\n }\n drawWithClipRange(\n ctx: IPath2D,\n size: number,\n x: number,\n y: number,\n clipRange: number,\n z?: number,\n cb?: (p: ICustomPath2D, a: any) => void\n ) {\n size = this.parseSize(size);\n if (this.isSvg) {\n if (!this.svgCache) {\n return false;\n }\n this.svgCache.forEach(item => {\n item.path.drawWithClipRange(ctx, size, x, y, clipRange);\n cb && cb(item.path, item.attribute);\n });\n return false;\n }\n this.path.drawWithClipRange(ctx, size, x, y, clipRange);\n // this.path.drawWithClipRange && this.path.drawWithClipRange(ctx, clipRange);\n // renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset);\n return false;\n }\n\n bounds(size: number, bounds: IBounds) {\n size = this.parseSize(size);\n if (this.isSvg) {\n if (!this.svgCache) {\n return;\n }\n bounds.clear();\n this.svgCache.forEach(({ path }) => {\n tempBounds.x1 = path.bounds.x1 * size;\n tempBounds.y1 = path.bounds.y1 * size;\n tempBounds.x2 = path.bounds.x2 * size;\n tempBounds.y2 = path.bounds.y2 * size;\n bounds.union(tempBounds);\n });\n return;\n }\n if (!this.path.bounds) {\n return;\n }\n bounds.x1 = this.path.bounds.x1 * size;\n bounds.y1 = this.path.bounds.y1 * size;\n bounds.x2 = this.path.bounds.x2 * size;\n bounds.y2 = this.path.bounds.y2 * size;\n }\n}\n\n// export function CustomSymbol(): ISymbolClass {\n\n// }\n"]}
@@ -60,7 +60,7 @@ class Group extends graphic_1.Graphic {
60
60
  application_1.application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
61
61
  const selfChange = this.shouldSelfChangeUpdateAABBBounds(), bounds = this.doUpdateAABBBounds();
62
62
  return this.addUpdateLayoutTag(), application_1.application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange),
63
- bounds;
63
+ "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
64
64
  }
65
65
  doUpdateLocalMatrix() {
66
66
  const {x: x = config_1.DefaultTransform.x, y: y = config_1.DefaultTransform.y, dx: dx = config_1.DefaultTransform.dx, dy: dy = config_1.DefaultTransform.dy, scaleX: scaleX = config_1.DefaultTransform.scaleX, scaleY: scaleY = config_1.DefaultTransform.scaleY, angle: angle = config_1.DefaultTransform.angle, postMatrix: postMatrix} = this.attribute;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/group.ts"],"names":[],"mappings":";;;AAEA,6CAAyC;AACzC,gDAA6C;AAY7C,uCAAyD;AACzD,mCAA0C;AAC1C,2CAA+D;AAC/D,2CAAgD;AAChD,qCAA4C;AAG5C,IAAY,yBAKX;AALD,WAAY,yBAAyB;IAEnC,qFAAc,CAAA;IAEd,qFAAc,CAAA;AAChB,CAAC,EALW,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAKpC;AAED,MAAa,KAAM,SAAQ,iBAA+B;IAWxD,YAAY,MAA8B;QACxC,KAAK,CAAC,MAAM,CAAC,CAAC;QAXhB,SAAI,GAAgB,OAAO,CAAC;QAC5B,WAAM,GAAQ,IAAI,CAAC;QACnB,gBAAW,GAAY,IAAI,CAAC;QAU1B,IAAI,CAAC,UAAU,GAAG,6BAAiB,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,iBAAS,CAAC,aAAa,CAAC;IAEjD,CAAC;IAED,OAAO,CAAC,IAAiB;QACvB,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IACtD,CAAC;IAED,SAAS;QACP,IAAI,CAAC,QAAQ,GAAG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,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;SACnB;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,KAAK,mBAAM,IAAI,CAAC,SAAS,EAAG,CAAC;IAC1C,CAAC;IAED,oBAAoB;QAClB,OAAO,KAAK,CAAC,mBAAmB,CAAC;IACnC,CAAC;;AA9XH,sBA+XC;AAtXQ,yBAAmB,GAAG,6BAAmB,CAAC;AAwXnD,SAAgB,WAAW,CAAC,UAAkC;IAC5D,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC;AAC/B,CAAC;AAFD,kCAEC","file":"group.js","sourcesContent":["import type { IAABBBounds, Matrix } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { Point } from '@visactor/vutils';\nimport { application } from '../application';\nimport type {\n IStage,\n GraphicAttributeMap,\n INode,\n IGraphic,\n ITheme,\n IThemeSpec,\n ILayer,\n GraphicType\n} from '../interface';\nimport type { IGroup, IGroupGraphicAttribute } from '../interface/graphic/group';\nimport { Graphic, NOWORK_ANIMATE_ATTR } from './graphic';\nimport { getTheme, Theme } from './theme';\nimport { UpdateTag, IContainPointMode } from '../common/enums';\nimport { GROUP_NUMBER_TYPE } from './constants';\nimport { DefaultTransform } from './config';\n\n// Group更新AABBBounds的策略\nexport enum GroupUpdateAABBBoundsMode {\n // Group较少的情况,不会批量设置所有父层的tag,而是每次都查找\n LESS_GROUP = 0,\n // Group较多的情况,每次都会设置tag到最顶层\n MORE_GROUP = 1\n}\n\nexport class Group extends Graphic<IGroupGraphicAttribute> implements IGroup {\n type: GraphicType = 'group';\n parent: any = null;\n isContainer: boolean = true;\n // 子元素的更新标记\n declare _childUpdateTag: number;\n\n declare theme?: ITheme;\n\n static NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;\n\n constructor(params: IGroupGraphicAttribute) {\n super(params);\n this.numberType = GROUP_NUMBER_TYPE;\n this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;\n // this.theme = new Theme();\n }\n\n setMode(mode: '2d' | '3d') {\n mode === '3d' ? this.set3dMode() : this.set2dMode();\n }\n\n set3dMode() {\n this.in3dMode = true;\n // this.forEachChildren((c: IGraphic) => {\n // c.setMode('3d');\n // });\n }\n set2dMode() {\n this.in3dMode = false;\n // this.forEachChildren((c: IGraphic) => {\n // c.setMode('2d');\n // });\n }\n\n setTheme(t: IThemeSpec) {\n if (!this.theme) {\n this.theme = new Theme();\n }\n return this.theme.setTheme(t, this);\n }\n\n createTheme() {\n if (!this.theme) {\n this.theme = new Theme();\n }\n }\n\n visibleAll(visible: boolean) {\n this.setAttribute('visible', visible);\n this.forEachChildren((item: IGraphic) => {\n if (item.isContainer && (item as any).visibleAll) {\n (item as any).visibleAll(visible);\n } else {\n item.setAttribute('visible', visible);\n }\n });\n }\n\n hideAll() {\n this.visibleAll(false);\n }\n\n showAll() {\n this.visibleAll(true);\n }\n\n /**\n * 是否包含某个点(点需要是全局坐标系)\n * group containsPoint 只需要判断bounds\n * TODO: group的shape判断\n * @param x\n * @param y\n * @param mode\n * @returns\n */\n containsPoint(x: number, y: number, mode: IContainPointMode): boolean {\n if (mode === IContainPointMode.GLOBAL) {\n // 转换x,y更精准\n const point = new Point(x, y);\n if (this.parent) {\n this.parent.globalTransMatrix.transformPoint(point, point);\n }\n return this.AABBBounds.contains(point.x, point.y);\n }\n return this.AABBBounds.contains(x, y);\n }\n\n shouldUpdateAABBBounds(): boolean {\n // 检索自己是否需要更新\n if (super.shouldUpdateAABBBounds()) {\n return true;\n }\n // 检索叶子节点是否有更新(如果children是叶子节点的话)\n if (this._childUpdateTag & UpdateTag.UPDATE_BOUNDS) {\n return true;\n }\n return false;\n // // 检索是否子group需要更新\n // let needUpdate = false;\n // this.forEachChildren((node: IGraphic) => {\n // // 只查找group层级\n // if (node.isContainer && (node as Group).shouldUpdateAABBBounds()) {\n // needUpdate = true;\n // return true;\n // }\n // return false;\n // });\n // return needUpdate;\n }\n\n protected tryUpdateAABBBounds(): IAABBBounds {\n if (!this.shouldUpdateAABBBounds()) {\n return this._AABBBounds;\n }\n application.graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);\n const selfChange = this.shouldSelfChangeUpdateAABBBounds();\n const bounds = this.doUpdateAABBBounds();\n this.addUpdateLayoutTag();\n application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange);\n return bounds;\n }\n\n /**\n * 大部分group不需要更新matrix,这里特殊优化一下\n * 更新局部matrix的具体函数\n */\n protected doUpdateLocalMatrix() {\n const {\n x = DefaultTransform.x,\n y = DefaultTransform.y,\n dx = DefaultTransform.dx,\n dy = DefaultTransform.dy,\n scaleX = DefaultTransform.scaleX,\n scaleY = DefaultTransform.scaleY,\n angle = DefaultTransform.angle,\n postMatrix\n } = this.attribute;\n if (x === 0 && y === 0 && dx === 0 && dy === 0 && scaleX === 1 && scaleY === 1 && angle === 0 && !postMatrix) {\n this._transMatrix.reset();\n return;\n }\n return super.doUpdateLocalMatrix();\n }\n\n getGraphicTheme(): Required<IGroupGraphicAttribute> {\n return getTheme(this).group;\n }\n\n protected updateAABBBounds(\n attribute: IGroupGraphicAttribute,\n groupTheme: Required<IGroupGraphicAttribute>,\n aabbBounds: IAABBBounds\n ) {\n const originalAABBBounds = aabbBounds; // fix aabbbounds update error in flex layout\n aabbBounds = aabbBounds.clone();\n\n const { width, height, path, clip = groupTheme.clip } = attribute;\n // 添加自身的fill或者clip\n if (path && path.length) {\n path.forEach(g => {\n aabbBounds.union(g.AABBBounds);\n });\n } else if (width != null && height != null) {\n aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)); // fix bounds set when auto size in vtable\n }\n if (!clip) {\n // 添加子节点\n this.forEachChildren((node: IGraphic) => {\n aabbBounds.union(node.AABBBounds);\n });\n // 如果没有clip的话,还需要加一下scroll\n const { scrollX = 0, scrollY = 0 } = attribute;\n aabbBounds.translate(scrollX, scrollY);\n }\n application.graphicService.updateTempAABBBounds(aabbBounds);\n\n application.graphicService.transformAABBBounds(attribute, aabbBounds, groupTheme, false, this);\n\n originalAABBBounds.copy(aabbBounds);\n return originalAABBBounds;\n }\n\n protected doUpdateAABBBounds(): IAABBBounds {\n this.updateAABBBoundsStamp++;\n const bounds = super.doUpdateAABBBounds();\n\n // 更新bounds之后需要设置父节点,否则tag丢失\n this.parent && this.parent.addChildUpdateBoundTag();\n this._emitCustomEvent('AAABBBoundsChange');\n\n return bounds;\n }\n\n protected clearUpdateBoundTag() {\n this._updateTag &= UpdateTag.CLEAR_BOUNDS;\n this._childUpdateTag &= UpdateTag.CLEAR_BOUNDS;\n }\n\n addUpdateBoundTag() {\n this._updateTag |= UpdateTag.UPDATE_BOUNDS; // for bounds\n if (this.parent) {\n this.parent.addChildUpdateBoundTag();\n }\n }\n\n addChildUpdateBoundTag() {\n // 如果已经设置过updateTag,那就不需要设置了\n if (this._childUpdateTag & UpdateTag.UPDATE_BOUNDS) {\n return;\n }\n // 如果没有设置过,那么继续向上设置\n this._childUpdateTag |= UpdateTag.UPDATE_BOUNDS;\n this.parent && this.parent.addChildUpdateBoundTag();\n }\n\n getTheme() {\n return this.theme.getTheme(this);\n }\n\n /* 场景树结构 */\n incrementalAppendChild(node: INode): INode | null {\n const data = super.appendChild(node);\n if (this.stage && data) {\n (data as unknown as this).stage = this.stage;\n (data as unknown as this).layer = this.layer;\n }\n this.addUpdateBoundTag();\n application.graphicService.onAddIncremental(node as unknown as IGraphic, this, this.stage);\n return data;\n }\n incrementalClearChild(): void {\n super.removeAllChild();\n this.addUpdateBoundTag();\n application.graphicService.onClearIncremental(this, this.stage);\n return;\n }\n\n protected _updateChildToStage(child: IGraphic) {\n if (this.stage && child) {\n child.setStage(this.stage, this.layer);\n }\n this.addUpdateBoundTag();\n return child;\n }\n // TODO 代码优化\n appendChild(node: INode, addStage: boolean = true): INode | null {\n const data = super.appendChild(node);\n if (addStage && this.stage && data) {\n (data as unknown as this).setStage(this.stage, this.layer);\n }\n this.addUpdateBoundTag();\n return data;\n }\n insertBefore(newNode: INode, referenceNode: INode): INode | null {\n return this._updateChildToStage(super.insertBefore(newNode, referenceNode) as undefined as IGraphic);\n }\n insertAfter(newNode: INode, referenceNode: INode): INode | null {\n return this._updateChildToStage(super.insertAfter(newNode, referenceNode) as undefined as IGraphic);\n }\n insertInto(newNode: INode, idx: number): INode | null {\n return this._updateChildToStage(super.insertInto(newNode, idx) as undefined as IGraphic);\n }\n\n removeChild(child: IGraphic): IGraphic {\n const data = super.removeChild(child);\n child.stage = null;\n application.graphicService.onRemove(child);\n this.addUpdateBoundTag();\n return data as IGraphic;\n }\n\n removeAllChild(deep: boolean = false): void {\n this.forEachChildren((child: IGraphic) => {\n application.graphicService.onRemove(child);\n if (deep && child.isContainer) {\n child.removeAllChild(deep);\n }\n });\n super.removeAllChild();\n this.addUpdateBoundTag();\n }\n\n setStage(stage?: IStage, layer?: ILayer) {\n if (this.stage !== stage) {\n this.stage = stage;\n this.layer = layer;\n this.setStageToShadowRoot(stage, layer);\n this._onSetStage && this._onSetStage(this, stage, layer);\n application.graphicService.onSetStage(this, stage);\n this.forEachChildren(item => {\n (item as any).setStage(stage, this.layer);\n });\n }\n }\n /**\n * 更新位置tag,包括全局tag和局部tag\n */\n addUpdatePositionTag() {\n super.addUpdatePositionTag();\n // 批量设置底层group的global tag\n this.forEachChildren((g: Group) => {\n if (g.isContainer) {\n g.addUpdateGlobalPositionTag();\n }\n });\n }\n /**\n * 更新全局位置tag\n */\n addUpdateGlobalPositionTag() {\n super.addUpdateGlobalPositionTag();\n // 批量设置底层group的global tag\n this.forEachChildren((g: Group) => {\n if (g.isContainer) {\n g.addUpdateGlobalPositionTag();\n }\n });\n }\n /**\n * group更新全局的transMatrix\n * @param clearTag\n * @returns\n */\n protected tryUpdateGlobalTransMatrix(clearTag: boolean = true): Matrix {\n if (this.shouldUpdateGlobalMatrix()) {\n if (!this._globalTransMatrix) {\n this._globalTransMatrix = this.parent\n ? (this.parent as IGroup).globalTransMatrix.clone()\n : this.transMatrix.clone();\n } else if (this.parent) {\n const m = (this.parent as IGroup).globalTransMatrix;\n this._globalTransMatrix.setValue(m.a, m.b, m.c, m.d, m.e, m.f);\n }\n this.doUpdateGlobalMatrix();\n clearTag && this.clearUpdateGlobalPositionTag();\n }\n return this._globalTransMatrix;\n }\n /**\n * 查找自身更新global的tag,如果存在,就更新\n * @returns\n */\n shouldUpdateGlobalMatrix(): boolean {\n const shouldUpdate = !!(this._updateTag & UpdateTag.UPDATE_GLOBAL_MATRIX);\n return shouldUpdate;\n }\n\n private _getChildByName<T extends INode = INode>(name: string, deep?: boolean): T | null {\n return this.find(node => node.name === name, deep);\n }\n\n /**\n * if graphic exist then update attributes, otherwise create a new instance\n * @param graphicName the name of graphic\n * @param attributes the attributes of graphic\n * @param graphicType the type of graphic\n * @returns the graphic instance\n */\n createOrUpdateChild<T extends keyof GraphicAttributeMap>(\n graphicName: string,\n attributes: GraphicAttributeMap[T],\n graphicType: T\n ): INode {\n let graphic = this._getChildByName(graphicName) as IGraphic;\n if (graphic) {\n graphic.setAttributes(attributes);\n } else {\n graphic = application.graphicService.creator[graphicType](attributes as any);\n graphic.name = graphicName;\n this.add(graphic);\n }\n\n return graphic;\n }\n\n clone() {\n return new Group({ ...this.attribute });\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return Group.NOWORK_ANIMATE_ATTR;\n }\n}\n\nexport function createGroup(attributes: IGroupGraphicAttribute): IGroup {\n return new Group(attributes);\n}\n"]}
1
+ {"version":3,"sources":["../src/graphic/group.ts"],"names":[],"mappings":";;;AAEA,6CAAyC;AACzC,gDAA6C;AAY7C,uCAAyD;AACzD,mCAA0C;AAC1C,2CAA+D;AAC/D,2CAAgD;AAChD,qCAA4C;AAG5C,IAAY,yBAKX;AALD,WAAY,yBAAyB;IAEnC,qFAAc,CAAA;IAEd,qFAAc,CAAA;AAChB,CAAC,EALW,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAKpC;AAED,MAAa,KAAM,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AS,CAAC,oBAAoB,CAAC,CAAC;QAC1E,OAAO,YAAY,CAAC;IACtB,CAAC;IAEO,eAAe,CAA0B,IAAY,EAAE,IAAc;QAC3E,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IASD,mBAAmB,CACjB,WAAmB,EACnB,UAAkC,EAClC,WAAc;QAEd,IAAI,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAa,CAAC;QAC5D,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;SACnC;aAAM;YACL,OAAO,GAAG,yBAAW,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,UAAiB,CAAC,CAAC;YAC7E,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC;YAC3B,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;SACnB;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,KAAK,mBAAM,IAAI,CAAC,SAAS,EAAG,CAAC;IAC1C,CAAC;IAED,oBAAoB;QAClB,OAAO,KAAK,CAAC,mBAAmB,CAAC;IACnC,CAAC;;AAlYH,sBAmYC;AA1XQ,yBAAmB,GAAG,6BAAmB,CAAC;AA4XnD,SAAgB,WAAW,CAAC,UAAkC;IAC5D,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC;AAC/B,CAAC;AAFD,kCAEC","file":"group.js","sourcesContent":["import type { IAABBBounds, Matrix } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { Point } from '@visactor/vutils';\nimport { application } from '../application';\nimport type {\n IStage,\n GraphicAttributeMap,\n INode,\n IGraphic,\n ITheme,\n IThemeSpec,\n ILayer,\n GraphicType\n} from '../interface';\nimport type { IGroup, IGroupGraphicAttribute } from '../interface/graphic/group';\nimport { Graphic, NOWORK_ANIMATE_ATTR } from './graphic';\nimport { getTheme, Theme } from './theme';\nimport { UpdateTag, IContainPointMode } from '../common/enums';\nimport { GROUP_NUMBER_TYPE } from './constants';\nimport { DefaultTransform } from './config';\n\n// Group更新AABBBounds的策略\nexport enum GroupUpdateAABBBoundsMode {\n // Group较少的情况,不会批量设置所有父层的tag,而是每次都查找\n LESS_GROUP = 0,\n // Group较多的情况,每次都会设置tag到最顶层\n MORE_GROUP = 1\n}\n\nexport class Group extends Graphic<IGroupGraphicAttribute> implements IGroup {\n type: GraphicType = 'group';\n parent: any = null;\n isContainer: boolean = true;\n // 子元素的更新标记\n declare _childUpdateTag: number;\n\n declare theme?: ITheme;\n\n static NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;\n\n constructor(params: IGroupGraphicAttribute) {\n super(params);\n this.numberType = GROUP_NUMBER_TYPE;\n this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;\n // this.theme = new Theme();\n }\n\n setMode(mode: '2d' | '3d') {\n mode === '3d' ? this.set3dMode() : this.set2dMode();\n }\n\n set3dMode() {\n this.in3dMode = true;\n // this.forEachChildren((c: IGraphic) => {\n // c.setMode('3d');\n // });\n }\n set2dMode() {\n this.in3dMode = false;\n // this.forEachChildren((c: IGraphic) => {\n // c.setMode('2d');\n // });\n }\n\n setTheme(t: IThemeSpec) {\n if (!this.theme) {\n this.theme = new Theme();\n }\n return this.theme.setTheme(t, this);\n }\n\n createTheme() {\n if (!this.theme) {\n this.theme = new Theme();\n }\n }\n\n visibleAll(visible: boolean) {\n this.setAttribute('visible', visible);\n this.forEachChildren((item: IGraphic) => {\n if (item.isContainer && (item as any).visibleAll) {\n (item as any).visibleAll(visible);\n } else {\n item.setAttribute('visible', visible);\n }\n });\n }\n\n hideAll() {\n this.visibleAll(false);\n }\n\n showAll() {\n this.visibleAll(true);\n }\n\n /**\n * 是否包含某个点(点需要是全局坐标系)\n * group containsPoint 只需要判断bounds\n * TODO: group的shape判断\n * @param x\n * @param y\n * @param mode\n * @returns\n */\n containsPoint(x: number, y: number, mode: IContainPointMode): boolean {\n if (mode === IContainPointMode.GLOBAL) {\n // 转换x,y更精准\n const point = new Point(x, y);\n if (this.parent) {\n this.parent.globalTransMatrix.transformPoint(point, point);\n }\n return this.AABBBounds.contains(point.x, point.y);\n }\n return this.AABBBounds.contains(x, y);\n }\n\n shouldUpdateAABBBounds(): boolean {\n // 检索自己是否需要更新\n if (super.shouldUpdateAABBBounds()) {\n return true;\n }\n // 检索叶子节点是否有更新(如果children是叶子节点的话)\n if (this._childUpdateTag & UpdateTag.UPDATE_BOUNDS) {\n return true;\n }\n return false;\n // // 检索是否子group需要更新\n // let needUpdate = false;\n // this.forEachChildren((node: IGraphic) => {\n // // 只查找group层级\n // if (node.isContainer && (node as Group).shouldUpdateAABBBounds()) {\n // needUpdate = true;\n // return true;\n // }\n // return false;\n // });\n // return needUpdate;\n }\n\n protected tryUpdateAABBBounds(): IAABBBounds {\n if (!this.shouldUpdateAABBBounds()) {\n return this._AABBBounds;\n }\n application.graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);\n const selfChange = this.shouldSelfChangeUpdateAABBBounds();\n const bounds = this.doUpdateAABBBounds();\n this.addUpdateLayoutTag();\n application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange);\n // 直接返回空Bounds,但是前面的流程还是要走\n if (this.attribute.boundsMode === 'empty') {\n bounds.clear();\n }\n return bounds;\n }\n\n /**\n * 大部分group不需要更新matrix,这里特殊优化一下\n * 更新局部matrix的具体函数\n */\n protected doUpdateLocalMatrix() {\n const {\n x = DefaultTransform.x,\n y = DefaultTransform.y,\n dx = DefaultTransform.dx,\n dy = DefaultTransform.dy,\n scaleX = DefaultTransform.scaleX,\n scaleY = DefaultTransform.scaleY,\n angle = DefaultTransform.angle,\n postMatrix\n } = this.attribute;\n if (x === 0 && y === 0 && dx === 0 && dy === 0 && scaleX === 1 && scaleY === 1 && angle === 0 && !postMatrix) {\n this._transMatrix.reset();\n return;\n }\n return super.doUpdateLocalMatrix();\n }\n\n getGraphicTheme(): Required<IGroupGraphicAttribute> {\n return getTheme(this).group;\n }\n\n protected updateAABBBounds(\n attribute: IGroupGraphicAttribute,\n groupTheme: Required<IGroupGraphicAttribute>,\n aabbBounds: IAABBBounds\n ) {\n const originalAABBBounds = aabbBounds; // fix aabbbounds update error in flex layout\n aabbBounds = aabbBounds.clone();\n\n const { width, height, path, clip = groupTheme.clip } = attribute;\n // 添加自身的fill或者clip\n if (path && path.length) {\n path.forEach(g => {\n aabbBounds.union(g.AABBBounds);\n });\n } else if (width != null && height != null) {\n aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)); // fix bounds set when auto size in vtable\n }\n if (!clip) {\n // 添加子节点\n this.forEachChildren((node: IGraphic) => {\n aabbBounds.union(node.AABBBounds);\n });\n // 如果没有clip的话,还需要加一下scroll\n const { scrollX = 0, scrollY = 0 } = attribute;\n aabbBounds.translate(scrollX, scrollY);\n }\n application.graphicService.updateTempAABBBounds(aabbBounds);\n\n application.graphicService.transformAABBBounds(attribute, aabbBounds, groupTheme, false, this);\n\n originalAABBBounds.copy(aabbBounds);\n return originalAABBBounds;\n }\n\n protected doUpdateAABBBounds(): IAABBBounds {\n this.updateAABBBoundsStamp++;\n const bounds = super.doUpdateAABBBounds();\n\n // 更新bounds之后需要设置父节点,否则tag丢失\n this.parent && this.parent.addChildUpdateBoundTag();\n this._emitCustomEvent('AAABBBoundsChange');\n\n return bounds;\n }\n\n protected clearUpdateBoundTag() {\n this._updateTag &= UpdateTag.CLEAR_BOUNDS;\n this._childUpdateTag &= UpdateTag.CLEAR_BOUNDS;\n }\n\n addUpdateBoundTag() {\n this._updateTag |= UpdateTag.UPDATE_BOUNDS; // for bounds\n if (this.parent) {\n this.parent.addChildUpdateBoundTag();\n }\n }\n\n addChildUpdateBoundTag() {\n // 如果已经设置过updateTag,那就不需要设置了\n if (this._childUpdateTag & UpdateTag.UPDATE_BOUNDS) {\n return;\n }\n // 如果没有设置过,那么继续向上设置\n this._childUpdateTag |= UpdateTag.UPDATE_BOUNDS;\n this.parent && this.parent.addChildUpdateBoundTag();\n }\n\n getTheme() {\n return this.theme.getTheme(this);\n }\n\n /* 场景树结构 */\n incrementalAppendChild(node: INode): INode | null {\n const data = super.appendChild(node);\n if (this.stage && data) {\n (data as unknown as this).stage = this.stage;\n (data as unknown as this).layer = this.layer;\n }\n this.addUpdateBoundTag();\n application.graphicService.onAddIncremental(node as unknown as IGraphic, this, this.stage);\n return data;\n }\n incrementalClearChild(): void {\n super.removeAllChild();\n this.addUpdateBoundTag();\n application.graphicService.onClearIncremental(this, this.stage);\n return;\n }\n\n protected _updateChildToStage(child: IGraphic) {\n if (this.stage && child) {\n child.setStage(this.stage, this.layer);\n }\n this.addUpdateBoundTag();\n return child;\n }\n // TODO 代码优化\n appendChild(node: INode, addStage: boolean = true): INode | null {\n const data = super.appendChild(node);\n if (addStage && this.stage && data) {\n (data as unknown as this).setStage(this.stage, this.layer);\n }\n this.addUpdateBoundTag();\n return data;\n }\n insertBefore(newNode: INode, referenceNode: INode): INode | null {\n return this._updateChildToStage(super.insertBefore(newNode, referenceNode) as undefined as IGraphic);\n }\n insertAfter(newNode: INode, referenceNode: INode): INode | null {\n return this._updateChildToStage(super.insertAfter(newNode, referenceNode) as undefined as IGraphic);\n }\n insertInto(newNode: INode, idx: number): INode | null {\n return this._updateChildToStage(super.insertInto(newNode, idx) as undefined as IGraphic);\n }\n\n removeChild(child: IGraphic): IGraphic {\n const data = super.removeChild(child);\n child.stage = null;\n application.graphicService.onRemove(child);\n this.addUpdateBoundTag();\n return data as IGraphic;\n }\n\n removeAllChild(deep: boolean = false): void {\n this.forEachChildren((child: IGraphic) => {\n application.graphicService.onRemove(child);\n if (deep && child.isContainer) {\n child.removeAllChild(deep);\n }\n });\n super.removeAllChild();\n this.addUpdateBoundTag();\n }\n\n setStage(stage?: IStage, layer?: ILayer) {\n if (this.stage !== stage) {\n this.stage = stage;\n this.layer = layer;\n this.setStageToShadowRoot(stage, layer);\n this._onSetStage && this._onSetStage(this, stage, layer);\n application.graphicService.onSetStage(this, stage);\n this.forEachChildren(item => {\n (item as any).setStage(stage, this.layer);\n });\n }\n }\n /**\n * 更新位置tag,包括全局tag和局部tag\n */\n addUpdatePositionTag() {\n super.addUpdatePositionTag();\n // 批量设置底层group的global tag\n this.forEachChildren((g: Group) => {\n if (g.isContainer) {\n g.addUpdateGlobalPositionTag();\n }\n });\n }\n /**\n * 更新全局位置tag\n */\n addUpdateGlobalPositionTag() {\n super.addUpdateGlobalPositionTag();\n // 批量设置底层group的global tag\n this.forEachChildren((g: Group) => {\n if (g.isContainer) {\n g.addUpdateGlobalPositionTag();\n }\n });\n }\n /**\n * group更新全局的transMatrix\n * @param clearTag\n * @returns\n */\n protected tryUpdateGlobalTransMatrix(clearTag: boolean = true): Matrix {\n if (this.shouldUpdateGlobalMatrix()) {\n if (!this._globalTransMatrix) {\n this._globalTransMatrix = this.parent\n ? (this.parent as IGroup).globalTransMatrix.clone()\n : this.transMatrix.clone();\n } else if (this.parent) {\n const m = (this.parent as IGroup).globalTransMatrix;\n this._globalTransMatrix.setValue(m.a, m.b, m.c, m.d, m.e, m.f);\n }\n this.doUpdateGlobalMatrix();\n clearTag && this.clearUpdateGlobalPositionTag();\n }\n return this._globalTransMatrix;\n }\n /**\n * 查找自身更新global的tag,如果存在,就更新\n * @returns\n */\n shouldUpdateGlobalMatrix(): boolean {\n const shouldUpdate = !!(this._updateTag & UpdateTag.UPDATE_GLOBAL_MATRIX);\n return shouldUpdate;\n }\n\n private _getChildByName<T extends INode = INode>(name: string, deep?: boolean): T | null {\n return this.find(node => node.name === name, deep);\n }\n\n /**\n * if graphic exist then update attributes, otherwise create a new instance\n * @param graphicName the name of graphic\n * @param attributes the attributes of graphic\n * @param graphicType the type of graphic\n * @returns the graphic instance\n */\n createOrUpdateChild<T extends keyof GraphicAttributeMap>(\n graphicName: string,\n attributes: GraphicAttributeMap[T],\n graphicType: T\n ): INode {\n let graphic = this._getChildByName(graphicName) as IGraphic;\n if (graphic) {\n graphic.setAttributes(attributes);\n } else {\n graphic = application.graphicService.creator[graphicType](attributes as any);\n graphic.name = graphicName;\n this.add(graphic);\n }\n\n return graphic;\n }\n\n clone() {\n return new Group({ ...this.attribute });\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return Group.NOWORK_ANIMATE_ATTR;\n }\n}\n\nexport function createGroup(attributes: IGroupGraphicAttribute): IGroup {\n return new Group(attributes);\n}\n"]}
@@ -7,12 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  const utils_1 = require("../../common/utils"), utils_2 = require("./utils");
8
8
 
9
9
  function getFixedLRTB(left, right, top, bottom) {
10
- const leftInt = Math.round(left), topInt = Math.round(top), rightInt = Math.round(right), bottomInt = Math.round(bottom);
11
10
  return {
12
- left: left > leftInt ? leftInt : leftInt - .5,
13
- top: top > topInt ? topInt : topInt - .5,
14
- right: rightInt > right ? rightInt : rightInt + .5,
15
- bottom: bottomInt > bottom ? bottomInt : bottomInt + .5
11
+ left: Math.round(left),
12
+ top: Math.round(top),
13
+ right: Math.round(right),
14
+ bottom: Math.round(bottom)
16
15
  };
17
16
  }
18
17
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/richtext/paragraph.ts"],"names":[],"mappings":";;;AAAA,8CAAyD;AAEzD,mCAAgE;AAEhE,SAAS,YAAY,CAAC,IAAY,EAAE,KAAa,EAAE,GAAW,EAAE,MAAc;IAC5E,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,IAAI,GA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AAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1F,OAAO,KAAK,GAAG,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;SAClD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA7WD,4BA6WC;AAED,SAAgB,iBAAiB,CAAC,SAAoB,EAAE,KAAa;IACnE,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,EAAE,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACxE,MAAM,EAAE,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE3D,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAClB,CAAC;AAPD,8CAOC","file":"paragraph.js","sourcesContent":["import { calculateLineHeight } from '../../common/utils';\nimport type { IContext2d, IRichTextParagraphCharacter } from '../../interface';\nimport { measureTextCanvas, getStrByWithCanvas } from './utils';\n\nfunction getFixedLRTB(left: number, right: number, top: number, bottom: number) {\n const leftInt = Math.round(left);\n const topInt = Math.round(top);\n const rightInt = Math.round(right);\n const bottomInt = Math.round(bottom);\n const _left = left > leftInt ? leftInt : leftInt - 0.5;\n const _top = top > topInt ? topInt : topInt - 0.5;\n const _right = rightInt > right ? rightInt : rightInt + 0.5;\n const _bottom = bottomInt > bottom ? bottomInt : bottomInt + 0.5;\n return {\n left: _left,\n top: _top,\n right: _right,\n bottom: _bottom\n };\n}\n\n/**\n * 部分代码参考 https://github.com/danielearwicker/carota/\n * The MIT License (MIT)\n\n \"Carota\" - Copyright (c) 2013 Daniel Earwicker\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\n\n// 文字段\n// 参考carota\n// https://github.com/danielearwicker/carota/blob/master/src/text.js\nexport default class Paragraph {\n text: string;\n ascent: number;\n descent: number;\n width: number;\n height: number;\n lineHeight: number;\n fontSize: number;\n length: number;\n newLine: boolean;\n character: IRichTextParagraphCharacter;\n left: number;\n top: number;\n // rotate?: number;\n direction?: 'horizontal' | 'vertical';\n // bounds?: Bounds;\n widthOrigin?: number;\n heightOrigin?: number;\n textBaseline?: CanvasTextBaseline;\n\n ellipsis: 'normal' | 'add' | 'replace' | 'hide';\n ellipsisStr: string;\n ellipsisWidth: number;\n ellipsisOtherParagraphWidth: number;\n verticalEllipsis?: boolean;\n overflow?: boolean;\n\n constructor(text: string, newLine: boolean, character: IRichTextParagraphCharacter) {\n // 测量文字\n this.fontSize = character.fontSize || 16;\n this.textBaseline = character.textBaseline || 'alphabetic';\n\n // 处理行高:\n // lineHeight为数字时,大于fontSize取lineHeight,小于fontSize时取fontSize\n // lineHeight不为数字时,统一认为lineHeight为'normal',值取1.2 * fontSize\n const lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);\n if (typeof lineHeight === 'number') {\n this.lineHeight = lineHeight > this.fontSize ? lineHeight : this.fontSize;\n } else {\n this.lineHeight = Math.floor(1.2 * this.fontSize);\n }\n\n this.height = this.lineHeight;\n\n const { ascent, height, descent, width } = measureTextCanvas(text, character);\n\n let halfDetaHeight = 0;\n let deltaAscent = 0;\n let deltaDescent = 0;\n if (this.height > height) {\n // measureTextCanvas测量出的是纯文字高度,this.height是考虑行高后的高度\n // 如果this.height > height,将超过的高度平均分配到ascent和descent上\n halfDetaHeight = (this.height - height) / 2;\n deltaAscent = Math.ceil(halfDetaHeight);\n deltaDescent = Math.floor(halfDetaHeight);\n }\n\n if (this.textBaseline === 'top') {\n this.ascent = halfDetaHeight;\n this.descent = height - halfDetaHeight;\n } else if (this.textBaseline === 'bottom') {\n this.ascent = height - halfDetaHeight;\n this.descent = halfDetaHeight;\n } else if (this.textBaseline === 'middle') {\n this.ascent = this.height / 2;\n this.descent = this.height / 2;\n } else {\n this.ascent = ascent + deltaAscent;\n this.descent = descent + deltaDescent;\n }\n\n this.length = text.length;\n this.width = width || 0;\n this.text = text || '';\n this.newLine = newLine || false;\n this.character = character;\n\n this.left = 0;\n this.top = 0;\n\n this.ellipsis = 'normal';\n this.ellipsisWidth = 0;\n this.ellipsisOtherParagraphWidth = 0;\n\n // 处理旋转\n if (character.direction === 'vertical') {\n this.direction = character.direction;\n this.widthOrigin = this.width;\n this.heightOrigin = this.height;\n // const bounds = new Bounds();\n // bounds.set(0, 0, this.width, this.height);\n // bounds.rotate(Math.PI / 2, this.width / 2, this.height / 2);\n // this.bounds = bounds;\n // this.width = bounds.width();\n // this.height = bounds.height();\n this.width = this.heightOrigin;\n this.height = this.widthOrigin;\n this.lineHeight = this.height;\n }\n this.ellipsisStr = '...';\n }\n\n updateWidth() {\n const { width } = measureTextCanvas(this.text, this.character);\n this.width = width;\n if (this.direction === 'vertical') {\n this.widthOrigin = this.width;\n this.width = this.heightOrigin;\n this.height = this.widthOrigin;\n }\n }\n\n drawBackground(\n ctx: IContext2d,\n top: number,\n ascent: number,\n deltaLeft: number,\n isLineFirst: boolean,\n textAlign: string,\n lineHeight: number\n ) {\n if (!(this.character.background && (!this.character.backgroundOpacity || this.character.backgroundOpacity > 0))) {\n return;\n }\n let baseline = top + ascent;\n let text = this.text;\n let left = this.left + deltaLeft;\n baseline += this.top;\n let direction = this.direction;\n\n if (this.verticalEllipsis) {\n text = this.ellipsisStr;\n direction = 'vertical';\n baseline -= this.ellipsisWidth / 2;\n } else if (this.ellipsis === 'hide') {\n return;\n } else if (this.ellipsis === 'add') {\n text += this.ellipsisStr;\n\n if (textAlign === 'right' || textAlign === 'end') {\n left -= this.ellipsisWidth;\n }\n } else if (this.ellipsis === 'replace') {\n // 找到需要截断的字符长度\n // const index = getStrByWith(text, this.width - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.style, text.length - 1);\n const index = getStrByWithCanvas(\n text,\n (direction === 'vertical' ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth,\n this.character,\n text.length - 1\n );\n text = text.slice(0, index);\n text += this.ellipsisStr;\n\n if (textAlign === 'right' || textAlign === 'end') {\n const { width } = measureTextCanvas(this.text.slice(index), this.character);\n if (direction === 'vertical') {\n // baseline -= this.ellipsisWidth - width;\n } else {\n left -= this.ellipsisWidth - width;\n }\n }\n }\n\n // prepareContext(ctx);\n switch (this.character.script) {\n case 'super':\n baseline -= this.ascent * (1 / 3);\n break;\n case 'sub':\n baseline += this.descent / 2;\n break;\n }\n\n // 处理旋转\n if (direction === 'vertical') {\n ctx.save();\n ctx.rotateAbout(Math.PI / 2, left, baseline);\n ctx.translate(-(this.heightOrigin as number) || -this.lineHeight / 2, -this.descent / 2);\n ctx.translate(left, baseline);\n left = 0;\n baseline = 0;\n }\n\n const fillStyle = ctx.fillStyle;\n const globalAlpha = ctx.globalAlpha;\n ctx.fillStyle = this.character.background;\n if (this.character.backgroundOpacity !== void 0) {\n ctx.globalAlpha = this.character.backgroundOpacity;\n }\n // 背景稍微扩充一些buf,否则会出现白线\n const right = left + (this.widthOrigin || this.width);\n const bottom = top + lineHeight;\n const lrtb = getFixedLRTB(left, right, top, bottom);\n ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);\n ctx.fillStyle = fillStyle;\n ctx.globalAlpha = globalAlpha;\n }\n\n draw(\n ctx: IContext2d,\n top: number,\n ascent: number,\n deltaLeft: number,\n isLineFirst: boolean,\n textAlign: string,\n lineHeight: number\n ) {\n let baseline = top + ascent;\n let text = this.text;\n let left = this.left + deltaLeft;\n baseline += this.top;\n let direction = this.direction;\n\n if (this.verticalEllipsis) {\n text = this.ellipsisStr;\n direction = 'vertical';\n baseline -= this.ellipsisWidth / 2;\n } else if (this.ellipsis === 'hide') {\n return;\n } else if (this.ellipsis === 'add') {\n text += this.ellipsisStr;\n\n if (textAlign === 'right' || textAlign === 'end') {\n left -= this.ellipsisWidth;\n }\n } else if (this.ellipsis === 'replace') {\n // 找到需要截断的字符长度\n // const index = getStrByWith(text, this.width - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.style, text.length - 1);\n const index = getStrByWithCanvas(\n text,\n (direction === 'vertical' ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth,\n this.character,\n text.length - 1\n );\n text = text.slice(0, index);\n text += this.ellipsisStr;\n\n if (textAlign === 'right' || textAlign === 'end') {\n const { width } = measureTextCanvas(this.text.slice(index), this.character);\n if (direction === 'vertical') {\n // baseline -= this.ellipsisWidth - width;\n } else {\n left -= this.ellipsisWidth - width;\n }\n }\n }\n\n // prepareContext(ctx);\n switch (this.character.script) {\n case 'super':\n baseline -= this.ascent * (1 / 3);\n break;\n case 'sub':\n baseline += this.descent / 2;\n break;\n }\n\n // if (isLineFirst) {\n // const result = regFirstSpace.exec(text);\n // if (result?.index !== 0) {\n // text = text.slice(result?.index);\n // }\n // }\n\n // 处理旋转\n if (direction === 'vertical') {\n ctx.save();\n ctx.rotateAbout(Math.PI / 2, left, baseline);\n ctx.translate(-(this.heightOrigin as number) || -this.lineHeight / 2, -this.descent / 2);\n ctx.translate(left, baseline);\n left = 0;\n baseline = 0;\n }\n\n // if (this.character.fill) {\n // if (this.character.background && (!this.character.backgroundOpacity || this.character.backgroundOpacity > 0)) {\n // const fillStyle = ctx.fillStyle;\n // const globalAlpha = ctx.globalAlpha;\n // ctx.fillStyle = this.character.background;\n // if (this.character.backgroundOpacity !== void 0) {\n // ctx.globalAlpha = this.character.backgroundOpacity;\n // }\n // // 背景稍微扩充一些buf,否则会出现白线\n // const right = left + (this.widthOrigin || this.width);\n // const bottom = top + lineHeight;\n // const lrtb = getFixedLRTB(left, right, top, bottom);\n // ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);\n // ctx.fillStyle = fillStyle;\n // ctx.globalAlpha = globalAlpha;\n // }\n // }\n\n const { lineWidth = 1 } = this.character;\n if (this.character.stroke && lineWidth) {\n ctx.strokeText(text, left, baseline);\n }\n\n if (this.character.fill) {\n ctx.fillText(text, left, baseline);\n }\n\n if (this.character.fill) {\n if (this.character.lineThrough || this.character.underline) {\n if (this.character.underline) {\n const top = 1 + baseline;\n const right = left + (this.widthOrigin || this.width);\n const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);\n const lrtb = getFixedLRTB(left, right, top, bottom);\n ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);\n }\n if (this.character.lineThrough) {\n const top = 1 + baseline - this.ascent / 2;\n const right = left + (this.widthOrigin || this.width);\n const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);\n const lrtb = getFixedLRTB(left, right, top, bottom);\n ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);\n }\n } else if (this.character.textDecoration === 'underline') {\n const top = 1 + baseline;\n const right = left + (this.widthOrigin || this.width);\n const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);\n const lrtb = getFixedLRTB(left, right, top, bottom);\n ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);\n } else if (this.character.textDecoration === 'line-through') {\n const top = 1 + baseline - this.ascent / 2;\n const right = left + (this.widthOrigin || this.width);\n const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);\n const lrtb = getFixedLRTB(left, right, top, bottom);\n ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);\n }\n }\n\n if (direction === 'vertical') {\n ctx.restore();\n }\n }\n\n getWidthWithEllips(direction: string): number {\n let text = this.text;\n // const direction = this.direction;\n const width = direction === 'vertical' ? this.height : this.width;\n // const height = direction === 'vertical' ? this.width: this.height;\n\n if (this.ellipsis === 'hide') {\n return width;\n } else if (this.ellipsis === 'add') {\n return width + this.ellipsisWidth;\n } else if (this.ellipsis === 'replace') {\n // 找到需要截断的字符长度\n // const index = getStrByWith(text, width - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.style, text.length - 1);\n const index = getStrByWithCanvas(\n text,\n width - this.ellipsisWidth + this.ellipsisOtherParagraphWidth,\n this.character,\n text.length - 1\n );\n text = text.slice(0, index);\n text += this.ellipsisStr;\n\n const { width: measureWidth } = measureTextCanvas(this.text.slice(index), this.character);\n return width + this.ellipsisWidth - measureWidth;\n }\n return width;\n }\n}\n\nexport function seperateParagraph(paragraph: Paragraph, index: number) {\n const text1 = paragraph.text.slice(0, index);\n const text2 = paragraph.text.slice(index);\n const p1 = new Paragraph(text1, paragraph.newLine, paragraph.character);\n const p2 = new Paragraph(text2, true, paragraph.character);\n\n return [p1, p2];\n}\n"]}
1
+ {"version":3,"sources":["../src/graphic/richtext/paragraph.ts"],"names":[],"mappings":";;;AAAA,8CAAyD;AAEzD,mCAAgE;AAEhE,SAAS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AAa,GAAG,YAAY,CAAC;SAClD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA7WD,4BA6WC;AAED,SAAgB,iBAAiB,CAAC,SAAoB,EAAE,KAAa;IACnE,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,EAAE,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACxE,MAAM,EAAE,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE3D,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAClB,CAAC;AAPD,8CAOC","file":"paragraph.js","sourcesContent":["import { calculateLineHeight } from '../../common/utils';\nimport type { IContext2d, IRichTextParagraphCharacter } from '../../interface';\nimport { measureTextCanvas, getStrByWithCanvas } from './utils';\n\nfunction getFixedLRTB(left: number, right: number, top: number, bottom: number) {\n const leftInt = Math.round(left);\n const topInt = Math.round(top);\n const rightInt = Math.round(right);\n const bottomInt = Math.round(bottom);\n // 会导致背景色重叠\n // const _left = left > leftInt ? leftInt : leftInt - 0.5;\n // const _top = top > topInt ? topInt : topInt - 0.5;\n // const _right = rightInt > right ? rightInt : rightInt + 0.5;\n // const _bottom = bottomInt > bottom ? bottomInt : bottomInt + 0.5;\n return {\n left: leftInt,\n top: topInt,\n right: rightInt,\n bottom: bottomInt\n };\n}\n\n/**\n * 部分代码参考 https://github.com/danielearwicker/carota/\n * The MIT License (MIT)\n\n \"Carota\" - Copyright (c) 2013 Daniel Earwicker\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\n\n// 文字段\n// 参考carota\n// https://github.com/danielearwicker/carota/blob/master/src/text.js\nexport default class Paragraph {\n text: string;\n ascent: number;\n descent: number;\n width: number;\n height: number;\n lineHeight: number;\n fontSize: number;\n length: number;\n newLine: boolean;\n character: IRichTextParagraphCharacter;\n left: number;\n top: number;\n // rotate?: number;\n direction?: 'horizontal' | 'vertical';\n // bounds?: Bounds;\n widthOrigin?: number;\n heightOrigin?: number;\n textBaseline?: CanvasTextBaseline;\n\n ellipsis: 'normal' | 'add' | 'replace' | 'hide';\n ellipsisStr: string;\n ellipsisWidth: number;\n ellipsisOtherParagraphWidth: number;\n verticalEllipsis?: boolean;\n overflow?: boolean;\n\n constructor(text: string, newLine: boolean, character: IRichTextParagraphCharacter) {\n // 测量文字\n this.fontSize = character.fontSize || 16;\n this.textBaseline = character.textBaseline || 'alphabetic';\n\n // 处理行高:\n // lineHeight为数字时,大于fontSize取lineHeight,小于fontSize时取fontSize\n // lineHeight不为数字时,统一认为lineHeight为'normal',值取1.2 * fontSize\n const lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);\n if (typeof lineHeight === 'number') {\n this.lineHeight = lineHeight > this.fontSize ? lineHeight : this.fontSize;\n } else {\n this.lineHeight = Math.floor(1.2 * this.fontSize);\n }\n\n this.height = this.lineHeight;\n\n const { ascent, height, descent, width } = measureTextCanvas(text, character);\n\n let halfDetaHeight = 0;\n let deltaAscent = 0;\n let deltaDescent = 0;\n if (this.height > height) {\n // measureTextCanvas测量出的是纯文字高度,this.height是考虑行高后的高度\n // 如果this.height > height,将超过的高度平均分配到ascent和descent上\n halfDetaHeight = (this.height - height) / 2;\n deltaAscent = Math.ceil(halfDetaHeight);\n deltaDescent = Math.floor(halfDetaHeight);\n }\n\n if (this.textBaseline === 'top') {\n this.ascent = halfDetaHeight;\n this.descent = height - halfDetaHeight;\n } else if (this.textBaseline === 'bottom') {\n this.ascent = height - halfDetaHeight;\n this.descent = halfDetaHeight;\n } else if (this.textBaseline === 'middle') {\n this.ascent = this.height / 2;\n this.descent = this.height / 2;\n } else {\n this.ascent = ascent + deltaAscent;\n this.descent = descent + deltaDescent;\n }\n\n this.length = text.length;\n this.width = width || 0;\n this.text = text || '';\n this.newLine = newLine || false;\n this.character = character;\n\n this.left = 0;\n this.top = 0;\n\n this.ellipsis = 'normal';\n this.ellipsisWidth = 0;\n this.ellipsisOtherParagraphWidth = 0;\n\n // 处理旋转\n if (character.direction === 'vertical') {\n this.direction = character.direction;\n this.widthOrigin = this.width;\n this.heightOrigin = this.height;\n // const bounds = new Bounds();\n // bounds.set(0, 0, this.width, this.height);\n // bounds.rotate(Math.PI / 2, this.width / 2, this.height / 2);\n // this.bounds = bounds;\n // this.width = bounds.width();\n // this.height = bounds.height();\n this.width = this.heightOrigin;\n this.height = this.widthOrigin;\n this.lineHeight = this.height;\n }\n this.ellipsisStr = '...';\n }\n\n updateWidth() {\n const { width } = measureTextCanvas(this.text, this.character);\n this.width = width;\n if (this.direction === 'vertical') {\n this.widthOrigin = this.width;\n this.width = this.heightOrigin;\n this.height = this.widthOrigin;\n }\n }\n\n drawBackground(\n ctx: IContext2d,\n top: number,\n ascent: number,\n deltaLeft: number,\n isLineFirst: boolean,\n textAlign: string,\n lineHeight: number\n ) {\n if (!(this.character.background && (!this.character.backgroundOpacity || this.character.backgroundOpacity > 0))) {\n return;\n }\n let baseline = top + ascent;\n let text = this.text;\n let left = this.left + deltaLeft;\n baseline += this.top;\n let direction = this.direction;\n\n if (this.verticalEllipsis) {\n text = this.ellipsisStr;\n direction = 'vertical';\n baseline -= this.ellipsisWidth / 2;\n } else if (this.ellipsis === 'hide') {\n return;\n } else if (this.ellipsis === 'add') {\n text += this.ellipsisStr;\n\n if (textAlign === 'right' || textAlign === 'end') {\n left -= this.ellipsisWidth;\n }\n } else if (this.ellipsis === 'replace') {\n // 找到需要截断的字符长度\n // const index = getStrByWith(text, this.width - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.style, text.length - 1);\n const index = getStrByWithCanvas(\n text,\n (direction === 'vertical' ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth,\n this.character,\n text.length - 1\n );\n text = text.slice(0, index);\n text += this.ellipsisStr;\n\n if (textAlign === 'right' || textAlign === 'end') {\n const { width } = measureTextCanvas(this.text.slice(index), this.character);\n if (direction === 'vertical') {\n // baseline -= this.ellipsisWidth - width;\n } else {\n left -= this.ellipsisWidth - width;\n }\n }\n }\n\n // prepareContext(ctx);\n switch (this.character.script) {\n case 'super':\n baseline -= this.ascent * (1 / 3);\n break;\n case 'sub':\n baseline += this.descent / 2;\n break;\n }\n\n // 处理旋转\n if (direction === 'vertical') {\n ctx.save();\n ctx.rotateAbout(Math.PI / 2, left, baseline);\n ctx.translate(-(this.heightOrigin as number) || -this.lineHeight / 2, -this.descent / 2);\n ctx.translate(left, baseline);\n left = 0;\n baseline = 0;\n }\n\n const fillStyle = ctx.fillStyle;\n const globalAlpha = ctx.globalAlpha;\n ctx.fillStyle = this.character.background;\n if (this.character.backgroundOpacity !== void 0) {\n ctx.globalAlpha = this.character.backgroundOpacity;\n }\n // 背景稍微扩充一些buf,否则会出现白线\n const right = left + (this.widthOrigin || this.width);\n const bottom = top + lineHeight;\n const lrtb = getFixedLRTB(left, right, top, bottom);\n ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);\n ctx.fillStyle = fillStyle;\n ctx.globalAlpha = globalAlpha;\n }\n\n draw(\n ctx: IContext2d,\n top: number,\n ascent: number,\n deltaLeft: number,\n isLineFirst: boolean,\n textAlign: string,\n lineHeight: number\n ) {\n let baseline = top + ascent;\n let text = this.text;\n let left = this.left + deltaLeft;\n baseline += this.top;\n let direction = this.direction;\n\n if (this.verticalEllipsis) {\n text = this.ellipsisStr;\n direction = 'vertical';\n baseline -= this.ellipsisWidth / 2;\n } else if (this.ellipsis === 'hide') {\n return;\n } else if (this.ellipsis === 'add') {\n text += this.ellipsisStr;\n\n if (textAlign === 'right' || textAlign === 'end') {\n left -= this.ellipsisWidth;\n }\n } else if (this.ellipsis === 'replace') {\n // 找到需要截断的字符长度\n // const index = getStrByWith(text, this.width - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.style, text.length - 1);\n const index = getStrByWithCanvas(\n text,\n (direction === 'vertical' ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth,\n this.character,\n text.length - 1\n );\n text = text.slice(0, index);\n text += this.ellipsisStr;\n\n if (textAlign === 'right' || textAlign === 'end') {\n const { width } = measureTextCanvas(this.text.slice(index), this.character);\n if (direction === 'vertical') {\n // baseline -= this.ellipsisWidth - width;\n } else {\n left -= this.ellipsisWidth - width;\n }\n }\n }\n\n // prepareContext(ctx);\n switch (this.character.script) {\n case 'super':\n baseline -= this.ascent * (1 / 3);\n break;\n case 'sub':\n baseline += this.descent / 2;\n break;\n }\n\n // if (isLineFirst) {\n // const result = regFirstSpace.exec(text);\n // if (result?.index !== 0) {\n // text = text.slice(result?.index);\n // }\n // }\n\n // 处理旋转\n if (direction === 'vertical') {\n ctx.save();\n ctx.rotateAbout(Math.PI / 2, left, baseline);\n ctx.translate(-(this.heightOrigin as number) || -this.lineHeight / 2, -this.descent / 2);\n ctx.translate(left, baseline);\n left = 0;\n baseline = 0;\n }\n\n // if (this.character.fill) {\n // if (this.character.background && (!this.character.backgroundOpacity || this.character.backgroundOpacity > 0)) {\n // const fillStyle = ctx.fillStyle;\n // const globalAlpha = ctx.globalAlpha;\n // ctx.fillStyle = this.character.background;\n // if (this.character.backgroundOpacity !== void 0) {\n // ctx.globalAlpha = this.character.backgroundOpacity;\n // }\n // // 背景稍微扩充一些buf,否则会出现白线\n // const right = left + (this.widthOrigin || this.width);\n // const bottom = top + lineHeight;\n // const lrtb = getFixedLRTB(left, right, top, bottom);\n // ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);\n // ctx.fillStyle = fillStyle;\n // ctx.globalAlpha = globalAlpha;\n // }\n // }\n\n const { lineWidth = 1 } = this.character;\n if (this.character.stroke && lineWidth) {\n ctx.strokeText(text, left, baseline);\n }\n\n if (this.character.fill) {\n ctx.fillText(text, left, baseline);\n }\n\n if (this.character.fill) {\n if (this.character.lineThrough || this.character.underline) {\n if (this.character.underline) {\n const top = 1 + baseline;\n const right = left + (this.widthOrigin || this.width);\n const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);\n const lrtb = getFixedLRTB(left, right, top, bottom);\n ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);\n }\n if (this.character.lineThrough) {\n const top = 1 + baseline - this.ascent / 2;\n const right = left + (this.widthOrigin || this.width);\n const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);\n const lrtb = getFixedLRTB(left, right, top, bottom);\n ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);\n }\n } else if (this.character.textDecoration === 'underline') {\n const top = 1 + baseline;\n const right = left + (this.widthOrigin || this.width);\n const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);\n const lrtb = getFixedLRTB(left, right, top, bottom);\n ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);\n } else if (this.character.textDecoration === 'line-through') {\n const top = 1 + baseline - this.ascent / 2;\n const right = left + (this.widthOrigin || this.width);\n const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);\n const lrtb = getFixedLRTB(left, right, top, bottom);\n ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);\n }\n }\n\n if (direction === 'vertical') {\n ctx.restore();\n }\n }\n\n getWidthWithEllips(direction: string): number {\n let text = this.text;\n // const direction = this.direction;\n const width = direction === 'vertical' ? this.height : this.width;\n // const height = direction === 'vertical' ? this.width: this.height;\n\n if (this.ellipsis === 'hide') {\n return width;\n } else if (this.ellipsis === 'add') {\n return width + this.ellipsisWidth;\n } else if (this.ellipsis === 'replace') {\n // 找到需要截断的字符长度\n // const index = getStrByWith(text, width - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.style, text.length - 1);\n const index = getStrByWithCanvas(\n text,\n width - this.ellipsisWidth + this.ellipsisOtherParagraphWidth,\n this.character,\n text.length - 1\n );\n text = text.slice(0, index);\n text += this.ellipsisStr;\n\n const { width: measureWidth } = measureTextCanvas(this.text.slice(index), this.character);\n return width + this.ellipsisWidth - measureWidth;\n }\n return width;\n }\n}\n\nexport function seperateParagraph(paragraph: Paragraph, index: number) {\n const text1 = paragraph.text.slice(0, index);\n const text2 = paragraph.text.slice(index);\n const p1 = new Paragraph(text1, paragraph.newLine, paragraph.character);\n const p2 = new Paragraph(text2, true, paragraph.character);\n\n return [p1, p2];\n}\n"]}
@@ -66,7 +66,8 @@ export declare class RichText extends Graphic<IRichTextGraphicAttribute> impleme
66
66
  set textConfig(config: IRichTextCharacter[]);
67
67
  getGraphicTheme(): Required<IRichTextGraphicAttribute>;
68
68
  static AllSingleCharacter(cache: IRichTextFrame | IRichTextGraphicAttribute['textConfig']): boolean;
69
- static splitText(text: string): string[];
69
+ static splitEmoji(text: string): any[];
70
+ static splitText(text: string): any[];
70
71
  static TransformTextConfig2SingleCharacter(textConfig: IRichTextGraphicAttribute['textConfig']): IRichTextCharacter[];
71
72
  protected updateAABBBounds(attribute: IRichTextGraphicAttribute, richtextTheme: Required<IRichTextGraphicAttribute>, aabbBounds: IAABBBounds): import("@visactor/vutils").IBounds;
72
73
  protected needUpdateTags(keys: string[]): boolean;
@@ -103,7 +103,13 @@ class RichText extends graphic_1.Graphic {
103
103
  }
104
104
  return cache.every((item => item.isComposing || !(item.text && (0, vutils_1.isString)(item.text) && RichText.splitText(item.text).length > 1)));
105
105
  }
106
+ static splitEmoji(text) {
107
+ return [ ...(new Intl.Segmenter).segment(text) ].map((x => x.segment));
108
+ }
106
109
  static splitText(text) {
110
+ try {
111
+ return this.splitEmoji(text);
112
+ } catch (e) {}
107
113
  return Array.from(text);
108
114
  }
109
115
  static TransformTextConfig2SingleCharacter(textConfig) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/richtext.ts"],"names":[],"mappings":";;;;;;AACA,6CAAsD;AAkBtD,uCAAiF;AACjF,qCAAoD;AACpD,6DAAqC;AACrC,qEAA6C;AAC7C,iEAAyC;AACzC,mCAAmC;AACnC,0CAA+C;AAE/C,gDAA6C;AAC7C,2CAAmD;AAEnD,MAAM,uBAAuB,GAAG;IAC9B,OAAO;IACP,QAAQ;IACR,UAAU;IACV,WAAW;IACX,mBAAmB;IACnB,WAAW;IACX,UAAU;IACV,WAAW;IACX,cAAc;IACd,YAAY;IACZ,iBAAiB;IACjB,MAAM;IACN,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,WAAW;IACX,SAAS;IACT,aAAa;IACb,eAAe;IACf,GAAG,gCAAsB;CAC1B,CAAC;AAEF,MAAa,QAAS,SAAQ,iBAAkC;IAiB9D,YAAY,MAAkC;QAC5C,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1E,QAAQ,CAAC,OAAO,GAAG,CAAC,MAAA,QAAQ,CAAC,SAAS,CAAC,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;aAC3E;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,oBAAoB;QAClB,OAAO,QAAQ,CAAC,mBAAmB,CAAC;IACtC,CAAC;;AA3lBH,4BA4lBC;AAtlBQ,4BAAmB,mBACxB,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,CAAC,EACZ,iBAAiB,EAAE,CAAC,EACpB,SAAS,EAAE,CAAC,EACZ,YAAY,EAAE,CAAC,EACf,UAAU,EAAE,CAAC,EACb,eAAe,EAAE,CAAC,IACf,6BAAmB,EACtB;AA+kBJ,SAAgB,cAAc,CAAC,UAAqC;IAClE,OAAO,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;AAClC,CAAC;AAFD,wCAEC","file":"richtext.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\nimport { isNumber, isString } from '@visactor/vutils';\nimport type {\n IRichText,\n IRichTextCharacter,\n RichTextGlobalAlignType,\n RichTextGlobalBaselineType,\n RichTextVerticalDirection,\n RichTextWordBreak,\n IRichTextGraphicAttribute,\n IRichTextImageCharacter,\n IRichTextParagraphCharacter,\n IStage,\n ILayer,\n IRichTextIcon,\n EventPoint,\n IRichTextFrame,\n ISetAttributeContext\n} from '../interface';\nimport { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from './graphic';\nimport { DefaultRichTextAttribute } from './config';\nimport Frame from './richtext/frame';\nimport Paragraph from './richtext/paragraph';\nimport Wrapper from './richtext/wrapper';\nimport { getTheme } from './theme';\nimport { RichTextIcon } from './richtext/icon';\nimport type { FederatedMouseEvent } from '../event';\nimport { application } from '../application';\nimport { RICHTEXT_NUMBER_TYPE } from './constants';\n\nconst RICHTEXT_UPDATE_TAG_KEY = [\n 'width',\n 'height',\n 'ellipsis',\n 'wordBreak',\n 'verticalDirection',\n 'maxHeight',\n 'maxWidth',\n 'textAlign',\n 'textBaseline',\n 'textConfig',\n 'layoutDirection',\n 'fill',\n 'stroke',\n 'fontSize',\n 'fontFamily',\n 'fontStyle',\n 'fontWeight',\n 'lineWidth',\n 'opacity',\n 'fillOpacity',\n 'strokeOpacity',\n ...GRAPHIC_UPDATE_TAG_KEY\n];\n\nexport class RichText extends Graphic<IRichTextGraphicAttribute> implements IRichText {\n type: 'richtext' = 'richtext';\n\n _frameCache: Frame; // 富文本布局画布\n _currentHoverIcon: IRichTextIcon | null = null;\n\n static NOWORK_ANIMATE_ATTR = {\n ellipsis: 1,\n wordBreak: 1,\n verticalDirection: 1,\n textAlign: 1,\n textBaseline: 1,\n textConfig: 1,\n layoutDirection: 1,\n ...NOWORK_ANIMATE_ATTR\n };\n\n constructor(params?: IRichTextGraphicAttribute) {\n super(params);\n this.numberType = RICHTEXT_NUMBER_TYPE;\n\n this.onBeforeAttributeUpdate = ((val: any, attributes: any, key: null | string | string[]) => {\n for (const key in val) {\n if (key === 'hoverIconId') {\n if (val[key] === attributes[key]) {\n continue;\n }\n const icon = this._frameCache.icons.get(val[key]);\n this.updateHoverIconState(icon);\n }\n }\n }) as any;\n }\n\n get width(): number {\n return this.attribute.width ?? DefaultRichTextAttribute.width;\n }\n set width(w: number) {\n if (this.attribute.width === w) {\n return;\n }\n this.attribute.width = w;\n this.addUpdateShapeAndBoundsTag();\n }\n get height(): number {\n return this.attribute.height ?? DefaultRichTextAttribute.height;\n }\n set height(h: number) {\n if (this.attribute.height === h) {\n return;\n }\n this.attribute.height = h;\n this.addUpdateShapeAndBoundsTag();\n }\n get maxWidth(): number | undefined {\n return this.attribute.maxWidth;\n }\n set maxWidth(mw: number | undefined) {\n if (this.attribute.maxWidth === mw) {\n return;\n }\n this.attribute.maxWidth = mw;\n this.addUpdateShapeAndBoundsTag();\n }\n get maxHeight(): number | undefined {\n return this.attribute.maxHeight;\n }\n set maxHeight(mh: number | undefined) {\n if (this.attribute.maxHeight === mh) {\n return;\n }\n this.attribute.maxHeight = mh;\n this.addUpdateShapeAndBoundsTag();\n }\n get ellipsis(): boolean | string {\n return this.attribute.ellipsis ?? DefaultRichTextAttribute.ellipsis;\n }\n set ellipsis(e: boolean | string) {\n if (this.attribute.ellipsis === e) {\n return;\n }\n this.attribute.ellipsis = e;\n this.addUpdateShapeAndBoundsTag();\n }\n get wordBreak(): RichTextWordBreak {\n return this.attribute.wordBreak ?? DefaultRichTextAttribute.wordBreak;\n }\n set wordBreak(wb: RichTextWordBreak) {\n if (this.attribute.wordBreak === wb) {\n return;\n }\n this.attribute.wordBreak = wb;\n this.addUpdateShapeAndBoundsTag();\n }\n get verticalDirection(): RichTextVerticalDirection {\n return this.attribute.verticalDirection ?? DefaultRichTextAttribute.verticalDirection;\n }\n set verticalDirection(vd: RichTextVerticalDirection) {\n if (this.attribute.verticalDirection === vd) {\n return;\n }\n this.attribute.verticalDirection = vd;\n this.addUpdateShapeAndBoundsTag();\n }\n get textAlign(): RichTextGlobalAlignType {\n return this.attribute.textAlign ?? DefaultRichTextAttribute.textAlign;\n }\n set textAlign(align: RichTextGlobalAlignType) {\n if (this.attribute.textAlign === align) {\n return;\n }\n this.attribute.textAlign = align;\n this.addUpdateShapeAndBoundsTag();\n }\n get textBaseline(): RichTextGlobalBaselineType {\n return this.attribute.textBaseline ?? DefaultRichTextAttribute.textBaseline;\n }\n set textBaseline(baseline: RichTextGlobalBaselineType) {\n if (this.attribute.textBaseline === baseline) {\n return;\n }\n this.attribute.textBaseline = baseline;\n this.addUpdateShapeAndBoundsTag();\n }\n get textConfig(): IRichTextCharacter[] {\n return this.attribute.textConfig ?? DefaultRichTextAttribute.textConfig;\n }\n set textConfig(config: IRichTextCharacter[]) {\n this.attribute.textConfig = config;\n this.addUpdateShapeAndBoundsTag();\n }\n\n getGraphicTheme(): Required<IRichTextGraphicAttribute> {\n return getTheme(this).richtext;\n }\n\n static AllSingleCharacter(cache: IRichTextFrame | IRichTextGraphicAttribute['textConfig']) {\n if ((cache as IRichTextFrame).lines) {\n const frame = cache as IRichTextFrame;\n return frame.lines.every(line =>\n line.paragraphs.every(item => !(item.text && isString(item.text) && RichText.splitText(item.text).length > 1))\n );\n }\n // isComposing的不算\n const tc = cache as IRichTextGraphicAttribute['textConfig'];\n return tc.every(\n item =>\n (item as any).isComposing ||\n !((item as any).text && isString((item as any).text) && RichText.splitText((item as any).text).length > 1)\n );\n }\n\n static splitText(text: string) {\n // 😁这种emoji长度算两个,所以得处理一下\n return Array.from(text);\n }\n\n static TransformTextConfig2SingleCharacter(textConfig: IRichTextGraphicAttribute['textConfig']) {\n const tc: IRichTextGraphicAttribute['textConfig'] = [];\n textConfig.forEach((item: IRichTextParagraphCharacter) => {\n const textList = RichText.splitText(item.text.toString());\n if (isString(item.text) && textList.length > 1) {\n // 拆分\n for (let i = 0; i < textList.length; i++) {\n const t = textList[i];\n tc.push({ ...item, text: t });\n }\n } else {\n tc.push(item);\n }\n });\n\n return tc;\n }\n\n protected updateAABBBounds(\n attribute: IRichTextGraphicAttribute,\n richtextTheme: Required<IRichTextGraphicAttribute>,\n aabbBounds: IAABBBounds\n ) {\n const {\n width = richtextTheme.width,\n height = richtextTheme.height,\n maxWidth = richtextTheme.maxWidth,\n maxHeight = richtextTheme.maxHeight,\n textAlign = richtextTheme.textAlign,\n textBaseline = richtextTheme.textBaseline,\n editOptions\n } = attribute;\n\n if (width > 0 && height > 0) {\n // 外部设置宽高\n aabbBounds.set(0, 0, width, height);\n } else {\n // 获取内容宽高\n const frameCache = this.getFrameCache();\n const { width: actualWidth, height: actualHeight } = frameCache.getActualSize();\n let contentWidth = width || actualWidth || 0;\n let contentHeight = height || actualHeight || 0;\n\n contentHeight = typeof maxHeight === 'number' && contentHeight > maxHeight ? maxHeight : contentHeight || 0;\n contentWidth = typeof maxWidth === 'number' && contentWidth > maxWidth ? maxWidth : contentWidth || 0;\n\n aabbBounds.set(0, 0, contentWidth, contentHeight);\n }\n\n // 如果是可编辑状态,且没有设置高度,就用fontSize,否则就完全选不到了\n if (editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !attribute.textConfig?.length) {\n aabbBounds.y2 = aabbBounds.y1 + (attribute.fontSize ?? 12);\n aabbBounds.x2 = aabbBounds.x1 + 2;\n }\n\n // 调整对齐方式\n let deltaY = 0;\n switch (textBaseline) {\n case 'top':\n deltaY = 0;\n break;\n case 'middle':\n deltaY = -aabbBounds.height() / 2;\n break;\n case 'bottom':\n deltaY = -aabbBounds.height();\n break;\n default:\n break;\n }\n let deltaX = 0;\n switch (textAlign) {\n case 'left':\n deltaX = 0;\n break;\n case 'center':\n deltaX = -aabbBounds.width() / 2;\n break;\n case 'right':\n deltaX = -aabbBounds.width();\n break;\n default:\n break;\n }\n aabbBounds.translate(deltaX, deltaY);\n\n application.graphicService.updateTempAABBBounds(aabbBounds);\n\n if (attribute.forceBoundsHeight != null || attribute.forceBoundsWidth != null) {\n application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds);\n }\n application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, false, this);\n return aabbBounds;\n }\n\n protected needUpdateTags(keys: string[]): boolean {\n return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);\n }\n protected needUpdateTag(key: string): boolean {\n return super.needUpdateTag(key, RICHTEXT_UPDATE_TAG_KEY);\n }\n getFrameCache(): IRichTextFrame {\n if (this.shouldUpdateShape()) {\n this.doUpdateFrameCache();\n this.clearUpdateShapeTag();\n }\n return this._frameCache as IRichTextFrame;\n }\n\n get cliped() {\n const frameCache = this.getFrameCache();\n if (frameCache.actualHeight > frameCache.height) {\n return true;\n }\n const { disableAutoWrapLine } = this.attribute;\n if (disableAutoWrapLine) {\n for (let i = 0; i < frameCache.lines.length; i++) {\n const l = frameCache.lines[i];\n for (let j = 0; j < l.paragraphs.length; j++) {\n const p = l.paragraphs[j];\n if ((p as any).overflow && (p as any).text !== '') {\n return true;\n }\n }\n }\n }\n return false;\n // if (height < this.attribute.height || )\n }\n combinedStyleToCharacter(config: IRichTextImageCharacter | IRichTextParagraphCharacter) {\n const {\n fill,\n stroke,\n fontSize,\n fontFamily,\n fontStyle,\n fontWeight,\n lineWidth,\n opacity,\n fillOpacity,\n strokeOpacity\n } = this.attribute;\n return {\n fill,\n stroke,\n fontSize,\n fontFamily,\n fontStyle,\n fontWeight,\n lineWidth,\n opacity,\n fillOpacity,\n strokeOpacity,\n ...config\n };\n }\n doUpdateFrameCache(tc?: IRichTextCharacter[]) {\n // 1. 测量,生成paragraph\n const {\n maxWidth,\n maxHeight,\n width,\n height,\n ellipsis,\n wordBreak,\n verticalDirection,\n textAlign,\n textBaseline,\n layoutDirection,\n singleLine,\n disableAutoWrapLine,\n editable\n } = this.attribute;\n\n let { textConfig: _tc = [] } = this.attribute;\n\n // 预处理editable,将textConfig中的text转换为单个字符\n if (editable && _tc.length > 0 && !RichText.AllSingleCharacter(_tc)) {\n _tc = RichText.TransformTextConfig2SingleCharacter(_tc);\n this.attribute.textConfig = _tc;\n }\n\n const paragraphs: (Paragraph | RichTextIcon)[] = [];\n\n const textConfig = tc ?? _tc;\n\n for (let i = 0; i < textConfig.length; i++) {\n if ('image' in textConfig[i]) {\n const config = this.combinedStyleToCharacter(\n textConfig[i] as IRichTextImageCharacter\n ) as IRichTextImageCharacter;\n (config as any).lineWidth = undefined; // for icon bounds\n // 直接创建icon Mark\n const iconCache =\n config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);\n if (iconCache) {\n paragraphs.push(iconCache as RichTextIcon);\n } else {\n const icon = new RichTextIcon(config);\n icon.successCallback = () => {\n this.addUpdateBoundTag();\n this.stage?.renderNextFrame();\n };\n icon.richtextId = config.id;\n paragraphs.push(icon);\n }\n } else {\n const richTextConfig = this.combinedStyleToCharacter(\n textConfig[i] as IRichTextParagraphCharacter\n ) as IRichTextParagraphCharacter;\n if (isNumber(richTextConfig.text)) {\n richTextConfig.text = `${richTextConfig.text}`;\n }\n if (richTextConfig.text && richTextConfig.text.includes('\\n')) {\n // 如果有文字内有换行符,将该段文字切为多段,并在后一段加入newLine标记\n const textParts = richTextConfig.text.split('\\n');\n for (let j = 0; j < textParts.length; j++) {\n paragraphs.push(new Paragraph(textParts[j], j !== 0, richTextConfig));\n }\n } else if (richTextConfig.text) {\n paragraphs.push(new Paragraph(richTextConfig.text, false, richTextConfig));\n }\n }\n }\n\n // 2. 布局,生成frame\n // const frameHeight =\n // typeof maxHeight === 'number' && (!height || height > maxHeight) // height = 0或height>maxHeight,使用maxHeight布局\n // ? maxHeight\n // : height;\n // const frameWidth =\n // typeof maxWidth === 'number' && (!width || width > maxWidth) // height = 0或height>maxWidth,使用maxWidth布局\n // ? maxWidth\n // : width;\n\n const maxWidthFinite = typeof maxWidth === 'number' && Number.isFinite(maxWidth) && maxWidth > 0;\n const maxHeightFinite = typeof maxHeight === 'number' && Number.isFinite(maxHeight) && maxHeight > 0;\n\n const richTextWidthEnable =\n typeof width === 'number' &&\n Number.isFinite(width) &&\n width > 0 &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (!maxWidthFinite || width <= maxWidth);\n const richTextHeightEnable =\n typeof height === 'number' &&\n Number.isFinite(height) &&\n height > 0 &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (!maxHeightFinite || height <= maxHeight);\n\n const frameWidth = richTextWidthEnable ? width : maxWidthFinite ? maxWidth : 0;\n const frameHeight = richTextHeightEnable ? height : maxHeightFinite ? maxHeight : 0;\n\n const frame = new Frame(\n 0,\n 0,\n frameWidth || 0,\n frameHeight || 0,\n ellipsis,\n wordBreak,\n verticalDirection,\n textAlign,\n textBaseline,\n layoutDirection || 'horizontal',\n // typeof maxWidth === 'number' && (!width || width > maxWidth),\n // typeof maxHeight === 'number' && (!height || height > maxHeight),\n !richTextWidthEnable && maxWidthFinite,\n !richTextHeightEnable && maxHeightFinite,\n singleLine || false,\n this._frameCache?.icons\n );\n const wrapper = new Wrapper(frame);\n // @since 0.22.0\n // 如果可编辑的话,则支持多换行符\n wrapper.newLine = editable;\n if (disableAutoWrapLine) {\n let lineCount = 0;\n let skip = false;\n for (let i = 0; i < paragraphs.length; i++) {\n const p = paragraphs[i];\n if (skip) {\n (p as Paragraph).overflow = true;\n (p as Paragraph).left = Infinity;\n (p as Paragraph).top = Infinity;\n !(p as Paragraph).newLine && frame.lines[frame.lines.length - 1].paragraphs.push(p);\n } else {\n wrapper.deal(p, true);\n }\n if (frame.lines.length !== lineCount) {\n lineCount = frame.lines.length;\n wrapper.lineBuffer.length = 0;\n (p as Paragraph).overflow = true;\n (p as Paragraph).left = 1000;\n (p as Paragraph).top = 1000;\n frame.lines[frame.lines.length - 1].paragraphs.push(p);\n skip = true;\n }\n if ((p as Paragraph).newLine) {\n skip = false;\n wrapper.lineWidth = 0;\n }\n wrapper.send();\n }\n } else {\n for (let i = 0; i < paragraphs.length; i++) {\n wrapper.deal(paragraphs[i]);\n }\n }\n\n wrapper.send(); // 最后一行手动输出\n\n // 如果对应的配置宽度不可用,那么需要额外进行一次对齐\n const directionEnable = frame.layoutDirection === 'horizontal' ? richTextWidthEnable : richTextHeightEnable;\n if (!directionEnable) {\n // 使用实际宽度\n const frameSize = frame.getActualSizeWidthEllipsis();\n let offsetSize = frame.layoutDirection === 'horizontal' ? frameSize.width : frameSize.height;\n // 如果最大值可用\n if (frame.layoutDirection === 'horizontal' ? maxWidthFinite : maxHeightFinite) {\n // 取2者中的较小值\n offsetSize = Math.min(\n offsetSize,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n frame.layoutDirection === 'horizontal' ? maxWidth : maxHeight\n );\n }\n\n frame.lines.forEach(function (l) {\n l.calcOffset(offsetSize, false);\n });\n }\n\n // 处理空行\n if (editable) {\n frame.lines.forEach(item => {\n const lastParagraphs = item.paragraphs;\n item.paragraphs = item.paragraphs.filter(p => (p as any).text !== '');\n if (item.paragraphs.length === 0 && lastParagraphs.length) {\n (lastParagraphs[0] as any).text = '\\n';\n item.paragraphs.push(lastParagraphs[0]);\n }\n });\n }\n\n this._frameCache = frame;\n\n // this.bindIconEvent();\n }\n\n clone() {\n return new RichText({ ...this.attribute });\n }\n\n setStage(stage?: IStage, layer?: ILayer) {\n super.setStage(stage, layer);\n const frameCache = this.getFrameCache();\n // for (let i = 0; i < frameCache.icons.length; i++) {\n // const icon = frameCache.icons[i];\n // icon.setStage(stage, layer);\n // }\n frameCache.icons.forEach(icon => {\n icon.setStage(stage, layer);\n });\n }\n\n // richtext绑定icon交互事件,供外部调用\n bindIconEvent() {\n this.addEventListener('pointermove', (e: FederatedMouseEvent) => {\n const pickedIcon = this.pickIcon(e.global);\n if (pickedIcon && pickedIcon === this._currentHoverIcon) {\n // do nothing\n } else if (pickedIcon) {\n this.setAttribute('hoverIconId', pickedIcon.richtextId);\n\n // this._currentHoverIcon?.setHoverState(false);\n // this._currentHoverIcon = pickedIcon;\n // this._currentHoverIcon.setHoverState(true);\n // this.stage?.setCursor(pickedIcon.attribute.cursor);\n // this.stage?.renderNextFrame();\n } else if (!pickedIcon && this._currentHoverIcon) {\n this.setAttribute('hoverIconId', undefined);\n\n // this._currentHoverIcon.setHoverState(false);\n // this._currentHoverIcon = null;\n // this.stage?.setCursor();\n // this.stage?.renderNextFrame();\n }\n });\n\n this.addEventListener('pointerleave', (e: FederatedMouseEvent) => {\n if (this._currentHoverIcon) {\n this.setAttribute('hoverIconId', undefined);\n\n // this._currentHoverIcon.setHoverState(false);\n // this._currentHoverIcon = null;\n // this.stage?.setCursor();\n // this.stage?.renderNextFrame();\n }\n });\n }\n\n updateHoverIconState(pickedIcon?: IRichTextIcon) {\n if (pickedIcon) {\n this._currentHoverIcon?.setHoverState(false);\n this._currentHoverIcon = pickedIcon;\n this._currentHoverIcon.setHoverState(true);\n this.stage?.setCursor(pickedIcon.attribute.cursor);\n this.stage?.renderNextFrame();\n } else {\n this._currentHoverIcon.setHoverState(false);\n this._currentHoverIcon = null;\n this.stage?.setCursor();\n this.stage?.renderNextFrame();\n }\n }\n\n pickIcon(point: EventPoint): IRichTextIcon | undefined {\n const frameCache = this.getFrameCache();\n const { e: x, f: y } = this.globalTransMatrix;\n // for (let i = 0; i < frameCache.icons.length; i++) {\n // const icon = frameCache.icons[i];\n // if (icon.containsPoint(point.x - x, point.y - y)) {\n // return icon;\n // }\n // }\n let pickIcon: IRichTextIcon | undefined;\n frameCache.icons.forEach((icon, key) => {\n const bounds = icon.AABBBounds.clone();\n bounds.translate(icon._marginArray[3], icon._marginArray[0]);\n if (bounds.containsPoint({ x: point.x - x, y: point.y - y })) {\n pickIcon = icon;\n\n pickIcon.globalX = (pickIcon.attribute.x ?? 0) + x + icon._marginArray[3];\n pickIcon.globalY = (pickIcon.attribute.y ?? 0) + y + icon._marginArray[0];\n }\n });\n\n return pickIcon;\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return RichText.NOWORK_ANIMATE_ATTR;\n }\n}\n\nexport function createRichText(attributes: IRichTextGraphicAttribute): IRichText {\n return new RichText(attributes);\n}\n"]}
1
+ {"version":3,"sources":["../src/graphic/richtext.ts"],"names":[],"mappings":";;;;;;AACA,6CAAsD;AAkBtD,uCAAiF;AACjF,qCAAoD;AACpD,6DAAqC;AACrC,qEAA6C;AAC7C,iEAAyC;AACzC,mCAAmC;AACnC,0CAA+C;AAE/C,gDAA6C;AAC7C,2CAAmD;AAEnD,MAAM,uBAAuB,GAAG;IAC9B,OAAO;IACP,QAAQ;IACR,UAAU;IACV,WAAW;IACX,mBAAmB;IACnB,WAAW;IACX,UAAU;IACV,WAAW;IACX,cAAc;IACd,YAAY;IACZ,iBAAiB;IACjB,MAAM;IACN,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,WAAW;IACX,SAAS;IACT,aAAa;IACb,eAAe;IACf,GAAG,gCAAsB;CAC1B,CAAC;AAEF,MAAa,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AE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7D,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;gBAC5D,QAAQ,GAAG,IAAI,CAAC;gBAEhB,QAAQ,CAAC,OAAO,GAAG,CAAC,MAAA,QAAQ,CAAC,SAAS,CAAC,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAC1E,QAAQ,CAAC,OAAO,GAAG,CAAC,MAAA,QAAQ,CAAC,SAAS,CAAC,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;aAC3E;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,oBAAoB;QAClB,OAAO,QAAQ,CAAC,mBAAmB,CAAC;IACtC,CAAC;;AAtmBH,4BAumBC;AAjmBQ,4BAAmB,mBACxB,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,CAAC,EACZ,iBAAiB,EAAE,CAAC,EACpB,SAAS,EAAE,CAAC,EACZ,YAAY,EAAE,CAAC,EACf,UAAU,EAAE,CAAC,EACb,eAAe,EAAE,CAAC,IACf,6BAAmB,EACtB;AA0lBJ,SAAgB,cAAc,CAAC,UAAqC;IAClE,OAAO,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;AAClC,CAAC;AAFD,wCAEC","file":"richtext.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\nimport { isNumber, isString } from '@visactor/vutils';\nimport type {\n IRichText,\n IRichTextCharacter,\n RichTextGlobalAlignType,\n RichTextGlobalBaselineType,\n RichTextVerticalDirection,\n RichTextWordBreak,\n IRichTextGraphicAttribute,\n IRichTextImageCharacter,\n IRichTextParagraphCharacter,\n IStage,\n ILayer,\n IRichTextIcon,\n EventPoint,\n IRichTextFrame,\n ISetAttributeContext\n} from '../interface';\nimport { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from './graphic';\nimport { DefaultRichTextAttribute } from './config';\nimport Frame from './richtext/frame';\nimport Paragraph from './richtext/paragraph';\nimport Wrapper from './richtext/wrapper';\nimport { getTheme } from './theme';\nimport { RichTextIcon } from './richtext/icon';\nimport type { FederatedMouseEvent } from '../event';\nimport { application } from '../application';\nimport { RICHTEXT_NUMBER_TYPE } from './constants';\n\nconst RICHTEXT_UPDATE_TAG_KEY = [\n 'width',\n 'height',\n 'ellipsis',\n 'wordBreak',\n 'verticalDirection',\n 'maxHeight',\n 'maxWidth',\n 'textAlign',\n 'textBaseline',\n 'textConfig',\n 'layoutDirection',\n 'fill',\n 'stroke',\n 'fontSize',\n 'fontFamily',\n 'fontStyle',\n 'fontWeight',\n 'lineWidth',\n 'opacity',\n 'fillOpacity',\n 'strokeOpacity',\n ...GRAPHIC_UPDATE_TAG_KEY\n];\n\nexport class RichText extends Graphic<IRichTextGraphicAttribute> implements IRichText {\n type: 'richtext' = 'richtext';\n\n _frameCache: Frame; // 富文本布局画布\n _currentHoverIcon: IRichTextIcon | null = null;\n\n static NOWORK_ANIMATE_ATTR = {\n ellipsis: 1,\n wordBreak: 1,\n verticalDirection: 1,\n textAlign: 1,\n textBaseline: 1,\n textConfig: 1,\n layoutDirection: 1,\n ...NOWORK_ANIMATE_ATTR\n };\n\n constructor(params?: IRichTextGraphicAttribute) {\n super(params);\n this.numberType = RICHTEXT_NUMBER_TYPE;\n\n this.onBeforeAttributeUpdate = ((val: any, attributes: any, key: null | string | string[]) => {\n for (const key in val) {\n if (key === 'hoverIconId') {\n if (val[key] === attributes[key]) {\n continue;\n }\n const icon = this._frameCache.icons.get(val[key]);\n this.updateHoverIconState(icon);\n }\n }\n }) as any;\n }\n\n get width(): number {\n return this.attribute.width ?? DefaultRichTextAttribute.width;\n }\n set width(w: number) {\n if (this.attribute.width === w) {\n return;\n }\n this.attribute.width = w;\n this.addUpdateShapeAndBoundsTag();\n }\n get height(): number {\n return this.attribute.height ?? DefaultRichTextAttribute.height;\n }\n set height(h: number) {\n if (this.attribute.height === h) {\n return;\n }\n this.attribute.height = h;\n this.addUpdateShapeAndBoundsTag();\n }\n get maxWidth(): number | undefined {\n return this.attribute.maxWidth;\n }\n set maxWidth(mw: number | undefined) {\n if (this.attribute.maxWidth === mw) {\n return;\n }\n this.attribute.maxWidth = mw;\n this.addUpdateShapeAndBoundsTag();\n }\n get maxHeight(): number | undefined {\n return this.attribute.maxHeight;\n }\n set maxHeight(mh: number | undefined) {\n if (this.attribute.maxHeight === mh) {\n return;\n }\n this.attribute.maxHeight = mh;\n this.addUpdateShapeAndBoundsTag();\n }\n get ellipsis(): boolean | string {\n return this.attribute.ellipsis ?? DefaultRichTextAttribute.ellipsis;\n }\n set ellipsis(e: boolean | string) {\n if (this.attribute.ellipsis === e) {\n return;\n }\n this.attribute.ellipsis = e;\n this.addUpdateShapeAndBoundsTag();\n }\n get wordBreak(): RichTextWordBreak {\n return this.attribute.wordBreak ?? DefaultRichTextAttribute.wordBreak;\n }\n set wordBreak(wb: RichTextWordBreak) {\n if (this.attribute.wordBreak === wb) {\n return;\n }\n this.attribute.wordBreak = wb;\n this.addUpdateShapeAndBoundsTag();\n }\n get verticalDirection(): RichTextVerticalDirection {\n return this.attribute.verticalDirection ?? DefaultRichTextAttribute.verticalDirection;\n }\n set verticalDirection(vd: RichTextVerticalDirection) {\n if (this.attribute.verticalDirection === vd) {\n return;\n }\n this.attribute.verticalDirection = vd;\n this.addUpdateShapeAndBoundsTag();\n }\n get textAlign(): RichTextGlobalAlignType {\n return this.attribute.textAlign ?? DefaultRichTextAttribute.textAlign;\n }\n set textAlign(align: RichTextGlobalAlignType) {\n if (this.attribute.textAlign === align) {\n return;\n }\n this.attribute.textAlign = align;\n this.addUpdateShapeAndBoundsTag();\n }\n get textBaseline(): RichTextGlobalBaselineType {\n return this.attribute.textBaseline ?? DefaultRichTextAttribute.textBaseline;\n }\n set textBaseline(baseline: RichTextGlobalBaselineType) {\n if (this.attribute.textBaseline === baseline) {\n return;\n }\n this.attribute.textBaseline = baseline;\n this.addUpdateShapeAndBoundsTag();\n }\n get textConfig(): IRichTextCharacter[] {\n return this.attribute.textConfig ?? DefaultRichTextAttribute.textConfig;\n }\n set textConfig(config: IRichTextCharacter[]) {\n this.attribute.textConfig = config;\n this.addUpdateShapeAndBoundsTag();\n }\n\n getGraphicTheme(): Required<IRichTextGraphicAttribute> {\n return getTheme(this).richtext;\n }\n\n static AllSingleCharacter(cache: IRichTextFrame | IRichTextGraphicAttribute['textConfig']) {\n if ((cache as IRichTextFrame).lines) {\n const frame = cache as IRichTextFrame;\n return frame.lines.every(line =>\n line.paragraphs.every(item => !(item.text && isString(item.text) && RichText.splitText(item.text).length > 1))\n );\n }\n // isComposing的不算\n const tc = cache as IRichTextGraphicAttribute['textConfig'];\n return tc.every(\n item =>\n (item as any).isComposing ||\n !((item as any).text && isString((item as any).text) && RichText.splitText((item as any).text).length > 1)\n );\n }\n\n static splitEmoji(text: string) {\n // 👈🏻这种emoji用Array.from还处理不了,所以得兼容一下\n return [...new (Intl as any).Segmenter().segment(text)].map(x => x.segment);\n }\n\n static splitText(text: string) {\n // 😁这种emoji长度算两个,所以得处理一下\n try {\n const arr = this.splitEmoji(text);\n return arr;\n } catch (e) {\n // do nothing\n }\n return Array.from(text);\n }\n\n static TransformTextConfig2SingleCharacter(textConfig: IRichTextGraphicAttribute['textConfig']) {\n const tc: IRichTextGraphicAttribute['textConfig'] = [];\n textConfig.forEach((item: IRichTextParagraphCharacter) => {\n const textList = RichText.splitText(item.text.toString());\n if (isString(item.text) && textList.length > 1) {\n // 拆分\n for (let i = 0; i < textList.length; i++) {\n const t = textList[i];\n tc.push({ ...item, text: t });\n }\n } else {\n tc.push(item);\n }\n });\n\n return tc;\n }\n\n protected updateAABBBounds(\n attribute: IRichTextGraphicAttribute,\n richtextTheme: Required<IRichTextGraphicAttribute>,\n aabbBounds: IAABBBounds\n ) {\n const {\n width = richtextTheme.width,\n height = richtextTheme.height,\n maxWidth = richtextTheme.maxWidth,\n maxHeight = richtextTheme.maxHeight,\n textAlign = richtextTheme.textAlign,\n textBaseline = richtextTheme.textBaseline,\n editOptions\n } = attribute;\n\n if (width > 0 && height > 0) {\n // 外部设置宽高\n aabbBounds.set(0, 0, width, height);\n } else {\n // 获取内容宽高\n const frameCache = this.getFrameCache();\n const { width: actualWidth, height: actualHeight } = frameCache.getActualSize();\n let contentWidth = width || actualWidth || 0;\n let contentHeight = height || actualHeight || 0;\n\n contentHeight = typeof maxHeight === 'number' && contentHeight > maxHeight ? maxHeight : contentHeight || 0;\n contentWidth = typeof maxWidth === 'number' && contentWidth > maxWidth ? maxWidth : contentWidth || 0;\n\n aabbBounds.set(0, 0, contentWidth, contentHeight);\n }\n\n // 如果是可编辑状态,且没有设置高度,就用fontSize,否则就完全选不到了\n if (editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !attribute.textConfig?.length) {\n aabbBounds.y2 = aabbBounds.y1 + (attribute.fontSize ?? 12);\n aabbBounds.x2 = aabbBounds.x1 + 2;\n }\n\n // 调整对齐方式\n let deltaY = 0;\n switch (textBaseline) {\n case 'top':\n deltaY = 0;\n break;\n case 'middle':\n deltaY = -aabbBounds.height() / 2;\n break;\n case 'bottom':\n deltaY = -aabbBounds.height();\n break;\n default:\n break;\n }\n let deltaX = 0;\n switch (textAlign) {\n case 'left':\n deltaX = 0;\n break;\n case 'center':\n deltaX = -aabbBounds.width() / 2;\n break;\n case 'right':\n deltaX = -aabbBounds.width();\n break;\n default:\n break;\n }\n aabbBounds.translate(deltaX, deltaY);\n\n application.graphicService.updateTempAABBBounds(aabbBounds);\n\n if (attribute.forceBoundsHeight != null || attribute.forceBoundsWidth != null) {\n application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds);\n }\n application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, false, this);\n return aabbBounds;\n }\n\n protected needUpdateTags(keys: string[]): boolean {\n return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);\n }\n protected needUpdateTag(key: string): boolean {\n return super.needUpdateTag(key, RICHTEXT_UPDATE_TAG_KEY);\n }\n getFrameCache(): IRichTextFrame {\n if (this.shouldUpdateShape()) {\n this.doUpdateFrameCache();\n this.clearUpdateShapeTag();\n }\n return this._frameCache as IRichTextFrame;\n }\n\n get cliped() {\n const frameCache = this.getFrameCache();\n if (frameCache.actualHeight > frameCache.height) {\n return true;\n }\n const { disableAutoWrapLine } = this.attribute;\n if (disableAutoWrapLine) {\n for (let i = 0; i < frameCache.lines.length; i++) {\n const l = frameCache.lines[i];\n for (let j = 0; j < l.paragraphs.length; j++) {\n const p = l.paragraphs[j];\n if ((p as any).overflow && (p as any).text !== '') {\n return true;\n }\n }\n }\n }\n return false;\n // if (height < this.attribute.height || )\n }\n combinedStyleToCharacter(config: IRichTextImageCharacter | IRichTextParagraphCharacter) {\n const {\n fill,\n stroke,\n fontSize,\n fontFamily,\n fontStyle,\n fontWeight,\n lineWidth,\n opacity,\n fillOpacity,\n strokeOpacity\n } = this.attribute;\n return {\n fill,\n stroke,\n fontSize,\n fontFamily,\n fontStyle,\n fontWeight,\n lineWidth,\n opacity,\n fillOpacity,\n strokeOpacity,\n ...config\n };\n }\n doUpdateFrameCache(tc?: IRichTextCharacter[]) {\n // 1. 测量,生成paragraph\n const {\n maxWidth,\n maxHeight,\n width,\n height,\n ellipsis,\n wordBreak,\n verticalDirection,\n textAlign,\n textBaseline,\n layoutDirection,\n singleLine,\n disableAutoWrapLine,\n editable\n } = this.attribute;\n\n let { textConfig: _tc = [] } = this.attribute;\n\n // 预处理editable,将textConfig中的text转换为单个字符\n if (editable && _tc.length > 0 && !RichText.AllSingleCharacter(_tc)) {\n _tc = RichText.TransformTextConfig2SingleCharacter(_tc);\n this.attribute.textConfig = _tc;\n }\n\n const paragraphs: (Paragraph | RichTextIcon)[] = [];\n\n const textConfig = tc ?? _tc;\n\n for (let i = 0; i < textConfig.length; i++) {\n if ('image' in textConfig[i]) {\n const config = this.combinedStyleToCharacter(\n textConfig[i] as IRichTextImageCharacter\n ) as IRichTextImageCharacter;\n (config as any).lineWidth = undefined; // for icon bounds\n // 直接创建icon Mark\n const iconCache =\n config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);\n if (iconCache) {\n paragraphs.push(iconCache as RichTextIcon);\n } else {\n const icon = new RichTextIcon(config);\n icon.successCallback = () => {\n this.addUpdateBoundTag();\n this.stage?.renderNextFrame();\n };\n icon.richtextId = config.id;\n paragraphs.push(icon);\n }\n } else {\n const richTextConfig = this.combinedStyleToCharacter(\n textConfig[i] as IRichTextParagraphCharacter\n ) as IRichTextParagraphCharacter;\n if (isNumber(richTextConfig.text)) {\n richTextConfig.text = `${richTextConfig.text}`;\n }\n if (richTextConfig.text && richTextConfig.text.includes('\\n')) {\n // 如果有文字内有换行符,将该段文字切为多段,并在后一段加入newLine标记\n const textParts = richTextConfig.text.split('\\n');\n for (let j = 0; j < textParts.length; j++) {\n paragraphs.push(new Paragraph(textParts[j], j !== 0, richTextConfig));\n }\n } else if (richTextConfig.text) {\n paragraphs.push(new Paragraph(richTextConfig.text, false, richTextConfig));\n }\n }\n }\n\n // 2. 布局,生成frame\n // const frameHeight =\n // typeof maxHeight === 'number' && (!height || height > maxHeight) // height = 0或height>maxHeight,使用maxHeight布局\n // ? maxHeight\n // : height;\n // const frameWidth =\n // typeof maxWidth === 'number' && (!width || width > maxWidth) // height = 0或height>maxWidth,使用maxWidth布局\n // ? maxWidth\n // : width;\n\n const maxWidthFinite = typeof maxWidth === 'number' && Number.isFinite(maxWidth) && maxWidth > 0;\n const maxHeightFinite = typeof maxHeight === 'number' && Number.isFinite(maxHeight) && maxHeight > 0;\n\n const richTextWidthEnable =\n typeof width === 'number' &&\n Number.isFinite(width) &&\n width > 0 &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (!maxWidthFinite || width <= maxWidth);\n const richTextHeightEnable =\n typeof height === 'number' &&\n Number.isFinite(height) &&\n height > 0 &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (!maxHeightFinite || height <= maxHeight);\n\n const frameWidth = richTextWidthEnable ? width : maxWidthFinite ? maxWidth : 0;\n const frameHeight = richTextHeightEnable ? height : maxHeightFinite ? maxHeight : 0;\n\n const frame = new Frame(\n 0,\n 0,\n frameWidth || 0,\n frameHeight || 0,\n ellipsis,\n wordBreak,\n verticalDirection,\n textAlign,\n textBaseline,\n layoutDirection || 'horizontal',\n // typeof maxWidth === 'number' && (!width || width > maxWidth),\n // typeof maxHeight === 'number' && (!height || height > maxHeight),\n !richTextWidthEnable && maxWidthFinite,\n !richTextHeightEnable && maxHeightFinite,\n singleLine || false,\n this._frameCache?.icons\n );\n const wrapper = new Wrapper(frame);\n // @since 0.22.0\n // 如果可编辑的话,则支持多换行符\n wrapper.newLine = editable;\n if (disableAutoWrapLine) {\n let lineCount = 0;\n let skip = false;\n for (let i = 0; i < paragraphs.length; i++) {\n const p = paragraphs[i];\n if (skip) {\n (p as Paragraph).overflow = true;\n (p as Paragraph).left = Infinity;\n (p as Paragraph).top = Infinity;\n !(p as Paragraph).newLine && frame.lines[frame.lines.length - 1].paragraphs.push(p);\n } else {\n wrapper.deal(p, true);\n }\n if (frame.lines.length !== lineCount) {\n lineCount = frame.lines.length;\n wrapper.lineBuffer.length = 0;\n (p as Paragraph).overflow = true;\n (p as Paragraph).left = 1000;\n (p as Paragraph).top = 1000;\n frame.lines[frame.lines.length - 1].paragraphs.push(p);\n skip = true;\n }\n if ((p as Paragraph).newLine) {\n skip = false;\n wrapper.lineWidth = 0;\n }\n wrapper.send();\n }\n } else {\n for (let i = 0; i < paragraphs.length; i++) {\n wrapper.deal(paragraphs[i]);\n }\n }\n\n wrapper.send(); // 最后一行手动输出\n\n // 如果对应的配置宽度不可用,那么需要额外进行一次对齐\n const directionEnable = frame.layoutDirection === 'horizontal' ? richTextWidthEnable : richTextHeightEnable;\n if (!directionEnable) {\n // 使用实际宽度\n const frameSize = frame.getActualSizeWidthEllipsis();\n let offsetSize = frame.layoutDirection === 'horizontal' ? frameSize.width : frameSize.height;\n // 如果最大值可用\n if (frame.layoutDirection === 'horizontal' ? maxWidthFinite : maxHeightFinite) {\n // 取2者中的较小值\n offsetSize = Math.min(\n offsetSize,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n frame.layoutDirection === 'horizontal' ? maxWidth : maxHeight\n );\n }\n\n frame.lines.forEach(function (l) {\n l.calcOffset(offsetSize, false);\n });\n }\n\n // 处理空行\n if (editable) {\n frame.lines.forEach(item => {\n const lastParagraphs = item.paragraphs;\n item.paragraphs = item.paragraphs.filter(p => (p as any).text !== '');\n if (item.paragraphs.length === 0 && lastParagraphs.length) {\n (lastParagraphs[0] as any).text = '\\n';\n item.paragraphs.push(lastParagraphs[0]);\n }\n });\n }\n\n this._frameCache = frame;\n\n // this.bindIconEvent();\n }\n\n clone() {\n return new RichText({ ...this.attribute });\n }\n\n setStage(stage?: IStage, layer?: ILayer) {\n super.setStage(stage, layer);\n const frameCache = this.getFrameCache();\n // for (let i = 0; i < frameCache.icons.length; i++) {\n // const icon = frameCache.icons[i];\n // icon.setStage(stage, layer);\n // }\n frameCache.icons.forEach(icon => {\n icon.setStage(stage, layer);\n });\n }\n\n // richtext绑定icon交互事件,供外部调用\n bindIconEvent() {\n this.addEventListener('pointermove', (e: FederatedMouseEvent) => {\n const pickedIcon = this.pickIcon(e.global);\n if (pickedIcon && pickedIcon === this._currentHoverIcon) {\n // do nothing\n } else if (pickedIcon) {\n this.setAttribute('hoverIconId', pickedIcon.richtextId);\n\n // this._currentHoverIcon?.setHoverState(false);\n // this._currentHoverIcon = pickedIcon;\n // this._currentHoverIcon.setHoverState(true);\n // this.stage?.setCursor(pickedIcon.attribute.cursor);\n // this.stage?.renderNextFrame();\n } else if (!pickedIcon && this._currentHoverIcon) {\n this.setAttribute('hoverIconId', undefined);\n\n // this._currentHoverIcon.setHoverState(false);\n // this._currentHoverIcon = null;\n // this.stage?.setCursor();\n // this.stage?.renderNextFrame();\n }\n });\n\n this.addEventListener('pointerleave', (e: FederatedMouseEvent) => {\n if (this._currentHoverIcon) {\n this.setAttribute('hoverIconId', undefined);\n\n // this._currentHoverIcon.setHoverState(false);\n // this._currentHoverIcon = null;\n // this.stage?.setCursor();\n // this.stage?.renderNextFrame();\n }\n });\n }\n\n updateHoverIconState(pickedIcon?: IRichTextIcon) {\n if (pickedIcon) {\n this._currentHoverIcon?.setHoverState(false);\n this._currentHoverIcon = pickedIcon;\n this._currentHoverIcon.setHoverState(true);\n this.stage?.setCursor(pickedIcon.attribute.cursor);\n this.stage?.renderNextFrame();\n } else {\n this._currentHoverIcon.setHoverState(false);\n this._currentHoverIcon = null;\n this.stage?.setCursor();\n this.stage?.renderNextFrame();\n }\n }\n\n pickIcon(point: EventPoint): IRichTextIcon | undefined {\n const frameCache = this.getFrameCache();\n const { e: x, f: y } = this.globalTransMatrix;\n // for (let i = 0; i < frameCache.icons.length; i++) {\n // const icon = frameCache.icons[i];\n // if (icon.containsPoint(point.x - x, point.y - y)) {\n // return icon;\n // }\n // }\n let pickIcon: IRichTextIcon | undefined;\n frameCache.icons.forEach((icon, key) => {\n const bounds = icon.AABBBounds.clone();\n bounds.translate(icon._marginArray[3], icon._marginArray[0]);\n if (bounds.containsPoint({ x: point.x - x, y: point.y - y })) {\n pickIcon = icon;\n\n pickIcon.globalX = (pickIcon.attribute.x ?? 0) + x + icon._marginArray[3];\n pickIcon.globalY = (pickIcon.attribute.y ?? 0) + y + icon._marginArray[0];\n }\n });\n\n return pickIcon;\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return RichText.NOWORK_ANIMATE_ATTR;\n }\n}\n\nexport function createRichText(attributes: IRichTextGraphicAttribute): IRichText {\n return new RichText(attributes);\n}\n"]}
@@ -5,6 +5,7 @@ import type { IImage, IImageGraphicAttribute } from './image';
5
5
  import type { ITextGraphicAttribute } from './text';
6
6
  export type IRichTextEditOptionsType = {
7
7
  placeholder?: string;
8
+ syncPlaceHolderToTextConfig?: boolean;
8
9
  placeholderColor?: string;
9
10
  placeholderFontSize?: number;
10
11
  placeholderFontFamily?: string;