@visactor/vrender-core 0.19.13-alpha.1 → 0.20.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/cjs/allocator/bounds-allocate.js.map +1 -1
  2. package/cjs/animate/config.js +2 -1
  3. package/cjs/animate/custom-animate.js +1 -2
  4. package/cjs/common/Reflect-metadata.js +2 -1
  5. package/cjs/common/bezier-utils.js +1 -2
  6. package/cjs/common/render-curve.js +2 -1
  7. package/cjs/common/render-utils.js +1 -2
  8. package/cjs/common/seg-context.js.map +1 -1
  9. package/cjs/common/segment/index.d.ts +2 -4
  10. package/cjs/common/segment/index.js.map +1 -1
  11. package/cjs/common/utils.js +1 -1
  12. package/cjs/core/camera.d.ts +1 -0
  13. package/cjs/core/camera.js +8 -2
  14. package/cjs/core/camera.js.map +1 -1
  15. package/cjs/core/graphic-utils.js.map +1 -1
  16. package/cjs/core/light.d.ts +1 -0
  17. package/cjs/core/light.js +8 -2
  18. package/cjs/core/light.js.map +1 -1
  19. package/cjs/core/stage.d.ts +1 -1
  20. package/cjs/core/stage.js +16 -7
  21. package/cjs/core/stage.js.map +1 -1
  22. package/cjs/factory.d.ts +5 -0
  23. package/cjs/factory.js +17 -0
  24. package/cjs/factory.js.map +1 -0
  25. package/cjs/graphic/arc.d.ts +1 -2
  26. package/cjs/graphic/arc.js +0 -3
  27. package/cjs/graphic/arc.js.map +1 -1
  28. package/cjs/graphic/area.d.ts +1 -2
  29. package/cjs/graphic/area.js +0 -3
  30. package/cjs/graphic/area.js.map +1 -1
  31. package/cjs/graphic/circle.d.ts +1 -2
  32. package/cjs/graphic/circle.js +0 -3
  33. package/cjs/graphic/circle.js.map +1 -1
  34. package/cjs/graphic/glyph.d.ts +1 -2
  35. package/cjs/graphic/glyph.js +0 -3
  36. package/cjs/graphic/glyph.js.map +1 -1
  37. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  38. package/cjs/graphic/graphic.d.ts +1 -4
  39. package/cjs/graphic/graphic.js +0 -3
  40. package/cjs/graphic/graphic.js.map +1 -1
  41. package/cjs/graphic/group.d.ts +1 -2
  42. package/cjs/graphic/group.js +0 -3
  43. package/cjs/graphic/group.js.map +1 -1
  44. package/cjs/graphic/image.d.ts +1 -2
  45. package/cjs/graphic/image.js +0 -3
  46. package/cjs/graphic/image.js.map +1 -1
  47. package/cjs/graphic/index.js.map +1 -1
  48. package/cjs/graphic/line.d.ts +1 -2
  49. package/cjs/graphic/line.js +0 -3
  50. package/cjs/graphic/line.js.map +1 -1
  51. package/cjs/graphic/path.d.ts +1 -2
  52. package/cjs/graphic/path.js +0 -3
  53. package/cjs/graphic/path.js.map +1 -1
  54. package/cjs/graphic/polygon.d.ts +1 -2
  55. package/cjs/graphic/polygon.js +0 -3
  56. package/cjs/graphic/polygon.js.map +1 -1
  57. package/cjs/graphic/rect.d.ts +1 -2
  58. package/cjs/graphic/rect.js +0 -3
  59. package/cjs/graphic/rect.js.map +1 -1
  60. package/cjs/graphic/richtext.d.ts +2 -3
  61. package/cjs/graphic/richtext.js +2 -5
  62. package/cjs/graphic/richtext.js.map +1 -1
  63. package/cjs/graphic/symbol.d.ts +0 -2
  64. package/cjs/graphic/symbol.js +0 -3
  65. package/cjs/graphic/symbol.js.map +1 -1
  66. package/cjs/graphic/text.d.ts +1 -2
  67. package/cjs/graphic/text.js +0 -3
  68. package/cjs/graphic/text.js.map +1 -1
  69. package/cjs/index.d.ts +5 -1
  70. package/cjs/index.js +19 -16
  71. package/cjs/index.js.map +1 -1
  72. package/cjs/interface/graphic.d.ts +1 -2
  73. package/cjs/interface/graphic.js.map +1 -1
  74. package/cjs/picker/picker-service.js +8 -7
  75. package/cjs/picker/picker-service.js.map +1 -1
  76. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +2 -2
  77. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  78. package/cjs/plugins/builtin-plugin/html-attribute-plugin.d.ts +1 -0
  79. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +11 -5
  80. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  81. package/cjs/plugins/builtin-plugin/react-attribute-plugin.d.ts +1 -0
  82. package/cjs/plugins/builtin-plugin/react-attribute-plugin.js +8 -2
  83. package/cjs/plugins/builtin-plugin/react-attribute-plugin.js.map +1 -1
  84. package/cjs/render/contributions/render/area-render.js +4 -32
  85. package/cjs/render/contributions/render/area-render.js.map +1 -1
  86. package/cjs/render/contributions/render/base-render.js +7 -7
  87. package/cjs/render/contributions/render/base-render.js.map +1 -1
  88. package/cjs/render/contributions/render/contributions/arc-contribution-render.js +14 -30
  89. package/cjs/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
  90. package/cjs/render/contributions/render/contributions/base-contribution-render.js +2 -2
  91. package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  92. package/cjs/render/contributions/render/contributions/circle-contribution-render.js +11 -22
  93. package/cjs/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
  94. package/cjs/render/contributions/render/contributions/image-contribution-render.js +2 -2
  95. package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  96. package/cjs/render/contributions/render/contributions/rect-contribution-render.js +11 -24
  97. package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  98. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +10 -21
  99. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  100. package/cjs/render/contributions/render/contributions/text-contribution-render.js +2 -2
  101. package/cjs/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
  102. package/cjs/render/contributions/render/draw-contribution.js +4 -4
  103. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  104. package/cjs/render/contributions/render/draw-interceptor.js +7 -7
  105. package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
  106. package/cjs/render/contributions/render/group-render.js +8 -7
  107. package/cjs/render/contributions/render/group-render.js.map +1 -1
  108. package/cjs/render/contributions/render/incremental-draw-contribution.js +4 -4
  109. package/cjs/render/contributions/render/incremental-draw-contribution.js.map +1 -1
  110. package/cjs/render/contributions/render/line-render.js.map +1 -1
  111. package/cjs/render/contributions/render/text-render.d.ts +3 -2
  112. package/cjs/render/contributions/render/text-render.js +13 -32
  113. package/cjs/render/contributions/render/text-render.js.map +1 -1
  114. package/dist/index.es.js +11412 -12020
  115. package/es/allocator/bounds-allocate.js.map +1 -1
  116. package/es/animate/config.js +2 -1
  117. package/es/animate/custom-animate.js +1 -2
  118. package/es/common/Reflect-metadata.js +2 -1
  119. package/es/common/bezier-utils.js +1 -2
  120. package/es/common/render-curve.js +2 -1
  121. package/es/common/render-utils.js +1 -2
  122. package/es/common/seg-context.js.map +1 -1
  123. package/es/common/segment/index.d.ts +2 -4
  124. package/es/common/segment/index.js.map +1 -1
  125. package/es/common/utils.js +1 -1
  126. package/es/core/camera.d.ts +1 -0
  127. package/es/core/camera.js +6 -0
  128. package/es/core/camera.js.map +1 -1
  129. package/es/core/graphic-utils.js.map +1 -1
  130. package/es/core/light.d.ts +1 -0
  131. package/es/core/light.js +6 -0
  132. package/es/core/light.js.map +1 -1
  133. package/es/core/stage.d.ts +1 -1
  134. package/es/core/stage.js +17 -12
  135. package/es/core/stage.js.map +1 -1
  136. package/es/factory.d.ts +5 -0
  137. package/es/factory.js +11 -0
  138. package/es/factory.js.map +1 -0
  139. package/es/graphic/arc.d.ts +1 -2
  140. package/es/graphic/arc.js +0 -3
  141. package/es/graphic/arc.js.map +1 -1
  142. package/es/graphic/area.d.ts +1 -2
  143. package/es/graphic/area.js +0 -3
  144. package/es/graphic/area.js.map +1 -1
  145. package/es/graphic/circle.d.ts +1 -2
  146. package/es/graphic/circle.js +0 -3
  147. package/es/graphic/circle.js.map +1 -1
  148. package/es/graphic/glyph.d.ts +1 -2
  149. package/es/graphic/glyph.js +0 -3
  150. package/es/graphic/glyph.js.map +1 -1
  151. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  152. package/es/graphic/graphic.d.ts +1 -4
  153. package/es/graphic/graphic.js +0 -3
  154. package/es/graphic/graphic.js.map +1 -1
  155. package/es/graphic/group.d.ts +1 -2
  156. package/es/graphic/group.js +0 -3
  157. package/es/graphic/group.js.map +1 -1
  158. package/es/graphic/image.d.ts +1 -2
  159. package/es/graphic/image.js +0 -3
  160. package/es/graphic/image.js.map +1 -1
  161. package/es/graphic/index.js.map +1 -1
  162. package/es/graphic/line.d.ts +1 -2
  163. package/es/graphic/line.js +0 -3
  164. package/es/graphic/line.js.map +1 -1
  165. package/es/graphic/path.d.ts +1 -2
  166. package/es/graphic/path.js +0 -3
  167. package/es/graphic/path.js.map +1 -1
  168. package/es/graphic/polygon.d.ts +1 -2
  169. package/es/graphic/polygon.js +0 -3
  170. package/es/graphic/polygon.js.map +1 -1
  171. package/es/graphic/rect.d.ts +1 -2
  172. package/es/graphic/rect.js +0 -3
  173. package/es/graphic/rect.js.map +1 -1
  174. package/es/graphic/richtext.d.ts +2 -3
  175. package/es/graphic/richtext.js +2 -5
  176. package/es/graphic/richtext.js.map +1 -1
  177. package/es/graphic/symbol.d.ts +0 -2
  178. package/es/graphic/symbol.js +0 -3
  179. package/es/graphic/symbol.js.map +1 -1
  180. package/es/graphic/text.d.ts +1 -2
  181. package/es/graphic/text.js +0 -3
  182. package/es/graphic/text.js.map +1 -1
  183. package/es/index.d.ts +5 -1
  184. package/es/index.js +10 -2
  185. package/es/index.js.map +1 -1
  186. package/es/interface/graphic.d.ts +1 -2
  187. package/es/interface/graphic.js.map +1 -1
  188. package/es/picker/picker-service.js +5 -1
  189. package/es/picker/picker-service.js.map +1 -1
  190. package/es/plugins/builtin-plugin/flex-layout-plugin.js +1 -1
  191. package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  192. package/es/plugins/builtin-plugin/html-attribute-plugin.d.ts +1 -0
  193. package/es/plugins/builtin-plugin/html-attribute-plugin.js +9 -1
  194. package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  195. package/es/plugins/builtin-plugin/react-attribute-plugin.d.ts +1 -0
  196. package/es/plugins/builtin-plugin/react-attribute-plugin.js +6 -0
  197. package/es/plugins/builtin-plugin/react-attribute-plugin.js.map +1 -1
  198. package/es/render/contributions/render/area-render.js +1 -30
  199. package/es/render/contributions/render/area-render.js.map +1 -1
  200. package/es/render/contributions/render/base-render.js +1 -1
  201. package/es/render/contributions/render/base-render.js.map +1 -1
  202. package/es/render/contributions/render/contributions/arc-contribution-render.js +13 -28
  203. package/es/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
  204. package/es/render/contributions/render/contributions/base-contribution-render.js +1 -1
  205. package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  206. package/es/render/contributions/render/contributions/circle-contribution-render.js +10 -20
  207. package/es/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
  208. package/es/render/contributions/render/contributions/image-contribution-render.js +1 -1
  209. package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  210. package/es/render/contributions/render/contributions/rect-contribution-render.js +10 -20
  211. package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  212. package/es/render/contributions/render/contributions/symbol-contribution-render.js +9 -19
  213. package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  214. package/es/render/contributions/render/contributions/text-contribution-render.js +1 -1
  215. package/es/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
  216. package/es/render/contributions/render/draw-contribution.js +1 -1
  217. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  218. package/es/render/contributions/render/draw-interceptor.js +5 -3
  219. package/es/render/contributions/render/draw-interceptor.js.map +1 -1
  220. package/es/render/contributions/render/group-render.js +3 -1
  221. package/es/render/contributions/render/group-render.js.map +1 -1
  222. package/es/render/contributions/render/incremental-draw-contribution.js +1 -1
  223. package/es/render/contributions/render/incremental-draw-contribution.js.map +1 -1
  224. package/es/render/contributions/render/line-render.js.map +1 -1
  225. package/es/render/contributions/render/text-render.d.ts +3 -2
  226. package/es/render/contributions/render/text-render.js +11 -30
  227. package/es/render/contributions/render/text-render.js.map +1 -1
  228. package/package.json +1 -1
  229. package/cjs/allocator/allocator-modules.d.ts +0 -1
  230. package/cjs/allocator/allocator-modules.js +0 -1
  231. package/cjs/allocator/allocator-modules.js.map +0 -1
  232. package/cjs/allocator/point-allocate.d.ts +0 -1
  233. package/cjs/allocator/point-allocate.js +0 -1
  234. package/cjs/allocator/point-allocate.js.map +0 -1
  235. package/cjs/graphic/graphic-service/arc-contribution.d.ts +0 -1
  236. package/cjs/graphic/graphic-service/arc-contribution.js +0 -3
  237. package/cjs/graphic/graphic-service/arc-contribution.js.map +0 -1
  238. package/cjs/graphic/graphic-service/area-contribution.d.ts +0 -1
  239. package/cjs/graphic/graphic-service/area-contribution.js +0 -3
  240. package/cjs/graphic/graphic-service/area-contribution.js.map +0 -1
  241. package/cjs/graphic/graphic-service/circle-contribution.d.ts +0 -1
  242. package/cjs/graphic/graphic-service/circle-contribution.js +0 -3
  243. package/cjs/graphic/graphic-service/circle-contribution.js.map +0 -1
  244. package/cjs/graphic/graphic-service/default-theme.d.ts +0 -1
  245. package/cjs/graphic/graphic-service/default-theme.js +0 -3
  246. package/cjs/graphic/graphic-service/default-theme.js.map +0 -1
  247. package/cjs/graphic/graphic-service/path-contribution.d.ts +0 -1
  248. package/cjs/graphic/graphic-service/path-contribution.js +0 -3
  249. package/cjs/graphic/graphic-service/path-contribution.js.map +0 -1
  250. package/cjs/graphic/graphic-service/rect-contribution.d.ts +0 -1
  251. package/cjs/graphic/graphic-service/rect-contribution.js +0 -3
  252. package/cjs/graphic/graphic-service/rect-contribution.js.map +0 -1
  253. package/cjs/interface/util.d.ts +0 -1
  254. package/cjs/interface/util.js +0 -3
  255. package/cjs/interface/util.js.map +0 -1
  256. package/cjs/plugins/builtin-plugin/edit-module.d.ts +0 -21
  257. package/cjs/plugins/builtin-plugin/edit-module.js +0 -81
  258. package/cjs/plugins/builtin-plugin/edit-module.js.map +0 -1
  259. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +0 -52
  260. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +0 -279
  261. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +0 -1
  262. package/es/allocator/allocator-modules.d.ts +0 -1
  263. package/es/allocator/allocator-modules.js +0 -1
  264. package/es/allocator/allocator-modules.js.map +0 -1
  265. package/es/allocator/point-allocate.d.ts +0 -1
  266. package/es/allocator/point-allocate.js +0 -1
  267. package/es/allocator/point-allocate.js.map +0 -1
  268. package/es/graphic/graphic-service/arc-contribution.d.ts +0 -1
  269. package/es/graphic/graphic-service/arc-contribution.js +0 -3
  270. package/es/graphic/graphic-service/arc-contribution.js.map +0 -1
  271. package/es/graphic/graphic-service/area-contribution.d.ts +0 -1
  272. package/es/graphic/graphic-service/area-contribution.js +0 -3
  273. package/es/graphic/graphic-service/area-contribution.js.map +0 -1
  274. package/es/graphic/graphic-service/circle-contribution.d.ts +0 -1
  275. package/es/graphic/graphic-service/circle-contribution.js +0 -3
  276. package/es/graphic/graphic-service/circle-contribution.js.map +0 -1
  277. package/es/graphic/graphic-service/default-theme.d.ts +0 -1
  278. package/es/graphic/graphic-service/default-theme.js +0 -3
  279. package/es/graphic/graphic-service/default-theme.js.map +0 -1
  280. package/es/graphic/graphic-service/path-contribution.d.ts +0 -1
  281. package/es/graphic/graphic-service/path-contribution.js +0 -3
  282. package/es/graphic/graphic-service/path-contribution.js.map +0 -1
  283. package/es/graphic/graphic-service/rect-contribution.d.ts +0 -1
  284. package/es/graphic/graphic-service/rect-contribution.js +0 -3
  285. package/es/graphic/graphic-service/rect-contribution.js.map +0 -1
  286. package/es/interface/util.d.ts +0 -1
  287. package/es/interface/util.js +0 -3
  288. package/es/interface/util.js.map +0 -1
  289. package/es/plugins/builtin-plugin/edit-module.d.ts +0 -21
  290. package/es/plugins/builtin-plugin/edit-module.js +0 -73
  291. package/es/plugins/builtin-plugin/edit-module.js.map +0 -1
  292. package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +0 -52
  293. package/es/plugins/builtin-plugin/richtext-edit-plugin.js +0 -276
  294. package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/allocator/point-allocate.ts"],"names":[],"mappings":"","file":"point-allocate.js","sourcesContent":["// import { Point, IPoint, IPointLike } from '@visactor/vutils';\n// import { IAllocate } from './interface';\n// import { Disposable } from '../interface';\n\n// export const PointLikeAllocate = Symbol.for('PointLikeAllocate');\n\n// export type IPointLikeAllocate = IAllocate<IPointLike>;\n\n// @injectable()\n// export class DefaultPointLikeAllocate implements IAllocate<IPointLike>, Disposable {\n// protected pools: IPointLike[] = [];\n// allocate(x: number, y: number): IPointLike {\n// if (!this.pools.length) {\n// return { x, y };\n// }\n// const p = this.pools.pop() as any;\n// p.x = x;\n// p.y = y;\n// return p;\n// }\n// free(d: IPointLike) {\n// this.pools.push(d);\n// }\n// get length(): number {\n// return this.pools.length;\n// }\n// dispose(...params: any): void {\n// this.pools = [];\n// }\n// }\n\n// export const PointAllocate = Symbol.for('PointAllocate');\n\n// export type IPointAllocate = IAllocate<IPoint>;\n\n// @injectable()\n// export class DefaultPointAllocate implements IAllocate<IPoint>, Disposable {\n// protected pools: IPoint[] = [];\n// allocate(x: number, y: number): IPoint {\n// if (!this.pools.length) {\n// return new Point(x, y);\n// }\n// const p = this.pools.pop() as any;\n// p.x = x;\n// p.y = y;\n// return p;\n// }\n// free(d: IPoint) {\n// this.pools.push(d);\n// }\n// get length(): number {\n// return this.pools.length;\n// }\n// dispose(...params: any): void {\n// this.pools = [];\n// }\n// }\n"]}
@@ -1,3 +0,0 @@
1
-
2
-
3
- //# sourceMappingURL=arc-contribution.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/graphic/graphic-service/arc-contribution.ts"],"names":[],"mappings":"","file":"arc-contribution.js","sourcesContent":["// import { injectable } from '../../common/inversify-lite';\n// import type { IArcBoundsContribution } from '../../interface';\n// import { DefaultOuterBorderBoundsContribution } from './common-contribution';\n\n// export const ArcBoundsContribution = Symbol.for('ArcBoundsContribution');\n\n// @injectable()\n// export class DefaultArcOuterBorderBoundsContribution\n// extends DefaultOuterBorderBoundsContribution\n// implements IArcBoundsContribution {}\n"]}
@@ -1,3 +0,0 @@
1
-
2
-
3
- //# sourceMappingURL=area-contribution.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/graphic/graphic-service/area-contribution.ts"],"names":[],"mappings":"","file":"area-contribution.js","sourcesContent":["// export const AreaBoundsContribution = Symbol.for('AreaBoundsContribution');\n\n// // @injectable()\n// // export class DefaultArcOuterBorderBoundsContribution\n// // extends DefaultOuterBorderBoundsContribution\n// // implements IArcBoundsContribution {}\n"]}
@@ -1,3 +0,0 @@
1
-
2
-
3
- //# sourceMappingURL=circle-contribution.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/graphic/graphic-service/circle-contribution.ts"],"names":[],"mappings":"","file":"circle-contribution.js","sourcesContent":["// import { injectable } from '../../common/inversify-lite';\n// import type { ICircleBoundsContribution } from '../../interface';\n// import { DefaultOuterBorderBoundsContribution } from './common-contribution';\n\n// export const CircleBoundsContribution = Symbol.for('CircleBoundsContribution');\n\n// @injectable()\n// export class DefaultCircleOuterBorderBoundsContribution\n// extends DefaultOuterBorderBoundsContribution\n// implements ICircleBoundsContribution {}\n"]}
@@ -1,3 +0,0 @@
1
-
2
-
3
- //# sourceMappingURL=default-theme.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/graphic/graphic-service/default-theme.ts"],"names":[],"mappings":"","file":"default-theme.js","sourcesContent":["// import {\n// ICircleGraphicAttribute,\n// ILineGraphicAttribute,\n// ISymbolGraphicAttribute,\n// ITextGraphicAttribute,\n// IRectGraphicAttribute,\n// IPathGraphicAttribute,\n// IArcGraphicAttribute,\n// IAreaGraphicAttribute,\n// IGroupGraphicAttribute,\n// IPolygonGraphicAttribute\n// } from '../../interface';\n// import { DefaultCircleAttribute } from '../circle';\n// import { DefaultLineAttribute } from '../line';\n// import { DefaultRectAttribute } from '../rect';\n// import { DefaultSymbolAttribute } from '../symbol';\n// import { DefaultTextAttribute } from '../text';\n// import { DefaultPathAttribute } from '../path';\n// import { DefaultArcAttribute } from '../arc';\n// import { DefaultAreaAttribute } from '../area';\n// import { DefaultGroupAttribute } from '../group';\n// import { DefaultPolygonAttribute } from '../polygon';\n// import { DEFAULT_THEME_ID, ITheme, IThemeService } from './theme-service';\n\n// @injectable()\n// export class DefaultTheme implements ITheme {\n// readonly id: string;\n// circleAttribute: Required<ICircleGraphicAttribute>;\n// textAttribute: Required<ITextGraphicAttribute>;\n// symbolAttribute: Required<ISymbolGraphicAttribute>;\n// lineAttribute: Required<ILineGraphicAttribute>;\n// rectAttribute: Required<IRectGraphicAttribute>;\n// pathAttribute: Required<IPathGraphicAttribute>;\n// arcAttribute: Required<IArcGraphicAttribute>;\n// groupAttribute: Required<IGroupGraphicAttribute>;\n// areaAttribute: Required<IAreaGraphicAttribute>;\n// polygonAttribute: Required<IPolygonGraphicAttribute>;\n\n// constructor() {\n// this.id = DEFAULT_THEME_ID;\n// this.circleAttribute = { ...DefaultCircleAttribute };\n// this.textAttribute = { ...DefaultTextAttribute };\n// this.symbolAttribute = { ...DefaultSymbolAttribute };\n// this.lineAttribute = { ...DefaultLineAttribute };\n// this.rectAttribute = { ...DefaultRectAttribute };\n// this.pathAttribute = { ...DefaultPathAttribute };\n// this.arcAttribute = { ...DefaultArcAttribute };\n// this.areaAttribute = { ...DefaultAreaAttribute };\n// this.groupAttribute = { ...DefaultGroupAttribute };\n// this.polygonAttribute = { ...DefaultPolygonAttribute };\n// }\n\n// configure(themeService: IThemeService) {\n// themeService.register(this);\n// }\n\n// activate(): void {\n// return;\n// }\n// deactivate(): void {\n// return;\n// }\n// }\n"]}
@@ -1,3 +0,0 @@
1
-
2
-
3
- //# sourceMappingURL=path-contribution.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/graphic/graphic-service/path-contribution.ts"],"names":[],"mappings":"","file":"path-contribution.js","sourcesContent":["// import { injectable } from '../../common/inversify-lite';\n// import { DefaultOuterBorderBoundsContribution } from './common-contribution';\n// import type { IPathBoundsContribution } from '../../interface/graphic-service';\n\n// export const PathBoundsContribution = Symbol.for('PathBoundsContribution');\n\n// @injectable()\n// export class DefaultPathOuterBorderBoundsContribution\n// extends DefaultOuterBorderBoundsContribution\n// implements IPathBoundsContribution {}\n"]}
@@ -1,3 +0,0 @@
1
-
2
-
3
- //# sourceMappingURL=rect-contribution.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/graphic/graphic-service/rect-contribution.ts"],"names":[],"mappings":"","file":"rect-contribution.js","sourcesContent":["// import { injectable } from '../../common/inversify-lite';\n// import type { IRectBoundsContribution } from '../../interface';\n// import { DefaultOuterBorderBoundsContribution } from './common-contribution';\n\n// export const RectBoundsContribution = Symbol.for('RectBoundsContribution');\n\n// @injectable()\n// export class DefaultRectOuterBorderBoundsContribution\n// extends DefaultOuterBorderBoundsContribution\n// implements IRectBoundsContribution {}\n"]}
@@ -1 +0,0 @@
1
-
@@ -1,3 +0,0 @@
1
-
2
-
3
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/interface/util.ts"],"names":[],"mappings":"","file":"util.js","sourcesContent":["// import { IMatrix } from './matrix';\n\n// export type IBoundsLike = Pick<IBounds, 'x1' | 'y1' | 'x2' | 'y2'>;\n// export type IOBBBoundsLike = Pick<IOBBBounds, 'x1' | 'y1' | 'x2' | 'y2' | 'angle'>;\n\n// export interface IBounds {\n// x1: number;\n// y1: number;\n// x2: number;\n// y2: number;\n// clone: () => IBounds;\n// clear: () => IBounds;\n// empty: () => boolean;\n// emptyMin: () => boolean;\n// equals: (b: IBounds) => boolean;\n// set: (x1: number, y1: number, x2: number, y2: number) => IBounds;\n// add: (x: number, y: number) => IBounds;\n// expand: (d: number) => IBounds;\n// round: () => IBounds;\n// translate: (dx: number, dy: number) => IBounds;\n// rotate: (angle: number, x: number, y: number) => IBounds;\n// scale: (sx: number, sy: number, x: number, y: number) => IBounds;\n// /**\n// * 并集\n// * @param b\n// * @returns\n// */\n// union: (b: IBounds) => IBounds;\n// /**\n// * 交集\n// * @param b\n// * @returns\n// */\n// intersect: (b: IBounds) => IBounds;\n// /**\n// * 是否包含b\n// * @param b\n// * @returns\n// */\n// encloses: (b: IBounds) => boolean;\n// /**\n// * 是否共边\n// * @param b\n// * @returns\n// */\n// alignsWith: (b: IBounds) => boolean;\n// /**\n// * 是否相交\n// * @param b\n// * @returns\n// */\n// intersects: (b: IBounds) => boolean;\n// /**\n// * 是否包含\n// * @param x\n// * @param y\n// * @returns\n// */\n// contains: (x: number, y: number) => boolean;\n// width: () => number;\n// height: () => number;\n// scaleX: (s: number) => IBounds;\n// scaleY: (s: number) => IBounds;\n\n// transformWithMatrix: (matrix: IMatrix) => IBounds;\n// }\n\n// export type IAABBBounds = IBounds;\n\n// export interface IOBBBounds extends IBounds {\n// angle: number;\n// }\n\n// export type IPointLike = Pick<IPoint, 'x' | 'y' | 'x1' | 'y1'>;\n\n// export interface IPoint {\n// x: number;\n// y: number;\n// x1?: number;\n// y1?: number;\n// // defined?: boolean;\n// add?: (point: IPoint | number) => IPoint;\n// sub?: (point: IPoint | number) => IPoint;\n// multi?: (point: IPoint | number) => IPoint;\n// div?: (point: IPoint | number) => IPoint;\n// length?: () => number;\n// }\n\n// export type vec2 = [number, number] | Float32Array;\n// export type vec3 = [number, number, number] | Float32Array;\n// export type vec4 = [number, number, number, number] | Float32Array;\n// export type vec8 = [number, number, number, number, number, number, number, number] | Float32Array;\n\n// export type RepeatType = 'no-repeat' | 'repeat' | 'stretch';\n"]}
@@ -1,21 +0,0 @@
1
- import type { IRichText } from '../../interface';
2
- export declare class EditModule {
3
- container: HTMLElement;
4
- textAreaDom: HTMLTextAreaElement;
5
- currRt: IRichText;
6
- isComposing: boolean;
7
- cursorIndex: number;
8
- selectionStartCursorIdx: number;
9
- onInputCbList: Array<(text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => void>;
10
- onChangeCbList: Array<(text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => void>;
11
- constructor(container?: HTMLElement);
12
- onInput(cb: (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => void): void;
13
- onChange(cb: (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => void): void;
14
- applyStyle(textAreaDom: HTMLTextAreaElement): void;
15
- handleKeyDown: (e: KeyboardEvent) => void;
16
- handleCompositionStart: () => void;
17
- handleCompositionEnd: () => void;
18
- handleInput: (ev: any) => void;
19
- moveTo(x: number, y: number, rt: IRichText, cursorIndex: number, selectionStartCursorIdx: number): void;
20
- release(): void;
21
- }
@@ -1,73 +0,0 @@
1
- export class EditModule {
2
- constructor(container) {
3
- this.handleKeyDown = e => {
4
- "Delete" !== e.key && "Backspace" !== e.key || this.handleInput({
5
- data: null,
6
- type: "Backspace"
7
- });
8
- }, this.handleCompositionStart = () => {
9
- const {textConfig: textConfig = []} = this.currRt.attribute, lastConfig = textConfig[this.cursorIndex];
10
- textConfig.splice(this.cursorIndex + 1, 0, Object.assign(Object.assign({}, lastConfig), {
11
- text: ""
12
- })), this.isComposing = !0;
13
- }, this.handleCompositionEnd = () => {
14
- this.isComposing = !1;
15
- const curIdx = this.cursorIndex + 1, {textConfig: textConfig = []} = this.currRt.attribute, lastConfig = textConfig[curIdx];
16
- textConfig.splice(curIdx, 1);
17
- const text = lastConfig.text, textList = Array.from(text.toString());
18
- for (let i = 0; i < textList.length; i++) textConfig.splice(i + curIdx, 0, Object.assign(Object.assign({}, lastConfig), {
19
- text: textList[i]
20
- }));
21
- this.currRt.setAttributes({
22
- textConfig: textConfig
23
- }), this.onChangeCbList.forEach((cb => {
24
- cb(text, this.isComposing, this.cursorIndex + textList.length, this.currRt);
25
- }));
26
- }, this.handleInput = ev => {
27
- if (!this.currRt) return;
28
- const str = ev.data || "\n", {textConfig: textConfig = []} = this.currRt.attribute;
29
- let startIdx = this.selectionStartCursorIdx, endIdx = this.cursorIndex;
30
- startIdx > endIdx && ([startIdx, endIdx] = [ endIdx, startIdx ]), this.selectionStartCursorIdx = startIdx,
31
- this.cursorIndex = startIdx;
32
- const lastConfig = textConfig[startIdx + (this.isComposing ? 1 : 0)];
33
- let currConfig = lastConfig;
34
- "Backspace" !== ev.type || this.isComposing ? (startIdx !== endIdx && textConfig.splice(startIdx + 1, endIdx - startIdx),
35
- this.isComposing || (currConfig = Object.assign(Object.assign({}, lastConfig), {
36
- text: ""
37
- }), startIdx += 1, textConfig.splice(startIdx, 0, currConfig)), currConfig.text = str) : startIdx !== endIdx ? textConfig.splice(startIdx + 1, endIdx - startIdx) : (textConfig.splice(startIdx, 1),
38
- startIdx -= 1), this.currRt.setAttributes({
39
- textConfig: textConfig
40
- }), this.isComposing ? this.onInputCbList.forEach((cb => {
41
- cb(str, this.isComposing, startIdx, this.currRt);
42
- })) : this.onChangeCbList.forEach((cb => {
43
- cb(str, this.isComposing, startIdx, this.currRt);
44
- }));
45
- }, this.container = null != container ? container : document.body;
46
- const textAreaDom = document.createElement("textarea");
47
- textAreaDom.autocomplete = "off", textAreaDom.innerText = "", this.applyStyle(textAreaDom),
48
- this.container.append(textAreaDom), this.textAreaDom = textAreaDom, this.isComposing = !1,
49
- this.onInputCbList = [], this.onChangeCbList = [];
50
- }
51
- onInput(cb) {
52
- this.onInputCbList.push(cb);
53
- }
54
- onChange(cb) {
55
- this.onChangeCbList.push(cb);
56
- }
57
- applyStyle(textAreaDom) {
58
- textAreaDom.setAttribute("style", "width: 100px; height: 30px; left: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;"),
59
- textAreaDom.addEventListener("input", this.handleInput), textAreaDom.addEventListener("compositionstart", this.handleCompositionStart),
60
- textAreaDom.addEventListener("compositionend", this.handleCompositionEnd), window.addEventListener("keydown", this.handleKeyDown);
61
- }
62
- moveTo(x, y, rt, cursorIndex, selectionStartCursorIdx) {
63
- this.textAreaDom.style.left = `${x}px`, this.textAreaDom.style.top = `${y}px`, setTimeout((() => {
64
- this.textAreaDom.focus(), this.textAreaDom.setSelectionRange(0, 0);
65
- })), this.currRt = rt, this.cursorIndex = cursorIndex, this.selectionStartCursorIdx = selectionStartCursorIdx;
66
- }
67
- release() {
68
- this.textAreaDom.removeEventListener("input", this.handleInput), this.textAreaDom.removeEventListener("compositionstart", this.handleCompositionStart),
69
- this.textAreaDom.removeEventListener("compositionend", this.handleCompositionEnd),
70
- window.removeEventListener("keydown", this.handleKeyDown);
71
- }
72
- }
73
- //# sourceMappingURL=edit-module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/plugins/builtin-plugin/edit-module.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,UAAU;IAYrB,YAAY,SAAuB;QAkCnC,kBAAa,GAAG,CAAC,CAAgB,EAAE,EAAE;YACnC,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,GAAG,KAAK,WAAW,EAAE;gBAC/C,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;aACrD;QACH,CAAC,CAAC;QAEF,2BAAsB,GAAG,GAAG,EAAE;YAC5B,MAAM,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;YAClD,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAChD,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC,kCAAO,UAAU,KAAE,IAAI,EAAE,EAAE,IAAG,CAAC;YACxE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC1B,CAAC,CAAC;QACF,yBAAoB,GAAG,GAAG,EAAE;YAC1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,CAAC,oBAAoB,CAAC,CAAC;QAClF,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC5D,CAAC;CACF","file":"edit-module.js","sourcesContent":["import type { IRichText } from '../../interface';\nimport { IRichTextIcon, IRichTextParagraph } from '../../interface';\n\nexport class EditModule {\n container: HTMLElement;\n textAreaDom: HTMLTextAreaElement;\n currRt: IRichText;\n isComposing: boolean;\n cursorIndex: number;\n selectionStartCursorIdx: number;\n // 输入的回调(composing的时候每次也会触发)\n onInputCbList: Array<(text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => void>;\n // change的回调(composing确认才会触发)\n onChangeCbList: Array<(text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => void>;\n\n constructor(container?: HTMLElement) {\n this.container = container ?? document.body;\n\n const textAreaDom = document.createElement('textarea');\n textAreaDom.autocomplete = 'off';\n textAreaDom.innerText = '';\n this.applyStyle(textAreaDom);\n this.container.append(textAreaDom);\n this.textAreaDom = textAreaDom;\n this.isComposing = false;\n this.onInputCbList = [];\n this.onChangeCbList = [];\n }\n\n onInput(cb: (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => void) {\n this.onInputCbList.push(cb);\n }\n\n onChange(cb: (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => void) {\n this.onChangeCbList.push(cb);\n }\n\n applyStyle(textAreaDom: HTMLTextAreaElement) {\n textAreaDom.setAttribute(\n 'style',\n `width: 100px; height: 30px; left: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;`\n );\n\n textAreaDom.addEventListener('input', this.handleInput);\n textAreaDom.addEventListener('compositionstart', this.handleCompositionStart);\n textAreaDom.addEventListener('compositionend', this.handleCompositionEnd);\n window.addEventListener('keydown', this.handleKeyDown);\n }\n\n handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Delete' || e.key === 'Backspace') {\n this.handleInput({ data: null, type: 'Backspace' });\n }\n };\n\n handleCompositionStart = () => {\n const { textConfig = [] } = this.currRt.attribute;\n const lastConfig = textConfig[this.cursorIndex];\n textConfig.splice(this.cursorIndex + 1, 0, { ...lastConfig, text: '' });\n this.isComposing = true;\n };\n handleCompositionEnd = () => {\n this.isComposing = false;\n\n const curIdx = this.cursorIndex + 1;\n // 拆分上一次的内容\n const { textConfig = [] } = this.currRt.attribute;\n const lastConfig = textConfig[curIdx];\n textConfig.splice(curIdx, 1);\n const text = (lastConfig as any).text;\n const textList: string[] = Array.from(text.toString());\n for (let i = 0; i < textList.length; i++) {\n textConfig.splice(i + curIdx, 0, { ...lastConfig, text: textList[i] });\n }\n this.currRt.setAttributes({ textConfig });\n this.onChangeCbList.forEach(cb => {\n cb(text, this.isComposing, this.cursorIndex + textList.length, this.currRt);\n });\n };\n\n handleInput = (ev: any) => {\n if (!this.currRt) {\n return;\n }\n const str = (ev as any).data || '\\n';\n // 如果是回车,那就不往后+1\n const { textConfig = [] } = this.currRt.attribute;\n\n // 如果有选中多个文字,那就先删除\n let startIdx = this.selectionStartCursorIdx;\n let endIdx = this.cursorIndex;\n if (startIdx > endIdx) {\n [startIdx, endIdx] = [endIdx, startIdx];\n }\n // 无论是否composition都立刻恢复到没有选中的idx状态\n this.selectionStartCursorIdx = startIdx;\n this.cursorIndex = startIdx;\n\n const lastConfig = textConfig[startIdx + (this.isComposing ? 1 : 0)];\n let currConfig = lastConfig;\n if (ev.type === 'Backspace' && !this.isComposing) {\n if (startIdx !== endIdx) {\n textConfig.splice(startIdx + 1, endIdx - startIdx);\n } else {\n textConfig.splice(startIdx, 1);\n startIdx -= 1;\n }\n } else {\n if (startIdx !== endIdx) {\n textConfig.splice(startIdx + 1, endIdx - startIdx);\n }\n\n if (!this.isComposing) {\n currConfig = { ...lastConfig, text: '' };\n startIdx += 1;\n textConfig.splice(startIdx, 0, currConfig);\n }\n (currConfig as any).text = str;\n }\n\n this.currRt.setAttributes({ textConfig });\n if (!this.isComposing) {\n this.onChangeCbList.forEach(cb => {\n cb(str, this.isComposing, startIdx, this.currRt);\n });\n } else {\n this.onInputCbList.forEach(cb => {\n cb(str, this.isComposing, startIdx, this.currRt);\n });\n }\n };\n\n moveTo(x: number, y: number, rt: IRichText, cursorIndex: number, selectionStartCursorIdx: number) {\n this.textAreaDom.style.left = `${x}px`;\n this.textAreaDom.style.top = `${y}px`;\n setTimeout(() => {\n this.textAreaDom.focus();\n this.textAreaDom.setSelectionRange(0, 0);\n });\n this.currRt = rt;\n\n this.cursorIndex = cursorIndex;\n this.selectionStartCursorIdx = selectionStartCursorIdx;\n }\n\n release() {\n this.textAreaDom.removeEventListener('input', this.handleInput);\n this.textAreaDom.removeEventListener('compositionstart', this.handleCompositionStart);\n this.textAreaDom.removeEventListener('compositionend', this.handleCompositionEnd);\n window.removeEventListener('keydown', this.handleKeyDown);\n }\n}\n"]}
@@ -1,52 +0,0 @@
1
- import type { IPointLike } from '@visactor/vutils';
2
- import type { IGroup, ILine, IPlugin, IPluginService, IRichText, IRichTextFrame, IRichTextIcon, IRichTextLine, IRichTextParagraph } from '../../interface';
3
- import { EditModule } from './edit-module';
4
- export declare class RichTextEditPlugin implements IPlugin {
5
- name: 'RichTextEditPlugin';
6
- activeEvent: 'onRegister';
7
- pluginService: IPluginService;
8
- _uid: number;
9
- key: string;
10
- editing: boolean;
11
- editLine: ILine;
12
- editBg: IGroup;
13
- pointerDown: boolean;
14
- lastPoint?: IPointLike;
15
- editModule: EditModule;
16
- curCursorIdx: number;
17
- selectionStartCursorIdx: number;
18
- activate(context: IPluginService): void;
19
- handleInput: (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => void;
20
- handleChange: (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => void;
21
- handleMove: (e: PointerEvent) => void;
22
- showSelection(e: PointerEvent): void;
23
- hideSelection(): void;
24
- handlePointerDown: (e: PointerEvent) => void;
25
- handlePointerUp: (e: PointerEvent) => void;
26
- handleEnter: (e: PointerEvent) => void;
27
- handleLeave: (e: PointerEvent) => void;
28
- isRichtext(e: PointerEvent): boolean;
29
- protected getEventPosition(e: PointerEvent): IPointLike;
30
- protected getLineByPoint(cache: IRichTextFrame, p1: IPointLike): IRichTextLine;
31
- protected getColumnByLinePoint(lineInfo: IRichTextLine, p1: IPointLike): IRichTextParagraph | IRichTextIcon;
32
- onFocus(e: PointerEvent): void;
33
- protected getPointByColumnIdx(idx: number, rt: IRichText): {
34
- x: any;
35
- y1: number;
36
- y2: number;
37
- };
38
- protected getColumnIndex(cache: IRichTextFrame, cInfo: IRichTextParagraph | IRichTextIcon): number;
39
- protected getColumnByIndex(cache: IRichTextFrame, index: number): {
40
- lineInfo: IRichTextLine;
41
- columnInfo: IRichTextParagraph | IRichTextIcon;
42
- } | null;
43
- protected setCursorAndTextArea(x: number, y1: number, y2: number, rt: IRichText): void;
44
- protected setCursor(x: number, y1: number, y2: number): void;
45
- applyUpdate(): void;
46
- deFocus(e: PointerEvent): void;
47
- splitText(text: string): string[];
48
- tryUpdateRichtext(richtext: IRichText): void;
49
- onSelect(): void;
50
- deactivate(context: IPluginService): void;
51
- release(): void;
52
- }
@@ -1,276 +0,0 @@
1
- import { isString } from "@visactor/vutils";
2
-
3
- import { Generator } from "../../common/generator";
4
-
5
- import { createGroup, createLine, createRect } from "../../graphic";
6
-
7
- import { EditModule } from "./edit-module";
8
-
9
- export class RichTextEditPlugin {
10
- constructor() {
11
- this.name = "RichTextEditPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(),
12
- this.key = this.name + this._uid, this.editing = !1, this.pointerDown = !1, this.handleInput = (text, isComposing, cursorIdx, rt) => {
13
- const p = this.getPointByColumnIdx(cursorIdx, rt);
14
- this.hideSelection(), this.setCursor(p.x, p.y1, p.y2);
15
- }, this.handleChange = (text, isComposing, cursorIdx, rt) => {
16
- const p = this.getPointByColumnIdx(cursorIdx, rt);
17
- this.curCursorIdx = cursorIdx, this.selectionStartCursorIdx = cursorIdx, this.setCursorAndTextArea(p.x, p.y1, p.y2, rt),
18
- this.hideSelection();
19
- }, this.handleMove = e => {
20
- this.isRichtext(e) && (this.handleEnter(e), e.target.once("pointerleave", this.handleLeave),
21
- this.showSelection(e));
22
- }, this.handlePointerDown = e => {
23
- this.editing ? this.onFocus(e) : this.deFocus(e), this.applyUpdate(), this.pointerDown = !0;
24
- }, this.handlePointerUp = e => {
25
- this.pointerDown = !1;
26
- }, this.handleEnter = e => {
27
- this.editing = !0, this.pluginService.stage.setCursor("text");
28
- }, this.handleLeave = e => {
29
- this.editing = !1, this.pluginService.stage.setCursor("default");
30
- };
31
- }
32
- activate(context) {
33
- this.pluginService = context, this.editModule = new EditModule, context.stage.on("pointermove", this.handleMove),
34
- context.stage.on("pointerdown", this.handlePointerDown), context.stage.on("pointerup", this.handlePointerUp),
35
- context.stage.on("pointerleave", this.handlePointerUp), this.editModule.onInput(this.handleInput),
36
- this.editModule.onChange(this.handleChange);
37
- }
38
- showSelection(e) {
39
- const cache = e.target.getFrameCache();
40
- if (cache && this.editBg) {
41
- if (this.pointerDown) {
42
- let p0 = this.lastPoint, p1 = this.getEventPosition(e), line1Info = this.getLineByPoint(cache, p1);
43
- const column1 = this.getColumnByLinePoint(line1Info, p1), y1 = line1Info.top, y2 = line1Info.top + line1Info.height;
44
- let x = column1.left + column1.width, cursorIndex = this.getColumnIndex(cache, column1);
45
- p1.x < column1.left + column1.width / 2 && (x = column1.left, cursorIndex -= 1),
46
- p1.x = x, p1.y = (y1 + y2) / 2;
47
- let line0Info = this.getLineByPoint(cache, p0);
48
- if ((p0.y > p1.y || p0.y === p1.y && p0.x > p1.x) && ([p0, p1] = [ p1, p0 ], [line1Info, line0Info] = [ line0Info, line1Info ]),
49
- this.editBg.removeAllChild(), line0Info === line1Info) {
50
- const column0 = this.getColumnByLinePoint(line0Info, p0);
51
- this.editBg.setAttributes({
52
- x: p0.x,
53
- y: line0Info.top,
54
- width: p1.x - p0.x,
55
- height: column0.height,
56
- fill: "#336df4",
57
- fillOpacity: .2
58
- });
59
- } else {
60
- this.editBg.setAttributes({
61
- x: 0,
62
- y: line0Info.top,
63
- width: 0,
64
- height: 0
65
- });
66
- const startIdx = cache.lines.findIndex((item => item === line0Info)), endIdx = cache.lines.findIndex((item => item === line1Info));
67
- let y = 0;
68
- for (let i = startIdx; i <= endIdx; i++) {
69
- const line = cache.lines[i];
70
- if (i === startIdx) {
71
- const p = line.paragraphs[line.paragraphs.length - 1];
72
- this.editBg.add(createRect({
73
- x: p0.x,
74
- y: y,
75
- width: p.left + p.width - p0.x,
76
- height: line.height,
77
- fill: "#336df4",
78
- fillOpacity: .2
79
- }));
80
- } else if (i === endIdx) {
81
- const p = line.paragraphs[0];
82
- this.editBg.add(createRect({
83
- x: p.left,
84
- y: y,
85
- width: p1.x - p.left,
86
- height: line.height,
87
- fill: "#336df4",
88
- fillOpacity: .2
89
- }));
90
- } else {
91
- const p0 = line.paragraphs[0], p1 = line.paragraphs[line.paragraphs.length - 1];
92
- this.editBg.add(createRect({
93
- x: p0.left,
94
- y: y,
95
- width: p1.left + p1.width - p0.left,
96
- height: line.height,
97
- fill: "#336df4",
98
- fillOpacity: .2
99
- }));
100
- }
101
- y += line.height;
102
- }
103
- }
104
- this.curCursorIdx = cursorIndex, this.setCursorAndTextArea(x, y1 + 2, y2 - 2, e.target);
105
- }
106
- this.applyUpdate();
107
- }
108
- }
109
- hideSelection() {
110
- this.editBg && (this.editBg.removeAllChild(), this.editBg.setAttributes({
111
- fill: "transparent"
112
- }));
113
- }
114
- isRichtext(e) {
115
- return !(!e.target || "richtext" !== e.target.type);
116
- }
117
- getEventPosition(e) {
118
- const p = this.pluginService.stage.eventPointTransform(e), p1 = {
119
- x: 0,
120
- y: 0
121
- };
122
- return e.target.globalTransMatrix.transformPoint(p, p1), p1;
123
- }
124
- getLineByPoint(cache, p1) {
125
- let lineInfo = cache.lines[0];
126
- for (let i = 0; i < cache.lines.length && !(lineInfo.top <= p1.y && lineInfo.top + lineInfo.height >= p1.y); i++) lineInfo = cache.lines[i + 1];
127
- return lineInfo;
128
- }
129
- getColumnByLinePoint(lineInfo, p1) {
130
- let columnInfo = lineInfo.paragraphs[0];
131
- for (let i = 0; i < lineInfo.paragraphs.length && !(columnInfo.left <= p1.x && columnInfo.left + columnInfo.width >= p1.x); i++) columnInfo = lineInfo.paragraphs[i];
132
- return columnInfo;
133
- }
134
- onFocus(e) {
135
- this.deFocus(e);
136
- const target = e.target;
137
- this.tryUpdateRichtext(target);
138
- const shadowRoot = target.attachShadow();
139
- shadowRoot.setAttributes({
140
- shadowRootIdx: -1
141
- });
142
- const cache = target.getFrameCache();
143
- if (!cache) return;
144
- if (!this.editLine) {
145
- const line = createLine({
146
- x: 0,
147
- y: 0,
148
- lineWidth: 1,
149
- stroke: "black"
150
- });
151
- line.animate().to({
152
- opacity: 1
153
- }, 10, "linear").wait(700).to({
154
- opacity: 0
155
- }, 10, "linear").wait(700).loop(1 / 0), this.editLine = line;
156
- const g = createGroup({
157
- x: 0,
158
- y: 0,
159
- width: 0,
160
- height: 0
161
- });
162
- this.editBg = g, shadowRoot.add(this.editLine), shadowRoot.add(this.editBg);
163
- }
164
- const p1 = this.getEventPosition(e), lineInfo = this.getLineByPoint(cache, p1);
165
- if (lineInfo) {
166
- const columnInfo = this.getColumnByLinePoint(lineInfo, p1);
167
- if (!columnInfo) return;
168
- let y1 = lineInfo.top, y2 = lineInfo.top + lineInfo.height, x = columnInfo.left + columnInfo.width;
169
- y1 += 2, y2 -= 2;
170
- let cursorIndex = this.getColumnIndex(cache, columnInfo);
171
- p1.x < columnInfo.left + columnInfo.width / 2 && (x = columnInfo.left, cursorIndex -= 1),
172
- this.lastPoint = {
173
- x: x,
174
- y: (y1 + y2) / 2
175
- }, this.curCursorIdx = cursorIndex, this.selectionStartCursorIdx = cursorIndex,
176
- this.setCursorAndTextArea(x, y1, y2, target);
177
- }
178
- }
179
- getPointByColumnIdx(idx, rt) {
180
- const cache = rt.getFrameCache(), {lineInfo: lineInfo, columnInfo: columnInfo} = this.getColumnByIndex(cache, idx);
181
- let y1 = lineInfo.top, y2 = lineInfo.top + lineInfo.height;
182
- return y1 += 2, y2 -= 2, {
183
- x: columnInfo.left + columnInfo.width,
184
- y1: y1,
185
- y2: y2
186
- };
187
- }
188
- getColumnIndex(cache, cInfo) {
189
- let inputIndex = -1;
190
- for (let i = 0; i < cache.lines.length; i++) {
191
- const line = cache.lines[i];
192
- for (let j = 0; j < line.paragraphs.length; j++) if (inputIndex++, cInfo === line.paragraphs[j]) return inputIndex;
193
- }
194
- return -1;
195
- }
196
- getColumnByIndex(cache, index) {
197
- let inputIndex = -1;
198
- for (let i = 0; i < cache.lines.length; i++) {
199
- const lineInfo = cache.lines[i];
200
- for (let j = 0; j < lineInfo.paragraphs.length; j++) {
201
- const columnInfo = lineInfo.paragraphs[j];
202
- if (inputIndex++, inputIndex === index) return {
203
- lineInfo: lineInfo,
204
- columnInfo: columnInfo
205
- };
206
- }
207
- }
208
- return null;
209
- }
210
- setCursorAndTextArea(x, y1, y2, rt) {
211
- this.editLine.setAttributes({
212
- points: [ {
213
- x: x,
214
- y: y1
215
- }, {
216
- x: x,
217
- y: y2
218
- } ]
219
- });
220
- const out = {
221
- x: 0,
222
- y: 0
223
- };
224
- rt.globalTransMatrix.getInverse().transformPoint({
225
- x: x,
226
- y: y1
227
- }, out);
228
- const {left: left, top: top} = this.pluginService.stage.window.getBoundingClientRect();
229
- out.x += left, out.y += top, this.editModule.moveTo(out.x, out.y, rt, this.curCursorIdx, this.selectionStartCursorIdx);
230
- }
231
- setCursor(x, y1, y2) {
232
- this.editLine.setAttributes({
233
- points: [ {
234
- x: x,
235
- y: y1
236
- }, {
237
- x: x,
238
- y: y2
239
- } ]
240
- });
241
- }
242
- applyUpdate() {
243
- this.pluginService.stage.renderNextFrame();
244
- }
245
- deFocus(e) {
246
- e.target.detachShadow(), this.editLine && (this.editLine.parent.removeChild(this.editLine),
247
- this.editLine.release(), this.editLine = null, this.editBg.parent.removeChild(this.editBg),
248
- this.editBg.release(), this.editBg = null);
249
- }
250
- splitText(text) {
251
- return Array.from(text);
252
- }
253
- tryUpdateRichtext(richtext) {
254
- if (!richtext.getFrameCache().lines.every((line => line.paragraphs.every((item => !(item.text && isString(item.text) && this.splitText(item.text).length > 1)))))) {
255
- const tc = [];
256
- richtext.attribute.textConfig.forEach((item => {
257
- const textList = this.splitText(item.text.toString());
258
- if (isString(item.text) && textList.length > 1) for (let i = 0; i < textList.length; i++) {
259
- const t = textList[i];
260
- tc.push(Object.assign(Object.assign({}, item), {
261
- text: t
262
- }));
263
- } else tc.push(item);
264
- })), richtext.doUpdateFrameCache(tc);
265
- }
266
- }
267
- onSelect() {}
268
- deactivate(context) {
269
- context.stage.off("pointermove", this.handleMove), context.stage.off("pointerdown", this.handlePointerDown),
270
- context.stage.off("pointerup", this.handlePointerUp), context.stage.off("pointerleave", this.handlePointerUp);
271
- }
272
- release() {
273
- this.editModule.release();
274
- }
275
- }
276
- //# sourceMappingURL=richtext-edit-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/plugins/builtin-plugin/richtext-edit-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAepE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,OAAO,kBAAkB;IAA/B;QACE,SAAI,GAAyB,oBAAoB,CAAC;QAClD,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACpC,YAAO,GAAY,KAAK,CAAC;QAGzB,gBAAW,GAAY,KAAK,CAAC;QAsB7B,gBAAW,G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,EAAE;wBACxC,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;wBACtB,EAAE,CAAC,IAAI,iCAAM,IAAI,KAAE,IAAI,EAAE,CAAC,IAAG,CAAC;qBAC/B;iBACF;qBAAM;oBACL,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACf;YACH,CAAC,CAAC,CAAC;YACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;SACjC;IACH,CAAC;IAED,QAAQ;QACN,OAAO;IACT,CAAC;IAED,UAAU,CAAC,OAAuB;QAEhC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAClD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACzD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACrD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO;QACL,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;CACF","file":"richtext-edit-plugin.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\nimport { isString } from '@visactor/vutils';\nimport { Generator } from '../../common/generator';\nimport { createGroup, createLine, createRect } from '../../graphic';\nimport type {\n IGroup,\n ILine,\n IPlugin,\n IPluginService,\n IRect,\n IRichText,\n IRichTextCharacter,\n IRichTextFrame,\n IRichTextIcon,\n IRichTextLine,\n IRichTextParagraph,\n IRichTextParagraphCharacter\n} from '../../interface';\nimport { EditModule } from './edit-module';\n\nexport class RichTextEditPlugin implements IPlugin {\n name: 'RichTextEditPlugin' = 'RichTextEditPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n editing: boolean = false;\n editLine: ILine;\n editBg: IGroup;\n pointerDown: boolean = false;\n // 用于selection中保存上一次click时候的位置\n lastPoint?: IPointLike;\n editModule: EditModule;\n\n // 当前的cursor信息\n curCursorIdx: number;\n selectionStartCursorIdx: number;\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n this.editModule = new EditModule();\n // context.stage.on('click', this.handleClick);\n context.stage.on('pointermove', this.handleMove);\n context.stage.on('pointerdown', this.handlePointerDown);\n context.stage.on('pointerup', this.handlePointerUp);\n context.stage.on('pointerleave', this.handlePointerUp);\n\n this.editModule.onInput(this.handleInput);\n this.editModule.onChange(this.handleChange);\n }\n\n handleInput = (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => {\n // 修改cursor的位置,但并不同步,因为这可能是临时的\n const p = this.getPointByColumnIdx(cursorIdx, rt);\n this.hideSelection();\n this.setCursor(p.x, p.y1, p.y2);\n };\n handleChange = (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => {\n // 修改cursor的位置,并同步到editModule\n const p = this.getPointByColumnIdx(cursorIdx, rt);\n this.curCursorIdx = cursorIdx;\n this.selectionStartCursorIdx = cursorIdx;\n this.setCursorAndTextArea(p.x, p.y1, p.y2, rt);\n this.hideSelection();\n };\n\n handleMove = (e: PointerEvent) => {\n if (!this.isRichtext(e)) {\n return;\n }\n this.handleEnter(e);\n (e.target as any).once('pointerleave', this.handleLeave);\n\n this.showSelection(e);\n };\n\n showSelection(e: PointerEvent) {\n const cache = (e.target as IRichText).getFrameCache();\n if (!(cache && this.editBg)) {\n return;\n }\n if (this.pointerDown) {\n let p0 = this.lastPoint;\n // 计算p1在字符中的位置\n let p1 = this.getEventPosition(e);\n let line1Info = this.getLineByPoint(cache, p1);\n const column1 = this.getColumnByLinePoint(line1Info, p1);\n const y1 = line1Info.top;\n const y2 = line1Info.top + line1Info.height;\n let x = column1.left + column1.width;\n let cursorIndex = this.getColumnIndex(cache, column1);\n if (p1.x < column1.left + column1.width / 2) {\n x = column1.left;\n cursorIndex -= 1;\n }\n p1.x = x;\n p1.y = (y1 + y2) / 2;\n let line0Info = this.getLineByPoint(cache, p0);\n if (p0.y > p1.y || (p0.y === p1.y && p0.x > p1.x)) {\n [p0, p1] = [p1, p0];\n [line1Info, line0Info] = [line0Info, line1Info];\n }\n\n this.editBg.removeAllChild();\n if (line0Info === line1Info) {\n const column0 = this.getColumnByLinePoint(line0Info, p0);\n this.editBg.setAttributes({\n x: p0.x,\n y: line0Info.top,\n width: p1.x - p0.x,\n height: column0.height,\n fill: '#336df4',\n fillOpacity: 0.2\n });\n } else {\n this.editBg.setAttributes({ x: 0, y: line0Info.top, width: 0, height: 0 });\n const startIdx = cache.lines.findIndex(item => item === line0Info);\n const endIdx = cache.lines.findIndex(item => item === line1Info);\n let y = 0;\n for (let i = startIdx; i <= endIdx; i++) {\n const line = cache.lines[i];\n if (i === startIdx) {\n const p = line.paragraphs[line.paragraphs.length - 1];\n this.editBg.add(\n createRect({\n x: p0.x,\n y,\n width: p.left + p.width - p0.x,\n height: line.height,\n fill: '#336df4',\n fillOpacity: 0.2\n })\n );\n } else if (i === endIdx) {\n const p = line.paragraphs[0];\n this.editBg.add(\n createRect({\n x: p.left,\n y,\n width: p1.x - p.left,\n height: line.height,\n fill: '#336df4',\n fillOpacity: 0.2\n })\n );\n } else {\n const p0 = line.paragraphs[0];\n const p1 = line.paragraphs[line.paragraphs.length - 1];\n this.editBg.add(\n createRect({\n x: p0.left,\n y,\n width: p1.left + p1.width - p0.left,\n height: line.height,\n fill: '#336df4',\n fillOpacity: 0.2\n })\n );\n }\n y += line.height;\n }\n }\n\n this.curCursorIdx = cursorIndex;\n this.setCursorAndTextArea(x, y1 + 2, y2 - 2, e.target as IRichText);\n }\n this.applyUpdate();\n }\n\n hideSelection() {\n if (this.editBg) {\n this.editBg.removeAllChild();\n this.editBg.setAttributes({ fill: 'transparent' });\n }\n }\n\n handlePointerDown = (e: PointerEvent) => {\n if (this.editing) {\n this.onFocus(e);\n } else {\n this.deFocus(e);\n }\n this.applyUpdate();\n this.pointerDown = true;\n };\n handlePointerUp = (e: PointerEvent) => {\n this.pointerDown = false;\n };\n\n handleEnter = (e: PointerEvent) => {\n this.editing = true;\n this.pluginService.stage.setCursor('text');\n };\n\n handleLeave = (e: PointerEvent) => {\n this.editing = false;\n this.pluginService.stage.setCursor('default');\n };\n\n isRichtext(e: PointerEvent) {\n return !!(e.target && (e.target as any).type === 'richtext');\n }\n\n protected getEventPosition(e: PointerEvent): IPointLike {\n const p = this.pluginService.stage.eventPointTransform(e);\n\n const p1 = { x: 0, y: 0 };\n (e.target as IRichText).globalTransMatrix.transformPoint(p, p1);\n return p1;\n }\n\n protected getLineByPoint(cache: IRichTextFrame, p1: IPointLike): IRichTextLine {\n let lineInfo = cache.lines[0];\n for (let i = 0; i < cache.lines.length; i++) {\n if (lineInfo.top <= p1.y && lineInfo.top + lineInfo.height >= p1.y) {\n break;\n }\n lineInfo = cache.lines[i + 1];\n }\n\n return lineInfo;\n }\n protected getColumnByLinePoint(lineInfo: IRichTextLine, p1: IPointLike): IRichTextParagraph | IRichTextIcon {\n let columnInfo = lineInfo.paragraphs[0];\n for (let i = 0; i < lineInfo.paragraphs.length; i++) {\n if (columnInfo.left <= p1.x && columnInfo.left + columnInfo.width >= p1.x) {\n break;\n }\n columnInfo = lineInfo.paragraphs[i];\n }\n\n return columnInfo;\n }\n\n onFocus(e: PointerEvent) {\n this.deFocus(e);\n\n // 添加shadowGraphic\n const target = e.target as IRichText;\n this.tryUpdateRichtext(target);\n const shadowRoot = target.attachShadow();\n shadowRoot.setAttributes({ shadowRootIdx: -1 });\n const cache = target.getFrameCache();\n if (!cache) {\n return;\n }\n if (!this.editLine) {\n const line = createLine({ x: 0, y: 0, lineWidth: 1, stroke: 'black' });\n line\n .animate()\n .to({ opacity: 1 }, 10, 'linear')\n .wait(700)\n .to({ opacity: 0 }, 10, 'linear')\n .wait(700)\n .loop(Infinity);\n this.editLine = line;\n\n const g = createGroup({ x: 0, y: 0, width: 0, height: 0 });\n this.editBg = g;\n shadowRoot.add(this.editLine);\n shadowRoot.add(this.editBg);\n }\n\n const p1 = this.getEventPosition(e);\n\n const lineInfo = this.getLineByPoint(cache, p1);\n\n if (lineInfo) {\n const columnInfo = this.getColumnByLinePoint(lineInfo, p1);\n if (!columnInfo) {\n return;\n }\n\n let y1 = lineInfo.top;\n let y2 = lineInfo.top + lineInfo.height;\n let x = columnInfo.left + columnInfo.width;\n y1 += 2;\n y2 -= 2;\n let cursorIndex = this.getColumnIndex(cache, columnInfo);\n if (p1.x < columnInfo.left + columnInfo.width / 2) {\n x = columnInfo.left;\n cursorIndex -= 1;\n }\n\n this.lastPoint = { x, y: (y1 + y2) / 2 };\n\n this.curCursorIdx = cursorIndex;\n this.selectionStartCursorIdx = cursorIndex;\n this.setCursorAndTextArea(x, y1, y2, target);\n }\n }\n\n protected getPointByColumnIdx(idx: number, rt: IRichText) {\n const cache = rt.getFrameCache();\n const { lineInfo, columnInfo } = this.getColumnByIndex(cache, idx);\n let y1 = lineInfo.top;\n let y2 = lineInfo.top + lineInfo.height;\n const x = columnInfo.left + columnInfo.width;\n y1 += 2;\n y2 -= 2;\n\n return { x, y1, y2 };\n }\n\n protected getColumnIndex(cache: IRichTextFrame, cInfo: IRichTextParagraph | IRichTextIcon) {\n // TODO 认为都是单个字符拆分的\n let inputIndex = -1;\n for (let i = 0; i < cache.lines.length; i++) {\n const line = cache.lines[i];\n for (let j = 0; j < line.paragraphs.length; j++) {\n inputIndex++;\n if (cInfo === line.paragraphs[j]) {\n return inputIndex;\n }\n }\n }\n return -1;\n }\n protected getColumnByIndex(\n cache: IRichTextFrame,\n index: number\n ): {\n lineInfo: IRichTextLine;\n columnInfo: IRichTextParagraph | IRichTextIcon;\n } | null {\n // TODO 认为都是单个字符拆分的\n let inputIndex = -1;\n for (let i = 0; i < cache.lines.length; i++) {\n const lineInfo = cache.lines[i];\n for (let j = 0; j < lineInfo.paragraphs.length; j++) {\n const columnInfo = lineInfo.paragraphs[j];\n inputIndex++;\n if (inputIndex === index) {\n return {\n lineInfo,\n columnInfo\n };\n }\n }\n }\n return null;\n }\n\n protected setCursorAndTextArea(x: number, y1: number, y2: number, rt: IRichText) {\n this.editLine.setAttributes({\n points: [\n { x, y: y1 },\n { x, y: y2 }\n ]\n });\n const out = { x: 0, y: 0 };\n rt.globalTransMatrix.getInverse().transformPoint({ x, y: y1 }, out);\n // TODO 考虑stage变换\n const { left, top } = this.pluginService.stage.window.getBoundingClientRect();\n out.x += left;\n out.y += top;\n\n this.editModule.moveTo(out.x, out.y, rt, this.curCursorIdx, this.selectionStartCursorIdx);\n }\n protected setCursor(x: number, y1: number, y2: number) {\n this.editLine.setAttributes({\n points: [\n { x, y: y1 },\n { x, y: y2 }\n ]\n });\n }\n\n applyUpdate() {\n this.pluginService.stage.renderNextFrame();\n }\n deFocus(e: PointerEvent) {\n const target = e.target as IRichText;\n target.detachShadow();\n if (this.editLine) {\n this.editLine.parent.removeChild(this.editLine);\n this.editLine.release();\n this.editLine = null;\n\n this.editBg.parent.removeChild(this.editBg);\n this.editBg.release();\n this.editBg = null;\n }\n }\n\n splitText(text: string) {\n // 😁这种emoji长度算两个,所以得处理一下\n return Array.from(text);\n }\n\n tryUpdateRichtext(richtext: IRichText) {\n const cache = richtext.getFrameCache();\n if (\n !cache.lines.every(line =>\n line.paragraphs.every(item => !(item.text && isString(item.text) && this.splitText(item.text).length > 1))\n )\n ) {\n const tc: IRichTextCharacter[] = [];\n richtext.attribute.textConfig.forEach((item: IRichTextParagraphCharacter) => {\n const textList = this.splitText(item.text.toString());\n if (isString(item.text) && textList.length > 1) {\n // 拆分\n for (let i = 0; i < textList.length; i++) {\n const t = textList[i];\n tc.push({ ...item, text: t });\n }\n } else {\n tc.push(item);\n }\n });\n richtext.doUpdateFrameCache(tc);\n }\n }\n\n onSelect() {\n return;\n }\n\n deactivate(context: IPluginService): void {\n // context.stage.off('pointerdown', this.handleClick);\n context.stage.off('pointermove', this.handleMove);\n context.stage.off('pointerdown', this.handlePointerDown);\n context.stage.off('pointerup', this.handlePointerUp);\n context.stage.off('pointerleave', this.handlePointerUp);\n }\n\n release() {\n this.editModule.release();\n }\n}\n"]}