@visactor/vrender-core 0.20.10 → 0.20.11-alpha.1

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 (166) hide show
  1. package/cjs/common/bezier-utils.d.ts +3 -0
  2. package/cjs/common/bezier-utils.js +17 -2
  3. package/cjs/common/bezier-utils.js.map +1 -1
  4. package/cjs/common/custom-path2d.d.ts +3 -0
  5. package/cjs/common/custom-path2d.js +35 -11
  6. package/cjs/common/custom-path2d.js.map +1 -1
  7. package/cjs/common/segment/curve/arc.d.ts +2 -1
  8. package/cjs/common/segment/curve/arc.js +4 -1
  9. package/cjs/common/segment/curve/arc.js.map +1 -1
  10. package/cjs/common/segment/curve/base.d.ts +2 -1
  11. package/cjs/common/segment/curve/base.js.map +1 -1
  12. package/cjs/common/segment/curve/cubic-bezier.d.ts +3 -1
  13. package/cjs/common/segment/curve/cubic-bezier.js +14 -3
  14. package/cjs/common/segment/curve/cubic-bezier.js.map +1 -1
  15. package/cjs/common/segment/curve/curve-context.js +5 -4
  16. package/cjs/common/segment/curve/curve-context.js.map +1 -1
  17. package/cjs/common/segment/curve/ellipse.d.ts +2 -1
  18. package/cjs/common/segment/curve/ellipse.js +3 -0
  19. package/cjs/common/segment/curve/ellipse.js.map +1 -1
  20. package/cjs/common/segment/curve/line.d.ts +2 -1
  21. package/cjs/common/segment/curve/line.js +6 -0
  22. package/cjs/common/segment/curve/line.js.map +1 -1
  23. package/cjs/common/segment/curve/move.d.ts +2 -1
  24. package/cjs/common/segment/curve/move.js +3 -0
  25. package/cjs/common/segment/curve/move.js.map +1 -1
  26. package/cjs/common/segment/curve/path.d.ts +2 -1
  27. package/cjs/common/segment/curve/path.js +5 -2
  28. package/cjs/common/segment/curve/path.js.map +1 -1
  29. package/cjs/common/segment/curve/quadratic-bezier.d.ts +4 -2
  30. package/cjs/common/segment/curve/quadratic-bezier.js +17 -5
  31. package/cjs/common/segment/curve/quadratic-bezier.js.map +1 -1
  32. package/cjs/graphic/builtin-symbol/utils.d.ts +2 -1
  33. package/cjs/graphic/builtin-symbol/utils.js +5 -0
  34. package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
  35. package/cjs/graphic/config.js +5 -1
  36. package/cjs/graphic/config.js.map +1 -1
  37. package/cjs/graphic/graphic-service/graphic-service.d.ts +2 -0
  38. package/cjs/graphic/graphic-service/graphic-service.js +10 -5
  39. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  40. package/cjs/graphic/richtext/wrapper.d.ts +1 -0
  41. package/cjs/graphic/richtext/wrapper.js +1 -1
  42. package/cjs/graphic/richtext/wrapper.js.map +1 -1
  43. package/cjs/graphic/richtext.js +2 -1
  44. package/cjs/graphic/richtext.js.map +1 -1
  45. package/cjs/interface/graphic/path.d.ts +1 -0
  46. package/cjs/interface/graphic/path.js.map +1 -1
  47. package/cjs/interface/graphic/symbol.d.ts +2 -0
  48. package/cjs/interface/graphic/symbol.js.map +1 -1
  49. package/cjs/interface/graphic-service.d.ts +2 -0
  50. package/cjs/interface/graphic-service.js.map +1 -1
  51. package/cjs/interface/graphic.d.ts +3 -1
  52. package/cjs/interface/graphic.js.map +1 -1
  53. package/cjs/interface/path.d.ts +2 -0
  54. package/cjs/interface/path.js.map +1 -1
  55. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +3 -0
  56. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  57. package/cjs/plugins/builtin-plugin/edit-module.d.ts +6 -5
  58. package/cjs/plugins/builtin-plugin/edit-module.js +84 -28
  59. package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -1
  60. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +1 -0
  61. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js +3 -0
  62. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +1 -0
  63. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +49 -30
  64. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +280 -217
  65. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  66. package/cjs/render/contributions/render/arc3d-render.js.map +1 -1
  67. package/cjs/render/contributions/render/base-render.d.ts +1 -0
  68. package/cjs/render/contributions/render/base-render.js +20 -2
  69. package/cjs/render/contributions/render/base-render.js.map +1 -1
  70. package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  71. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js +29 -2
  72. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
  73. package/cjs/render/contributions/render/contributions/symbol-contribution-render.d.ts +8 -1
  74. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +30 -2
  75. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  76. package/cjs/render/contributions/render/path-render.js.map +1 -1
  77. package/cjs/render/contributions/render/polygon-render.js.map +1 -1
  78. package/cjs/render/contributions/render/symbol-render.js +15 -12
  79. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  80. package/cjs/render/contributions/render/utils.d.ts +1 -2
  81. package/cjs/render/contributions/render/utils.js +4 -20
  82. package/cjs/render/contributions/render/utils.js.map +1 -1
  83. package/dist/index.es.js +8610 -8142
  84. package/es/common/bezier-utils.d.ts +3 -0
  85. package/es/common/bezier-utils.js +14 -0
  86. package/es/common/bezier-utils.js.map +1 -1
  87. package/es/common/custom-path2d.d.ts +3 -0
  88. package/es/common/custom-path2d.js +36 -12
  89. package/es/common/custom-path2d.js.map +1 -1
  90. package/es/common/segment/curve/arc.d.ts +2 -1
  91. package/es/common/segment/curve/arc.js +4 -1
  92. package/es/common/segment/curve/arc.js.map +1 -1
  93. package/es/common/segment/curve/base.d.ts +2 -1
  94. package/es/common/segment/curve/base.js.map +1 -1
  95. package/es/common/segment/curve/cubic-bezier.d.ts +3 -1
  96. package/es/common/segment/curve/cubic-bezier.js +14 -1
  97. package/es/common/segment/curve/cubic-bezier.js.map +1 -1
  98. package/es/common/segment/curve/curve-context.js +6 -3
  99. package/es/common/segment/curve/curve-context.js.map +1 -1
  100. package/es/common/segment/curve/ellipse.d.ts +2 -1
  101. package/es/common/segment/curve/ellipse.js +3 -0
  102. package/es/common/segment/curve/ellipse.js.map +1 -1
  103. package/es/common/segment/curve/line.d.ts +2 -1
  104. package/es/common/segment/curve/line.js +6 -0
  105. package/es/common/segment/curve/line.js.map +1 -1
  106. package/es/common/segment/curve/move.d.ts +2 -1
  107. package/es/common/segment/curve/move.js +3 -0
  108. package/es/common/segment/curve/move.js.map +1 -1
  109. package/es/common/segment/curve/path.d.ts +2 -1
  110. package/es/common/segment/curve/path.js +5 -2
  111. package/es/common/segment/curve/path.js.map +1 -1
  112. package/es/common/segment/curve/quadratic-bezier.d.ts +4 -2
  113. package/es/common/segment/curve/quadratic-bezier.js +22 -5
  114. package/es/common/segment/curve/quadratic-bezier.js.map +1 -1
  115. package/es/graphic/builtin-symbol/utils.d.ts +2 -1
  116. package/es/graphic/builtin-symbol/utils.js +5 -0
  117. package/es/graphic/builtin-symbol/utils.js.map +1 -1
  118. package/es/graphic/config.js +5 -1
  119. package/es/graphic/config.js.map +1 -1
  120. package/es/graphic/graphic-service/graphic-service.d.ts +2 -0
  121. package/es/graphic/graphic-service/graphic-service.js +11 -4
  122. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  123. package/es/graphic/richtext/wrapper.d.ts +1 -0
  124. package/es/graphic/richtext/wrapper.js +1 -1
  125. package/es/graphic/richtext/wrapper.js.map +1 -1
  126. package/es/graphic/richtext.js +2 -1
  127. package/es/graphic/richtext.js.map +1 -1
  128. package/es/interface/graphic/path.d.ts +1 -0
  129. package/es/interface/graphic/path.js.map +1 -1
  130. package/es/interface/graphic/symbol.d.ts +2 -0
  131. package/es/interface/graphic/symbol.js.map +1 -1
  132. package/es/interface/graphic-service.d.ts +2 -0
  133. package/es/interface/graphic-service.js.map +1 -1
  134. package/es/interface/graphic.d.ts +3 -1
  135. package/es/interface/graphic.js.map +1 -1
  136. package/es/interface/path.d.ts +2 -0
  137. package/es/interface/path.js.map +1 -1
  138. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +3 -0
  139. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  140. package/es/plugins/builtin-plugin/edit-module.d.ts +6 -5
  141. package/es/plugins/builtin-plugin/edit-module.js +79 -25
  142. package/es/plugins/builtin-plugin/edit-module.js.map +1 -1
  143. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +1 -0
  144. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js +3 -0
  145. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +1 -0
  146. package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +49 -30
  147. package/es/plugins/builtin-plugin/richtext-edit-plugin.js +283 -214
  148. package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  149. package/es/render/contributions/render/arc3d-render.js.map +1 -1
  150. package/es/render/contributions/render/base-render.d.ts +1 -0
  151. package/es/render/contributions/render/base-render.js +21 -2
  152. package/es/render/contributions/render/base-render.js.map +1 -1
  153. package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  154. package/es/render/contributions/render/contributions/base-texture-contribution-render.js +29 -2
  155. package/es/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
  156. package/es/render/contributions/render/contributions/symbol-contribution-render.d.ts +8 -1
  157. package/es/render/contributions/render/contributions/symbol-contribution-render.js +26 -0
  158. package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  159. package/es/render/contributions/render/path-render.js.map +1 -1
  160. package/es/render/contributions/render/polygon-render.js.map +1 -1
  161. package/es/render/contributions/render/symbol-render.js +16 -13
  162. package/es/render/contributions/render/symbol-render.js.map +1 -1
  163. package/es/render/contributions/render/utils.d.ts +1 -2
  164. package/es/render/contributions/render/utils.js +0 -18
  165. package/es/render/contributions/render/utils.js.map +1 -1
  166. package/package.json +1 -1
@@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,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;QACzE,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;QAEzE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACtB,CAAC;CACF,CAAA;AA7NY,qBAAqB;IADjC,IAAA,2BAAU,GAAE;IAgBE,WAAA,IAAA,uBAAM,EAAC,0BAAc,CAAC,CAAA;;GAfxB,qBAAqB,CA6NjC;AA7NY,sDAAqB","file":"graphic-service.js","sourcesContent":["import { inject, injectable } from '../../common/inversify-lite';\nimport type { IAABBBounds } from '@visactor/vutils';\nimport { AABBBounds, isNumber, transformBoundsWithMatrix } from '@visactor/vutils';\nimport { SyncHook } from '../../tapable';\nimport type {\n mat4,\n IGraphicAttribute,\n IGraphic,\n IGroup,\n IStage,\n IText,\n ITextGraphicAttribute,\n ITransform,\n IGraphicService,\n IGraphicCreator,\n ISyncHook\n} from '../../interface';\nimport { textDrawOffsetX, textLayoutOffsetY } from '../../common/text';\nimport { boundStroke } from '../tools';\nimport { mat4Allocate } from '../../allocator/matrix-allocate';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { BoundsContext } from '../../common/bounds-context';\nimport { renderCommandList } from '../../common/render-command-list';\nimport { GraphicCreator } from '../constants';\nimport { identityMat4, multiplyMat4Mat4, rotateX, rotateY, rotateZ, scaleMat4, translate } from '../../common/matrix';\n\nexport function getExtraModelMatrix(dx: number, dy: number, graphic: IGraphic): mat4 | null {\n const { alpha, beta } = graphic.attribute;\n if (!alpha && !beta) {\n return null;\n }\n const { anchor3d = graphic.attribute.anchor } = graphic.attribute;\n\n const _anchor: [number, number] = [0, 0];\n if (anchor3d) {\n if (typeof anchor3d[0] === 'string') {\n const ratio = parseFloat(anchor3d[0]) / 100;\n const bounds = graphic.AABBBounds;\n _anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[0] = anchor3d[0];\n }\n if (typeof anchor3d[1] === 'string') {\n const ratio = parseFloat(anchor3d[1]) / 100;\n const bounds = graphic.AABBBounds;\n _anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[1] = anchor3d[1];\n }\n }\n\n if (graphic.type === 'text') {\n const { textAlign } = graphic.attribute as ITextGraphicAttribute;\n // 计算偏移\n _anchor[0] += textDrawOffsetX(textAlign, (graphic as IText).clipedWidth);\n }\n\n // 应用偏移,计算全局的偏移\n _anchor[0] += dx;\n _anchor[1] += dy;\n // matrix.scale(dpr, dpr);\n\n const modelMatrix = mat4Allocate.allocate();\n translate(modelMatrix, modelMatrix, [_anchor[0], _anchor[1], 0]);\n if (beta) {\n rotateX(modelMatrix, modelMatrix, beta);\n }\n if (alpha) {\n rotateY(modelMatrix, modelMatrix, alpha);\n }\n translate(modelMatrix, modelMatrix, [-_anchor[0], -_anchor[1], 0]);\n\n return modelMatrix;\n}\n\n// 计算3d下的模型矩阵\nexport function getModelMatrix(out: mat4, graphic: IGraphic, theme: ITransform) {\n const {\n x = theme.x,\n y = theme.y,\n z = theme.z,\n dx = theme.dx,\n dy = theme.dy,\n dz = theme.dz,\n scaleX = theme.scaleX,\n scaleY = theme.scaleY,\n scaleZ = theme.scaleZ,\n alpha = theme.alpha,\n beta = theme.beta,\n angle = theme.angle,\n anchor3d = graphic.attribute.anchor,\n anchor\n } = graphic.attribute;\n\n const _anchor: [number, number, number] = [0, 0, 0];\n if (anchor3d) {\n if (typeof anchor3d[0] === 'string') {\n const ratio = parseFloat(anchor3d[0]) / 100;\n const bounds = graphic.AABBBounds;\n _anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[0] = anchor3d[0];\n }\n if (typeof anchor3d[1] === 'string') {\n const ratio = parseFloat(anchor3d[1]) / 100;\n const bounds = graphic.AABBBounds;\n _anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[1] = anchor3d[1];\n }\n _anchor[2] = anchor3d[2] ?? 0;\n }\n\n // if (graphic.type === 'text') {\n // const { textAlign } = graphic.attribute as ITextGraphicAttribute;\n // // 计算偏移\n // _anchor[0] += textDrawOffsetX(textAlign, (graphic as IText).clipedWidth);\n // }\n\n identityMat4(out);\n // 平移\n translate(out, out, [x + dx, y + dy, z + dz]);\n translate(out, out, [_anchor[0], _anchor[1], _anchor[2]]);\n rotateX(out, out, beta);\n rotateY(out, out, alpha);\n // 基于z轴的偏移基于anchor计算\n // rotateZ(out, out, angle);\n translate(out, out, [-_anchor[0], -_anchor[1], _anchor[2]]);\n scaleMat4(out, out, [scaleX, scaleY, scaleZ]);\n\n // 计算基于z轴的偏移\n if (angle) {\n const m = mat4Allocate.allocate();\n const _anchor: [number, number] = [0, 0];\n if (anchor) {\n if (typeof anchor3d[0] === 'string') {\n const ratio = parseFloat(anchor3d[0]) / 100;\n const bounds = graphic.AABBBounds;\n _anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[0] = anchor3d[0];\n }\n if (typeof anchor3d[1] === 'string') {\n const ratio = parseFloat(anchor3d[1]) / 100;\n const bounds = graphic.AABBBounds;\n _anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[1] = anchor3d[1];\n }\n }\n\n translate(m, m, [_anchor[0], _anchor[1], 0]);\n // 基于z轴的偏移基于anchor计算\n rotateZ(m, m, angle);\n translate(m, m, [-_anchor[0], -_anchor[1], 0]);\n\n multiplyMat4Mat4(out, out, m);\n }\n}\n\nexport function shouldUseMat4(graphic: IGraphic) {\n const { alpha, beta } = graphic.attribute;\n return alpha || beta;\n}\n\n// 管理graphic\n@injectable()\nexport class DefaultGraphicService implements IGraphicService {\n declare hooks: {\n onAttributeUpdate: ISyncHook<[IGraphic]>;\n onSetStage: ISyncHook<[IGraphic, IStage]>;\n onRemove: ISyncHook<[IGraphic]>;\n onRelease: ISyncHook<[IGraphic]>;\n onAddIncremental: ISyncHook<[IGraphic, IGroup, IStage]>;\n onClearIncremental: ISyncHook<[IGroup, IStage]>;\n beforeUpdateAABBBounds: ISyncHook<[IGraphic, IStage, boolean, IAABBBounds]>;\n afterUpdateAABBBounds: ISyncHook<[IGraphic, IStage, IAABBBounds, { globalAABBBounds: IAABBBounds }, boolean]>;\n };\n\n // 临时bounds,用作缓存\n protected tempAABBBounds1: AABBBounds;\n protected tempAABBBounds2: AABBBounds;\n constructor(@inject(GraphicCreator) public readonly creator: IGraphicCreator) {\n this.hooks = {\n onAttributeUpdate: new SyncHook<[IGraphic]>(['graphic']),\n onSetStage: new SyncHook<[IGraphic, IStage]>(['graphic', 'stage']),\n onRemove: new SyncHook<[IGraphic]>(['graphic']),\n onRelease: new SyncHook<[IGraphic]>(['graphic']),\n onAddIncremental: new SyncHook<[IGraphic, IGroup, IStage]>(['graphic', 'group', 'stage']),\n onClearIncremental: new SyncHook<[IGroup, IStage]>(['graphic', 'group', 'stage']),\n beforeUpdateAABBBounds: new SyncHook<[IGraphic, IStage, boolean, IAABBBounds]>([\n 'graphic',\n 'stage',\n 'willUpdate',\n 'aabbBounds'\n ]),\n afterUpdateAABBBounds: new SyncHook<[IGraphic, IStage, IAABBBounds, { globalAABBBounds: IAABBBounds }, boolean]>([\n 'graphic',\n 'stage',\n 'aabbBounds',\n 'globalAABBBounds',\n 'selfChange'\n ])\n };\n this.tempAABBBounds1 = new AABBBounds();\n this.tempAABBBounds2 = new AABBBounds();\n }\n onAttributeUpdate(graphic: IGraphic) {\n if (this.hooks.onAttributeUpdate.taps.length) {\n this.hooks.onAttributeUpdate.call(graphic);\n }\n }\n onSetStage(graphic: IGraphic, stage: IStage): void {\n if (this.hooks.onSetStage.taps.length) {\n this.hooks.onSetStage.call(graphic, stage);\n }\n }\n onRemove(graphic: IGraphic<Partial<IGraphicAttribute>>): void {\n if (this.hooks.onRemove.taps.length) {\n this.hooks.onRemove.call(graphic);\n }\n }\n onRelease(graphic: IGraphic<Partial<IGraphicAttribute>>): void {\n if (this.hooks.onRelease.taps.length) {\n this.hooks.onRelease.call(graphic);\n }\n }\n onAddIncremental(graphic: IGraphic, group: IGroup, stage: IStage): void {\n if (this.hooks.onAddIncremental.taps.length) {\n this.hooks.onAddIncremental.call(graphic, group, stage);\n }\n }\n onClearIncremental(group: IGroup, stage: IStage): void {\n if (this.hooks.onClearIncremental.taps.length) {\n this.hooks.onClearIncremental.call(group, stage);\n }\n }\n beforeUpdateAABBBounds(graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) {\n if (this.hooks.beforeUpdateAABBBounds.taps.length) {\n this.hooks.beforeUpdateAABBBounds.call(graphic, stage, willUpdate, bounds);\n }\n }\n afterUpdateAABBBounds(\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) {\n if (this.hooks.afterUpdateAABBBounds.taps.length) {\n this.hooks.afterUpdateAABBBounds.call(graphic, stage, bounds, params, selfChange);\n }\n }\n // TODO delete\n updatePathProxyAABBBounds(aabbBounds: IAABBBounds, graphic?: IGraphic): boolean {\n const path = typeof graphic.pathProxy === 'function' ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;\n if (!path) {\n return false;\n }\n const boundsContext = new BoundsContext(aabbBounds);\n renderCommandList(path.commandList, boundsContext, 0, 0);\n return true;\n }\n\n updateHTMLTextAABBBounds(\n attribute: ITextGraphicAttribute,\n textTheme: Required<ITextGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IText\n ) {\n const { textAlign, textBaseline } = attribute;\n if (attribute.forceBoundsHeight != null) {\n const h = isNumber(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight();\n const dy = textLayoutOffsetY(textBaseline, h, h);\n aabbBounds.set(aabbBounds.x1, dy, aabbBounds.x2, dy + h);\n }\n if (attribute.forceBoundsWidth != null) {\n const w = isNumber(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth();\n const dx = textDrawOffsetX(textAlign, w);\n aabbBounds.set(dx, aabbBounds.y1, dx + w, aabbBounds.y2);\n }\n }\n\n combindShadowAABBBounds(bounds: IAABBBounds, graphic?: IGraphic) {\n // 合并shadowRoot的Bounds\n if (graphic && graphic.shadowRoot) {\n const b = graphic.shadowRoot.AABBBounds;\n bounds.union(b);\n }\n }\n\n transformAABBBounds(\n attribute: Partial<IGraphicAttribute>,\n aabbBounds: IAABBBounds,\n theme: Required<IGraphicAttribute>,\n miter: boolean,\n graphic?: IGraphic\n ) {\n if (!aabbBounds.empty()) {\n const {\n scaleX = theme.scaleX,\n scaleY = theme.scaleY,\n stroke = theme.stroke,\n shadowBlur = theme.shadowBlur,\n lineWidth = theme.lineWidth,\n pickStrokeBuffer = theme.pickStrokeBuffer,\n strokeBoundsBuffer = theme.strokeBoundsBuffer\n } = attribute;\n const tb1 = this.tempAABBBounds1;\n const tb2 = this.tempAABBBounds2;\n if (stroke && lineWidth) {\n const scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);\n boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer);\n aabbBounds.union(tb1);\n tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);\n }\n if (shadowBlur) {\n const { shadowOffsetX = theme.shadowOffsetX, shadowOffsetY = theme.shadowOffsetY } = attribute;\n const shadowBlurWidth = (shadowBlur / Math.abs(scaleX + scaleY)) * 2;\n boundStroke(tb1, shadowBlurWidth, false, strokeBoundsBuffer + 1);\n tb1.translate(shadowOffsetX, shadowOffsetY);\n aabbBounds.union(tb1);\n // tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);\n }\n }\n\n // 合并shadowRoot的bounds\n this.combindShadowAABBBounds(aabbBounds, graphic);\n if (aabbBounds.empty()) {\n return;\n }\n\n // 性能优化逻辑,group类型变换较少,不需要矩阵变换\n let updateMatrix = true;\n const m = graphic.transMatrix;\n if (graphic && graphic.isContainer) {\n updateMatrix = !(m.a === 1 && m.b === 0 && m.c === 0 && m.d === 1 && m.e === 0 && m.f === 0);\n }\n updateMatrix && transformBoundsWithMatrix(aabbBounds, aabbBounds, m);\n\n // TODO 加上锚点\n // transformBounds(aabbBounds, x, y, scaleX, scaleY, angle);\n // if (graphic.attribute.postMatrix) {\n // console.log('aaa');\n // transformBoundsWithMatrix(aabbBounds, graphic.attribute.postMatrix);\n // }\n // aabbBounds.translate(dx, dy);\n }\n\n validCheck(\n attribute: Partial<IGraphicAttribute>,\n theme: Required<IGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ): boolean {\n if (!graphic) {\n return true;\n }\n\n // 设置了强制wh,那就直接认为是合法的\n if (attribute.forceBoundsHeight != null || attribute.forceBoundsWidth != null) {\n return true;\n }\n\n if (graphic.shadowRoot) {\n return true;\n }\n\n if (!graphic.valid) {\n aabbBounds.clear();\n return false;\n }\n const { visible = theme.visible } = attribute;\n if (!visible) {\n aabbBounds.clear();\n return false;\n }\n return true;\n }\n\n updateTempAABBBounds(aabbBounds: IAABBBounds) {\n const tb1 = this.tempAABBBounds1;\n const tb2 = this.tempAABBBounds2;\n tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);\n tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);\n\n return { tb1, tb2 };\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/graphic/graphic-service/graphic-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAiE;AAEjE,6CAAmF;AACnF,2CAAyC;AAczC,4CAAuE;AACvE,oCAAuC;AACvC,qEAA+D;AAE/D,gEAA4D;AAC5D,0EAAqE;AACrE,4CAA8C;AAC9C,gDAAsH;AACtH,mDAAgD;A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AO,EAAE,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;gBAC/E,UAAU,CAAC,KAAK,EAAE,CAAC;aACpB;YACD,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oBAAoB,CAAC,UAAuB;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,eAAe,CAAC;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,eAAe,CAAC;QACjC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;QACzE,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;QAEzE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACtB,CAAC;CACF,CAAA;AAvOY,qBAAqB;IADjC,IAAA,2BAAU,GAAE;IAiBE,WAAA,IAAA,uBAAM,EAAC,0BAAc,CAAC,CAAA;;GAhBxB,qBAAqB,CAuOjC;AAvOY,sDAAqB","file":"graphic-service.js","sourcesContent":["import { inject, injectable } from '../../common/inversify-lite';\nimport type { IAABBBounds } from '@visactor/vutils';\nimport { AABBBounds, isNumber, transformBoundsWithMatrix } from '@visactor/vutils';\nimport { SyncHook } from '../../tapable';\nimport type {\n mat4,\n IGraphicAttribute,\n IGraphic,\n IGroup,\n IStage,\n IText,\n ITextGraphicAttribute,\n ITransform,\n IGraphicService,\n IGraphicCreator,\n ISyncHook\n} from '../../interface';\nimport { textDrawOffsetX, textLayoutOffsetY } from '../../common/text';\nimport { boundStroke } from '../tools';\nimport { mat4Allocate } from '../../allocator/matrix-allocate';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { BoundsContext } from '../../common/bounds-context';\nimport { renderCommandList } from '../../common/render-command-list';\nimport { GraphicCreator } from '../constants';\nimport { identityMat4, multiplyMat4Mat4, rotateX, rotateY, rotateZ, scaleMat4, translate } from '../../common/matrix';\nimport { application } from '../../application';\n\nexport function getExtraModelMatrix(dx: number, dy: number, graphic: IGraphic): mat4 | null {\n const { alpha, beta } = graphic.attribute;\n if (!alpha && !beta) {\n return null;\n }\n const { anchor3d = graphic.attribute.anchor } = graphic.attribute;\n\n const _anchor: [number, number] = [0, 0];\n if (anchor3d) {\n if (typeof anchor3d[0] === 'string') {\n const ratio = parseFloat(anchor3d[0]) / 100;\n const bounds = graphic.AABBBounds;\n _anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[0] = anchor3d[0];\n }\n if (typeof anchor3d[1] === 'string') {\n const ratio = parseFloat(anchor3d[1]) / 100;\n const bounds = graphic.AABBBounds;\n _anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[1] = anchor3d[1];\n }\n }\n\n if (graphic.type === 'text') {\n const { textAlign } = graphic.attribute as ITextGraphicAttribute;\n // 计算偏移\n _anchor[0] += textDrawOffsetX(textAlign, (graphic as IText).clipedWidth);\n }\n\n // 应用偏移,计算全局的偏移\n _anchor[0] += dx;\n _anchor[1] += dy;\n // matrix.scale(dpr, dpr);\n\n const modelMatrix = mat4Allocate.allocate();\n translate(modelMatrix, modelMatrix, [_anchor[0], _anchor[1], 0]);\n if (beta) {\n rotateX(modelMatrix, modelMatrix, beta);\n }\n if (alpha) {\n rotateY(modelMatrix, modelMatrix, alpha);\n }\n translate(modelMatrix, modelMatrix, [-_anchor[0], -_anchor[1], 0]);\n\n return modelMatrix;\n}\n\n// 计算3d下的模型矩阵\nexport function getModelMatrix(out: mat4, graphic: IGraphic, theme: ITransform) {\n const {\n x = theme.x,\n y = theme.y,\n z = theme.z,\n dx = theme.dx,\n dy = theme.dy,\n dz = theme.dz,\n scaleX = theme.scaleX,\n scaleY = theme.scaleY,\n scaleZ = theme.scaleZ,\n alpha = theme.alpha,\n beta = theme.beta,\n angle = theme.angle,\n anchor3d = graphic.attribute.anchor,\n anchor\n } = graphic.attribute;\n\n const _anchor: [number, number, number] = [0, 0, 0];\n if (anchor3d) {\n if (typeof anchor3d[0] === 'string') {\n const ratio = parseFloat(anchor3d[0]) / 100;\n const bounds = graphic.AABBBounds;\n _anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[0] = anchor3d[0];\n }\n if (typeof anchor3d[1] === 'string') {\n const ratio = parseFloat(anchor3d[1]) / 100;\n const bounds = graphic.AABBBounds;\n _anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[1] = anchor3d[1];\n }\n _anchor[2] = anchor3d[2] ?? 0;\n }\n\n // if (graphic.type === 'text') {\n // const { textAlign } = graphic.attribute as ITextGraphicAttribute;\n // // 计算偏移\n // _anchor[0] += textDrawOffsetX(textAlign, (graphic as IText).clipedWidth);\n // }\n\n identityMat4(out);\n // 平移\n translate(out, out, [x + dx, y + dy, z + dz]);\n translate(out, out, [_anchor[0], _anchor[1], _anchor[2]]);\n rotateX(out, out, beta);\n rotateY(out, out, alpha);\n // 基于z轴的偏移基于anchor计算\n // rotateZ(out, out, angle);\n translate(out, out, [-_anchor[0], -_anchor[1], _anchor[2]]);\n scaleMat4(out, out, [scaleX, scaleY, scaleZ]);\n\n // 计算基于z轴的偏移\n if (angle) {\n const m = mat4Allocate.allocate();\n const _anchor: [number, number] = [0, 0];\n if (anchor) {\n if (typeof anchor3d[0] === 'string') {\n const ratio = parseFloat(anchor3d[0]) / 100;\n const bounds = graphic.AABBBounds;\n _anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[0] = anchor3d[0];\n }\n if (typeof anchor3d[1] === 'string') {\n const ratio = parseFloat(anchor3d[1]) / 100;\n const bounds = graphic.AABBBounds;\n _anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;\n } else {\n _anchor[1] = anchor3d[1];\n }\n }\n\n translate(m, m, [_anchor[0], _anchor[1], 0]);\n // 基于z轴的偏移基于anchor计算\n rotateZ(m, m, angle);\n translate(m, m, [-_anchor[0], -_anchor[1], 0]);\n\n multiplyMat4Mat4(out, out, m);\n }\n}\n\nexport function shouldUseMat4(graphic: IGraphic) {\n const { alpha, beta } = graphic.attribute;\n return alpha || beta;\n}\n\n// 管理graphic\n@injectable()\nexport class DefaultGraphicService implements IGraphicService {\n declare hooks: {\n onAttributeUpdate: ISyncHook<[IGraphic]>;\n onSetStage: ISyncHook<[IGraphic, IStage]>;\n onRemove: ISyncHook<[IGraphic]>;\n onRelease: ISyncHook<[IGraphic]>;\n onAddIncremental: ISyncHook<[IGraphic, IGroup, IStage]>;\n onClearIncremental: ISyncHook<[IGroup, IStage]>;\n beforeUpdateAABBBounds: ISyncHook<[IGraphic, IStage, boolean, IAABBBounds]>;\n afterUpdateAABBBounds: ISyncHook<[IGraphic, IStage, IAABBBounds, { globalAABBBounds: IAABBBounds }, boolean]>;\n clearAABBBounds: ISyncHook<[IGraphic, IStage, IAABBBounds]>;\n };\n\n // 临时bounds,用作缓存\n protected tempAABBBounds1: AABBBounds;\n protected tempAABBBounds2: AABBBounds;\n constructor(@inject(GraphicCreator) public readonly creator: IGraphicCreator) {\n this.hooks = {\n onAttributeUpdate: new SyncHook<[IGraphic]>(['graphic']),\n onSetStage: new SyncHook<[IGraphic, IStage]>(['graphic', 'stage']),\n onRemove: new SyncHook<[IGraphic]>(['graphic']),\n onRelease: new SyncHook<[IGraphic]>(['graphic']),\n onAddIncremental: new SyncHook<[IGraphic, IGroup, IStage]>(['graphic', 'group', 'stage']),\n onClearIncremental: new SyncHook<[IGroup, IStage]>(['graphic', 'group', 'stage']),\n beforeUpdateAABBBounds: new SyncHook<[IGraphic, IStage, boolean, IAABBBounds]>([\n 'graphic',\n 'stage',\n 'willUpdate',\n 'aabbBounds'\n ]),\n afterUpdateAABBBounds: new SyncHook<[IGraphic, IStage, IAABBBounds, { globalAABBBounds: IAABBBounds }, boolean]>([\n 'graphic',\n 'stage',\n 'aabbBounds',\n 'globalAABBBounds',\n 'selfChange'\n ]),\n clearAABBBounds: new SyncHook<[IGraphic, IStage, IAABBBounds]>(['graphic', 'stage', 'aabbBounds'])\n };\n this.tempAABBBounds1 = new AABBBounds();\n this.tempAABBBounds2 = new AABBBounds();\n }\n onAttributeUpdate(graphic: IGraphic) {\n if (this.hooks.onAttributeUpdate.taps.length) {\n this.hooks.onAttributeUpdate.call(graphic);\n }\n }\n onSetStage(graphic: IGraphic, stage: IStage): void {\n if (this.hooks.onSetStage.taps.length) {\n this.hooks.onSetStage.call(graphic, stage);\n }\n }\n onRemove(graphic: IGraphic<Partial<IGraphicAttribute>>): void {\n if (this.hooks.onRemove.taps.length) {\n this.hooks.onRemove.call(graphic);\n }\n }\n onRelease(graphic: IGraphic<Partial<IGraphicAttribute>>): void {\n if (this.hooks.onRelease.taps.length) {\n this.hooks.onRelease.call(graphic);\n }\n }\n onAddIncremental(graphic: IGraphic, group: IGroup, stage: IStage): void {\n if (this.hooks.onAddIncremental.taps.length) {\n this.hooks.onAddIncremental.call(graphic, group, stage);\n }\n }\n onClearIncremental(group: IGroup, stage: IStage): void {\n if (this.hooks.onClearIncremental.taps.length) {\n this.hooks.onClearIncremental.call(group, stage);\n }\n }\n beforeUpdateAABBBounds(graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) {\n if (this.hooks.beforeUpdateAABBBounds.taps.length) {\n this.hooks.beforeUpdateAABBBounds.call(graphic, stage, willUpdate, bounds);\n }\n }\n afterUpdateAABBBounds(\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) {\n if (this.hooks.afterUpdateAABBBounds.taps.length) {\n this.hooks.afterUpdateAABBBounds.call(graphic, stage, bounds, params, selfChange);\n }\n }\n clearAABBBounds(graphic: IGraphic, stage: IStage, b: IAABBBounds) {\n if (this.hooks.clearAABBBounds.taps.length) {\n this.hooks.clearAABBBounds.call(graphic, stage, b);\n }\n }\n // TODO delete\n updatePathProxyAABBBounds(aabbBounds: IAABBBounds, graphic?: IGraphic): boolean {\n const path = typeof graphic.pathProxy === 'function' ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;\n if (!path) {\n return false;\n }\n const boundsContext = new BoundsContext(aabbBounds);\n renderCommandList(path.commandList, boundsContext, 0, 0);\n return true;\n }\n\n updateHTMLTextAABBBounds(\n attribute: ITextGraphicAttribute,\n textTheme: Required<ITextGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IText\n ) {\n const { textAlign, textBaseline } = attribute;\n if (attribute.forceBoundsHeight != null) {\n const h = isNumber(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight();\n const dy = textLayoutOffsetY(textBaseline, h, h);\n aabbBounds.set(aabbBounds.x1, dy, aabbBounds.x2, dy + h);\n }\n if (attribute.forceBoundsWidth != null) {\n const w = isNumber(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth();\n const dx = textDrawOffsetX(textAlign, w);\n aabbBounds.set(dx, aabbBounds.y1, dx + w, aabbBounds.y2);\n }\n }\n\n combindShadowAABBBounds(bounds: IAABBBounds, graphic?: IGraphic) {\n // 合并shadowRoot的Bounds\n if (graphic && graphic.shadowRoot) {\n const b = graphic.shadowRoot.AABBBounds;\n bounds.union(b);\n }\n }\n\n transformAABBBounds(\n attribute: Partial<IGraphicAttribute>,\n aabbBounds: IAABBBounds,\n theme: Required<IGraphicAttribute>,\n miter: boolean,\n graphic?: IGraphic\n ) {\n if (!aabbBounds.empty()) {\n const {\n scaleX = theme.scaleX,\n scaleY = theme.scaleY,\n stroke = theme.stroke,\n shadowBlur = theme.shadowBlur,\n lineWidth = theme.lineWidth,\n pickStrokeBuffer = theme.pickStrokeBuffer,\n strokeBoundsBuffer = theme.strokeBoundsBuffer\n } = attribute;\n const tb1 = this.tempAABBBounds1;\n const tb2 = this.tempAABBBounds2;\n if (stroke && lineWidth) {\n const scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);\n boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer);\n aabbBounds.union(tb1);\n tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);\n }\n if (shadowBlur) {\n const { shadowOffsetX = theme.shadowOffsetX, shadowOffsetY = theme.shadowOffsetY } = attribute;\n const shadowBlurWidth = (shadowBlur / Math.abs(scaleX + scaleY)) * 2;\n boundStroke(tb1, shadowBlurWidth, false, strokeBoundsBuffer + 1);\n tb1.translate(shadowOffsetX, shadowOffsetY);\n aabbBounds.union(tb1);\n // tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);\n }\n }\n\n // 合并shadowRoot的bounds\n this.combindShadowAABBBounds(aabbBounds, graphic);\n if (aabbBounds.empty()) {\n return;\n }\n\n // 性能优化逻辑,group类型变换较少,不需要矩阵变换\n let updateMatrix = true;\n const m = graphic.transMatrix;\n if (graphic && graphic.isContainer) {\n updateMatrix = !(m.a === 1 && m.b === 0 && m.c === 0 && m.d === 1 && m.e === 0 && m.f === 0);\n }\n updateMatrix && transformBoundsWithMatrix(aabbBounds, aabbBounds, m);\n\n // TODO 加上锚点\n // transformBounds(aabbBounds, x, y, scaleX, scaleY, angle);\n // if (graphic.attribute.postMatrix) {\n // console.log('aaa');\n // transformBoundsWithMatrix(aabbBounds, graphic.attribute.postMatrix);\n // }\n // aabbBounds.translate(dx, dy);\n }\n\n validCheck(\n attribute: Partial<IGraphicAttribute>,\n theme: Required<IGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ): boolean {\n if (!graphic) {\n return true;\n }\n\n // 设置了强制wh,那就直接认为是合法的\n if (attribute.forceBoundsHeight != null || attribute.forceBoundsWidth != null) {\n return true;\n }\n\n // 是Group或者有影子节点的话,就直接认为是合法的\n if (graphic.shadowRoot || graphic.isContainer) {\n return true;\n }\n\n const { visible = theme.visible } = attribute;\n\n if (!(graphic.valid && visible)) {\n // application.graphicService.beforeUpdateAABBBounds(graphic, graphic.stage, true, aabbBounds);\n if (!aabbBounds.empty()) {\n graphic.parent && aabbBounds.transformWithMatrix((graphic.parent as IGroup).globalTransMatrix);\n application.graphicService.clearAABBBounds(graphic, graphic.stage, aabbBounds);\n aabbBounds.clear();\n }\n return false;\n }\n return true;\n }\n\n updateTempAABBBounds(aabbBounds: IAABBBounds) {\n const tb1 = this.tempAABBBounds1;\n const tb2 = this.tempAABBBounds2;\n tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);\n tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);\n\n return { tb1, tb2 };\n }\n}\n"]}
@@ -17,6 +17,7 @@ export default class Wrapper {
17
17
  width: string;
18
18
  height: string;
19
19
  };
20
+ newLine: boolean;
20
21
  constructor(frame: Frame);
21
22
  store(paragraph: Paragraph | RichTextIcon): void;
22
23
  send(): void;
@@ -40,7 +40,7 @@ class Wrapper {
40
40
  deal(paragraph, singleLine = !1) {
41
41
  paragraph instanceof icon_1.RichTextIcon ? "horizontal" === this.direction && 0 === this.width || "vertical" === this.direction && 0 === this.height || this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width] ? this.store(paragraph) : 0 === this.lineBuffer.length ? (this.store(paragraph),
42
42
  this.send()) : (this.send(), this.deal(paragraph)) : "number" != typeof this.width || this.width < 0 || (paragraph.newLine && this.send(),
43
- 0 !== paragraph.text.length && ("horizontal" === this.direction && 0 === this.width || "vertical" === this.direction && 0 === this.height || this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width] ? this.store(paragraph) : this.lineWidth === this[this.directionKey.width] ? (this.send(),
43
+ (0 !== paragraph.text.length || this.newLine) && ("horizontal" === this.direction && 0 === this.width || "vertical" === this.direction && 0 === this.height || this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width] ? this.store(paragraph) : this.lineWidth === this[this.directionKey.width] ? (this.send(),
44
44
  this.deal(paragraph)) : this.cut(paragraph, singleLine)));
45
45
  }
46
46
  cut(paragraph, singleLine) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/richtext/wrapper.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAG1B,2CAAgD;AAChD,mCAA4D;AAC5D,iCAAsC;AA8BtC,MAAqB,OAAO;IAe1B,YAAY,KAAY;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QAEhC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAEpB,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QAErB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,eAAe,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,qBAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IAGD,KAAK,CAAC,SAAmC;QACvC,IAAI,SAAS,YAAY,mBAAY,EAAE;YACrC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YACtD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAChC,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,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;YACrD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACf,IAAI,UAAU,EAAE;gBACd,IAAI,CAAC,IAAI,EAAE,CAAC;aACb;iBAAM;gBACL,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aACf;SACF;aAAM,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAEvC,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACtB;IAEH,CAAC;CACF;AAvMD,0BAuMC","file":"wrapper.js","sourcesContent":["import Line from './line';\nimport type Frame from './frame';\nimport type Paragraph from './paragraph';\nimport { seperateParagraph } from './paragraph';\nimport { DIRECTION_KEY, getStrByWithCanvas } from './utils';\nimport { RichTextIcon } from './icon';\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/wrap.js\nexport default class Wrapper {\n frame: Frame;\n\n lineWidth: number;\n width: number;\n height: number;\n y: number;\n maxAscent: number;\n maxDescent: number;\n maxAscentForBlank: number;\n maxDescentForBlank: number;\n lineBuffer: (Paragraph | RichTextIcon)[];\n direction: 'horizontal' | 'vertical';\n directionKey: { width: string; height: string };\n\n constructor(frame: Frame) {\n this.frame = frame;\n this.width = this.frame.width;\n this.height = this.frame.height;\n\n this.lineWidth = 0;\n this.y = this.frame.top;\n this.maxAscent = 0;\n this.maxDescent = 0;\n // 空字符串测量出的Ascent和Descent和文字不一致(空字符串测量结果ascent和descent一半一半),需要特殊处理\n this.maxAscentForBlank = 0;\n this.maxDescentForBlank = 0;\n this.lineBuffer = [];\n\n this.direction = frame.layoutDirection;\n this.directionKey = DIRECTION_KEY[this.direction];\n }\n\n // 不满一行,存储\n store(paragraph: Paragraph | RichTextIcon) {\n if (paragraph instanceof RichTextIcon) {\n this.frame.icons.set(paragraph.richtextId, paragraph);\n this.lineBuffer.push(paragraph);\n this.lineWidth += paragraph[this.directionKey.width];\n\n // 处理icon textBaseline ascent descent\n let iconAscent = 0;\n let iconDescent = 0;\n if (paragraph.attribute.textBaseline === 'top') {\n iconAscent = 0;\n iconDescent = paragraph.height;\n } else if (paragraph.attribute.textBaseline === 'bottom') {\n iconAscent = paragraph.height;\n iconDescent = 0;\n } else {\n iconAscent = paragraph.height / 2;\n iconDescent = paragraph.height / 2;\n }\n this.maxAscent = Math.max(this.maxAscent, iconAscent);\n this.maxDescent = Math.max(this.maxDescent, iconDescent);\n } else {\n this.lineBuffer.push(paragraph);\n if (paragraph.text.length !== 0) {\n this.lineWidth += paragraph[this.directionKey.width];\n this.maxAscent = Math.max(this.maxAscent, paragraph.ascent);\n this.maxDescent = Math.max(this.maxDescent, paragraph.descent);\n } else {\n this.maxAscentForBlank = Math.max(this.maxAscentForBlank, paragraph.ascent);\n this.maxDescentForBlank = Math.max(this.maxDescentForBlank, paragraph.descent);\n }\n }\n }\n\n // 满一行,生成line\n send() {\n if (this.lineBuffer.length === 0) {\n return;\n }\n // 当一行中有文字和空白时,不考虑空白的ascent和descent;如果只有空白(\\n引起的空行),取空白部分的ascent和descent\n const maxAscent = this.maxAscent === 0 ? this.maxAscentForBlank : this.maxAscent;\n const maxDescent = this.maxDescent === 0 ? this.maxDescentForBlank : this.maxDescent;\n const line = new Line(\n this.frame.left,\n this[this.directionKey.width],\n this.y + maxAscent,\n maxAscent,\n maxDescent,\n this.lineBuffer,\n this.direction,\n this.direction === 'horizontal' ? this.frame.isWidthMax : this.frame.isHeightMax\n );\n this.frame.lines.push(line);\n this.frame.actualHeight += line.height;\n\n // this.y += maxAscent + maxDescent;\n this.y += line.height;\n\n this.lineBuffer.length = 0;\n this.lineWidth = this.maxAscent = this.maxDescent = this.maxAscentForBlank = this.maxDescentForBlank = 0;\n }\n\n // 处理paragraph\n // singleLine表示是否将这个作为单行处理,也就是不拆多行了\n deal(paragraph: Paragraph | RichTextIcon, singleLine: boolean = false) {\n if (paragraph instanceof RichTextIcon) {\n if (\n (this.direction === 'horizontal' && this.width === 0) ||\n (this.direction === 'vertical' && this.height === 0)\n ) {\n // width为0时,宽度不设限制,不主动换行\n this.store(paragraph);\n } else {\n if (this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width]) {\n this.store(paragraph);\n } else if (this.lineBuffer.length === 0) {\n this.store(paragraph);\n this.send();\n } else {\n this.send();\n this.deal(paragraph);\n }\n }\n\n return;\n }\n\n // 可能会出现宽度为负的情况,此时不处理数据\n if (typeof this.width !== 'number' || this.width < 0) {\n return;\n }\n\n if (paragraph.newLine) {\n // 需要换行前,先完成上一行绘制\n this.send();\n }\n\n if (paragraph.text.length === 0) {\n return;\n } // 换行符分割出的Paragraph不进入line\n\n if ((this.direction === 'horizontal' && this.width === 0) || (this.direction === 'vertical' && this.height === 0)) {\n // width为0时,宽度不设限制,不主动换行\n this.store(paragraph);\n } else {\n // // width为有效值时,按照宽度限制,主动换行\n // if (this.lineWidth + paragraph.width <= this.width) {\n // this.store(paragraph);\n // } else if (this.lineWidth === this.width) {\n // this.send();\n // // this.store(paragraph);\n // this.deal(paragraph);\n // } else {\n // this.cut(paragraph);\n // }\n if (this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width]) {\n this.store(paragraph);\n } else if (this.lineWidth === this[this.directionKey.width]) {\n this.send();\n this.deal(paragraph);\n } else {\n this.cut(paragraph, singleLine);\n }\n }\n }\n\n // 文字超长,按需截断\n // 如果singleLine的话,最多就拆两行\n cut(paragraph: Paragraph, singleLine?: boolean) {\n // if (this.direction === 'vertical' && this.lineBuffer.length) {\n // // 纵排不做paragraph内截断\n // this.send();\n // this.deal(paragraph);\n // return;\n // } else if (this.direction === 'vertical') {\n // // 超长不处理?\n // this.store(paragraph);\n // this.send();\n // return;\n // }\n const availableWidth = this[this.directionKey.width] - this.lineWidth || 0;\n const guessIndex = Math.ceil((availableWidth / paragraph[this.directionKey.width]) * paragraph.length) || 0;\n // const index = getStrByWith(paragraph.text, availableWidth, paragraph.style, guessIndex, true);\n const index = getStrByWithCanvas(\n paragraph.text,\n availableWidth,\n paragraph.character,\n guessIndex,\n this.frame.wordBreak === 'break-word'\n );\n if (index !== 0) {\n const [p1, p2] = seperateParagraph(paragraph, index);\n this.store(p1);\n if (singleLine) {\n this.send();\n } else {\n this.deal(p2);\n }\n } else if (this.lineBuffer.length !== 0) {\n // 当前行无法容纳,转下一行处理\n this.send();\n this.deal(paragraph);\n }\n // 宽度过低,无法截断(容不下第一个字符的宽度),不处理\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/graphic/richtext/wrapper.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAG1B,2CAAgD;AAChD,mCAA4D;AAC5D,iCAAsC;AA8BtC,MAAqB,OAAO;IAgB1B,YAAY,KAAY;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,G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CACF;AAxMD,0BAwMC","file":"wrapper.js","sourcesContent":["import Line from './line';\nimport type Frame from './frame';\nimport type Paragraph from './paragraph';\nimport { seperateParagraph } from './paragraph';\nimport { DIRECTION_KEY, getStrByWithCanvas } from './utils';\nimport { RichTextIcon } from './icon';\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/wrap.js\nexport default class Wrapper {\n frame: Frame;\n\n lineWidth: number;\n width: number;\n height: number;\n y: number;\n maxAscent: number;\n maxDescent: number;\n maxAscentForBlank: number;\n maxDescentForBlank: number;\n lineBuffer: (Paragraph | RichTextIcon)[];\n direction: 'horizontal' | 'vertical';\n directionKey: { width: string; height: string };\n newLine: boolean; // 空换行符是否新增一行\n\n constructor(frame: Frame) {\n this.frame = frame;\n this.width = this.frame.width;\n this.height = this.frame.height;\n\n this.lineWidth = 0;\n this.y = this.frame.top;\n this.maxAscent = 0;\n this.maxDescent = 0;\n // 空字符串测量出的Ascent和Descent和文字不一致(空字符串测量结果ascent和descent一半一半),需要特殊处理\n this.maxAscentForBlank = 0;\n this.maxDescentForBlank = 0;\n this.lineBuffer = [];\n\n this.direction = frame.layoutDirection;\n this.directionKey = DIRECTION_KEY[this.direction];\n }\n\n // 不满一行,存储\n store(paragraph: Paragraph | RichTextIcon) {\n if (paragraph instanceof RichTextIcon) {\n this.frame.icons.set(paragraph.richtextId, paragraph);\n this.lineBuffer.push(paragraph);\n this.lineWidth += paragraph[this.directionKey.width];\n\n // 处理icon textBaseline ascent descent\n let iconAscent = 0;\n let iconDescent = 0;\n if (paragraph.attribute.textBaseline === 'top') {\n iconAscent = 0;\n iconDescent = paragraph.height;\n } else if (paragraph.attribute.textBaseline === 'bottom') {\n iconAscent = paragraph.height;\n iconDescent = 0;\n } else {\n iconAscent = paragraph.height / 2;\n iconDescent = paragraph.height / 2;\n }\n this.maxAscent = Math.max(this.maxAscent, iconAscent);\n this.maxDescent = Math.max(this.maxDescent, iconDescent);\n } else {\n this.lineBuffer.push(paragraph);\n if (paragraph.text.length !== 0) {\n this.lineWidth += paragraph[this.directionKey.width];\n this.maxAscent = Math.max(this.maxAscent, paragraph.ascent);\n this.maxDescent = Math.max(this.maxDescent, paragraph.descent);\n } else {\n this.maxAscentForBlank = Math.max(this.maxAscentForBlank, paragraph.ascent);\n this.maxDescentForBlank = Math.max(this.maxDescentForBlank, paragraph.descent);\n }\n }\n }\n\n // 满一行,生成line\n send() {\n if (this.lineBuffer.length === 0) {\n return;\n }\n // 当一行中有文字和空白时,不考虑空白的ascent和descent;如果只有空白(\\n引起的空行),取空白部分的ascent和descent\n const maxAscent = this.maxAscent === 0 ? this.maxAscentForBlank : this.maxAscent;\n const maxDescent = this.maxDescent === 0 ? this.maxDescentForBlank : this.maxDescent;\n const line = new Line(\n this.frame.left,\n this[this.directionKey.width],\n this.y + maxAscent,\n maxAscent,\n maxDescent,\n this.lineBuffer,\n this.direction,\n this.direction === 'horizontal' ? this.frame.isWidthMax : this.frame.isHeightMax\n );\n this.frame.lines.push(line);\n this.frame.actualHeight += line.height;\n\n // this.y += maxAscent + maxDescent;\n this.y += line.height;\n\n this.lineBuffer.length = 0;\n this.lineWidth = this.maxAscent = this.maxDescent = this.maxAscentForBlank = this.maxDescentForBlank = 0;\n }\n\n // 处理paragraph\n // singleLine表示是否将这个作为单行处理,也就是不拆多行了\n deal(paragraph: Paragraph | RichTextIcon, singleLine: boolean = false) {\n if (paragraph instanceof RichTextIcon) {\n if (\n (this.direction === 'horizontal' && this.width === 0) ||\n (this.direction === 'vertical' && this.height === 0)\n ) {\n // width为0时,宽度不设限制,不主动换行\n this.store(paragraph);\n } else {\n if (this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width]) {\n this.store(paragraph);\n } else if (this.lineBuffer.length === 0) {\n this.store(paragraph);\n this.send();\n } else {\n this.send();\n this.deal(paragraph);\n }\n }\n\n return;\n }\n\n // 可能会出现宽度为负的情况,此时不处理数据\n if (typeof this.width !== 'number' || this.width < 0) {\n return;\n }\n\n if (paragraph.newLine) {\n // 需要换行前,先完成上一行绘制\n this.send();\n }\n\n if (paragraph.text.length === 0 && !this.newLine) {\n return;\n } // 换行符分割出的Paragraph不进入line\n\n if ((this.direction === 'horizontal' && this.width === 0) || (this.direction === 'vertical' && this.height === 0)) {\n // width为0时,宽度不设限制,不主动换行\n this.store(paragraph);\n } else {\n // // width为有效值时,按照宽度限制,主动换行\n // if (this.lineWidth + paragraph.width <= this.width) {\n // this.store(paragraph);\n // } else if (this.lineWidth === this.width) {\n // this.send();\n // // this.store(paragraph);\n // this.deal(paragraph);\n // } else {\n // this.cut(paragraph);\n // }\n if (this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width]) {\n this.store(paragraph);\n } else if (this.lineWidth === this[this.directionKey.width]) {\n this.send();\n this.deal(paragraph);\n } else {\n this.cut(paragraph, singleLine);\n }\n }\n }\n\n // 文字超长,按需截断\n // 如果singleLine的话,最多就拆两行\n cut(paragraph: Paragraph, singleLine?: boolean) {\n // if (this.direction === 'vertical' && this.lineBuffer.length) {\n // // 纵排不做paragraph内截断\n // this.send();\n // this.deal(paragraph);\n // return;\n // } else if (this.direction === 'vertical') {\n // // 超长不处理?\n // this.store(paragraph);\n // this.send();\n // return;\n // }\n const availableWidth = this[this.directionKey.width] - this.lineWidth || 0;\n const guessIndex = Math.ceil((availableWidth / paragraph[this.directionKey.width]) * paragraph.length) || 0;\n // const index = getStrByWith(paragraph.text, availableWidth, paragraph.style, guessIndex, true);\n const index = getStrByWithCanvas(\n paragraph.text,\n availableWidth,\n paragraph.character,\n guessIndex,\n this.frame.wordBreak === 'break-word'\n );\n if (index !== 0) {\n const [p1, p2] = seperateParagraph(paragraph, index);\n this.store(p1);\n if (singleLine) {\n this.send();\n } else {\n this.deal(p2);\n }\n } else if (this.lineBuffer.length !== 0) {\n // 当前行无法容纳,转下一行处理\n this.send();\n this.deal(paragraph);\n }\n // 宽度过低,无法截断(容不下第一个字符的宽度),不处理\n }\n}\n"]}
@@ -206,7 +206,8 @@ class RichText extends graphic_1.Graphic {
206
206
  p.overflow = !0, p.left = 1e3, p.top = 1e3, frame.lines[frame.lines.length - 1].paragraphs.push(p),
207
207
  skip = !0), p.newLine && (skip = !1, wrapper.lineWidth = 0), wrapper.send();
208
208
  }
209
- } else for (let i = 0; i < paragraphs.length; i++) wrapper.deal(paragraphs[i]);
209
+ } else for (let i = 0; i < paragraphs.length; i++) i === paragraphs.length - 1 && (wrapper.newLine = !0),
210
+ wrapper.deal(paragraphs[i]), wrapper.newLine = !1;
210
211
  wrapper.send();
211
212
  if (!("horizontal" === frame.layoutDirection ? richTextWidthEnable : richTextHeightEnable)) {
212
213
  const frameSize = frame.getActualSizeWidthEllipsis();
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/richtext.ts"],"names":[],"mappings":";;;;;;AACA,6CAA4C;AAgB5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Q,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;;AArhBH,4BAshBC;AAhhBQ,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;AAygBJ,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 } 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} 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 ...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 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 } = 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 // 调整对齐方式\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(): Frame {\n if (this.shouldUpdateShape()) {\n this.doUpdateFrameCache();\n this.clearUpdateShapeTag();\n }\n return this._frameCache;\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 textConfig: _tc = [],\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 } = this.attribute;\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 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 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,6CAA4C;AAgB5C,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,GAAG,gCAAsB;CAC1B,CAAC;AAEF,MAAa,QAAS,SAAQ,iBAAkC;IAiB9D,YAAY,MAAkC;QAC5C,KAAK,CAAC,MAAM,CAAC,CAAC;QAjBhB,SAAI,GAAe,UAAU,CAAC;QAG9B,sBAAiB,GAAyB,IAAI,CAAC;QAe7C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AC,mBAAmB,CAAC;IACtC,CAAC;;AAzhBH,4BA0hBC;AAphBQ,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;AA6gBJ,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 } 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} 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 ...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 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 } = 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 // 调整对齐方式\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(): Frame {\n if (this.shouldUpdateShape()) {\n this.doUpdateFrameCache();\n this.clearUpdateShapeTag();\n }\n return this._frameCache;\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 textConfig: _tc = [],\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 } = this.attribute;\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 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 if (i === paragraphs.length - 1) {\n wrapper.newLine = true;\n }\n wrapper.deal(paragraphs[i]);\n wrapper.newLine = false;\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 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"]}
@@ -2,6 +2,7 @@ import type { IGraphicAttribute, IGraphic } from '../graphic';
2
2
  import type { ICustomPath2D } from '../path';
3
3
  export type IPathAttribute = {
4
4
  path: ICustomPath2D | string;
5
+ clipRange: number;
5
6
  customPath: (context: ICustomPath2D, pathMark: IPath) => void;
6
7
  };
7
8
  export type IPathGraphicAttribute = Partial<IGraphicAttribute> & Partial<IPathAttribute>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface/graphic/path.ts"],"names":[],"mappings":"","file":"path.js","sourcesContent":["import type { IGraphicAttribute, IGraphic } from '../graphic';\nimport type { ICustomPath2D } from '../path';\n// TODO: Path svg <Path path='' />\n\nexport type IPathAttribute = {\n path: ICustomPath2D | string;\n customPath: (context: ICustomPath2D, pathMark: IPath) => void;\n};\n\nexport type IPathGraphicAttribute = Partial<IGraphicAttribute> & Partial<IPathAttribute>;\n\nexport type ShapeType = 'area' | 'circle' | 'ellipse' | 'line' | 'rect';\n\nexport interface IPath extends IGraphic<IPathGraphicAttribute> {\n originType?: ShapeType;\n cache?: ICustomPath2D;\n pathShape: ICustomPath2D;\n\n getParsedPathShape: () => ICustomPath2D;\n}\n"]}
1
+ {"version":3,"sources":["../src/interface/graphic/path.ts"],"names":[],"mappings":"","file":"path.js","sourcesContent":["import type { IGraphicAttribute, IGraphic } from '../graphic';\nimport type { ICustomPath2D } from '../path';\n// TODO: Path svg <Path path='' />\n\nexport type IPathAttribute = {\n path: ICustomPath2D | string;\n clipRange: number;\n customPath: (context: ICustomPath2D, pathMark: IPath) => void;\n};\n\nexport type IPathGraphicAttribute = Partial<IGraphicAttribute> & Partial<IPathAttribute>;\n\nexport type ShapeType = 'area' | 'circle' | 'ellipse' | 'line' | 'rect';\n\nexport interface IPath extends IGraphic<IPathGraphicAttribute> {\n originType?: ShapeType;\n cache?: ICustomPath2D;\n pathShape: ICustomPath2D;\n\n getParsedPathShape: () => ICustomPath2D;\n}\n"]}
@@ -4,6 +4,7 @@ import type { ICustomPath2D, IPath2D } from '../path';
4
4
  export type ISymbolAttribute = {
5
5
  symbolType: SymbolType;
6
6
  size: number | [number, number];
7
+ clipRange: number;
7
8
  };
8
9
  export type ISymbolGraphicAttribute = Partial<IGraphicAttribute> & Partial<ISymbolAttribute>;
9
10
  export interface ISymbol extends IGraphic<ISymbolGraphicAttribute> {
@@ -16,6 +17,7 @@ export interface ISymbolClass {
16
17
  pathStr: string;
17
18
  isSvg?: boolean;
18
19
  draw: (ctx: IPath2D, size: number | [number, number], x: number, y: number, z?: number, cb?: (p: ICustomPath2D, a: any) => void) => boolean;
20
+ drawWithClipRange?: (ctx: IPath2D, size: number | [number, number], x: number, y: number, clipRange: number, z?: number, cb?: (p: ICustomPath2D, a: any) => void) => boolean;
19
21
  drawOffset: (ctx: IPath2D, size: number | [number, number], x: number, y: number, offset: number, z?: number, cb?: (p: ICustomPath2D, a: any) => void) => boolean;
20
22
  drawToSvgPath?: (size: number | [number, number], x: number, y: number, z?: number) => string;
21
23
  bounds: (size: number | [number, number], bounds: IBounds) => void;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface/graphic/symbol.ts"],"names":[],"mappings":"","file":"symbol.js","sourcesContent":["import type { IBounds } from '@visactor/vutils';\nimport type { IGraphicAttribute, IGraphic } from '../graphic';\nimport type { ICustomPath2D, IPath2D } from '../path';\n\nexport type ISymbolAttribute = {\n symbolType: SymbolType;\n size: number | [number, number];\n};\n\nexport type ISymbolGraphicAttribute = Partial<IGraphicAttribute> & Partial<ISymbolAttribute>;\n\nexport interface ISymbol extends IGraphic<ISymbolGraphicAttribute> {\n getParsedPath: () => ISymbolClass;\n}\n\nexport type SymbolType =\n | 'circle'\n | 'cross'\n | 'diamond'\n | 'square'\n | 'arrow'\n | 'arrowLeft'\n | 'arrowRight'\n | 'arrow2Left'\n | 'arrow2Right'\n | 'wedge'\n | 'thinTriangle'\n | 'triangle'\n | 'triangleUp'\n | 'triangleDown'\n | 'triangleRight'\n | 'triangleLeft'\n | 'stroke'\n | 'star'\n | 'wye'\n | 'rect'\n | 'rectRound'\n | 'roundLine'\n | string;\n\nexport interface ISymbolClass {\n type: SymbolType | string;\n path?: ICustomPath2D;\n pathStr: string;\n isSvg?: boolean;\n\n // 返回true表示内部已经调用closePath,返回false表示没有调用closePath,外部需要调用closePath\n draw: (\n ctx: IPath2D,\n size: number | [number, number],\n x: number,\n y: number,\n z?: number,\n cb?: (p: ICustomPath2D, a: any) => void\n ) => boolean;\n drawOffset: (\n ctx: IPath2D,\n size: number | [number, number],\n x: number,\n y: number,\n offset: number,\n z?: number,\n cb?: (p: ICustomPath2D, a: any) => void\n ) => boolean;\n\n drawToSvgPath?: (size: number | [number, number], x: number, y: number, z?: number) => string;\n\n bounds: (size: number | [number, number], bounds: IBounds) => void;\n}\n"]}
1
+ {"version":3,"sources":["../src/interface/graphic/symbol.ts"],"names":[],"mappings":"","file":"symbol.js","sourcesContent":["import type { IBounds } from '@visactor/vutils';\nimport type { IGraphicAttribute, IGraphic } from '../graphic';\nimport type { ICustomPath2D, IPath2D } from '../path';\n\nexport type ISymbolAttribute = {\n symbolType: SymbolType;\n size: number | [number, number];\n clipRange: number;\n};\n\nexport type ISymbolGraphicAttribute = Partial<IGraphicAttribute> & Partial<ISymbolAttribute>;\n\nexport interface ISymbol extends IGraphic<ISymbolGraphicAttribute> {\n getParsedPath: () => ISymbolClass;\n}\n\nexport type SymbolType =\n | 'circle'\n | 'cross'\n | 'diamond'\n | 'square'\n | 'arrow'\n | 'arrowLeft'\n | 'arrowRight'\n | 'arrow2Left'\n | 'arrow2Right'\n | 'wedge'\n | 'thinTriangle'\n | 'triangle'\n | 'triangleUp'\n | 'triangleDown'\n | 'triangleRight'\n | 'triangleLeft'\n | 'stroke'\n | 'star'\n | 'wye'\n | 'rect'\n | 'rectRound'\n | 'roundLine'\n | string;\n\nexport interface ISymbolClass {\n type: SymbolType | string;\n path?: ICustomPath2D;\n pathStr: string;\n isSvg?: boolean;\n\n // 返回true表示内部已经调用closePath,返回false表示没有调用closePath,外部需要调用closePath\n draw: (\n ctx: IPath2D,\n size: number | [number, number],\n x: number,\n y: number,\n z?: number,\n cb?: (p: ICustomPath2D, a: any) => void\n ) => boolean;\n drawWithClipRange?: (\n ctx: IPath2D,\n size: number | [number, number],\n x: number,\n y: number,\n clipRange: number,\n z?: number,\n cb?: (p: ICustomPath2D, a: any) => void\n ) => boolean;\n drawOffset: (\n ctx: IPath2D,\n size: number | [number, number],\n x: number,\n y: number,\n offset: number,\n z?: number,\n cb?: (p: ICustomPath2D, a: any) => void\n ) => boolean;\n\n drawToSvgPath?: (size: number | [number, number], x: number, y: number, z?: number) => string;\n\n bounds: (size: number | [number, number], bounds: IBounds) => void;\n}\n"]}
@@ -21,11 +21,13 @@ export interface IGraphicService {
21
21
  afterUpdateAABBBounds: ISyncHook<[IGraphic, IStage, IAABBBounds, {
22
22
  globalAABBBounds: IAABBBounds;
23
23
  }, boolean]>;
24
+ clearAABBBounds: ISyncHook<[IGraphic, IStage, IAABBBounds]>;
24
25
  };
25
26
  beforeUpdateAABBBounds: (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => void;
26
27
  afterUpdateAABBBounds: (graphic: IGraphic, stage: IStage, bounds: IAABBBounds, params: {
27
28
  globalAABBBounds: IAABBBounds;
28
29
  }, selfChange: boolean) => void;
30
+ clearAABBBounds: (graphic: IGraphic, stage: IStage, b: IAABBBounds) => void;
29
31
  creator: IGraphicCreator;
30
32
  validCheck: (attribute: Partial<IGraphicAttribute>, theme: Required<IGraphicAttribute>, aabbBounds: IAABBBounds, graphic?: IGraphic) => boolean;
31
33
  transformAABBBounds: (attribute: Partial<IGraphicAttribute>, aabbBounds: IAABBBounds, theme: Required<IGraphicAttribute>, miter: boolean, graphic?: IGraphic) => void;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface/graphic-service.ts"],"names":[],"mappings":"","file":"graphic-service.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\n\nimport type { ISyncHook } from './sync-hook';\nimport type { IGraphic, IGraphicAttribute } from './graphic';\nimport type { IStage } from './stage';\nimport type {\n IRectGraphicAttribute,\n IGroup,\n IGroupGraphicAttribute,\n ISymbolGraphicAttribute,\n ICircleGraphicAttribute,\n ICircle,\n ISymbol,\n IArcGraphicAttribute,\n IArc,\n IAreaGraphicAttribute,\n IArea,\n ILineGraphicAttribute,\n IPathGraphicAttribute,\n ILine,\n IPath,\n IPolygonGraphicAttribute,\n IPolygon,\n ITextGraphicAttribute,\n IText,\n IRichTextGraphicAttribute,\n IRichText,\n IImageGraphicAttribute,\n IImage,\n IRect3dGraphicAttribute,\n IRect,\n IRect3d,\n IShadowRoot,\n IWrapTextGraphicAttribute\n} from './graphic/index';\n\nexport interface IGraphicService {\n // themeService: IThemeService;\n onAttributeUpdate: (graphic: IGraphic) => void;\n onSetStage: (graphic: IGraphic, stage: IStage) => void;\n onRemove: (graphic: IGraphic) => void;\n onRelease: (graphic: IGraphic) => void;\n onAddIncremental: (graphic: IGraphic, group: IGroup, stage: IStage) => void;\n onClearIncremental: (group: IGroup, stage: IStage) => void;\n hooks: {\n onAttributeUpdate: ISyncHook<[IGraphic]>;\n onSetStage: ISyncHook<[IGraphic, IStage]>;\n onRemove: ISyncHook<[IGraphic]>;\n onRelease: ISyncHook<[IGraphic]>;\n onAddIncremental: ISyncHook<[IGraphic, IGroup, IStage]>;\n onClearIncremental: ISyncHook<[IGroup, IStage]>;\n beforeUpdateAABBBounds: ISyncHook<[IGraphic, IStage, boolean, IAABBBounds]>;\n afterUpdateAABBBounds: ISyncHook<[IGraphic, IStage, IAABBBounds, { globalAABBBounds: IAABBBounds }, boolean]>;\n };\n beforeUpdateAABBBounds: (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => void;\n afterUpdateAABBBounds: (\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) => void;\n\n creator: IGraphicCreator;\n validCheck: (\n attribute: Partial<IGraphicAttribute>,\n theme: Required<IGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => boolean;\n\n transformAABBBounds: (\n attribute: Partial<IGraphicAttribute>,\n aabbBounds: IAABBBounds,\n theme: Required<IGraphicAttribute>,\n miter: boolean,\n graphic?: IGraphic\n ) => void;\n\n updateHTMLTextAABBBounds: (\n attribute: ITextGraphicAttribute,\n textTheme: Required<ITextGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IText\n ) => void;\n\n combindShadowAABBBounds: (bounds: IAABBBounds, graphic?: IGraphic) => void;\n updateTempAABBBounds: (aabbBounds: IAABBBounds) => { tb1: IAABBBounds; tb2: IAABBBounds };\n}\n\nexport type IGraphicCreator = {\n arc: (attributes: IArcGraphicAttribute) => IArc;\n area: (attributes: IAreaGraphicAttribute) => IArea;\n circle: (attributes: ICircleGraphicAttribute) => ICircle;\n group: (attributes: IGroupGraphicAttribute) => IGroup;\n image: (attributes: IImageGraphicAttribute) => IImage;\n line: (attributes: ILineGraphicAttribute) => ILine;\n path: (attributes: IPathGraphicAttribute) => IPath;\n rect: (attributes: IRectGraphicAttribute) => IRect;\n rect3d: (attributes: IRect3dGraphicAttribute) => IRect3d;\n symbol: (attributes: ISymbolGraphicAttribute) => ISymbol;\n text: (attributes: ITextGraphicAttribute) => IText;\n richtext: (attributes: IRichTextGraphicAttribute) => IRichText;\n polygon: (attributes: IPolygonGraphicAttribute) => IPolygon;\n shadowRoot: (graphic?: IGraphic) => IShadowRoot;\n wrapText: (attributes: IWrapTextGraphicAttribute) => IText;\n};\n\nexport interface IArcBoundsContribution {\n updateBounds: (\n attribute: IArcGraphicAttribute,\n arcTheme: Required<IArcGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface IAreaBoundsContribution {\n updateBounds: (\n attribute: IAreaGraphicAttribute,\n arcTheme: Required<IAreaGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface ICircleBoundsContribution {\n updateBounds: (\n attribute: ICircleGraphicAttribute,\n circleTheme: Required<ICircleGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface IPathBoundsContribution {\n updateBounds: (\n attribute: IPathGraphicAttribute,\n pathTheme: Required<IPathGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface IRectBoundsContribution {\n updateBounds: (\n attribute: IRectGraphicAttribute,\n rectTheme: Required<IRectGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface ISymbolBoundsContribution {\n updateBounds: (\n attribute: ISymbolGraphicAttribute,\n SymbolTheme: Required<ISymbolGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\nexport interface IImageBoundsContribution {\n updateBounds: (\n attribute: IImageGraphicAttribute,\n ImageTheme: Required<IImageGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n"]}
1
+ {"version":3,"sources":["../src/interface/graphic-service.ts"],"names":[],"mappings":"","file":"graphic-service.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\n\nimport type { ISyncHook } from './sync-hook';\nimport type { IGraphic, IGraphicAttribute } from './graphic';\nimport type { IStage } from './stage';\nimport type {\n IRectGraphicAttribute,\n IGroup,\n IGroupGraphicAttribute,\n ISymbolGraphicAttribute,\n ICircleGraphicAttribute,\n ICircle,\n ISymbol,\n IArcGraphicAttribute,\n IArc,\n IAreaGraphicAttribute,\n IArea,\n ILineGraphicAttribute,\n IPathGraphicAttribute,\n ILine,\n IPath,\n IPolygonGraphicAttribute,\n IPolygon,\n ITextGraphicAttribute,\n IText,\n IRichTextGraphicAttribute,\n IRichText,\n IImageGraphicAttribute,\n IImage,\n IRect3dGraphicAttribute,\n IRect,\n IRect3d,\n IShadowRoot,\n IWrapTextGraphicAttribute\n} from './graphic/index';\n\nexport interface IGraphicService {\n // themeService: IThemeService;\n onAttributeUpdate: (graphic: IGraphic) => void;\n onSetStage: (graphic: IGraphic, stage: IStage) => void;\n onRemove: (graphic: IGraphic) => void;\n onRelease: (graphic: IGraphic) => void;\n onAddIncremental: (graphic: IGraphic, group: IGroup, stage: IStage) => void;\n onClearIncremental: (group: IGroup, stage: IStage) => void;\n hooks: {\n onAttributeUpdate: ISyncHook<[IGraphic]>;\n onSetStage: ISyncHook<[IGraphic, IStage]>;\n onRemove: ISyncHook<[IGraphic]>;\n onRelease: ISyncHook<[IGraphic]>;\n onAddIncremental: ISyncHook<[IGraphic, IGroup, IStage]>;\n onClearIncremental: ISyncHook<[IGroup, IStage]>;\n beforeUpdateAABBBounds: ISyncHook<[IGraphic, IStage, boolean, IAABBBounds]>;\n afterUpdateAABBBounds: ISyncHook<[IGraphic, IStage, IAABBBounds, { globalAABBBounds: IAABBBounds }, boolean]>;\n clearAABBBounds: ISyncHook<[IGraphic, IStage, IAABBBounds]>;\n };\n beforeUpdateAABBBounds: (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => void;\n afterUpdateAABBBounds: (\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) => void;\n clearAABBBounds: (graphic: IGraphic, stage: IStage, b: IAABBBounds) => void;\n\n creator: IGraphicCreator;\n validCheck: (\n attribute: Partial<IGraphicAttribute>,\n theme: Required<IGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => boolean;\n\n transformAABBBounds: (\n attribute: Partial<IGraphicAttribute>,\n aabbBounds: IAABBBounds,\n theme: Required<IGraphicAttribute>,\n miter: boolean,\n graphic?: IGraphic\n ) => void;\n\n updateHTMLTextAABBBounds: (\n attribute: ITextGraphicAttribute,\n textTheme: Required<ITextGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IText\n ) => void;\n\n combindShadowAABBBounds: (bounds: IAABBBounds, graphic?: IGraphic) => void;\n updateTempAABBBounds: (aabbBounds: IAABBBounds) => { tb1: IAABBBounds; tb2: IAABBBounds };\n}\n\nexport type IGraphicCreator = {\n arc: (attributes: IArcGraphicAttribute) => IArc;\n area: (attributes: IAreaGraphicAttribute) => IArea;\n circle: (attributes: ICircleGraphicAttribute) => ICircle;\n group: (attributes: IGroupGraphicAttribute) => IGroup;\n image: (attributes: IImageGraphicAttribute) => IImage;\n line: (attributes: ILineGraphicAttribute) => ILine;\n path: (attributes: IPathGraphicAttribute) => IPath;\n rect: (attributes: IRectGraphicAttribute) => IRect;\n rect3d: (attributes: IRect3dGraphicAttribute) => IRect3d;\n symbol: (attributes: ISymbolGraphicAttribute) => ISymbol;\n text: (attributes: ITextGraphicAttribute) => IText;\n richtext: (attributes: IRichTextGraphicAttribute) => IRichText;\n polygon: (attributes: IPolygonGraphicAttribute) => IPolygon;\n shadowRoot: (graphic?: IGraphic) => IShadowRoot;\n wrapText: (attributes: IWrapTextGraphicAttribute) => IText;\n};\n\nexport interface IArcBoundsContribution {\n updateBounds: (\n attribute: IArcGraphicAttribute,\n arcTheme: Required<IArcGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface IAreaBoundsContribution {\n updateBounds: (\n attribute: IAreaGraphicAttribute,\n arcTheme: Required<IAreaGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface ICircleBoundsContribution {\n updateBounds: (\n attribute: ICircleGraphicAttribute,\n circleTheme: Required<ICircleGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface IPathBoundsContribution {\n updateBounds: (\n attribute: IPathGraphicAttribute,\n pathTheme: Required<IPathGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface IRectBoundsContribution {\n updateBounds: (\n attribute: IRectGraphicAttribute,\n rectTheme: Required<IRectGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface ISymbolBoundsContribution {\n updateBounds: (\n attribute: ISymbolGraphicAttribute,\n SymbolTheme: Required<ISymbolGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\nexport interface IImageBoundsContribution {\n updateBounds: (\n attribute: IImageGraphicAttribute,\n ImageTheme: Required<IImageGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n"]}
@@ -16,7 +16,7 @@ type IStrokeSeg = {
16
16
  end: number;
17
17
  length: number;
18
18
  };
19
- export type GraphicType = 'area' | 'circle' | 'ellipse' | 'line' | 'rect' | 'rect3d' | 'path' | 'richtext' | 'text' | 'arc' | 'arc3d' | 'image' | 'symbol' | 'group' | 'shadowroot' | 'polygon' | 'pyramid3d' | 'glyph';
19
+ export type GraphicType = 'area' | 'circle' | 'ellipse' | 'line' | 'rect' | 'rect3d' | 'path' | 'richtext' | 'text' | 'arc' | 'arc3d' | 'image' | 'symbol' | 'group' | 'shadowroot' | 'polygon' | 'pyramid3d' | 'glyph' | string;
20
20
  export type Cursor = 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'all-scroll' | 'col-resize' | 'row-resize' | 'n-resize' | 'e-resize' | 's-resize' | 'w-resize' | 'ne-resize' | 'nw-resize' | 'se-resize' | 'sw-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'zoom-in' | 'zoom-out';
21
21
  export type ITransform = {
22
22
  x: number;
@@ -120,6 +120,8 @@ export type IGraphicStyle = ILayout & IFillStyle & IStrokeStyle & IPickStyle & {
120
120
  backgroundFit: boolean;
121
121
  backgroundCornerRadius: number | number[];
122
122
  backgroundOpacity: number;
123
+ textureRatio: number;
124
+ textureOptions: any;
123
125
  background: IBackgroundType | {
124
126
  background: IBackgroundType;
125
127
  dx?: number;