@fileverse-dev/fortune-core 1.0.26 → 2.0.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 (346) hide show
  1. package/dist/index.esm.js +80254 -0
  2. package/dist/index.js +80600 -0
  3. package/{es → dist/packages/core/src}/api/cell.d.ts +10 -10
  4. package/{lib → dist/packages/core/src}/api/common.d.ts +66 -71
  5. package/{es → dist/packages/core/src}/api/errors.d.ts +2 -2
  6. package/{es → dist/packages/core/src}/api/index.d.ts +9 -9
  7. package/{es → dist/packages/core/src}/api/merge.d.ts +5 -5
  8. package/{lib → dist/packages/core/src}/api/range.d.ts +22 -22
  9. package/{lib → dist/packages/core/src}/api/rowcol.d.ts +14 -14
  10. package/{lib → dist/packages/core/src}/api/sheet.d.ts +10 -10
  11. package/{lib → dist/packages/core/src}/api/workbook.d.ts +15 -15
  12. package/{lib → dist/packages/core/src}/canvas.d.ts +46 -46
  13. package/{es → dist/packages/core/src}/context.d.ts +197 -198
  14. package/{es → dist/packages/core/src}/events/copy.d.ts +2 -2
  15. package/{lib → dist/packages/core/src}/events/index.d.ts +4 -4
  16. package/{lib → dist/packages/core/src}/events/keyboard.d.ts +6 -6
  17. package/{es → dist/packages/core/src}/events/mouse.d.ts +22 -22
  18. package/{es → dist/packages/core/src}/events/paste.d.ts +3 -3
  19. package/{lib → dist/packages/core/src}/index.d.ts +10 -10
  20. package/{lib → dist/packages/core/src}/locale/en.d.ts +992 -992
  21. package/{lib → dist/packages/core/src}/locale/es.d.ts +1134 -1134
  22. package/{lib → dist/packages/core/src}/locale/hi.d.ts +1030 -1030
  23. package/{lib → dist/packages/core/src}/locale/index.d.ts +1049 -1049
  24. package/{es → dist/packages/core/src}/locale/zh.d.ts +1048 -1048
  25. package/{lib → dist/packages/core/src}/locale/zh_tw.d.ts +1187 -1187
  26. package/{lib → dist/packages/core/src}/modules/ConditionFormat.d.ts +17 -17
  27. package/{lib → dist/packages/core/src}/modules/border.d.ts +3 -3
  28. package/{lib → dist/packages/core/src}/modules/cell.d.ts +32 -32
  29. package/{es → dist/packages/core/src}/modules/clipboard.d.ts +3 -3
  30. package/{es → dist/packages/core/src}/modules/color.d.ts +1 -1
  31. package/{lib → dist/packages/core/src}/modules/comment.d.ts +97 -97
  32. package/{es → dist/packages/core/src}/modules/conditionalFormat.d.ts +2 -2
  33. package/{es → dist/packages/core/src}/modules/cursor.d.ts +3 -3
  34. package/{es → dist/packages/core/src}/modules/dataVerification.d.ts +11 -11
  35. package/{es → dist/packages/core/src}/modules/dropCell.d.ts +10 -10
  36. package/{lib → dist/packages/core/src}/modules/filter.d.ts +45 -45
  37. package/{es → dist/packages/core/src}/modules/format.d.ts +6 -6
  38. package/{lib → dist/packages/core/src}/modules/formula.d.ts +54 -54
  39. package/{es → dist/packages/core/src}/modules/freeze.d.ts +5 -5
  40. package/{es → dist/packages/core/src}/modules/hyperlink.d.ts +21 -21
  41. package/{lib → dist/packages/core/src}/modules/iframe.d.ts +12 -12
  42. package/{es → dist/packages/core/src}/modules/image.d.ts +31 -31
  43. package/{es → dist/packages/core/src}/modules/index.d.ts +36 -36
  44. package/{lib → dist/packages/core/src}/modules/inline-string.d.ts +36 -36
  45. package/{es → dist/packages/core/src}/modules/location.d.ts +6 -6
  46. package/{es → dist/packages/core/src}/modules/locationCondition.d.ts +21 -21
  47. package/{es → dist/packages/core/src}/modules/merge.d.ts +3 -3
  48. package/{es → dist/packages/core/src}/modules/mobile.d.ts +5 -5
  49. package/{lib → dist/packages/core/src}/modules/moveCells.d.ts +5 -5
  50. package/{lib → dist/packages/core/src}/modules/protection.d.ts +5 -5
  51. package/{lib → dist/packages/core/src}/modules/refresh.d.ts +3 -3
  52. package/{es → dist/packages/core/src}/modules/rowcol.d.ts +19 -19
  53. package/{lib → dist/packages/core/src}/modules/screenshot.d.ts +2 -2
  54. package/{es → dist/packages/core/src}/modules/searchReplace.d.ts +36 -36
  55. package/{lib → dist/packages/core/src}/modules/selection.d.ts +46 -46
  56. package/{es → dist/packages/core/src}/modules/sheet.d.ts +10 -10
  57. package/{es → dist/packages/core/src}/modules/sort.d.ts +7 -7
  58. package/{es → dist/packages/core/src}/modules/splitColumn.d.ts +5 -5
  59. package/{es → dist/packages/core/src}/modules/text.d.ts +10 -10
  60. package/{lib → dist/packages/core/src}/modules/toolbar.d.ts +32 -32
  61. package/{es → dist/packages/core/src}/modules/validation.d.ts +19 -19
  62. package/{es → dist/packages/core/src}/modules/zoom.d.ts +3 -3
  63. package/{es → dist/packages/core/src}/settings.d.ts +100 -100
  64. package/{es → dist/packages/core/src}/types.d.ts +371 -376
  65. package/{es → dist/packages/core/src}/utils/freeze.d.ts +7 -7
  66. package/{es → dist/packages/core/src}/utils/index.d.ts +18 -19
  67. package/{lib → dist/packages/core/src}/utils/patch.d.ts +37 -37
  68. package/dist/packages/react/src/components/ChangeColor/index.d.ts +7 -0
  69. package/dist/packages/react/src/components/ConditionFormat/ConditionRules.d.ts +6 -0
  70. package/dist/packages/react/src/components/ConditionFormat/index.d.ts +7 -0
  71. package/dist/packages/react/src/components/ContextMenu/Divider.d.ts +3 -0
  72. package/dist/packages/react/src/components/ContextMenu/FilterMenu.d.ts +3 -0
  73. package/dist/packages/react/src/components/ContextMenu/Menu.d.ts +8 -0
  74. package/dist/packages/react/src/components/ContextMenu/SheetTab.d.ts +4 -0
  75. package/dist/packages/react/src/components/ContextMenu/index.d.ts +5 -0
  76. package/dist/packages/react/src/components/CustomSort/index.d.ts +4 -0
  77. package/dist/packages/react/src/components/DataVerification/DropdownList.d.ts +4 -0
  78. package/dist/packages/react/src/components/DataVerification/RangeDialog.d.ts +4 -0
  79. package/dist/packages/react/src/components/DataVerification/getDisplayedRangeTxt.d.ts +2 -0
  80. package/dist/packages/react/src/components/DataVerification/index.d.ts +4 -0
  81. package/dist/packages/react/src/components/Dialog/index.d.ts +15 -0
  82. package/dist/packages/react/src/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +11 -0
  83. package/dist/packages/react/src/components/DunePreview/DunePreview.d.ts +13 -0
  84. package/dist/packages/react/src/components/FilterOption/index.d.ts +5 -0
  85. package/dist/packages/react/src/components/FormatSearch/index.d.ts +6 -0
  86. package/dist/packages/react/src/components/FormulaSearch/index.d.ts +5 -0
  87. package/dist/packages/react/src/components/FxEditor/NameBox.d.ts +3 -0
  88. package/dist/packages/react/src/components/FxEditor/index.d.ts +4 -0
  89. package/dist/packages/react/src/components/IFrameBoxs/iFrameBoxs.d.ts +4 -0
  90. package/dist/packages/react/src/components/ImgBoxs/index.d.ts +3 -0
  91. package/dist/packages/react/src/components/LinkEidtCard/index.d.ts +5 -0
  92. package/dist/packages/react/src/components/LocationCondition/index.d.ts +3 -0
  93. package/dist/packages/react/src/components/MessageBox/index.d.ts +9 -0
  94. package/dist/packages/react/src/components/NotationBoxes/index.d.ts +3 -0
  95. package/dist/packages/react/src/components/ResetColumnWidth/index.d.ts +2 -0
  96. package/dist/packages/react/src/components/SVGDefines.d.ts +5 -0
  97. package/dist/packages/react/src/components/SVGIcon.d.ts +9 -0
  98. package/dist/packages/react/src/components/SearchReplace/index.d.ts +6 -0
  99. package/dist/packages/react/src/components/Sheet/index.d.ts +8 -0
  100. package/dist/packages/react/src/components/SheetList/SheetHiddenButton.d.ts +8 -0
  101. package/dist/packages/react/src/components/SheetList/SheetListItem.d.ts +9 -0
  102. package/dist/packages/react/src/components/SheetList/index.d.ts +4 -0
  103. package/dist/packages/react/src/components/SheetOverlay/ColumnHeader.d.ts +3 -0
  104. package/dist/packages/react/src/components/SheetOverlay/ContentEditable.d.ts +11 -0
  105. package/dist/packages/react/src/components/SheetOverlay/FormulaHint/index.d.ts +4 -0
  106. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/constant.d.ts +63 -0
  107. package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/index.d.ts +4 -0
  108. package/dist/packages/react/src/components/SheetOverlay/InputBox.d.ts +3 -0
  109. package/dist/packages/react/src/components/SheetOverlay/RowHeader.d.ts +3 -0
  110. package/dist/packages/react/src/components/SheetOverlay/ScrollBar/index.d.ts +7 -0
  111. package/dist/packages/react/src/components/SheetOverlay/index.d.ts +4 -0
  112. package/dist/packages/react/src/components/SheetTab/SheetItem.d.ts +8 -0
  113. package/dist/packages/react/src/components/SheetTab/index.d.ts +4 -0
  114. package/dist/packages/react/src/components/SplitColumn/index.d.ts +3 -0
  115. package/dist/packages/react/src/components/Toolbar/Button.d.ts +12 -0
  116. package/dist/packages/react/src/components/Toolbar/ColorPicker.d.ts +6 -0
  117. package/dist/packages/react/src/components/Toolbar/Combo.d.ts +12 -0
  118. package/dist/packages/react/src/components/Toolbar/CustomBorder.d.ts +7 -0
  119. package/dist/packages/react/src/components/Toolbar/CustomButton.d.ts +11 -0
  120. package/dist/packages/react/src/components/Toolbar/CustomColor.d.ts +8 -0
  121. package/dist/packages/react/src/components/Toolbar/CustomIcon.d.ts +9 -0
  122. package/dist/packages/react/src/components/Toolbar/Divider.d.ts +4 -0
  123. package/dist/packages/react/src/components/Toolbar/MoreItemsContainer.d.ts +6 -0
  124. package/dist/packages/react/src/components/Toolbar/Select.d.ts +14 -0
  125. package/dist/packages/react/src/components/Toolbar/index.d.ts +10 -0
  126. package/dist/packages/react/src/components/Workbook/api.d.ts +1177 -0
  127. package/dist/packages/react/src/components/Workbook/index.d.ts +1185 -0
  128. package/dist/packages/react/src/components/ZoomControl/index.d.ts +4 -0
  129. package/dist/packages/react/src/components/index.d.ts +4 -0
  130. package/dist/packages/react/src/constants.d.ts +1 -0
  131. package/dist/packages/react/src/context/index.d.ts +25 -0
  132. package/dist/packages/react/src/context/modal.d.ts +10 -0
  133. package/dist/packages/react/src/hooks/useAlert.d.ts +4 -0
  134. package/dist/packages/react/src/hooks/useDialog.d.ts +5 -0
  135. package/dist/packages/react/src/hooks/useOutsideClick.d.ts +2 -0
  136. package/dist/packages/react/src/hooks/usePrevious.d.ts +2 -0
  137. package/dist/packages/react/src/index.d.ts +1 -0
  138. package/dist/packages/react/src/utils/datepickerStyles.d.ts +2 -0
  139. package/dist/stories/API.stories.d.ts +1210 -0
  140. package/dist/stories/Collabration.stories.d.ts +2359 -0
  141. package/dist/stories/Features.stories.d.ts +9430 -0
  142. package/dist/stories/data/cell.d.ts +983 -0
  143. package/dist/stories/data/dataVerification.d.ts +131 -0
  144. package/dist/stories/data/empty.d.ts +10 -0
  145. package/dist/stories/data/formula.d.ts +362 -0
  146. package/dist/stories/data/freeze.d.ts +34 -0
  147. package/dist/stories/data/protected.d.ts +40 -0
  148. package/dist/stories/utils.d.ts +1 -0
  149. package/package.json +6 -7
  150. package/es/api/cell.js +0 -204
  151. package/es/api/common.d.ts +0 -71
  152. package/es/api/common.js +0 -79
  153. package/es/api/errors.js +0 -2
  154. package/es/api/index.js +0 -8
  155. package/es/api/merge.js +0 -15
  156. package/es/api/range.d.ts +0 -22
  157. package/es/api/range.js +0 -123
  158. package/es/api/rowcol.d.ts +0 -14
  159. package/es/api/rowcol.js +0 -207
  160. package/es/api/sheet.d.ts +0 -10
  161. package/es/api/sheet.js +0 -128
  162. package/es/api/workbook.d.ts +0 -15
  163. package/es/api/workbook.js +0 -85
  164. package/es/canvas.d.ts +0 -46
  165. package/es/canvas.js +0 -1350
  166. package/es/context.js +0 -381
  167. package/es/events/copy.js +0 -78
  168. package/es/events/index.d.ts +0 -4
  169. package/es/events/index.js +0 -4
  170. package/es/events/keyboard.d.ts +0 -6
  171. package/es/events/keyboard.js +0 -332
  172. package/es/events/mouse.js +0 -1725
  173. package/es/events/paste.js +0 -1378
  174. package/es/index.d.ts +0 -10
  175. package/es/index.js +0 -10
  176. package/es/locale/en.d.ts +0 -992
  177. package/es/locale/en.js +0 -10564
  178. package/es/locale/es.d.ts +0 -1134
  179. package/es/locale/es.js +0 -10010
  180. package/es/locale/hi.d.ts +0 -1030
  181. package/es/locale/hi.js +0 -10550
  182. package/es/locale/index.d.ts +0 -1049
  183. package/es/locale/index.js +0 -23
  184. package/es/locale/zh.js +0 -10568
  185. package/es/locale/zh_tw.d.ts +0 -1187
  186. package/es/locale/zh_tw.js +0 -10072
  187. package/es/modules/ConditionFormat.d.ts +0 -17
  188. package/es/modules/ConditionFormat.js +0 -1258
  189. package/es/modules/border.d.ts +0 -3
  190. package/es/modules/border.js +0 -1240
  191. package/es/modules/cell.d.ts +0 -32
  192. package/es/modules/cell.js +0 -1055
  193. package/es/modules/clipboard.js +0 -36
  194. package/es/modules/color.js +0 -1
  195. package/es/modules/comment.d.ts +0 -97
  196. package/es/modules/comment.js +0 -597
  197. package/es/modules/conditionalFormat.js +0 -441
  198. package/es/modules/cursor.js +0 -62
  199. package/es/modules/dataVerification.js +0 -701
  200. package/es/modules/dropCell.js +0 -2267
  201. package/es/modules/filter.d.ts +0 -45
  202. package/es/modules/filter.js +0 -434
  203. package/es/modules/format.js +0 -323
  204. package/es/modules/formula.d.ts +0 -54
  205. package/es/modules/formula.js +0 -2301
  206. package/es/modules/freeze.js +0 -148
  207. package/es/modules/hyperlink.js +0 -216
  208. package/es/modules/iframe.d.ts +0 -12
  209. package/es/modules/iframe.js +0 -220
  210. package/es/modules/image.js +0 -253
  211. package/es/modules/index.js +0 -36
  212. package/es/modules/inline-string.d.ts +0 -36
  213. package/es/modules/inline-string.js +0 -437
  214. package/es/modules/location.js +0 -46
  215. package/es/modules/locationCondition.js +0 -218
  216. package/es/modules/merge.js +0 -216
  217. package/es/modules/mobile.js +0 -33
  218. package/es/modules/moveCells.d.ts +0 -5
  219. package/es/modules/moveCells.js +0 -348
  220. package/es/modules/protection.d.ts +0 -5
  221. package/es/modules/protection.js +0 -96
  222. package/es/modules/refresh.d.ts +0 -3
  223. package/es/modules/refresh.js +0 -34
  224. package/es/modules/rowcol.js +0 -1922
  225. package/es/modules/screenshot.d.ts +0 -2
  226. package/es/modules/screenshot.js +0 -90
  227. package/es/modules/searchReplace.js +0 -388
  228. package/es/modules/selection.d.ts +0 -46
  229. package/es/modules/selection.js +0 -1674
  230. package/es/modules/sheet.js +0 -237
  231. package/es/modules/sort.js +0 -134
  232. package/es/modules/splitColumn.js +0 -126
  233. package/es/modules/ssf.js +0 -1533
  234. package/es/modules/text.js +0 -1207
  235. package/es/modules/toolbar.d.ts +0 -32
  236. package/es/modules/toolbar.js +0 -970
  237. package/es/modules/validation.js +0 -190
  238. package/es/modules/zoom.js +0 -29
  239. package/es/settings.js +0 -36
  240. package/es/types.js +0 -1
  241. package/es/utils/freeze.js +0 -86
  242. package/es/utils/index.js +0 -198
  243. package/es/utils/patch.d.ts +0 -37
  244. package/es/utils/patch.js +0 -381
  245. package/lib/api/cell.d.ts +0 -10
  246. package/lib/api/cell.js +0 -215
  247. package/lib/api/common.js +0 -88
  248. package/lib/api/errors.d.ts +0 -2
  249. package/lib/api/errors.js +0 -8
  250. package/lib/api/index.d.ts +0 -9
  251. package/lib/api/index.js +0 -101
  252. package/lib/api/merge.d.ts +0 -5
  253. package/lib/api/merge.js +0 -22
  254. package/lib/api/range.js +0 -138
  255. package/lib/api/rowcol.js +0 -222
  256. package/lib/api/sheet.js +0 -145
  257. package/lib/api/workbook.js +0 -98
  258. package/lib/canvas.js +0 -1356
  259. package/lib/context.d.ts +0 -198
  260. package/lib/context.js +0 -393
  261. package/lib/events/copy.d.ts +0 -2
  262. package/lib/events/copy.js +0 -85
  263. package/lib/events/index.js +0 -49
  264. package/lib/events/keyboard.js +0 -342
  265. package/lib/events/mouse.d.ts +0 -22
  266. package/lib/events/mouse.js +0 -1744
  267. package/lib/events/paste.d.ts +0 -3
  268. package/lib/events/paste.js +0 -1386
  269. package/lib/index.js +0 -109
  270. package/lib/locale/en.js +0 -10570
  271. package/lib/locale/es.js +0 -10016
  272. package/lib/locale/hi.js +0 -10556
  273. package/lib/locale/index.js +0 -29
  274. package/lib/locale/zh.d.ts +0 -1048
  275. package/lib/locale/zh.js +0 -10574
  276. package/lib/locale/zh_tw.js +0 -10078
  277. package/lib/modules/ConditionFormat.js +0 -1273
  278. package/lib/modules/border.js +0 -1248
  279. package/lib/modules/cell.js +0 -1085
  280. package/lib/modules/clipboard.d.ts +0 -3
  281. package/lib/modules/clipboard.js +0 -42
  282. package/lib/modules/color.d.ts +0 -1
  283. package/lib/modules/color.js +0 -7
  284. package/lib/modules/comment.js +0 -625
  285. package/lib/modules/conditionalFormat.d.ts +0 -2
  286. package/lib/modules/conditionalFormat.js +0 -447
  287. package/lib/modules/cursor.d.ts +0 -3
  288. package/lib/modules/cursor.js +0 -70
  289. package/lib/modules/dataVerification.d.ts +0 -11
  290. package/lib/modules/dataVerification.js +0 -716
  291. package/lib/modules/dropCell.d.ts +0 -10
  292. package/lib/modules/dropCell.js +0 -2283
  293. package/lib/modules/filter.js +0 -448
  294. package/lib/modules/format.d.ts +0 -6
  295. package/lib/modules/format.js +0 -334
  296. package/lib/modules/formula.js +0 -2330
  297. package/lib/modules/freeze.d.ts +0 -5
  298. package/lib/modules/freeze.js +0 -158
  299. package/lib/modules/hyperlink.d.ts +0 -21
  300. package/lib/modules/hyperlink.js +0 -232
  301. package/lib/modules/iframe.js +0 -236
  302. package/lib/modules/image.d.ts +0 -31
  303. package/lib/modules/image.js +0 -272
  304. package/lib/modules/index.d.ts +0 -36
  305. package/lib/modules/index.js +0 -401
  306. package/lib/modules/inline-string.js +0 -452
  307. package/lib/modules/location.d.ts +0 -6
  308. package/lib/modules/location.js +0 -57
  309. package/lib/modules/locationCondition.d.ts +0 -21
  310. package/lib/modules/locationCondition.js +0 -229
  311. package/lib/modules/merge.d.ts +0 -3
  312. package/lib/modules/merge.js +0 -223
  313. package/lib/modules/mobile.d.ts +0 -5
  314. package/lib/modules/mobile.js +0 -41
  315. package/lib/modules/moveCells.js +0 -357
  316. package/lib/modules/protection.js +0 -106
  317. package/lib/modules/refresh.js +0 -40
  318. package/lib/modules/rowcol.d.ts +0 -19
  319. package/lib/modules/rowcol.js +0 -1935
  320. package/lib/modules/screenshot.js +0 -96
  321. package/lib/modules/searchReplace.d.ts +0 -36
  322. package/lib/modules/searchReplace.js +0 -402
  323. package/lib/modules/selection.js +0 -1703
  324. package/lib/modules/sheet.d.ts +0 -10
  325. package/lib/modules/sheet.js +0 -250
  326. package/lib/modules/sort.d.ts +0 -7
  327. package/lib/modules/sort.js +0 -143
  328. package/lib/modules/splitColumn.d.ts +0 -5
  329. package/lib/modules/splitColumn.js +0 -136
  330. package/lib/modules/ssf.js +0 -1539
  331. package/lib/modules/text.d.ts +0 -10
  332. package/lib/modules/text.js +0 -1221
  333. package/lib/modules/toolbar.js +0 -1003
  334. package/lib/modules/validation.d.ts +0 -19
  335. package/lib/modules/validation.js +0 -205
  336. package/lib/modules/zoom.d.ts +0 -3
  337. package/lib/modules/zoom.js +0 -36
  338. package/lib/settings.d.ts +0 -100
  339. package/lib/settings.js +0 -42
  340. package/lib/types.d.ts +0 -376
  341. package/lib/types.js +0 -5
  342. package/lib/utils/freeze.d.ts +0 -7
  343. package/lib/utils/freeze.js +0 -92
  344. package/lib/utils/index.d.ts +0 -19
  345. package/lib/utils/index.js +0 -258
  346. package/lib/utils/patch.js +0 -392
@@ -1,1207 +0,0 @@
1
- import _ from "lodash";
2
- import { isdatatypemulti } from ".";
3
- import { locale } from "../locale";
4
- import { normalizedCellAttr } from "./cell";
5
- import { isInlineStringCell } from "./inline-string";
6
- function checkWordByteLength(value) {
7
- return Math.ceil(value.charCodeAt(0).toString(2).length / 8);
8
- }
9
- export function hasChinaword(s) {
10
- var patrn = /[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi;
11
- if (!patrn.exec(s)) {
12
- return false;
13
- }
14
- return true;
15
- }
16
- var textHeightCache = {};
17
- var measureTextCache = {};
18
- var measureTextCellInfoCache = {};
19
- export function clearMeasureTextCache() {
20
- measureTextCache = {};
21
- measureTextCellInfoCache = {};
22
- }
23
- function getTextSize(text, font) {
24
- if (font in textHeightCache) {
25
- return textHeightCache[font];
26
- }
27
- var ele = document.createElement("span");
28
- ele.style.float = "left";
29
- ele.style.whiteSpace = "nowrap";
30
- ele.style.visibility = "hidden";
31
- ele.style.margin = "0";
32
- ele.style.padding = "0";
33
- ele.innerHTML = text;
34
- document.body.append(ele);
35
- var w = Math.max(ele.scrollWidth, ele.offsetWidth, ele.clientWidth);
36
- var h = Math.max(ele.scrollHeight, ele.offsetHeight, ele.clientHeight);
37
- textHeightCache[font] = [w, h];
38
- ele.remove();
39
- return [w, h];
40
- }
41
- export function defaultFont(defaultFontSize) {
42
- return "normal normal normal ".concat(defaultFontSize, "pt \"Helvetica Neue\", Helvetica, Arial, \"PingFang SC\", \"Hiragino Sans GB\", \"Heiti SC\", \"WenQuanYi Micro Hei\", sans-serif");
43
- }
44
- export function getFontSet(format, defaultFontSize, ctx) {
45
- if (_.isPlainObject(format)) {
46
- var fontAttr = [];
47
- if (format.it === "0" || format.it === 0 || _.isNil(format.it)) {
48
- fontAttr.push("normal");
49
- } else {
50
- fontAttr.push("italic");
51
- }
52
- fontAttr.push("normal");
53
- if (format.bl === "0" || format.bl === 0 || _.isNil(format.bl)) {
54
- fontAttr.push("normal");
55
- } else {
56
- fontAttr.push("bold");
57
- }
58
- if (!format.fs) {
59
- fontAttr.push("".concat(defaultFontSize, "pt"));
60
- } else {
61
- fontAttr.push("".concat(Math.ceil(format.fs), "pt"));
62
- }
63
- var fontSet = "\"Helvetica Neue\", Helvetica, Arial, \"PingFang SC\", \"Hiragino Sans GB\", \"Heiti SC\", \"Microsoft YaHei\", \"WenQuanYi Micro Hei\", sans-serif";
64
- if (ctx) {
65
- var fontarray = locale(ctx).fontarray;
66
- if (!format.ff) {
67
- fontSet = "".concat(fontarray[0], ",").concat(fontSet);
68
- } else {
69
- var fontfamily = null;
70
- if (ctx) {
71
- if (isdatatypemulti(format.ff).num) {
72
- fontfamily = fontarray[parseInt(format.ff, 10)];
73
- } else {
74
- fontfamily = format.ff;
75
- fontfamily = fontfamily.replace(/"/g, "").replace(/'/g, "");
76
- if (fontfamily.indexOf(" ") > -1) {
77
- fontfamily = "\"".concat(fontfamily, "\"");
78
- }
79
- }
80
- }
81
- fontSet = "".concat(fontfamily, ",").concat(fontSet);
82
- }
83
- }
84
- return "".concat(fontAttr.join(" "), " ").concat(fontSet);
85
- }
86
- return defaultFont(defaultFontSize);
87
- }
88
- export function getMeasureText(value, renderCtx, sheetCtx, fontset) {
89
- var mtc = measureTextCache["".concat(value, "_").concat(renderCtx.font)];
90
- if (fontset) {
91
- mtc = measureTextCache["".concat(value, "_").concat(fontset)];
92
- }
93
- if (mtc != null) {
94
- return mtc;
95
- }
96
- if (fontset) {
97
- renderCtx.font = fontset;
98
- }
99
- var measureText = renderCtx.measureText(value);
100
- var cache = {};
101
- cache.width = measureText.width;
102
- if (fontset) {
103
- renderCtx.font = fontset;
104
- }
105
- cache.actualBoundingBoxDescent = measureText.actualBoundingBoxDescent;
106
- cache.actualBoundingBoxAscent = measureText.actualBoundingBoxAscent;
107
- if (cache.actualBoundingBoxDescent == null || cache.actualBoundingBoxAscent == null || Number.isNaN(cache.actualBoundingBoxDescent) || Number.isNaN(cache.actualBoundingBoxAscent)) {
108
- var commonWord = "M";
109
- if (hasChinaword(value)) {
110
- commonWord = "田";
111
- }
112
- var oneLineTextHeight = getTextSize(commonWord, renderCtx.font)[1] * 0.8;
113
- if (renderCtx.textBaseline === "top") {
114
- cache.actualBoundingBoxDescent = oneLineTextHeight;
115
- cache.actualBoundingBoxAscent = 0;
116
- } else if (renderCtx.textBaseline === "middle") {
117
- cache.actualBoundingBoxDescent = oneLineTextHeight / 2;
118
- cache.actualBoundingBoxAscent = oneLineTextHeight / 2;
119
- } else {
120
- cache.actualBoundingBoxDescent = 0;
121
- cache.actualBoundingBoxAscent = oneLineTextHeight;
122
- }
123
- }
124
- if (renderCtx.textBaseline === "alphabetic") {
125
- var descText = "gjpqy";
126
- var matchText = "abcdABCD";
127
- var descTextMeasure = measureTextCache["".concat(descText, "_").concat(renderCtx.font)];
128
- if (fontset) {
129
- descTextMeasure = measureTextCache["".concat(descText, "_").concat(fontset)];
130
- }
131
- var matchTextMeasure = measureTextCache["".concat(matchText, "_").concat(renderCtx.font)];
132
- if (fontset) {
133
- matchTextMeasure = measureTextCache["".concat(matchText, "_").concat(fontset)];
134
- }
135
- if (descTextMeasure == null) {
136
- descTextMeasure = renderCtx.measureText(descText);
137
- }
138
- if (matchTextMeasure == null) {
139
- matchTextMeasure = renderCtx.measureText(matchText);
140
- }
141
- if (cache.actualBoundingBoxDescent <= matchTextMeasure.actualBoundingBoxDescent) {
142
- cache.actualBoundingBoxDescent = descTextMeasure.actualBoundingBoxDescent;
143
- if (!cache.actualBoundingBoxDescent) {
144
- cache.actualBoundingBoxDescent = 0;
145
- }
146
- }
147
- }
148
- cache.width *= sheetCtx.zoomRatio;
149
- cache.actualBoundingBoxDescent *= sheetCtx.zoomRatio;
150
- cache.actualBoundingBoxAscent *= sheetCtx.zoomRatio;
151
- measureTextCache["".concat(value, "_").concat(sheetCtx.zoomRatio, "_").concat(renderCtx.font)] = cache;
152
- return cache;
153
- }
154
- export function isSupportBoundingBox(ctx) {
155
- var measureText = ctx.measureText("田");
156
- if (_.isNil(measureText.actualBoundingBoxAscent)) {
157
- return false;
158
- }
159
- return true;
160
- }
161
- export function drawLineInfo(wordGroup, cancelLine, underLine, option) {
162
- var left = option.left;
163
- var top = option.top;
164
- var width = option.width;
165
- var asc = option.asc;
166
- var desc = option.desc;
167
- var fs = option.fs;
168
- if (wordGroup.wrap === true) {
169
- return;
170
- }
171
- if (wordGroup.inline === true && !_.isNil(wordGroup.style)) {
172
- cancelLine = wordGroup.style.cl;
173
- underLine = wordGroup.style.un;
174
- }
175
- if (Number(cancelLine) !== 0) {
176
- wordGroup.cancelLine = {};
177
- wordGroup.cancelLine.startX = left;
178
- wordGroup.cancelLine.startY = top - asc / 2 + 1;
179
- wordGroup.cancelLine.endX = left + width;
180
- wordGroup.cancelLine.endY = top - asc / 2 + 1;
181
- wordGroup.cancelLine.fs = fs;
182
- }
183
- var nUnderline = Number(underLine);
184
- if (nUnderline !== 0) {
185
- wordGroup.underLine = [];
186
- if (nUnderline === 1 || nUnderline === 2) {
187
- var item = {};
188
- item.startX = left;
189
- item.startY = top + 3;
190
- item.endX = left + width;
191
- item.endY = top + 3;
192
- item.fs = fs;
193
- wordGroup.underLine.push(item);
194
- }
195
- if (nUnderline === 2) {
196
- var item = {};
197
- item.startX = left;
198
- item.startY = top + desc;
199
- item.endX = left + width;
200
- item.endY = top + desc;
201
- item.fs = fs;
202
- wordGroup.underLine.push(item);
203
- }
204
- if (nUnderline === 3 || nUnderline === 4) {
205
- var item = {};
206
- item.startX = left;
207
- item.startY = top + desc;
208
- item.endX = left + width;
209
- item.endY = top + desc;
210
- item.fs = fs;
211
- wordGroup.underLine.push(item);
212
- }
213
- if (nUnderline === 4) {
214
- var item = {};
215
- item.startX = left;
216
- item.startY = top + desc + 2;
217
- item.endX = left + width;
218
- item.endY = top + desc + 2;
219
- item.fs = fs;
220
- wordGroup.underLine.push(item);
221
- }
222
- }
223
- }
224
- export function getCellTextInfo(cell, renderCtx, sheetCtx, option, ctx) {
225
- var cellWidth = option.cellWidth;
226
- var cellHeight = option.cellHeight;
227
- var isMode = "";
228
- var isModeSplit = "";
229
- if (cellWidth == null) {
230
- isMode = "onlyWidth";
231
- isModeSplit = "_";
232
- }
233
- var textInfo = measureTextCellInfoCache["".concat(option.r, "_").concat(option.c).concat(isModeSplit).concat(isMode)];
234
- if (textInfo) {
235
- return textInfo;
236
- }
237
- var space_width = option.space_width;
238
- var space_height = option.space_height;
239
- if (space_width === undefined) {
240
- space_width = 2;
241
- }
242
- if (space_height === undefined) {
243
- space_height = 2;
244
- }
245
- var horizonAlign = normalizedCellAttr(cell, "ht");
246
- var verticalAlign = normalizedCellAttr(cell, "vt");
247
- var tb = normalizedCellAttr(cell, "tb");
248
- var tr = normalizedCellAttr(cell, "tr");
249
- var rt = normalizedCellAttr(cell, "rt");
250
- var isRotateUp = 1;
251
- if (_.isNil(rt)) {
252
- if (tr === "0") {
253
- rt = 0;
254
- } else if (tr === "1") {
255
- rt = 45;
256
- } else if (tr === "4") {
257
- rt = 90;
258
- } else if (tr === "2") {
259
- rt = 135;
260
- } else if (tr === "5") {
261
- rt = 180;
262
- }
263
- if (_.isNil(rt)) {
264
- rt = 0;
265
- }
266
- }
267
- if (rt > 180 || rt < 0) {
268
- rt = 0;
269
- }
270
- rt = parseInt(rt, 10);
271
- if (rt > 90) {
272
- rt = 90 - rt;
273
- isRotateUp = 0;
274
- }
275
- renderCtx.textAlign = "start";
276
- var textContent = {};
277
- textContent.values = [];
278
- var fontset;
279
- var cancelLine = "0";
280
- var underLine = "0";
281
- var fontSize = 11;
282
- var isInline = false;
283
- var value;
284
- var inlineStringArr = [];
285
- if (isInlineStringCell(cell)) {
286
- var sharedStrings = cell.ct.s;
287
- var similarIndex = 0;
288
- for (var i = 0; i < sharedStrings.length; i += 1) {
289
- var shareCell = sharedStrings[i];
290
- var scfontset = getFontSet(shareCell, sheetCtx.defaultFontSize, ctx);
291
- var fc = shareCell.fc;
292
- var cl = shareCell.cl;
293
- var un = shareCell.un;
294
- var v = shareCell.v;
295
- var fs = shareCell.fs;
296
- v = v.replace(/\r\n/g, "_x000D_").replace(/&#13;&#10;/g, "_x000D_").replace(/\r/g, "_x000D_").replace(/\n/g, "_x000D_");
297
- var splitArr = v.split("_x000D_");
298
- for (var x = 0; x < splitArr.length; x += 1) {
299
- var newValue = splitArr[x];
300
- if (newValue === "" && x !== splitArr.length - 1) {
301
- inlineStringArr.push({
302
- fontset: scfontset,
303
- fc: !fc ? "#000" : fc,
304
- cl: !cl ? 0 : cl,
305
- un: !un ? 0 : un,
306
- wrap: true,
307
- fs: !fs ? 11 : fs
308
- });
309
- similarIndex += 1;
310
- } else {
311
- inlineStringArr.push({
312
- fontset: scfontset,
313
- fc: !fc ? "#000" : fc,
314
- cl: !cl ? 0 : cl,
315
- un: !un ? 0 : un,
316
- v: newValue,
317
- si: similarIndex,
318
- fs: !fs ? 11 : fs
319
- });
320
- if (x !== splitArr.length - 1) {
321
- inlineStringArr.push({
322
- fontset: scfontset,
323
- fc: !fc ? "#000" : fc,
324
- cl: !cl ? 0 : cl,
325
- un: !un ? 0 : un,
326
- wrap: true,
327
- fs: !fs ? 11 : fs
328
- });
329
- similarIndex += 1;
330
- }
331
- }
332
- }
333
- similarIndex += 1;
334
- }
335
- isInline = true;
336
- } else {
337
- fontset = getFontSet(cell, sheetCtx.defaultFontSize, ctx);
338
- renderCtx.font = fontset;
339
- cancelLine = normalizedCellAttr(cell, "cl");
340
- underLine = normalizedCellAttr(cell, "un");
341
- fontSize = normalizedCellAttr(cell, "fs");
342
- if (cell instanceof Object) {
343
- value = cell.m;
344
- if (_.isNil(value)) {
345
- value = cell.v;
346
- }
347
- } else {
348
- value = cell;
349
- }
350
- if (_.isEmpty(value)) {
351
- return null;
352
- }
353
- }
354
- if (tr === "3") {
355
- renderCtx.textBaseline = "top";
356
- var textW_all = 0;
357
- var textH_all = 0;
358
- var colIndex = 0;
359
- var textH_all_cache = 0;
360
- var textH_all_Column = {};
361
- var textH_all_ColumnHeight = [];
362
- if (isInline) {
363
- var preShareCell = null;
364
- for (var i = 0; i < inlineStringArr.length; i += 1) {
365
- var shareCell = inlineStringArr[i];
366
- var value1 = shareCell.v;
367
- var showValue = shareCell.v;
368
- if (shareCell.wrap === true) {
369
- value1 = "M";
370
- showValue = "";
371
- if (!_.isNil(preShareCell) && preShareCell.wrap !== true && i < inlineStringArr.length - 1) {
372
- textH_all_ColumnHeight.push(textH_all_cache);
373
- textH_all_cache = 0;
374
- colIndex += 1;
375
- preShareCell = shareCell;
376
- continue;
377
- }
378
- }
379
- var measureText = getMeasureText(value1, renderCtx, sheetCtx, shareCell.fontset);
380
- var textW = measureText.width + space_width;
381
- var textH = measureText.actualBoundingBoxAscent + measureText.actualBoundingBoxDescent + space_height;
382
- textH_all_cache += textH;
383
- if (tb === "2" && !shareCell.wrap) {
384
- if (textH_all_cache > cellHeight && !_.isNil(textH_all_Column[colIndex])) {
385
- textH_all_ColumnHeight.push(textH_all_cache - textH);
386
- textH_all_cache = textH;
387
- colIndex += 1;
388
- }
389
- }
390
- if (i === inlineStringArr.length - 1) {
391
- textH_all_ColumnHeight.push(textH_all_cache);
392
- }
393
- if (_.isNil(textH_all_Column[colIndex])) {
394
- textH_all_Column[colIndex] = [];
395
- }
396
- var item = {
397
- content: showValue,
398
- style: shareCell,
399
- width: textW,
400
- height: textH,
401
- left: 0,
402
- top: 0,
403
- colIndex: colIndex,
404
- asc: measureText.actualBoundingBoxAscent,
405
- desc: measureText.actualBoundingBoxDescent,
406
- inline: true,
407
- wrap: false
408
- };
409
- if (shareCell.wrap === true) {
410
- item.wrap = true;
411
- }
412
- textH_all_Column[colIndex].push(item);
413
- preShareCell = shareCell;
414
- }
415
- } else {
416
- var measureText = getMeasureText(value, renderCtx, sheetCtx);
417
- var textHeight = measureText.actualBoundingBoxDescent + measureText.actualBoundingBoxAscent;
418
- value = value.toString();
419
- var vArr = [];
420
- if (value.length > 1) {
421
- vArr = value.split("");
422
- } else {
423
- vArr.push(value);
424
- }
425
- var oneWordWidth = getMeasureText(vArr[0], renderCtx, sheetCtx).width;
426
- for (var i = 0; i < vArr.length; i += 1) {
427
- var textW = oneWordWidth + space_width;
428
- var textH = textHeight + space_height;
429
- textH_all_cache += textH;
430
- if (tb === "2") {
431
- if (textH_all_cache > cellHeight && !_.isNil(textH_all_Column[colIndex])) {
432
- textH_all_ColumnHeight.push(textH_all_cache - textH);
433
- textH_all_cache = textH;
434
- colIndex += 1;
435
- }
436
- }
437
- if (i === vArr.length - 1) {
438
- textH_all_ColumnHeight.push(textH_all_cache);
439
- }
440
- if (_.isNil(textH_all_Column[colIndex])) {
441
- textH_all_Column[colIndex] = [];
442
- }
443
- textH_all_Column[colIndex].push({
444
- content: vArr[i],
445
- style: fontset,
446
- width: textW,
447
- height: textH,
448
- left: 0,
449
- top: 0,
450
- colIndex: colIndex,
451
- asc: measureText.actualBoundingBoxAscent,
452
- desc: measureText.actualBoundingBoxDescent
453
- });
454
- }
455
- }
456
- var textH_all_ColumWidth = [];
457
- for (var i = 0; i < textH_all_ColumnHeight.length; i += 1) {
458
- var columnHeight = textH_all_ColumnHeight[i];
459
- var col = textH_all_Column[i];
460
- var colMaxW = 0;
461
- for (var c = 0; c < col.length; c += 1) {
462
- var word = col[c];
463
- colMaxW = Math.max(colMaxW, word.width);
464
- }
465
- textH_all_ColumWidth.push(colMaxW);
466
- textW_all += colMaxW;
467
- textH_all = Math.max(textH_all, columnHeight);
468
- }
469
- textContent.type = "verticalWrap";
470
- textContent.textWidthAll = textW_all;
471
- textContent.textHeightAll = textH_all;
472
- if (isMode === "onlyWidth") {
473
- return textContent;
474
- }
475
- var cumColumnWidth = 0;
476
- for (var i = 0; i < textH_all_ColumnHeight.length; i += 1) {
477
- var columnHeight = textH_all_ColumnHeight[i];
478
- var columnWidth = textH_all_ColumWidth[i];
479
- var col = textH_all_Column[i];
480
- var cumWordHeight = 0;
481
- for (var c = 0; c < col.length; c += 1) {
482
- var word = col[c];
483
- var left = space_width + cumColumnWidth;
484
- if (horizonAlign === "0") {
485
- left = cellWidth / 2 + cumColumnWidth - textW_all / 2 + space_width * textH_all_ColumnHeight.length;
486
- } else if (horizonAlign === "2") {
487
- left = cellWidth + cumColumnWidth - textW_all + space_width;
488
- }
489
- var top_1 = cellHeight - space_height + cumWordHeight - columnHeight;
490
- if (verticalAlign === "0") {
491
- top_1 = cellHeight / 2 + cumWordHeight - columnHeight / 2;
492
- } else if (verticalAlign === "1") {
493
- top_1 = space_height + cumWordHeight;
494
- }
495
- cumWordHeight += word.height;
496
- word.left = left;
497
- word.top = top_1;
498
- drawLineInfo(word, cancelLine, underLine, {
499
- width: columnWidth,
500
- height: word.height,
501
- left: left,
502
- top: top_1 + word.height - space_height,
503
- asc: word.height,
504
- desc: 0,
505
- fs: fontSize
506
- });
507
- textContent.values.push(word);
508
- }
509
- cumColumnWidth += columnWidth;
510
- }
511
- } else {
512
- var supportBoundBox = isSupportBoundingBox(renderCtx);
513
- if (supportBoundBox) {
514
- renderCtx.textBaseline = "alphabetic";
515
- } else {
516
- renderCtx.textBaseline = "bottom";
517
- }
518
- if (tb === "2" || isInline) {
519
- var textW_all = 0;
520
- var textH_all = 0;
521
- var textW_all_inner = 0;
522
- var splitIndex = 0;
523
- var text_all_split = {};
524
- textContent.rotate = rt;
525
- rt = Math.abs(rt);
526
- var anchor = 0;
527
- var preStr = void 0;
528
- var preTextHeight = void 0;
529
- var preTextWidth = void 0;
530
- var preMeasureText = void 0;
531
- var i = 1;
532
- var spaceOrTwoByte = null;
533
- var spaceOrTwoByteIndex = null;
534
- if (isInline) {
535
- while (i <= inlineStringArr.length) {
536
- var shareCells = inlineStringArr.slice(anchor, i);
537
- if (shareCells[shareCells.length - 1].wrap === true) {
538
- anchor = i;
539
- if (shareCells.length > 1) {
540
- for (var s = 0; s < shareCells.length - 1; s += 1) {
541
- var sc = shareCells[s];
542
- var item = {
543
- content: sc.v,
544
- style: sc,
545
- width: sc.measureText.width,
546
- height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
547
- left: 0,
548
- top: 0,
549
- splitIndex: splitIndex,
550
- asc: sc.measureText.actualBoundingBoxAscent,
551
- desc: sc.measureText.actualBoundingBoxDescent,
552
- inline: true,
553
- fs: sc.fs
554
- };
555
- text_all_split[splitIndex].push(item);
556
- }
557
- }
558
- if (shareCells.length === 1) {
559
- var sc = shareCells[0];
560
- var measureText = getMeasureText("M", renderCtx, sheetCtx, sc.fontset);
561
- if (_.isNil(text_all_split[splitIndex])) {
562
- text_all_split[splitIndex] = [];
563
- }
564
- text_all_split[splitIndex].push({
565
- content: "",
566
- style: sc,
567
- width: measureText.width,
568
- height: measureText.actualBoundingBoxAscent + measureText.actualBoundingBoxDescent,
569
- left: 0,
570
- top: 0,
571
- splitIndex: splitIndex,
572
- asc: measureText.actualBoundingBoxAscent,
573
- desc: measureText.actualBoundingBoxDescent,
574
- inline: true,
575
- wrap: true,
576
- fs: sc.fs
577
- });
578
- }
579
- splitIndex += 1;
580
- i += 1;
581
- continue;
582
- }
583
- var textWidth = 0;
584
- var textHeight = 0;
585
- for (var s = 0; s < shareCells.length; s += 1) {
586
- var sc = shareCells[s];
587
- if (_.isNil(sc.measureText)) {
588
- sc.measureText = getMeasureText(sc.v, renderCtx, sheetCtx, sc.fontset);
589
- }
590
- textWidth += sc.measureText.width;
591
- textHeight = Math.max(sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent);
592
- }
593
- var width = textWidth * Math.cos(rt * Math.PI / 180) + textHeight * Math.sin(rt * Math.PI / 180);
594
- var height = textWidth * Math.sin(rt * Math.PI / 180) + textHeight * Math.cos(rt * Math.PI / 180);
595
- var lastWord = shareCells[shareCells.length - 1];
596
- if (lastWord.v === " " || checkWordByteLength(lastWord.v) === 2) {
597
- spaceOrTwoByteIndex = i;
598
- }
599
- if (rt !== 0) {
600
- if (height + space_height > cellHeight && !_.isNil(text_all_split[splitIndex]) && tb === "2") {
601
- if (!_.isNil(spaceOrTwoByteIndex) && spaceOrTwoByteIndex < i) {
602
- for (var s = 0; s < spaceOrTwoByteIndex - anchor; s += 1) {
603
- var sc = shareCells[s];
604
- text_all_split[splitIndex].push({
605
- content: sc.v,
606
- style: sc,
607
- width: sc.measureText.width,
608
- height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
609
- left: 0,
610
- top: 0,
611
- splitIndex: splitIndex,
612
- asc: sc.measureText.actualBoundingBoxAscent,
613
- desc: sc.measureText.actualBoundingBoxDescent,
614
- inline: true,
615
- fs: sc.fs
616
- });
617
- }
618
- anchor = spaceOrTwoByteIndex;
619
- i = spaceOrTwoByteIndex + 1;
620
- splitIndex += 1;
621
- spaceOrTwoByteIndex = null;
622
- } else {
623
- anchor = i - 1;
624
- for (var s = 0; s < shareCells.length - 1; s += 1) {
625
- var sc = shareCells[s];
626
- text_all_split[splitIndex].push({
627
- content: sc.v,
628
- style: sc,
629
- width: sc.measureText.width,
630
- height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
631
- left: 0,
632
- top: 0,
633
- splitIndex: splitIndex,
634
- asc: sc.measureText.actualBoundingBoxAscent,
635
- desc: sc.measureText.actualBoundingBoxDescent,
636
- inline: true,
637
- fs: sc.fs
638
- });
639
- }
640
- splitIndex += 1;
641
- }
642
- } else if (i === inlineStringArr.length) {
643
- if (_.isNil(text_all_split[splitIndex])) {
644
- text_all_split[splitIndex] = [];
645
- }
646
- for (var s = 0; s < shareCells.length; s += 1) {
647
- var sc = shareCells[s];
648
- text_all_split[splitIndex].push({
649
- content: sc.v,
650
- style: sc,
651
- width: sc.measureText.width,
652
- height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
653
- left: 0,
654
- top: 0,
655
- splitIndex: splitIndex,
656
- asc: sc.measureText.actualBoundingBoxAscent,
657
- desc: sc.measureText.actualBoundingBoxDescent,
658
- inline: true,
659
- fs: sc.fs
660
- });
661
- }
662
- break;
663
- } else {
664
- if (_.isNil(text_all_split[splitIndex])) {
665
- text_all_split[splitIndex] = [];
666
- }
667
- i += 1;
668
- }
669
- } else {
670
- if (width + space_width > cellWidth && !_.isNil(text_all_split[splitIndex]) && tb === "2") {
671
- if (!_.isNil(spaceOrTwoByteIndex) && spaceOrTwoByteIndex < i) {
672
- for (var s = 0; s < spaceOrTwoByteIndex - anchor; s += 1) {
673
- var sc = shareCells[s];
674
- text_all_split[splitIndex].push({
675
- content: sc.v,
676
- style: sc,
677
- width: sc.measureText.width,
678
- height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
679
- left: 0,
680
- top: 0,
681
- splitIndex: splitIndex,
682
- asc: sc.measureText.actualBoundingBoxAscent,
683
- desc: sc.measureText.actualBoundingBoxDescent,
684
- inline: true,
685
- fs: sc.fs
686
- });
687
- }
688
- anchor = spaceOrTwoByteIndex;
689
- i = spaceOrTwoByteIndex + 1;
690
- splitIndex += 1;
691
- spaceOrTwoByteIndex = null;
692
- } else {
693
- anchor = i - 1;
694
- for (var s = 0; s < shareCells.length - 1; s += 1) {
695
- var sc = shareCells[s];
696
- text_all_split[splitIndex].push({
697
- content: sc.v,
698
- style: sc,
699
- width: sc.measureText.width,
700
- height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
701
- left: 0,
702
- top: 0,
703
- splitIndex: splitIndex,
704
- asc: sc.measureText.actualBoundingBoxAscent,
705
- desc: sc.measureText.actualBoundingBoxDescent,
706
- inline: true,
707
- fs: sc.fs
708
- });
709
- }
710
- splitIndex += 1;
711
- }
712
- } else if (i === inlineStringArr.length) {
713
- if (_.isNil(text_all_split[splitIndex])) {
714
- text_all_split[splitIndex] = [];
715
- }
716
- for (var s = 0; s < shareCells.length; s += 1) {
717
- var sc = shareCells[s];
718
- text_all_split[splitIndex].push({
719
- content: sc.v,
720
- style: sc,
721
- width: sc.measureText.width,
722
- height: sc.measureText.actualBoundingBoxAscent + sc.measureText.actualBoundingBoxDescent,
723
- left: 0,
724
- top: 0,
725
- splitIndex: splitIndex,
726
- asc: sc.measureText.actualBoundingBoxAscent,
727
- desc: sc.measureText.actualBoundingBoxDescent,
728
- inline: true,
729
- fs: sc.fs
730
- });
731
- }
732
- break;
733
- } else {
734
- if (_.isNil(text_all_split[splitIndex])) {
735
- text_all_split[splitIndex] = [];
736
- }
737
- i += 1;
738
- }
739
- }
740
- }
741
- } else {
742
- value = value.toString();
743
- while (i <= value.length) {
744
- var str = value.substring(anchor, i);
745
- var measureText = getMeasureText(str, renderCtx, sheetCtx);
746
- var textWidth = measureText.width;
747
- var textHeight = measureText.actualBoundingBoxAscent + measureText.actualBoundingBoxDescent;
748
- var width = textWidth * Math.cos(rt * Math.PI / 180) + textHeight * Math.sin(rt * Math.PI / 180);
749
- var height = textWidth * Math.sin(rt * Math.PI / 180) + textHeight * Math.cos(rt * Math.PI / 180);
750
- var lastWord = str.substr(str.length - 1, 1);
751
- if (lastWord === " " || checkWordByteLength(lastWord) === 2) {
752
- spaceOrTwoByte = {
753
- index: i,
754
- str: str,
755
- width: width,
756
- height: height,
757
- asc: measureText.actualBoundingBoxAscent,
758
- desc: measureText.actualBoundingBoxDescent
759
- };
760
- }
761
- if (rt !== 0) {
762
- if (height + space_height > cellHeight && !_.isNil(text_all_split[splitIndex])) {
763
- if (!_.isNil(spaceOrTwoByte) && spaceOrTwoByte.index < i) {
764
- anchor = spaceOrTwoByte.index;
765
- i = spaceOrTwoByte.index + 1;
766
- text_all_split[splitIndex].push({
767
- content: spaceOrTwoByte.str,
768
- style: fontset,
769
- width: spaceOrTwoByte.width,
770
- height: spaceOrTwoByte.height,
771
- left: 0,
772
- top: 0,
773
- splitIndex: splitIndex,
774
- asc: spaceOrTwoByte.asc,
775
- desc: spaceOrTwoByte.desc,
776
- fs: fontSize
777
- });
778
- splitIndex += 1;
779
- spaceOrTwoByte = null;
780
- } else {
781
- anchor = i - 1;
782
- text_all_split[splitIndex].push({
783
- content: preStr,
784
- style: fontset,
785
- left: 0,
786
- top: 0,
787
- splitIndex: splitIndex,
788
- height: preTextHeight,
789
- width: preTextWidth,
790
- asc: measureText.actualBoundingBoxAscent,
791
- desc: measureText.actualBoundingBoxDescent,
792
- fs: fontSize
793
- });
794
- splitIndex += 1;
795
- }
796
- } else if (i === value.length) {
797
- if (_.isNil(text_all_split[splitIndex])) {
798
- text_all_split[splitIndex] = [];
799
- }
800
- text_all_split[splitIndex].push({
801
- content: str,
802
- style: fontset,
803
- left: 0,
804
- top: 0,
805
- splitIndex: splitIndex,
806
- height: textHeight,
807
- width: textWidth,
808
- asc: measureText.actualBoundingBoxAscent,
809
- desc: measureText.actualBoundingBoxDescent,
810
- fs: fontSize
811
- });
812
- break;
813
- } else {
814
- if (_.isNil(text_all_split[splitIndex])) {
815
- text_all_split[splitIndex] = [];
816
- }
817
- i += 1;
818
- }
819
- } else {
820
- if (width + space_width > cellWidth && !_.isNil(text_all_split[splitIndex])) {
821
- if (!_.isNil(spaceOrTwoByte) && spaceOrTwoByte.index < i) {
822
- anchor = spaceOrTwoByte.index;
823
- i = spaceOrTwoByte.index + 1;
824
- text_all_split[splitIndex].push({
825
- content: spaceOrTwoByte.str,
826
- style: fontset,
827
- width: spaceOrTwoByte.width,
828
- height: spaceOrTwoByte.height,
829
- left: 0,
830
- top: 0,
831
- splitIndex: splitIndex,
832
- asc: spaceOrTwoByte.asc,
833
- desc: spaceOrTwoByte.desc,
834
- fs: fontSize
835
- });
836
- splitIndex += 1;
837
- spaceOrTwoByte = null;
838
- } else {
839
- spaceOrTwoByte = null;
840
- anchor = i - 1;
841
- text_all_split[splitIndex].push({
842
- content: preStr,
843
- style: fontset,
844
- width: preTextWidth,
845
- height: preTextHeight,
846
- left: 0,
847
- top: 0,
848
- splitIndex: splitIndex,
849
- asc: preMeasureText.actualBoundingBoxAscent,
850
- desc: preMeasureText.actualBoundingBoxDescent,
851
- fs: fontSize
852
- });
853
- splitIndex += 1;
854
- }
855
- } else if (i === value.length) {
856
- if (_.isNil(text_all_split[splitIndex])) {
857
- text_all_split[splitIndex] = [];
858
- }
859
- text_all_split[splitIndex].push({
860
- content: str,
861
- style: fontset,
862
- width: textWidth,
863
- height: textHeight,
864
- left: 0,
865
- top: 0,
866
- splitIndex: splitIndex,
867
- asc: measureText.actualBoundingBoxAscent,
868
- desc: measureText.actualBoundingBoxDescent,
869
- fs: fontSize
870
- });
871
- break;
872
- } else {
873
- if (_.isNil(text_all_split[splitIndex])) {
874
- text_all_split[splitIndex] = [];
875
- }
876
- i += 1;
877
- }
878
- }
879
- preStr = str;
880
- preTextHeight = textHeight;
881
- preTextWidth = textWidth;
882
- preMeasureText = measureText;
883
- }
884
- }
885
- var split_all_size = [];
886
- var oneLinemaxWordCount = 0;
887
- var splitLen = Object.keys(text_all_split).length;
888
- if (splitLen === 0) return textContent;
889
- for (var j = 0; j < splitLen; j += 1) {
890
- var splitLists = text_all_split[j];
891
- if (_.isNil(splitLists)) {
892
- continue;
893
- }
894
- var sWidth = 0;
895
- var sHeight = 0;
896
- var maxDesc = 0;
897
- var maxAsc = 0;
898
- var lineHeight = 0;
899
- var maxWordCount = 0;
900
- for (var s = 0; s < splitLists.length; s += 1) {
901
- var sp = splitLists[s];
902
- if (rt !== 0) {
903
- sWidth += sp.width;
904
- sHeight = Math.max(sHeight, sp.height - (supportBoundBox ? sp.desc : 0));
905
- } else {
906
- sWidth += sp.width;
907
- sHeight = Math.max(sHeight, sp.height - (supportBoundBox ? sp.desc : 0));
908
- }
909
- maxDesc = Math.max(maxDesc, supportBoundBox ? sp.desc : 0);
910
- maxAsc = Math.max(maxAsc, sp.asc);
911
- maxWordCount += 1;
912
- }
913
- lineHeight = sHeight / 2;
914
- oneLinemaxWordCount = Math.max(oneLinemaxWordCount, maxWordCount);
915
- if (rt !== 0) {
916
- sHeight += lineHeight;
917
- textW_all_inner = Math.max(textW_all_inner, sWidth);
918
- textH_all += sHeight;
919
- } else {
920
- sHeight += lineHeight;
921
- textW_all = Math.max(textW_all, sWidth);
922
- textH_all += sHeight;
923
- }
924
- split_all_size.push({
925
- width: sWidth,
926
- height: sHeight,
927
- desc: maxDesc,
928
- asc: maxAsc,
929
- lineHeight: lineHeight,
930
- wordCount: maxWordCount
931
- });
932
- }
933
- var cumWordHeight = 0;
934
- var cumColumnWidth = 0;
935
- var rtPI = rt * Math.PI / 180;
936
- var lastLine = split_all_size[splitLen - 1];
937
- var lastLineSpaceHeight = lastLine.lineHeight;
938
- textH_all = textH_all - lastLineSpaceHeight + lastLine.desc;
939
- var rw = textH_all / Math.sin(rtPI) + textW_all_inner * Math.cos(rtPI);
940
- var rh = textW_all_inner * Math.sin(rtPI);
941
- var fixOneLineLeft = 0;
942
- if (rt !== 0) {
943
- if (splitLen === 1) {
944
- textW_all = textW_all_inner + 2 * (textH_all / Math.tan(rtPI));
945
- fixOneLineLeft = textH_all / Math.tan(rtPI);
946
- } else {
947
- textW_all = textW_all_inner + textH_all / Math.tan(rtPI);
948
- }
949
- textContent.textWidthAll = rw;
950
- textContent.textHeightAll = rh;
951
- } else {
952
- textContent.textWidthAll = textW_all;
953
- textContent.textHeightAll = textH_all;
954
- }
955
- if (isMode === "onlyWidth") {
956
- return textContent;
957
- }
958
- if (rt !== 0 && Number(isRotateUp) === 1) {
959
- renderCtx.textAlign = "end";
960
- for (var j = 0; j < splitLen; j += 1) {
961
- var splitLists = text_all_split[j];
962
- if (_.isNil(splitLists)) {
963
- continue;
964
- }
965
- var size = split_all_size[j];
966
- cumColumnWidth = 0;
967
- for (var c = splitLists.length - 1; c >= 0; c -= 1) {
968
- var wordGroup = splitLists[c];
969
- var left = void 0;
970
- var top_2 = void 0;
971
- if (rt !== 0) {
972
- var y = cumWordHeight + size.asc;
973
- var x = cumWordHeight / Math.tan(rtPI) - cumColumnWidth + textW_all_inner;
974
- if (horizonAlign === "0") {
975
- if (verticalAlign === "0") {
976
- left = x + cellWidth / 2 - textW_all / 2 + lastLineSpaceHeight * Math.cos(rtPI) / 2;
977
- top_2 = y + cellHeight / 2 - textH_all / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
978
- } else if (verticalAlign === "1") {
979
- left = x + cellWidth / 2 - textW_all / 2;
980
- top_2 = y - (textH_all / 2 - rh / 2);
981
- } else if (verticalAlign === "2") {
982
- left = x + cellWidth / 2 - textW_all / 2 + lastLineSpaceHeight * Math.cos(rtPI);
983
- top_2 = y + cellHeight - rh / 2 - textH_all / 2 - lastLineSpaceHeight * Math.cos(rtPI);
984
- }
985
- } else if (horizonAlign === "1") {
986
- if (verticalAlign === "0") {
987
- left = x - rh * Math.sin(rtPI) / 2 + lastLineSpaceHeight * Math.cos(rtPI) / 2;
988
- top_2 = y + cellHeight / 2 + rh * Math.cos(rtPI) / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
989
- } else if (verticalAlign === "1") {
990
- left = x - rh * Math.sin(rtPI);
991
- top_2 = y + rh * Math.cos(rtPI);
992
- } else if (verticalAlign === "2") {
993
- left = x + lastLineSpaceHeight * Math.cos(rtPI);
994
- top_2 = y + cellHeight - lastLineSpaceHeight * Math.cos(rtPI);
995
- }
996
- } else if (horizonAlign === "2") {
997
- if (verticalAlign === "0") {
998
- left = x + cellWidth - rw / 2 - (textW_all_inner / 2 + textH_all / 2 / Math.tan(rtPI)) + lastLineSpaceHeight * Math.cos(rtPI) / 2;
999
- top_2 = y + cellHeight / 2 - textH_all / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1000
- } else if (verticalAlign === "1") {
1001
- left = x + cellWidth - textW_all + fixOneLineLeft;
1002
- top_2 = y - textH_all;
1003
- } else if (verticalAlign === "2") {
1004
- left = x + cellWidth - rw * Math.cos(rtPI) + lastLineSpaceHeight * Math.cos(rtPI);
1005
- top_2 = y + cellHeight - rw * Math.sin(rtPI) - lastLineSpaceHeight * Math.cos(rtPI);
1006
- }
1007
- }
1008
- }
1009
- wordGroup.left = left;
1010
- wordGroup.top = top_2;
1011
- drawLineInfo(wordGroup, cancelLine, underLine, {
1012
- width: wordGroup.width,
1013
- height: wordGroup.height,
1014
- left: (left || 0) - wordGroup.width,
1015
- top: top_2,
1016
- asc: size.asc,
1017
- desc: size.desc,
1018
- fs: wordGroup.fs
1019
- });
1020
- textContent.values.push(wordGroup);
1021
- cumColumnWidth += wordGroup.width;
1022
- }
1023
- cumWordHeight += size.height;
1024
- }
1025
- } else {
1026
- for (var j = 0; j < splitLen; j += 1) {
1027
- var splitLists = text_all_split[j];
1028
- if (_.isNil(splitLists)) {
1029
- continue;
1030
- }
1031
- var size = split_all_size[j];
1032
- cumColumnWidth = 0;
1033
- for (var c = 0; c < splitLists.length; c += 1) {
1034
- var wordGroup = splitLists[c];
1035
- var left = void 0;
1036
- var top_3 = void 0;
1037
- if (rt !== 0) {
1038
- var y = cumWordHeight + size.asc;
1039
- var x = (textH_all - cumWordHeight) / Math.tan(rtPI) + cumColumnWidth;
1040
- if (horizonAlign === "0") {
1041
- if (verticalAlign === "0") {
1042
- left = x + cellWidth / 2 - textW_all / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1043
- top_3 = y + cellHeight / 2 - textH_all / 2 + lastLineSpaceHeight * Math.cos(rtPI) / 2;
1044
- } else if (verticalAlign === "1") {
1045
- left = x + cellWidth / 2 - textW_all / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1046
- top_3 = y - (textH_all / 2 - rh / 2) + lastLineSpaceHeight * Math.cos(rtPI) / 2;
1047
- } else if (verticalAlign === "2") {
1048
- left = x + cellWidth / 2 - textW_all / 2 - lastLineSpaceHeight * Math.cos(rtPI);
1049
- top_3 = y + cellHeight - rh / 2 - textH_all / 2 - lastLineSpaceHeight * Math.cos(rtPI);
1050
- }
1051
- } else if (horizonAlign === "1") {
1052
- if (verticalAlign === "0") {
1053
- left = x - rh * Math.sin(rtPI) / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1054
- top_3 = y - textH_all + cellHeight / 2 - rh * Math.cos(rtPI) / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1055
- } else if (verticalAlign === "1") {
1056
- left = x;
1057
- top_3 = y - textH_all;
1058
- } else if (verticalAlign === "2") {
1059
- left = x - rh * Math.sin(rtPI) - lastLineSpaceHeight * Math.cos(rtPI);
1060
- top_3 = y - textH_all + cellHeight - rh * Math.cos(rtPI) - lastLineSpaceHeight * Math.cos(rtPI);
1061
- }
1062
- } else if (horizonAlign === "2") {
1063
- if (verticalAlign === "0") {
1064
- left = x + cellWidth - rw / 2 - textW_all / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1065
- top_3 = y + cellHeight / 2 - textH_all / 2 - lastLineSpaceHeight * Math.cos(rtPI) / 2;
1066
- } else if (verticalAlign === "1") {
1067
- left = x + cellWidth - rw * Math.cos(rtPI);
1068
- top_3 = y + rh * Math.cos(rtPI);
1069
- } else if (verticalAlign === "2") {
1070
- left = x + cellWidth - textW_all - lastLineSpaceHeight * Math.cos(rtPI) + fixOneLineLeft;
1071
- top_3 = y + cellHeight - lastLineSpaceHeight * Math.cos(rtPI);
1072
- }
1073
- }
1074
- drawLineInfo(wordGroup, cancelLine, underLine, {
1075
- width: wordGroup.width,
1076
- height: wordGroup.height,
1077
- left: left,
1078
- top: top_3,
1079
- asc: size.asc,
1080
- desc: size.desc,
1081
- fs: wordGroup.fs
1082
- });
1083
- } else {
1084
- left = space_width + cumColumnWidth;
1085
- if (horizonAlign === "0") {
1086
- left = cellWidth / 2 + cumColumnWidth - size.width / 2;
1087
- } else if (horizonAlign === "2") {
1088
- left = cellWidth + cumColumnWidth - size.width;
1089
- }
1090
- top_3 = cellHeight - space_height + cumWordHeight + size.asc - textH_all;
1091
- if (verticalAlign === "0") {
1092
- top_3 = cellHeight / 2 + cumWordHeight - textH_all / 2 + size.asc;
1093
- } else if (verticalAlign === "1") {
1094
- top_3 = space_height + cumWordHeight + size.asc;
1095
- }
1096
- drawLineInfo(wordGroup, cancelLine, underLine, {
1097
- width: wordGroup.width,
1098
- height: wordGroup.height,
1099
- left: left,
1100
- top: top_3,
1101
- asc: size.asc,
1102
- desc: size.desc,
1103
- fs: wordGroup.fs
1104
- });
1105
- }
1106
- wordGroup.left = left;
1107
- wordGroup.top = top_3;
1108
- textContent.values.push(wordGroup);
1109
- cumColumnWidth += wordGroup.width;
1110
- }
1111
- cumWordHeight += size.height;
1112
- }
1113
- }
1114
- textContent.type = "plainWrap";
1115
- if (rt !== 0) {
1116
- if (horizonAlign === "0") {
1117
- textContent.textLeftAll = cellWidth / 2;
1118
- if (verticalAlign === "0") {
1119
- textContent.textTopAll = cellHeight / 2;
1120
- } else if (verticalAlign === "1") {
1121
- textContent.textTopAll = rh / 2;
1122
- } else if (verticalAlign === "2") {
1123
- textContent.textTopAll = cellHeight - rh / 2;
1124
- }
1125
- } else if (horizonAlign === "1") {
1126
- if (verticalAlign === "0") {
1127
- textContent.textLeftAll = 0;
1128
- textContent.textTopAll = cellHeight / 2;
1129
- } else if (verticalAlign === "1") {
1130
- textContent.textLeftAll = 0;
1131
- textContent.textTopAll = 0;
1132
- } else if (verticalAlign === "2") {
1133
- textContent.textLeftAll = 0;
1134
- textContent.textTopAll = cellHeight;
1135
- }
1136
- } else if (horizonAlign === "2") {
1137
- if (verticalAlign === "0") {
1138
- textContent.textLeftAll = cellWidth - rw / 2;
1139
- textContent.textTopAll = cellHeight / 2;
1140
- } else if (verticalAlign === "1") {
1141
- textContent.textLeftAll = cellWidth;
1142
- textContent.textTopAll = 0;
1143
- } else if (verticalAlign === "2") {
1144
- textContent.textLeftAll = cellWidth;
1145
- textContent.textTopAll = cellHeight;
1146
- }
1147
- }
1148
- }
1149
- } else {
1150
- var measureText = getMeasureText(value, renderCtx, sheetCtx);
1151
- var textWidth = measureText.width;
1152
- var textHeight = measureText.actualBoundingBoxDescent + measureText.actualBoundingBoxAscent;
1153
- textContent.rotate = rt;
1154
- rt = Math.abs(rt);
1155
- var rtPI = rt * Math.PI / 180;
1156
- var textWidthAll = textWidth * Math.cos(rtPI) + textHeight * Math.sin(rtPI);
1157
- var textHeightAll = textWidth * Math.sin(rtPI) + textHeight * Math.cos(rtPI);
1158
- if (rt !== 0) {
1159
- textContent.textHeightAll = textHeightAll;
1160
- } else {
1161
- textContent.textHeightAll = textHeightAll + textHeight / 2 - measureText.actualBoundingBoxDescent - space_height;
1162
- }
1163
- textContent.textWidthAll = textWidthAll;
1164
- if (isMode === "onlyWidth") {
1165
- return textContent;
1166
- }
1167
- var width = textWidthAll;
1168
- var height = textHeightAll;
1169
- var left = space_width + textHeight * Math.sin(rtPI) * isRotateUp;
1170
- if (horizonAlign === "0") {
1171
- left = cellWidth / 2 - width / 2 + textHeight * Math.sin(rtPI) * isRotateUp;
1172
- } else if (horizonAlign === "2") {
1173
- left = cellWidth - space_width - width + textHeight * Math.sin(rtPI) * isRotateUp;
1174
- }
1175
- var top_4 = cellHeight - space_height - height + measureText.actualBoundingBoxAscent * Math.cos(rtPI) + textWidth * Math.sin(rtPI) * isRotateUp;
1176
- if (verticalAlign === "0") {
1177
- top_4 = cellHeight / 2 - height / 2 + measureText.actualBoundingBoxAscent * Math.cos(rtPI) + textWidth * Math.sin(rtPI) * isRotateUp;
1178
- } else if (verticalAlign === "1") {
1179
- top_4 = space_height + measureText.actualBoundingBoxAscent * Math.cos(rtPI) + textWidth * Math.sin(rtPI) * isRotateUp;
1180
- }
1181
- textContent.type = "plain";
1182
- var wordGroup = {
1183
- content: value,
1184
- style: fontset,
1185
- width: width,
1186
- height: height,
1187
- left: left,
1188
- top: top_4
1189
- };
1190
- drawLineInfo(wordGroup, cancelLine, underLine, {
1191
- width: textWidth,
1192
- height: textHeight,
1193
- left: left,
1194
- top: top_4,
1195
- asc: measureText.actualBoundingBoxAscent,
1196
- desc: measureText.actualBoundingBoxDescent,
1197
- fs: fontSize
1198
- });
1199
- textContent.values.push(wordGroup);
1200
- textContent.textLeftAll = left;
1201
- textContent.textTopAll = top_4;
1202
- textContent.asc = measureText.actualBoundingBoxAscent;
1203
- textContent.desc = measureText.actualBoundingBoxDescent;
1204
- }
1205
- }
1206
- return textContent;
1207
- }