@labelbee/lb-annotation 1.14.0-alpha.3 → 1.14.0-alpha.6

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 (189) hide show
  1. package/dist/_virtual/MathUtilsWorker.js +1 -8
  2. package/dist/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -35
  3. package/dist/_virtual/filterBoxWorker.js +1 -8
  4. package/dist/_virtual/highlightWorker.js +1 -8
  5. package/dist/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -5
  6. package/dist/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -5
  7. package/dist/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -5
  8. package/dist/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -5
  9. package/dist/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -5
  10. package/dist/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -5
  11. package/dist/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -5
  12. package/dist/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -5
  13. package/dist/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -5
  14. package/dist/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -5
  15. package/dist/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -5
  16. package/dist/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -5
  17. package/dist/assets/attributeIcon/icon_cuboidMore.svg.js +5 -5
  18. package/dist/assets/attributeIcon/icon_cuboidRight.svg.js +5 -5
  19. package/dist/assets/attributeIcon/icon_cuboidTop.svg.js +12 -5
  20. package/dist/assets/attributeIcon/icon_editFEN.svg.js +1 -5
  21. package/dist/assets/attributeIcon/icon_editHUANG.svg.js +1 -5
  22. package/dist/assets/attributeIcon/icon_editLAN.svg.js +1 -5
  23. package/dist/assets/attributeIcon/icon_editLV.svg.js +1 -5
  24. package/dist/assets/attributeIcon/icon_editQING.svg.js +1 -5
  25. package/dist/constant/annotation.js +1 -127
  26. package/dist/constant/annotationTask.js +1 -30
  27. package/dist/constant/defaultConfig.js +1 -266
  28. package/dist/constant/keyCode.js +1 -38
  29. package/dist/constant/style.js +1 -98
  30. package/dist/constant/tool.js +1 -236
  31. package/dist/core/index.js +1 -150
  32. package/dist/core/pointCloud/OrbitControls.js +1 -665
  33. package/dist/core/pointCloud/PCDLoader.js +2 -260
  34. package/dist/core/pointCloud/annotation.js +1 -215
  35. package/dist/core/pointCloud/cache.js +1 -53
  36. package/dist/core/pointCloud/index.js +5 -991
  37. package/dist/core/pointCloud/matrix.js +1 -138
  38. package/dist/core/scheduler.js +1 -233
  39. package/dist/core/toolOperation/LineToolOperation.js +1 -1434
  40. package/dist/core/toolOperation/ScribbleTool.js +1 -292
  41. package/dist/core/toolOperation/TextToolOperation.js +1 -131
  42. package/dist/core/toolOperation/ViewOperation.js +1 -556
  43. package/dist/core/toolOperation/basicToolOperation.js +1 -881
  44. package/dist/core/toolOperation/checkOperation.js +1 -208
  45. package/dist/core/toolOperation/cuboidOperation.js +1 -754
  46. package/dist/core/toolOperation/cuboidToggleButtonClass.js +7 -152
  47. package/dist/core/toolOperation/eventListener.js +1 -37
  48. package/dist/core/toolOperation/measureOperation.js +1 -41
  49. package/dist/core/toolOperation/pointCloud2dOperation.js +1 -365
  50. package/dist/core/toolOperation/pointOperation.js +1 -696
  51. package/dist/core/toolOperation/polygonOperation.js +1 -1251
  52. package/dist/core/toolOperation/rectOperation.js +1 -1233
  53. package/dist/core/toolOperation/segmentByRect.js +1 -174
  54. package/dist/core/toolOperation/tagOperation.js +3 -201
  55. package/dist/core/toolOperation/textAttributeClass.js +16 -182
  56. package/dist/index.js +1 -185
  57. package/dist/locales/constants.js +1 -24
  58. package/dist/locales/en_US/message.js +1 -25
  59. package/dist/locales/index.js +1 -19
  60. package/dist/locales/zh_CN/message.js +1 -25
  61. package/dist/newCore/CanvasScheduler.js +1 -35
  62. package/dist/types/core/pointCloud/index.d.ts +2 -2
  63. package/dist/utils/ActionsHistory.js +1 -84
  64. package/dist/utils/ImgUtils.js +1 -23
  65. package/dist/utils/MathUtils.js +2 -385
  66. package/dist/utils/VectorUtils.js +1 -25
  67. package/dist/utils/tool/AttributeUtils.js +1 -218
  68. package/dist/utils/tool/AxisUtils.js +1 -340
  69. package/dist/utils/tool/CanvasUtils.js +1 -62
  70. package/dist/utils/tool/CommonToolUtils.js +1 -174
  71. package/dist/utils/tool/CuboidUtils.js +1 -704
  72. package/dist/utils/tool/DblClickEventListener.js +1 -102
  73. package/dist/utils/tool/DrawUtils.js +3 -492
  74. package/dist/utils/tool/EnhanceCommonToolUtils.js +1 -53
  75. package/dist/utils/tool/ImgPosUtils.js +1 -58
  76. package/dist/utils/tool/LineToolUtils.js +1 -261
  77. package/dist/utils/tool/MarkerUtils.js +1 -56
  78. package/dist/utils/tool/PolygonUtils.js +1 -460
  79. package/dist/utils/tool/RectUtils.js +1 -155
  80. package/dist/utils/tool/RenderDomClass.js +7 -57
  81. package/dist/utils/tool/RenderDomUtils.js +4 -21
  82. package/dist/utils/tool/StyleUtils.js +1 -31
  83. package/dist/utils/tool/TagUtils.js +1 -129
  84. package/dist/utils/tool/UnitUtils.js +1 -12
  85. package/dist/utils/tool/ZoomUtils.js +1 -72
  86. package/dist/utils/tool/polygonTool.js +1 -133
  87. package/dist/utils/uuid.js +1 -26
  88. package/es/_virtual/MathUtilsWorker.js +1 -6
  89. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -31
  90. package/es/_virtual/filterBoxWorker.js +1 -6
  91. package/es/_virtual/highlightWorker.js +1 -6
  92. package/es/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -3
  93. package/es/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -3
  94. package/es/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -3
  95. package/es/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -3
  96. package/es/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -3
  97. package/es/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -3
  98. package/es/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -3
  99. package/es/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -3
  100. package/es/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -3
  101. package/es/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -3
  102. package/es/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -3
  103. package/es/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -3
  104. package/es/assets/attributeIcon/icon_cuboidMore.svg.js +5 -3
  105. package/es/assets/attributeIcon/icon_cuboidRight.svg.js +5 -3
  106. package/es/assets/attributeIcon/icon_cuboidTop.svg.js +12 -3
  107. package/es/assets/attributeIcon/icon_editFEN.svg.js +1 -3
  108. package/es/assets/attributeIcon/icon_editHUANG.svg.js +1 -3
  109. package/es/assets/attributeIcon/icon_editLAN.svg.js +1 -3
  110. package/es/assets/attributeIcon/icon_editLV.svg.js +1 -3
  111. package/es/assets/attributeIcon/icon_editQING.svg.js +1 -3
  112. package/es/constant/annotation.js +1 -113
  113. package/es/constant/annotationTask.js +1 -25
  114. package/es/constant/defaultConfig.js +1 -260
  115. package/es/constant/keyCode.js +1 -36
  116. package/es/constant/style.js +1 -74
  117. package/es/constant/tool.js +1 -220
  118. package/es/core/index.js +1 -148
  119. package/es/core/pointCloud/OrbitControls.js +1 -661
  120. package/es/core/pointCloud/PCDLoader.js +2 -256
  121. package/es/core/pointCloud/annotation.js +1 -211
  122. package/es/core/pointCloud/cache.js +1 -49
  123. package/es/core/pointCloud/index.js +5 -962
  124. package/es/core/pointCloud/matrix.js +1 -109
  125. package/es/core/scheduler.js +1 -228
  126. package/es/core/toolOperation/LineToolOperation.js +1 -1421
  127. package/es/core/toolOperation/ScribbleTool.js +1 -290
  128. package/es/core/toolOperation/TextToolOperation.js +1 -129
  129. package/es/core/toolOperation/ViewOperation.js +1 -549
  130. package/es/core/toolOperation/basicToolOperation.js +1 -877
  131. package/es/core/toolOperation/checkOperation.js +1 -206
  132. package/es/core/toolOperation/cuboidOperation.js +1 -752
  133. package/es/core/toolOperation/cuboidToggleButtonClass.js +7 -150
  134. package/es/core/toolOperation/eventListener.js +1 -35
  135. package/es/core/toolOperation/measureOperation.js +1 -39
  136. package/es/core/toolOperation/pointCloud2dOperation.js +1 -359
  137. package/es/core/toolOperation/pointOperation.js +1 -690
  138. package/es/core/toolOperation/polygonOperation.js +1 -1245
  139. package/es/core/toolOperation/rectOperation.js +1 -1228
  140. package/es/core/toolOperation/segmentByRect.js +1 -172
  141. package/es/core/toolOperation/tagOperation.js +3 -199
  142. package/es/core/toolOperation/textAttributeClass.js +16 -180
  143. package/es/index.js +1 -46
  144. package/es/locales/constants.js +1 -22
  145. package/es/locales/en_US/message.js +1 -23
  146. package/es/locales/index.js +1 -17
  147. package/es/locales/zh_CN/message.js +1 -23
  148. package/es/newCore/CanvasScheduler.js +1 -31
  149. package/es/utils/ActionsHistory.js +1 -78
  150. package/es/utils/ImgUtils.js +1 -21
  151. package/es/utils/MathUtils.js +2 -380
  152. package/es/utils/VectorUtils.js +1 -23
  153. package/es/utils/tool/AttributeUtils.js +1 -212
  154. package/es/utils/tool/AxisUtils.js +1 -335
  155. package/es/utils/tool/CanvasUtils.js +1 -60
  156. package/es/utils/tool/CommonToolUtils.js +1 -172
  157. package/es/utils/tool/CuboidUtils.js +1 -680
  158. package/es/utils/tool/DblClickEventListener.js +1 -100
  159. package/es/utils/tool/DrawUtils.js +3 -490
  160. package/es/utils/tool/EnhanceCommonToolUtils.js +1 -48
  161. package/es/utils/tool/ImgPosUtils.js +1 -56
  162. package/es/utils/tool/LineToolUtils.js +1 -255
  163. package/es/utils/tool/MarkerUtils.js +1 -54
  164. package/es/utils/tool/PolygonUtils.js +1 -458
  165. package/es/utils/tool/RectUtils.js +1 -153
  166. package/es/utils/tool/RenderDomClass.js +7 -55
  167. package/es/utils/tool/RenderDomUtils.js +4 -19
  168. package/es/utils/tool/StyleUtils.js +1 -29
  169. package/es/utils/tool/TagUtils.js +1 -127
  170. package/es/utils/tool/UnitUtils.js +1 -10
  171. package/es/utils/tool/ZoomUtils.js +1 -70
  172. package/es/utils/tool/polygonTool.js +1 -126
  173. package/es/utils/uuid.js +1 -24
  174. package/package.json +3 -4
  175. package/LICENSE +0 -203
  176. package/dist/core/pointCloud/segmentation.js +0 -144
  177. package/dist/core/pointCloud/selector/Sse3dLassoSelector.js +0 -26
  178. package/dist/core/pointCloud/selector/Sse3dSelector.js +0 -16
  179. package/dist/types/core/pointCloud/segmentation.d.ts +0 -0
  180. package/dist/types/core/pointCloud/selector/Sse3dLassoSelector.d.ts +0 -0
  181. package/dist/types/core/pointCloud/selector/Sse3dSelector.d.ts +0 -0
  182. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +0 -12
  183. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +0 -7
  184. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +0 -11
  185. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +0 -18
  186. package/es/core/pointCloud/segmentation.js +0 -120
  187. package/es/core/pointCloud/selector/Sse3dLassoSelector.js +0 -24
  188. package/es/core/pointCloud/selector/Sse3dSelector.js +0 -14
  189. package/es/core/toolOperation/scribbleTool2.js +0 -249
@@ -1,22 +1 @@
1
- var EMessage;
2
- (function(EMessage2) {
3
- EMessage2["NoRotateNotice"] = "noRotateNotice";
4
- EMessage2["RectErrorSizeNotice"] = "rectErrorSizeNotice";
5
- EMessage2["TextCheckNumberErrorNotice"] = "textCheckNumberErrorNotice";
6
- EMessage2["TextCheckEnglishErrorNotice"] = "textCheckEnglishErrorNotice";
7
- EMessage2["TextCheckCustomErrorNotice"] = "textCheckCustomErrorNotice";
8
- EMessage2["UpperLimitErrorNotice"] = "UpperLimitErrorNotice";
9
- EMessage2["LowerLimitErrorNotice"] = "LowerLimitErrorNotice";
10
- EMessage2["InvalidImage"] = "InvalidImage";
11
- EMessage2["DisableDelete"] = "DisableDelete";
12
- EMessage2["ClearPartialData"] = "ClearPartialData";
13
- EMessage2["MarkerFinish"] = "MarkerFinish";
14
- EMessage2["LowerLimitPoint"] = "LowerLimitPoint";
15
- EMessage2["NoRotateInDependence"] = "noRotateInDependence";
16
- EMessage2["UnableToReannotation"] = "unableToReannotation";
17
- EMessage2["ForbiddenCreationOutsideBoundary"] = "ForbiddenCreationOutsideBoundary";
18
- EMessage2["SuccessfulEdgeAdsorption"] = "SuccessfulEdgeAdsorption";
19
- EMessage2["ForbidAddNewPoint"] = "ForbidAddNewPoint";
20
- })(EMessage || (EMessage = {}));
21
-
22
- export { EMessage };
1
+ var o;(function(r){r.NoRotateNotice="noRotateNotice",r.RectErrorSizeNotice="rectErrorSizeNotice",r.TextCheckNumberErrorNotice="textCheckNumberErrorNotice",r.TextCheckEnglishErrorNotice="textCheckEnglishErrorNotice",r.TextCheckCustomErrorNotice="textCheckCustomErrorNotice",r.UpperLimitErrorNotice="UpperLimitErrorNotice",r.LowerLimitErrorNotice="LowerLimitErrorNotice",r.InvalidImage="InvalidImage",r.DisableDelete="DisableDelete",r.ClearPartialData="ClearPartialData",r.MarkerFinish="MarkerFinish",r.LowerLimitPoint="LowerLimitPoint",r.NoRotateInDependence="noRotateInDependence",r.UnableToReannotation="unableToReannotation",r.ForbiddenCreationOutsideBoundary="ForbiddenCreationOutsideBoundary",r.SuccessfulEdgeAdsorption="SuccessfulEdgeAdsorption",r.ForbidAddNewPoint="ForbidAddNewPoint"})(o||(o={}));export{o as EMessage};
@@ -1,23 +1 @@
1
- import { EMessage } from '../constants.js';
2
-
3
- const message = {
4
- [EMessage.NoRotateNotice]: "This Image contains data and cannot be rotated",
5
- [EMessage.RectErrorSizeNotice]: "The drawing frame size is smaller than the minimum drawing size",
6
- [EMessage.TextCheckNumberErrorNotice]: "Please enter in number-only format",
7
- [EMessage.TextCheckEnglishErrorNotice]: "Please enter in English only format",
8
- [EMessage.TextCheckCustomErrorNotice]: "Please enter in the required format",
9
- [EMessage.UpperLimitErrorNotice]: "The number of vertices is not more than",
10
- [EMessage.LowerLimitErrorNotice]: "The number of vertices is not less than",
11
- [EMessage.InvalidImage]: "Invalid image, please skip this image",
12
- [EMessage.DisableDelete]: "Disable delete",
13
- [EMessage.ClearPartialData]: "Clear partial data",
14
- [EMessage.MarkerFinish]: "ListAnnotation is finished",
15
- [EMessage.LowerLimitPoint]: "The maximum number of points has been reached",
16
- [EMessage.NoRotateInDependence]: "Disallow rotation in dependent cases",
17
- [EMessage.UnableToReannotation]: "Unabled to reannotation",
18
- [EMessage.ForbiddenCreationOutsideBoundary]: "Fobid creation outside boundary",
19
- [EMessage.SuccessfulEdgeAdsorption]: "Successful edge adsorption",
20
- [EMessage.ForbidAddNewPoint]: "Forbid to add new point in rect-polygon"
21
- };
22
-
23
- export { message as default };
1
+ import{EMessage as e}from"../constants.js";const t={[e.NoRotateNotice]:"This Image contains data and cannot be rotated",[e.RectErrorSizeNotice]:"The drawing frame size is smaller than the minimum drawing size",[e.TextCheckNumberErrorNotice]:"Please enter in number-only format",[e.TextCheckEnglishErrorNotice]:"Please enter in English only format",[e.TextCheckCustomErrorNotice]:"Please enter in the required format",[e.UpperLimitErrorNotice]:"The number of vertices is not more than",[e.LowerLimitErrorNotice]:"The number of vertices is not less than",[e.InvalidImage]:"Invalid image, please skip this image",[e.DisableDelete]:"Disable delete",[e.ClearPartialData]:"Clear partial data",[e.MarkerFinish]:"ListAnnotation is finished",[e.LowerLimitPoint]:"The maximum number of points has been reached",[e.NoRotateInDependence]:"Disallow rotation in dependent cases",[e.UnableToReannotation]:"Unabled to reannotation",[e.ForbiddenCreationOutsideBoundary]:"Fobid creation outside boundary",[e.SuccessfulEdgeAdsorption]:"Successful edge adsorption",[e.ForbidAddNewPoint]:"Forbid to add new point in rect-polygon"};export{t as default};
@@ -1,17 +1 @@
1
- import { ELang } from '../constant/annotation.js';
2
- import message$1 from './en_US/message.js';
3
- import message from './zh_CN/message.js';
4
-
5
- class Locale {
6
- }
7
- Locale.getMessagesByLocale = (key, locale) => {
8
- switch (locale) {
9
- case ELang.US:
10
- return message$1[key];
11
- case ELang.Zh:
12
- default:
13
- return message[key];
14
- }
15
- };
16
-
17
- export { Locale as default };
1
+ import{ELang as e}from"../constant/annotation.js";import o from"./en_US/message.js";import r from"./zh_CN/message.js";class a{}a.getMessagesByLocale=(s,t)=>{switch(t){case e.US:return o[s];case e.Zh:default:return r[s]}};export{a as default};
@@ -1,23 +1 @@
1
- import { EMessage } from '../constants.js';
2
-
3
- const message = {
4
- [EMessage.NoRotateNotice]: "\u672C\u56FE\u542B\u6709\u6570\u636E\uFF0C\u65E0\u6CD5\u8FDB\u884C\u65CB\u8F6C",
5
- [EMessage.RectErrorSizeNotice]: "\u7ED8\u5236\u6846\u5C3A\u5BF8\u5C0F\u4E8E\u6700\u5C0F\u7ED8\u5236\u5C3A\u5BF8",
6
- [EMessage.TextCheckNumberErrorNotice]: "\u8BF7\u6309\u4EC5\u6570\u5B57\u7684\u683C\u5F0F\u8F93\u5165",
7
- [EMessage.TextCheckEnglishErrorNotice]: "\u8BF7\u6309\u4EC5\u82F1\u6587\u7684\u683C\u5F0F\u8F93\u5165",
8
- [EMessage.TextCheckCustomErrorNotice]: "\u8BF7\u6309\u8981\u6C42\u7684\u683C\u5F0F\u8F93\u5165",
9
- [EMessage.UpperLimitErrorNotice]: "\u9876\u70B9\u6570\u4E0D\u591A\u4E8E",
10
- [EMessage.LowerLimitErrorNotice]: "\u9876\u70B9\u6570\u4E0D\u5C11\u4E8E",
11
- [EMessage.InvalidImage]: "\u65E0\u6548\u56FE\u7247\uFF0C\u8BF7\u8DF3\u8FC7\u6B64\u56FE",
12
- [EMessage.DisableDelete]: "\u8BE5\u6570\u636E\u7981\u6B62\u5220\u9664",
13
- [EMessage.ClearPartialData]: "\u5B58\u5728\u90E8\u5206\u6570\u636E\u65E0\u6CD5\u6E05\u9664",
14
- [EMessage.MarkerFinish]: "\u5217\u8868\u6807\u6CE8\u5DF2\u5B8C\u6210",
15
- [EMessage.LowerLimitPoint]: "\u5DF2\u5230\u8FBE\u6807\u70B9\u6570\u91CF\u4E0A\u9650",
16
- [EMessage.NoRotateInDependence]: "\u4F9D\u8D56\u60C5\u51B5\u4E0B\u65E0\u6CD5\u8FDB\u884C\u65CB\u8F6C",
17
- [EMessage.UnableToReannotation]: "\u65E0\u6CD5\u8FDB\u884C\u7EED\u6807\u64CD\u4F5C",
18
- [EMessage.ForbiddenCreationOutsideBoundary]: "\u8FB9\u754C\u5916\u7981\u6B62\u521B\u5EFA",
19
- [EMessage.SuccessfulEdgeAdsorption]: "\u8FB9\u7F18\u5438\u9644\u6210\u529F",
20
- [EMessage.ForbidAddNewPoint]: "\u6846\u4F53\u65E0\u6CD5\u6DFB\u52A0\u70B9"
21
- };
22
-
23
- export { message as default };
1
+ import{EMessage as u}from"../constants.js";const F={[u.NoRotateNotice]:"\u672C\u56FE\u542B\u6709\u6570\u636E\uFF0C\u65E0\u6CD5\u8FDB\u884C\u65CB\u8F6C",[u.RectErrorSizeNotice]:"\u7ED8\u5236\u6846\u5C3A\u5BF8\u5C0F\u4E8E\u6700\u5C0F\u7ED8\u5236\u5C3A\u5BF8",[u.TextCheckNumberErrorNotice]:"\u8BF7\u6309\u4EC5\u6570\u5B57\u7684\u683C\u5F0F\u8F93\u5165",[u.TextCheckEnglishErrorNotice]:"\u8BF7\u6309\u4EC5\u82F1\u6587\u7684\u683C\u5F0F\u8F93\u5165",[u.TextCheckCustomErrorNotice]:"\u8BF7\u6309\u8981\u6C42\u7684\u683C\u5F0F\u8F93\u5165",[u.UpperLimitErrorNotice]:"\u9876\u70B9\u6570\u4E0D\u591A\u4E8E",[u.LowerLimitErrorNotice]:"\u9876\u70B9\u6570\u4E0D\u5C11\u4E8E",[u.InvalidImage]:"\u65E0\u6548\u56FE\u7247\uFF0C\u8BF7\u8DF3\u8FC7\u6B64\u56FE",[u.DisableDelete]:"\u8BE5\u6570\u636E\u7981\u6B62\u5220\u9664",[u.ClearPartialData]:"\u5B58\u5728\u90E8\u5206\u6570\u636E\u65E0\u6CD5\u6E05\u9664",[u.MarkerFinish]:"\u5217\u8868\u6807\u6CE8\u5DF2\u5B8C\u6210",[u.LowerLimitPoint]:"\u5DF2\u5230\u8FBE\u6807\u70B9\u6570\u91CF\u4E0A\u9650",[u.NoRotateInDependence]:"\u4F9D\u8D56\u60C5\u51B5\u4E0B\u65E0\u6CD5\u8FDB\u884C\u65CB\u8F6C",[u.UnableToReannotation]:"\u65E0\u6CD5\u8FDB\u884C\u7EED\u6807\u64CD\u4F5C",[u.ForbiddenCreationOutsideBoundary]:"\u8FB9\u754C\u5916\u7981\u6B62\u521B\u5EFA",[u.SuccessfulEdgeAdsorption]:"\u8FB9\u7F18\u5438\u9644\u6210\u529F",[u.ForbidAddNewPoint]:"\u6846\u4F53\u65E0\u6CD5\u6DFB\u52A0\u70B9"};export{F as default};
@@ -1,31 +1 @@
1
- class CanvasScheduler {
2
- constructor(props) {
3
- this.container = props.container;
4
- }
5
- createCanvas(id, options) {
6
- if (typeof id !== "string") {
7
- this.container.appendChild(id);
8
- id.style.position = "absolute";
9
- id.style.left = "0";
10
- id.style.top = "0";
11
- return id;
12
- }
13
- const canvas = document.createElement("canvas");
14
- canvas.id = id;
15
- if (options && options.size) {
16
- canvas.width = options.size.width;
17
- canvas.height = options.size.height;
18
- }
19
- this.container.appendChild(canvas);
20
- return canvas;
21
- }
22
- destroyCanvas(id) {
23
- const dom = document.getElementById(id);
24
- if (dom) {
25
- this.container.removeChild(dom);
26
- }
27
- return dom;
28
- }
29
- }
30
-
31
- export { CanvasScheduler };
1
+ class a{constructor(e){this.container=e.container}createCanvas(e,t){if(typeof e!="string")return this.container.appendChild(e),e.style.position="absolute",e.style.left="0",e.style.top="0",e;const n=document.createElement("canvas");return n.id=e,t&&t.size&&(n.width=t.size.width,n.height=t.size.height),this.container.appendChild(n),n}destroyCanvas(e){const t=document.getElementById(e);return t&&this.container.removeChild(t),t}}export{a as CanvasScheduler};
@@ -1,78 +1 @@
1
- import _ from 'lodash';
2
-
3
- class ActionsHistory {
4
- constructor(historyChanged) {
5
- this.record = [];
6
- this.recordIndex = -1;
7
- this.minRecordIndex = -1;
8
- this.emitHistoryChanged = () => {
9
- if (this.historyChanged) {
10
- const isEmit = this.constructor.name === "ActionsHistory" ? true : this.record.length > 0;
11
- if (isEmit) {
12
- this.historyChanged(this.undoEnabled, this.redoEnabled);
13
- }
14
- }
15
- };
16
- this.historyChanged = historyChanged;
17
- }
18
- get undoEnabled() {
19
- return this.recordIndex > this.minRecordIndex;
20
- }
21
- get redoEnabled() {
22
- return this.recordIndex < this.record.length - 1;
23
- }
24
- pushHistory(action) {
25
- if (this.recordIndex !== this.record.length - 1) {
26
- const newRecord = this.record.slice(0, Math.min(this.recordIndex + 1, this.record.length));
27
- this.record = newRecord;
28
- }
29
- this.record.push(_.cloneDeepWith(action));
30
- this.recordIndex += 1;
31
- this.emitHistoryChanged();
32
- }
33
- updateHistory(newRecord) {
34
- this.record[this.recordIndex] = _.cloneDeep(newRecord);
35
- }
36
- applyAttribute(id, key, value) {
37
- if (id) {
38
- this.record.forEach((lines) => {
39
- const line = lines.find((i) => i.id === id);
40
- if (line) {
41
- line[key] = value;
42
- }
43
- });
44
- }
45
- }
46
- undo() {
47
- if (this.undoEnabled) {
48
- this.recordIndex -= 1;
49
- this.emitHistoryChanged();
50
- return _.cloneDeep(this.record[this.recordIndex]) || [];
51
- }
52
- }
53
- redo() {
54
- if (this.redoEnabled) {
55
- this.recordIndex += 1;
56
- this.emitHistoryChanged();
57
- return _.cloneDeep(this.record[this.recordIndex]);
58
- }
59
- }
60
- init() {
61
- this.record = [[]];
62
- this.recordIndex = 0;
63
- this.emitHistoryChanged();
64
- }
65
- empty() {
66
- this.record = [];
67
- this.recordIndex = -1;
68
- this.emitHistoryChanged();
69
- }
70
- initRecord(data, isExitData = false) {
71
- const existData = data.length > 0 || isExitData;
72
- this.record = existData ? [_.cloneDeep(data)] : [];
73
- this.minRecordIndex = existData ? 0 : -1;
74
- this.recordIndex = 0;
75
- }
76
- }
77
-
78
- export { ActionsHistory as default };
1
+ import r from"lodash";class h{constructor(e){this.record=[],this.recordIndex=-1,this.minRecordIndex=-1,this.emitHistoryChanged=()=>{this.historyChanged&&(this.constructor.name==="ActionsHistory"?!0:this.record.length>0)&&this.historyChanged(this.undoEnabled,this.redoEnabled)},this.historyChanged=e}get undoEnabled(){return this.recordIndex>this.minRecordIndex}get redoEnabled(){return this.recordIndex<this.record.length-1}pushHistory(e){if(this.recordIndex!==this.record.length-1){const t=this.record.slice(0,Math.min(this.recordIndex+1,this.record.length));this.record=t}this.record.push(r.cloneDeepWith(e)),this.recordIndex+=1,this.emitHistoryChanged()}updateHistory(e){this.record[this.recordIndex]=r.cloneDeep(e)}applyAttribute(e,t,i){e&&this.record.forEach(d=>{const s=d.find(o=>o.id===e);s&&(s[t]=i)})}undo(){if(this.undoEnabled)return this.recordIndex-=1,this.emitHistoryChanged(),r.cloneDeep(this.record[this.recordIndex])||[]}redo(){if(this.redoEnabled)return this.recordIndex+=1,this.emitHistoryChanged(),r.cloneDeep(this.record[this.recordIndex])}init(){this.record=[[]],this.recordIndex=0,this.emitHistoryChanged()}empty(){this.record=[],this.recordIndex=-1,this.emitHistoryChanged()}initRecord(e,t=!1){const i=e.length>0||t;this.record=i?[r.cloneDeep(e)]:[],this.minRecordIndex=i?0:-1,this.recordIndex=0}}export{h as default};
@@ -1,21 +1 @@
1
- class ImgUtils {
2
- static load(src) {
3
- return new Promise((resolve, reject) => {
4
- const imgNode = new Image();
5
- imgNode.crossOrigin = "anonymous";
6
- if (src.startsWith("file")) {
7
- imgNode.src = encodeURI(src);
8
- } else {
9
- imgNode.src = src;
10
- }
11
- imgNode.onload = () => {
12
- resolve(imgNode);
13
- };
14
- imgNode.onerror = () => {
15
- reject(imgNode);
16
- };
17
- });
18
- }
19
- }
20
-
21
- export { ImgUtils as default };
1
+ class r{static load(o){return new Promise((s,n)=>{const e=new Image;e.crossOrigin="anonymous",o.startsWith("file")?e.src=encodeURI(o):e.src=o,e.onload=()=>{s(e)},e.onerror=()=>{n(e)}})}}export{r as default};
@@ -1,380 +1,2 @@
1
- import WorkerFactory from '../_virtual/MathUtilsWorker.js';
2
- import { SEGMENT_NUMBER, DEFAULT_TEXT_MAX_WIDTH, DEFAULT_FONT, ELineTypes } from '../constant/tool.js';
3
- import { createSmoothCurvePointsFromPointList } from './tool/polygonTool.js';
4
- import PolygonUtils from './tool/PolygonUtils.js';
5
- import Vector from './VectorUtils.js';
6
-
7
- var __defProp = Object.defineProperty;
8
- var __defProps = Object.defineProperties;
9
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
10
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
13
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
14
- var __spreadValues = (a, b) => {
15
- for (var prop in b || (b = {}))
16
- if (__hasOwnProp.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- if (__getOwnPropSymbols)
19
- for (var prop of __getOwnPropSymbols(b)) {
20
- if (__propIsEnum.call(b, prop))
21
- __defNormalProp(a, prop, b[prop]);
22
- }
23
- return a;
24
- };
25
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
- class Trigonometric {
27
- static tanAPlusB(tanA, tanB) {
28
- return (tanA + tanB) / (1 - tanA * tanB);
29
- }
30
- static sinAPlusB(sinA, cosA, sinB, cosB) {
31
- return cosB * sinA + cosA * sinB;
32
- }
33
- static cosAPlusB(sinA, cosA, sinB, cosB) {
34
- return cosA * cosB - sinA * sinB;
35
- }
36
- }
37
- const _MathUtils = class {
38
- static getRotate(rotate) {
39
- if (rotate + 90 >= 360) {
40
- return rotate + 90 - 360;
41
- }
42
- return rotate + 90;
43
- }
44
- static getLineLength(point1, point2) {
45
- return Math.sqrt(Math.pow(point2.y - point1.y, 2) + Math.pow(point2.x - point1.x, 2));
46
- }
47
- static getTextArea(canvas, text, maxWidth = DEFAULT_TEXT_MAX_WIDTH, font = DEFAULT_FONT, lineHeight) {
48
- if (typeof text !== "string") {
49
- return {
50
- width: 0,
51
- height: 0
52
- };
53
- }
54
- const context = canvas.getContext("2d");
55
- context.font = font;
56
- let height = 0;
57
- if (typeof lineHeight === "undefined") {
58
- lineHeight = canvas && parseInt(window.getComputedStyle(canvas).lineHeight, 10) || parseInt(window.getComputedStyle(document.body).lineHeight, 10);
59
- }
60
- const fontHeight = canvas && parseInt(window.getComputedStyle(canvas).fontSize, 10) || parseInt(window.getComputedStyle(document.body).fontSize, 10) || 0;
61
- const arrParagraph = text.split("\n");
62
- let lineWidth = 0;
63
- for (let i = 0; i < arrParagraph.length; i++) {
64
- const arrText = arrParagraph[i].split("");
65
- let line = "";
66
- for (let n = 0; n < arrText.length; n++) {
67
- const testLine = line + arrText[n];
68
- const metrics = context.measureText(testLine);
69
- const textWidth = metrics.width;
70
- if (textWidth > maxWidth && n > 0) {
71
- line = arrText[n];
72
- height += lineHeight;
73
- lineWidth = maxWidth;
74
- } else {
75
- line = testLine;
76
- if (textWidth > lineWidth) {
77
- lineWidth = textWidth;
78
- }
79
- }
80
- }
81
- if (i !== arrParagraph.length - 1) {
82
- height += lineHeight;
83
- }
84
- }
85
- return {
86
- width: lineWidth,
87
- height: height + fontHeight,
88
- lineHeight,
89
- fontHeight
90
- };
91
- }
92
- static getLineCenterPoint(line) {
93
- const [p1, p2] = line;
94
- const vector = Vector.getVector(p1, p2);
95
- return {
96
- x: p1.x + vector.x / 2,
97
- y: p1.y + vector.y / 2
98
- };
99
- }
100
- static getPerpendicularLine(line) {
101
- if (line.length !== 2) {
102
- return void 0;
103
- }
104
- const [p1, p2] = line;
105
- const p3 = {
106
- x: p2.x + p2.y - p1.y,
107
- y: p2.y - (p2.x - p1.x)
108
- };
109
- return [p2, p3];
110
- }
111
- static getPerpendicularFootOfLine(line, coordinate) {
112
- if (line.length !== 2) {
113
- return line;
114
- }
115
- const perpendicularLine = this.getPerpendicularLine(line);
116
- if (!perpendicularLine) {
117
- return line;
118
- }
119
- const [begin, end] = perpendicularLine;
120
- return this.getFootOfPerpendicular(coordinate, begin, end).footPoint;
121
- }
122
- static getQuadrangleFromTriangle(triangle) {
123
- if (triangle.length !== 3) {
124
- return triangle;
125
- }
126
- const [p1, p2, p3] = triangle;
127
- const p4 = {
128
- x: p3.x + p1.x - p2.x,
129
- y: p3.y + p1.y - p2.y
130
- };
131
- return [p1, p2, p3, p4];
132
- }
133
- static getRectPerpendicularOffset(dragStartCoord, currentCoord, basicLine) {
134
- const [p1, p2] = basicLine;
135
- const footer1 = this.getFootOfPerpendicular(dragStartCoord, p1, p2).footPoint;
136
- const footer2 = this.getFootOfPerpendicular(currentCoord, p1, p2).footPoint;
137
- const offset = {
138
- x: footer1.x - footer2.x,
139
- y: footer1.y - footer2.y
140
- };
141
- const newPoint = Vector.add(currentCoord, offset);
142
- const vector3 = Vector.getVector(dragStartCoord, newPoint);
143
- return vector3;
144
- }
145
- static getArrayIndex(index, len) {
146
- if (index < 0) {
147
- return len + index;
148
- }
149
- if (index >= len) {
150
- return index - len;
151
- }
152
- return index;
153
- }
154
- static getPointListFromPointOffset(pointList, changePointIndex, offset) {
155
- const prePointIndex = this.getArrayIndex(changePointIndex - 1, pointList.length);
156
- const nextPointIndex = this.getArrayIndex(changePointIndex + 1, pointList.length);
157
- const originIndex = this.getArrayIndex(changePointIndex - 2, pointList.length);
158
- const newPointList = [...pointList];
159
- newPointList[changePointIndex] = Vector.add(newPointList[changePointIndex], offset);
160
- const newFooter1 = this.getFootOfPerpendicular(newPointList[changePointIndex], newPointList[originIndex], newPointList[prePointIndex]).footPoint;
161
- const newFooter2 = this.getFootOfPerpendicular(newPointList[changePointIndex], newPointList[nextPointIndex], newPointList[originIndex]).footPoint;
162
- newPointList[prePointIndex] = newFooter1;
163
- newPointList[nextPointIndex] = newFooter2;
164
- return newPointList;
165
- }
166
- static getRectCenterPoint(rectPointList) {
167
- const [p1, , p3] = rectPointList;
168
- return {
169
- x: (p1.x + p3.x) / 2,
170
- y: (p1.y + p3.y) / 2
171
- };
172
- }
173
- static rotateRectPointList(angle = 5, rectPointList) {
174
- const centerPoint = this.getRectCenterPoint(rectPointList);
175
- const {PI} = Math;
176
- const sinB = Math.sin(angle * PI / 180);
177
- const cosB = Math.cos(angle * PI / 180);
178
- return rectPointList.map((point) => {
179
- const vector = Vector.getVector(centerPoint, point);
180
- const len = Vector.len(vector);
181
- const sinA = vector.y / len;
182
- const cosA = vector.x / len;
183
- return {
184
- x: len * Trigonometric.cosAPlusB(sinA, cosA, sinB, cosB) + centerPoint.x,
185
- y: len * Trigonometric.sinAPlusB(sinA, cosA, sinB, cosB) + centerPoint.y
186
- };
187
- });
188
- }
189
- static getRectangleByRightAngle(coordinate, pointList) {
190
- if (pointList.length !== 2) {
191
- return pointList;
192
- }
193
- const newPoint = _MathUtils.getPerpendicularFootOfLine(pointList, coordinate);
194
- return _MathUtils.getQuadrangleFromTriangle([...pointList, newPoint]);
195
- }
196
- static getRadiusFromQuadrangle(points) {
197
- const [, point2, point3] = points;
198
- const y = point3.y - point2.y;
199
- const x = point2.x - point3.x;
200
- const len = this.getLineLength(point2, point3);
201
- const cosX = y / len;
202
- const radius = Math.acos(cosX);
203
- if (x > 0) {
204
- return Math.PI * 2 - radius;
205
- }
206
- return radius;
207
- }
208
- static getCollectionPointByAnnotationDataPromise(annotations) {
209
- const points = annotations.filter((v) => v.type === "point").map((v) => v.annotation);
210
- const backgroundList = annotations.filter((v) => {
211
- if (["polygon", "line"].includes(v.type)) {
212
- return true;
213
- }
214
- return false;
215
- }).map((v) => {
216
- if (v.type === "polygon") {
217
- return __spreadProps(__spreadValues({}, v.annotation), {
218
- pointList: PolygonUtils.concatBeginAndEnd(v.annotation.pointList)
219
- });
220
- }
221
- return v.annotation;
222
- });
223
- const mathUtilsWorker = new WorkerFactory();
224
- return {
225
- promise: new Promise(function collectionPromise(resolve) {
226
- mathUtilsWorker.postMessage({points, backgroundList});
227
- mathUtilsWorker.onmessage = (e) => {
228
- resolve(e.data);
229
- mathUtilsWorker.terminate();
230
- };
231
- }),
232
- close: () => {
233
- mathUtilsWorker.terminate();
234
- }
235
- };
236
- }
237
- static getCollectionPointByAnnotationData(annotations) {
238
- const connectionPoints = [];
239
- const cacheSet = new Set();
240
- const points = annotations.filter((v) => v.type === "point").map((v) => v.annotation);
241
- const backgroundList = annotations.filter((v) => {
242
- if (["polygon", "line"].includes(v.type)) {
243
- return true;
244
- }
245
- return false;
246
- }).map((v) => {
247
- if (v.type === "polygon") {
248
- return __spreadProps(__spreadValues({}, v.annotation), {
249
- pointList: PolygonUtils.concatBeginAndEnd(v.annotation.pointList)
250
- });
251
- }
252
- return v.annotation;
253
- });
254
- const judgeIsConnectPoint = (point, polygonList) => {
255
- const {dropFoot} = PolygonUtils.getClosestPoint(point, polygonList, ELineTypes.Line, 1, {isClose: false});
256
- if (dropFoot !== point) {
257
- const s = `${dropFoot.x} + ${dropFoot.y}`;
258
- if (!cacheSet.has(s)) {
259
- connectionPoints.push(point);
260
- }
261
- cacheSet.add(s);
262
- }
263
- };
264
- points.forEach((point) => {
265
- judgeIsConnectPoint(point, backgroundList);
266
- });
267
- backgroundList.forEach((v) => {
268
- let traverseID = "";
269
- traverseID = v.id;
270
- backgroundList.forEach((annotation, i) => {
271
- if (annotation.id === traverseID) {
272
- return;
273
- }
274
- const newPolygonList = [...backgroundList];
275
- newPolygonList.splice(i, 1);
276
- annotation.pointList.forEach((point) => {
277
- judgeIsConnectPoint(point, newPolygonList);
278
- });
279
- });
280
- });
281
- return {connectionPoints};
282
- }
283
- };
284
- let MathUtils = _MathUtils;
285
- MathUtils.isInRange = (value, range) => {
286
- const min = Math.min(...range);
287
- const max = Math.max(...range);
288
- const inRange = (v) => v <= max && v >= min;
289
- const values = Array.isArray(value) ? value : [value];
290
- return values.every((v) => inRange(v));
291
- };
292
- MathUtils.withinRange = (value, range) => {
293
- const min = Math.min(...range);
294
- const max = Math.max(...range);
295
- if (value > max) {
296
- return max;
297
- }
298
- if (value < min) {
299
- return min;
300
- }
301
- return value;
302
- };
303
- MathUtils.calcViewportBoundaries = (array, isCurve = false, numberOfSegments = SEGMENT_NUMBER, zoom = 1) => {
304
- if (!array) {
305
- return {
306
- top: 0,
307
- bottom: 0,
308
- left: 0,
309
- right: 0
310
- };
311
- }
312
- const MIN_LENGTH = 20 / zoom;
313
- const xAxis = [];
314
- const yAxis = [];
315
- let points = array;
316
- if (isCurve) {
317
- points = createSmoothCurvePointsFromPointList(array, numberOfSegments);
318
- }
319
- points.forEach(({x, y}) => {
320
- xAxis.push(x);
321
- yAxis.push(y);
322
- });
323
- let minX = Math.min(...xAxis);
324
- let maxX = Math.max(...xAxis);
325
- let minY = Math.min(...yAxis);
326
- let maxY = Math.max(...yAxis);
327
- const diffX = maxX - minX;
328
- const diffY = maxY - minY;
329
- if (diffX < MIN_LENGTH) {
330
- const addLen = (MIN_LENGTH - diffX) / 2;
331
- minX -= addLen;
332
- maxX += addLen;
333
- }
334
- if (diffY < MIN_LENGTH) {
335
- const addLen = (MIN_LENGTH - diffY) / 2;
336
- minY -= addLen;
337
- maxY += addLen;
338
- }
339
- return {
340
- top: minY,
341
- bottom: maxY,
342
- left: minX,
343
- right: maxX
344
- };
345
- };
346
- MathUtils.getFootOfPerpendicular = (pt, begin, end, useAxisRange = false, allowOverRange = false) => {
347
- let retVal = {x: 0, y: 0};
348
- const dx = begin.x - end.x;
349
- const dy = begin.y - end.y;
350
- if (Math.abs(dx) < 1e-8 && Math.abs(dy) < 1e-8) {
351
- retVal = begin;
352
- return retVal;
353
- }
354
- let u = (pt.x - begin.x) * (begin.x - end.x) + (pt.y - begin.y) * (begin.y - end.y);
355
- u /= dx * dx + dy * dy;
356
- retVal.x = begin.x + u * dx;
357
- retVal.y = begin.y + u * dy;
358
- const length = _MathUtils.getLineLength(pt, retVal);
359
- const ratio = 2;
360
- const fromX = Math.min(begin.x, end.x);
361
- const toX = Math.max(begin.x, end.x);
362
- const fromY = Math.min(begin.y, end.y);
363
- const toY = Math.max(begin.y, end.y);
364
- const allAxisOverRange = !(_MathUtils.isInRange(pt.x, [fromX, toX]) || _MathUtils.isInRange(pt.y, [fromY, toY]));
365
- const someAxisOverRange = pt.x > toX + ratio || pt.x < fromX - ratio || pt.y > toY + ratio || pt.y < fromY - ratio;
366
- const isOverRange = useAxisRange ? allAxisOverRange : someAxisOverRange;
367
- if (!allowOverRange && isOverRange) {
368
- return {
369
- footPoint: retVal,
370
- length: Infinity
371
- };
372
- }
373
- return {
374
- footPoint: retVal,
375
- length
376
- };
377
- };
378
- var MathUtils$1 = MathUtils;
379
-
380
- export { Trigonometric, MathUtils$1 as default };
1
+ import F from"../_virtual/MathUtilsWorker.js";import{SEGMENT_NUMBER as R,DEFAULT_TEXT_MAX_WIDTH as E,DEFAULT_FONT as I,ELineTypes as T}from"../constant/tool.js";import{createSmoothCurvePointsFromPointList as B}from"./tool/polygonTool.js";import w from"./tool/PolygonUtils.js";import h from"./VectorUtils.js";var C=Object.defineProperty,v=Object.defineProperties,S=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,_=(e,t,o)=>t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,A=(e,t)=>{for(var o in t||(t={}))U.call(t,o)&&_(e,o,t[o]);if(O)for(var o of O(t))j.call(t,o)&&_(e,o,t[o]);return e},L=(e,t)=>v(e,S(t));class M{static tanAPlusB(t,o){return(t+o)/(1-t*o)}static sinAPlusB(t,o,s,r){return r*t+o*s}static cosAPlusB(t,o,s,r){return o*r-t*s}}const m=class{static getRotate(e){return e+90>=360?e+90-360:e+90}static getLineLength(e,t){return Math.sqrt(Math.pow(t.y-e.y,2)+Math.pow(t.x-e.x,2))}static getTextArea(e,t,o=E,s=I,r){if(typeof t!="string")return{width:0,height:0};const i=e.getContext("2d");i.font=s;let n=0;typeof r=="undefined"&&(r=e&&parseInt(window.getComputedStyle(e).lineHeight,10)||parseInt(window.getComputedStyle(document.body).lineHeight,10));const a=e&&parseInt(window.getComputedStyle(e).fontSize,10)||parseInt(window.getComputedStyle(document.body).fontSize,10)||0,c=t.split(`
2
+ `);let l=0;for(let f=0;f<c.length;f++){const p=c[f].split("");let g="";for(let y=0;y<p.length;y++){const u=g+p[y],d=i.measureText(u).width;d>o&&y>0?(g=p[y],n+=r,l=o):(g=u,d>l&&(l=d))}f!==c.length-1&&(n+=r)}return{width:l,height:n+a,lineHeight:r,fontHeight:a}}static getLineCenterPoint(e){const[t,o]=e,s=h.getVector(t,o);return{x:t.x+s.x/2,y:t.y+s.y/2}}static getPerpendicularLine(e){if(e.length!==2)return;const[t,o]=e,s={x:o.x+o.y-t.y,y:o.y-(o.x-t.x)};return[o,s]}static getPerpendicularFootOfLine(e,t){if(e.length!==2)return e;const o=this.getPerpendicularLine(e);if(!o)return e;const[s,r]=o;return this.getFootOfPerpendicular(t,s,r).footPoint}static getQuadrangleFromTriangle(e){if(e.length!==3)return e;const[t,o,s]=e,r={x:s.x+t.x-o.x,y:s.y+t.y-o.y};return[t,o,s,r]}static getRectPerpendicularOffset(e,t,o){const[s,r]=o,i=this.getFootOfPerpendicular(e,s,r).footPoint,n=this.getFootOfPerpendicular(t,s,r).footPoint,a={x:i.x-n.x,y:i.y-n.y},c=h.add(t,a);return h.getVector(e,c)}static getArrayIndex(e,t){return e<0?t+e:e>=t?e-t:e}static getPointListFromPointOffset(e,t,o){const s=this.getArrayIndex(t-1,e.length),r=this.getArrayIndex(t+1,e.length),i=this.getArrayIndex(t-2,e.length),n=[...e];n[t]=h.add(n[t],o);const a=this.getFootOfPerpendicular(n[t],n[i],n[s]).footPoint,c=this.getFootOfPerpendicular(n[t],n[r],n[i]).footPoint;return n[s]=a,n[r]=c,n}static getRectCenterPoint(e){const[t,,o]=e;return{x:(t.x+o.x)/2,y:(t.y+o.y)/2}}static rotateRectPointList(e=5,t){const o=this.getRectCenterPoint(t),{PI:s}=Math,r=Math.sin(e*s/180),i=Math.cos(e*s/180);return t.map(n=>{const a=h.getVector(o,n),c=h.len(a),l=a.y/c,f=a.x/c;return{x:c*M.cosAPlusB(l,f,r,i)+o.x,y:c*M.sinAPlusB(l,f,r,i)+o.y}})}static getRectangleByRightAngle(e,t){if(t.length!==2)return t;const o=m.getPerpendicularFootOfLine(t,e);return m.getQuadrangleFromTriangle([...t,o])}static getRadiusFromQuadrangle(e){const[,t,o]=e,s=o.y-t.y,r=t.x-o.x,i=this.getLineLength(t,o),n=s/i,a=Math.acos(n);return r>0?Math.PI*2-a:a}static getCollectionPointByAnnotationDataPromise(e){const t=e.filter(r=>r.type==="point").map(r=>r.annotation),o=e.filter(r=>!!["polygon","line"].includes(r.type)).map(r=>r.type==="polygon"?L(A({},r.annotation),{pointList:w.concatBeginAndEnd(r.annotation.pointList)}):r.annotation),s=new F;return{promise:new Promise(function(i){s.postMessage({points:t,backgroundList:o}),s.onmessage=n=>{i(n.data),s.terminate()}}),close:()=>{s.terminate()}}}static getCollectionPointByAnnotationData(e){const t=[],o=new Set,s=e.filter(n=>n.type==="point").map(n=>n.annotation),r=e.filter(n=>!!["polygon","line"].includes(n.type)).map(n=>n.type==="polygon"?L(A({},n.annotation),{pointList:w.concatBeginAndEnd(n.annotation.pointList)}):n.annotation),i=(n,a)=>{const{dropFoot:c}=w.getClosestPoint(n,a,T.Line,1,{isClose:!1});if(c!==n){const l=`${c.x} + ${c.y}`;o.has(l)||t.push(n),o.add(l)}};return s.forEach(n=>{i(n,r)}),r.forEach(n=>{let a="";a=n.id,r.forEach((c,l)=>{if(c.id===a)return;const f=[...r];f.splice(l,1),c.pointList.forEach(p=>{i(p,f)})})}),{connectionPoints:t}}};let x=m;x.isInRange=(e,t)=>{const o=Math.min(...t),s=Math.max(...t),r=n=>n<=s&&n>=o;return(Array.isArray(e)?e:[e]).every(n=>r(n))},x.withinRange=(e,t)=>{const o=Math.min(...t),s=Math.max(...t);return e>s?s:e<o?o:e},x.calcViewportBoundaries=(e,t=!1,o=R,s=1)=>{if(!e)return{top:0,bottom:0,left:0,right:0};const r=20/s,i=[],n=[];let a=e;t&&(a=B(e,o)),a.forEach(({x:u,y:P})=>{i.push(u),n.push(P)});let c=Math.min(...i),l=Math.max(...i),f=Math.min(...n),p=Math.max(...n);const g=l-c,y=p-f;if(g<r){const u=(r-g)/2;c-=u,l+=u}if(y<r){const u=(r-y)/2;f-=u,p+=u}return{top:f,bottom:p,left:c,right:l}},x.getFootOfPerpendicular=(e,t,o,s=!1,r=!1)=>{let i={x:0,y:0};const n=t.x-o.x,a=t.y-o.y;if(Math.abs(n)<1e-8&&Math.abs(a)<1e-8)return i=t,i;let c=(e.x-t.x)*(t.x-o.x)+(e.y-t.y)*(t.y-o.y);c/=n*n+a*a,i.x=t.x+c*n,i.y=t.y+c*a;const l=m.getLineLength(e,i),f=2,p=Math.min(t.x,o.x),g=Math.max(t.x,o.x),y=Math.min(t.y,o.y),u=Math.max(t.y,o.y),P=!(m.isInRange(e.x,[p,g])||m.isInRange(e.y,[y,u])),d=e.x>g+f||e.x<p-f||e.y>u+f||e.y<y-f;return!r&&(s?P:d)?{footPoint:i,length:Infinity}:{footPoint:i,length:l}};var D=x;export{M as Trigonometric,D as default};
@@ -1,23 +1 @@
1
- var __pow = Math.pow;
2
- class Vector {
3
- static add(vector1, vector2) {
4
- return {
5
- x: vector1.x + vector2.x,
6
- y: vector1.y + vector2.y
7
- };
8
- }
9
- static getVector(point1, point2) {
10
- return {
11
- x: point2.x - point1.x,
12
- y: point2.y - point1.y
13
- };
14
- }
15
- static len(vector) {
16
- return Math.sqrt(__pow(vector.x, 2) + __pow(vector.y, 2));
17
- }
18
- static dotProduct(vector1, vector2) {
19
- return vector1.x * vector2.x + vector1.y + vector2.y;
20
- }
21
- }
22
-
23
- export { Vector as default };
1
+ var x=Math.pow;class r{static add(t,a){return{x:t.x+a.x,y:t.y+a.y}}static getVector(t,a){return{x:a.x-t.x,y:a.y-t.y}}static len(t){return Math.sqrt(x(t.x,2)+x(t.y,2))}static dotProduct(t,a){return t.x*a.x+t.y+a.y}}export{r as default};