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

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 (187) hide show
  1. package/dist/_virtual/MathUtilsWorker.js +8 -1
  2. package/dist/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +35 -2
  3. package/dist/_virtual/filterBoxWorker.js +8 -1
  4. package/dist/_virtual/highlightWorker.js +8 -1
  5. package/dist/assets/attributeIcon/icon_canvasEdit0.svg.js +5 -1
  6. package/dist/assets/attributeIcon/icon_canvasEdit1.svg.js +5 -1
  7. package/dist/assets/attributeIcon/icon_canvasEdit2.svg.js +5 -1
  8. package/dist/assets/attributeIcon/icon_canvasEdit3.svg.js +5 -1
  9. package/dist/assets/attributeIcon/icon_canvasEdit4.svg.js +5 -1
  10. package/dist/assets/attributeIcon/icon_canvasEdit5.svg.js +5 -1
  11. package/dist/assets/attributeIcon/icon_canvasEdit6.svg.js +5 -1
  12. package/dist/assets/attributeIcon/icon_canvasEdit7.svg.js +5 -1
  13. package/dist/assets/attributeIcon/icon_canvasEdit8.svg.js +5 -1
  14. package/dist/assets/attributeIcon/icon_canvasEdit_miss.svg.js +5 -1
  15. package/dist/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -5
  16. package/dist/assets/attributeIcon/icon_cuboidLeft.svg.js +5 -7
  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 +5 -12
  20. package/dist/assets/attributeIcon/icon_editFEN.svg.js +5 -1
  21. package/dist/assets/attributeIcon/icon_editHUANG.svg.js +5 -1
  22. package/dist/assets/attributeIcon/icon_editLAN.svg.js +5 -1
  23. package/dist/assets/attributeIcon/icon_editLV.svg.js +5 -1
  24. package/dist/assets/attributeIcon/icon_editQING.svg.js +5 -1
  25. package/dist/constant/annotation.js +127 -1
  26. package/dist/constant/annotationTask.js +30 -1
  27. package/dist/constant/defaultConfig.js +266 -1
  28. package/dist/constant/keyCode.js +38 -1
  29. package/dist/constant/style.js +98 -1
  30. package/dist/constant/tool.js +236 -1
  31. package/dist/core/index.js +150 -1
  32. package/dist/core/pointCloud/OrbitControls.js +665 -1
  33. package/dist/core/pointCloud/PCDLoader.js +260 -2
  34. package/dist/core/pointCloud/annotation.js +215 -1
  35. package/dist/core/pointCloud/cache.js +53 -1
  36. package/dist/core/pointCloud/index.js +991 -5
  37. package/dist/core/pointCloud/matrix.js +138 -1
  38. package/dist/core/pointCloud/segmentation.js +144 -0
  39. package/dist/core/pointCloud/selector/Sse3dLassoSelector.js +26 -0
  40. package/dist/core/pointCloud/selector/Sse3dSelector.js +16 -0
  41. package/dist/core/scheduler.js +233 -1
  42. package/dist/core/toolOperation/LineToolOperation.js +1434 -1
  43. package/dist/core/toolOperation/ScribbleTool.js +292 -1
  44. package/dist/core/toolOperation/TextToolOperation.js +131 -1
  45. package/dist/core/toolOperation/ViewOperation.js +556 -1
  46. package/dist/core/toolOperation/basicToolOperation.js +881 -1
  47. package/dist/core/toolOperation/checkOperation.js +208 -1
  48. package/dist/core/toolOperation/cuboidOperation.js +754 -1
  49. package/dist/core/toolOperation/cuboidToggleButtonClass.js +152 -7
  50. package/dist/core/toolOperation/eventListener.js +37 -1
  51. package/dist/core/toolOperation/measureOperation.js +41 -1
  52. package/dist/core/toolOperation/pointCloud2dOperation.js +365 -1
  53. package/dist/core/toolOperation/pointOperation.js +696 -1
  54. package/dist/core/toolOperation/polygonOperation.js +1251 -1
  55. package/dist/core/toolOperation/rectOperation.js +1233 -1
  56. package/dist/core/toolOperation/segmentByRect.js +174 -1
  57. package/dist/core/toolOperation/tagOperation.js +201 -3
  58. package/dist/core/toolOperation/textAttributeClass.js +182 -16
  59. package/dist/index.js +185 -1
  60. package/dist/locales/constants.js +24 -1
  61. package/dist/locales/en_US/message.js +25 -1
  62. package/dist/locales/index.js +19 -1
  63. package/dist/locales/zh_CN/message.js +25 -1
  64. package/dist/newCore/CanvasScheduler.js +35 -1
  65. package/dist/types/core/pointCloud/segmentation.d.ts +0 -0
  66. package/dist/types/core/pointCloud/selector/Sse3dLassoSelector.d.ts +0 -0
  67. package/dist/types/core/pointCloud/selector/Sse3dSelector.d.ts +0 -0
  68. package/dist/utils/ActionsHistory.js +84 -1
  69. package/dist/utils/ImgUtils.js +23 -1
  70. package/dist/utils/MathUtils.js +385 -2
  71. package/dist/utils/VectorUtils.js +25 -1
  72. package/dist/utils/tool/AttributeUtils.js +218 -1
  73. package/dist/utils/tool/AxisUtils.js +340 -1
  74. package/dist/utils/tool/CanvasUtils.js +62 -1
  75. package/dist/utils/tool/CommonToolUtils.js +174 -1
  76. package/dist/utils/tool/CuboidUtils.js +704 -1
  77. package/dist/utils/tool/DblClickEventListener.js +102 -1
  78. package/dist/utils/tool/DrawUtils.js +492 -3
  79. package/dist/utils/tool/EnhanceCommonToolUtils.js +53 -1
  80. package/dist/utils/tool/ImgPosUtils.js +58 -1
  81. package/dist/utils/tool/LineToolUtils.js +261 -1
  82. package/dist/utils/tool/MarkerUtils.js +56 -1
  83. package/dist/utils/tool/PolygonUtils.js +460 -1
  84. package/dist/utils/tool/RectUtils.js +155 -1
  85. package/dist/utils/tool/RenderDomClass.js +57 -7
  86. package/dist/utils/tool/RenderDomUtils.js +21 -4
  87. package/dist/utils/tool/StyleUtils.js +31 -1
  88. package/dist/utils/tool/TagUtils.js +129 -1
  89. package/dist/utils/tool/UnitUtils.js +12 -1
  90. package/dist/utils/tool/ZoomUtils.js +72 -1
  91. package/dist/utils/tool/polygonTool.js +133 -1
  92. package/dist/utils/uuid.js +26 -1
  93. package/es/_virtual/MathUtilsWorker.js +6 -1
  94. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +12 -0
  95. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +7 -0
  96. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +31 -2
  97. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +11 -0
  98. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +18 -0
  99. package/es/_virtual/filterBoxWorker.js +6 -1
  100. package/es/_virtual/highlightWorker.js +6 -1
  101. package/es/assets/attributeIcon/icon_canvasEdit0.svg.js +3 -1
  102. package/es/assets/attributeIcon/icon_canvasEdit1.svg.js +3 -1
  103. package/es/assets/attributeIcon/icon_canvasEdit2.svg.js +3 -1
  104. package/es/assets/attributeIcon/icon_canvasEdit3.svg.js +3 -1
  105. package/es/assets/attributeIcon/icon_canvasEdit4.svg.js +3 -1
  106. package/es/assets/attributeIcon/icon_canvasEdit5.svg.js +3 -1
  107. package/es/assets/attributeIcon/icon_canvasEdit6.svg.js +3 -1
  108. package/es/assets/attributeIcon/icon_canvasEdit7.svg.js +3 -1
  109. package/es/assets/attributeIcon/icon_canvasEdit8.svg.js +3 -1
  110. package/es/assets/attributeIcon/icon_canvasEdit_miss.svg.js +3 -1
  111. package/es/assets/attributeIcon/icon_cuboidFAB.svg.js +3 -5
  112. package/es/assets/attributeIcon/icon_cuboidLeft.svg.js +3 -7
  113. package/es/assets/attributeIcon/icon_cuboidMore.svg.js +3 -5
  114. package/es/assets/attributeIcon/icon_cuboidRight.svg.js +3 -5
  115. package/es/assets/attributeIcon/icon_cuboidTop.svg.js +3 -12
  116. package/es/assets/attributeIcon/icon_editFEN.svg.js +3 -1
  117. package/es/assets/attributeIcon/icon_editHUANG.svg.js +3 -1
  118. package/es/assets/attributeIcon/icon_editLAN.svg.js +3 -1
  119. package/es/assets/attributeIcon/icon_editLV.svg.js +3 -1
  120. package/es/assets/attributeIcon/icon_editQING.svg.js +3 -1
  121. package/es/constant/annotation.js +113 -1
  122. package/es/constant/annotationTask.js +25 -1
  123. package/es/constant/defaultConfig.js +260 -1
  124. package/es/constant/keyCode.js +36 -1
  125. package/es/constant/style.js +74 -1
  126. package/es/constant/tool.js +220 -1
  127. package/es/core/index.js +148 -1
  128. package/es/core/pointCloud/OrbitControls.js +661 -1
  129. package/es/core/pointCloud/PCDLoader.js +256 -2
  130. package/es/core/pointCloud/annotation.js +211 -1
  131. package/es/core/pointCloud/cache.js +49 -1
  132. package/es/core/pointCloud/index.js +962 -5
  133. package/es/core/pointCloud/matrix.js +109 -1
  134. package/es/core/pointCloud/segmentation.js +120 -0
  135. package/es/core/pointCloud/selector/Sse3dLassoSelector.js +24 -0
  136. package/es/core/pointCloud/selector/Sse3dSelector.js +14 -0
  137. package/es/core/scheduler.js +228 -1
  138. package/es/core/toolOperation/LineToolOperation.js +1421 -1
  139. package/es/core/toolOperation/ScribbleTool.js +290 -1
  140. package/es/core/toolOperation/TextToolOperation.js +129 -1
  141. package/es/core/toolOperation/ViewOperation.js +549 -1
  142. package/es/core/toolOperation/basicToolOperation.js +877 -1
  143. package/es/core/toolOperation/checkOperation.js +206 -1
  144. package/es/core/toolOperation/cuboidOperation.js +752 -1
  145. package/es/core/toolOperation/cuboidToggleButtonClass.js +150 -7
  146. package/es/core/toolOperation/eventListener.js +35 -1
  147. package/es/core/toolOperation/measureOperation.js +39 -1
  148. package/es/core/toolOperation/pointCloud2dOperation.js +359 -1
  149. package/es/core/toolOperation/pointOperation.js +690 -1
  150. package/es/core/toolOperation/polygonOperation.js +1245 -1
  151. package/es/core/toolOperation/rectOperation.js +1228 -1
  152. package/es/core/toolOperation/scribbleTool2.js +249 -0
  153. package/es/core/toolOperation/segmentByRect.js +172 -1
  154. package/es/core/toolOperation/tagOperation.js +199 -3
  155. package/es/core/toolOperation/textAttributeClass.js +180 -16
  156. package/es/index.js +46 -1
  157. package/es/locales/constants.js +22 -1
  158. package/es/locales/en_US/message.js +23 -1
  159. package/es/locales/index.js +17 -1
  160. package/es/locales/zh_CN/message.js +23 -1
  161. package/es/newCore/CanvasScheduler.js +31 -1
  162. package/es/utils/ActionsHistory.js +78 -1
  163. package/es/utils/ImgUtils.js +21 -1
  164. package/es/utils/MathUtils.js +380 -2
  165. package/es/utils/VectorUtils.js +23 -1
  166. package/es/utils/tool/AttributeUtils.js +212 -1
  167. package/es/utils/tool/AxisUtils.js +335 -1
  168. package/es/utils/tool/CanvasUtils.js +60 -1
  169. package/es/utils/tool/CommonToolUtils.js +172 -1
  170. package/es/utils/tool/CuboidUtils.js +680 -1
  171. package/es/utils/tool/DblClickEventListener.js +100 -1
  172. package/es/utils/tool/DrawUtils.js +490 -3
  173. package/es/utils/tool/EnhanceCommonToolUtils.js +48 -1
  174. package/es/utils/tool/ImgPosUtils.js +56 -1
  175. package/es/utils/tool/LineToolUtils.js +255 -1
  176. package/es/utils/tool/MarkerUtils.js +54 -1
  177. package/es/utils/tool/PolygonUtils.js +458 -1
  178. package/es/utils/tool/RectUtils.js +153 -1
  179. package/es/utils/tool/RenderDomClass.js +55 -7
  180. package/es/utils/tool/RenderDomUtils.js +19 -4
  181. package/es/utils/tool/StyleUtils.js +29 -1
  182. package/es/utils/tool/TagUtils.js +127 -1
  183. package/es/utils/tool/UnitUtils.js +10 -1
  184. package/es/utils/tool/ZoomUtils.js +70 -1
  185. package/es/utils/tool/polygonTool.js +126 -1
  186. package/es/utils/uuid.js +24 -1
  187. package/package.json +7 -5
@@ -1 +1,208 @@
1
- "use strict";var _=require("lodash"),CommonToolUtils=require("../../utils/tool/CommonToolUtils.js"),RectUtils=require("../../utils/tool/RectUtils.js"),TagUtils=require("../../utils/tool/TagUtils.js"),annotation=require("../../constant/annotation.js"),tool=require("../../constant/tool.js"),AttributeUtils=require("../../utils/tool/AttributeUtils.js"),AxisUtils=require("../../utils/tool/AxisUtils.js"),DrawUtils=require("../../utils/tool/DrawUtils.js"),StyleUtils=require("../../utils/tool/StyleUtils.js"),basicToolOperation=require("./basicToolOperation.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(a,e,t)=>e in a?__defProp(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,__spreadValues=(a,e)=>{for(var t in e||(e={}))__hasOwnProp.call(e,t)&&__defNormalProp(a,t,e[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(e))__propIsEnum.call(e,t)&&__defNormalProp(a,t,e[t]);return a};const TEXT_ATTRIBUTE_OFFSET={x:8,y:26},newScope=2;class CheckOperation extends basicToolOperation.BasicToolOperation{constructor(e){super(e);this.getHoverRectID=t=>{var i,o;const s=this.getCoordinateUnderZoom(t),l=(o=(i=this.resultList.find(r=>r.toolName===tool.EToolName.Rect))==null?void 0:i.result)!=null?o:[];if(l.length>0){const r=l.filter(n=>RectUtils.isInRect(s,n,newScope,this.zoom));if(r.length===0)return"";if(r.length===1)return r[0].id;if(r.length>1)return r.map(u=>({size:u.width*u.height,id:u.id})).sort((u,h)=>u.size-h.size)[0].id}return""},this.resultList=[],this.hoverID=[],this.fillID=[],this.render=this.render.bind(this),this.drawPolygon=this.drawPolygon.bind(this),this.drawRect=this.drawRect.bind(this),this.drawTag=this.drawTag.bind(this),this.setShowDefaultCursor(!0),this.forbidOperation=!0}onMouseDown(e){var t,i;if(super.onMouseDown(e)||this.forbidMouseOperation||!this.imgInfo)return!0;const o=this.mouseHoverID,s=(i=(t=this.resultList.find(l=>l.toolName===tool.EToolName.Rect))==null?void 0:t.result)!=null?i:[];if(e.button===0){let l=[o],r=!0;o&&s.find(n=>n.id===o&&(n==null?void 0:n.isSelected))&&(r=!1),o||(l=s.map(n=>n.id),r=!1),this.emit("setSelectedID",l,r),this.render()}}updateRotate(){}onMouseMove(e){if(super.onMouseMove(e)||this.forbidMouseOperation||!this.imgInfo)return;const t=this.mouseHoverID,i=this.getHoverRectID(e);if(t!==i){this.mouseHoverID=i;let o=[i];i||(o=[]),this.emit("setHoverID",o),this.render()}}setResult(e){this.resultList=_.cloneDeep(e),this.render()}drawPolygon(e,t){e==null||e.forEach(i=>{var o,s,l,r,n;const u=this.getColor(i.attribute,t),h=StyleUtils.getStrokeAndFill(u,i.valid);let d=(s=(o=this.style)==null?void 0:o.width)!=null?s:2;this.hoverID.includes(i.id)?(d=4,DrawUtils.drawPolygonWithFillAndLine(this.canvas,AxisUtils.default.changePointListByZoom(i.pointList,this.zoom,this.currentPos),{fillColor:h.fill,strokeColor:h.stroke,pointColor:"white",thickness:d,lineCap:"round",isClose:!0,lineType:t==null?void 0:t.lineType})):DrawUtils.drawPolygon(this.canvas,AxisUtils.default.changePointListByZoom(i.pointList,this.zoom,this.currentPos),{color:h.fill,lineType:(l=this.config)==null?void 0:l.lineType,thickness:d,isClose:!0});let c=`${(n=AttributeUtils.default.getAttributeShowText(i.attribute,(r=t==null?void 0:t.attributeList)!=null?r:[]))!=null?n:""}`;(t==null?void 0:t.isShowOrder)&&(i==null?void 0:i.order)>0&&(c=`${i.order} ${c}`),DrawUtils.drawText(this.canvas,AxisUtils.default.changePointByZoom(i.pointList[0],this.zoom,this.currentPos),c,__spreadValues({color:h.stroke},annotation.DEFAULT_TEXT_OFFSET));const v=AxisUtils.default.changePointListByZoom(i.pointList||[],this.zoom,this.currentPos),f=v[v.length-1];DrawUtils.drawText(this.canvas,{x:f.x+TEXT_ATTRIBUTE_OFFSET.x,y:f.y+TEXT_ATTRIBUTE_OFFSET.y},i==null?void 0:i.textAttribute,__spreadValues({color:h.stroke},annotation.DEFAULT_TEXT_OFFSET))})}drawRect(e,t){e==null||e.forEach(i=>{let o=1;this.hoverID.includes(i.id)&&(o=3);const s=this.getColor(i.attribute,t),l=AxisUtils.default.changeRectByZoom(i,this.zoom,this.currentPos);DrawUtils.drawRect(this.canvas,l,{color:(i==null?void 0:i.valid)?s.valid.stroke:s.invalid.stroke,thickness:o}),this.fillID.includes(i.id)&&DrawUtils.drawRectWithFill(this.canvas,l,{color:(i==null?void 0:i.valid)?s.valid.fill:s.invalid.fill})})}drawTag(e,t){const i=e.reduce((o,s)=>[...o,...(t==null?void 0:t.inputList)?TagUtils.getTagNameList(s.result,t.inputList):TagUtils.getTagnameListWithoutConfig(s.result)],[]);DrawUtils.drawTag(this.canvas,i)}setHoverID(e){this.hoverID=e,this.render()}setFillID(e){this.fillID=e,this.render()}render(){var e;super.render(),(e=this.resultList)==null||e.forEach(t=>{switch(t==null?void 0:t.toolName){case tool.EToolName.Rect:this.drawRect(t.result,CommonToolUtils.jsonParser(t.config));break;case tool.EToolName.Polygon:this.drawPolygon(t.result,CommonToolUtils.jsonParser(t.config));break;case tool.EToolName.Tag:this.drawTag(t.result,CommonToolUtils.jsonParser(t.config));break}})}exportData(){return[[],{}]}}module.exports=CheckOperation;
1
+ 'use strict';
2
+
3
+ var _ = require('lodash');
4
+ var CommonToolUtils = require('../../utils/tool/CommonToolUtils.js');
5
+ var RectUtils = require('../../utils/tool/RectUtils.js');
6
+ var TagUtils = require('../../utils/tool/TagUtils.js');
7
+ var annotation = require('../../constant/annotation.js');
8
+ var tool = require('../../constant/tool.js');
9
+ var AttributeUtils = require('../../utils/tool/AttributeUtils.js');
10
+ var AxisUtils = require('../../utils/tool/AxisUtils.js');
11
+ var DrawUtils = require('../../utils/tool/DrawUtils.js');
12
+ var StyleUtils = require('../../utils/tool/StyleUtils.js');
13
+ var basicToolOperation = require('./basicToolOperation.js');
14
+
15
+ var __defProp = Object.defineProperty;
16
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
17
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
18
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
19
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
20
+ var __spreadValues = (a, b) => {
21
+ for (var prop in b || (b = {}))
22
+ if (__hasOwnProp.call(b, prop))
23
+ __defNormalProp(a, prop, b[prop]);
24
+ if (__getOwnPropSymbols)
25
+ for (var prop of __getOwnPropSymbols(b)) {
26
+ if (__propIsEnum.call(b, prop))
27
+ __defNormalProp(a, prop, b[prop]);
28
+ }
29
+ return a;
30
+ };
31
+ const TEXT_ATTRIBUTE_OFFSET = {
32
+ x: 8,
33
+ y: 26
34
+ };
35
+ const newScope = 2;
36
+ class CheckOperation extends basicToolOperation.BasicToolOperation {
37
+ constructor(props) {
38
+ super(props);
39
+ this.getHoverRectID = (e) => {
40
+ var _a, _b;
41
+ const coordinate = this.getCoordinateUnderZoom(e);
42
+ const currentShowList = (_b = (_a = this.resultList.find((v) => v.toolName === tool.EToolName.Rect)) == null ? void 0 : _a.result) != null ? _b : [];
43
+ if (currentShowList.length > 0) {
44
+ const hoverList = currentShowList.filter((rect) => RectUtils.isInRect(coordinate, rect, newScope, this.zoom));
45
+ if (hoverList.length === 0) {
46
+ return "";
47
+ }
48
+ if (hoverList.length === 1) {
49
+ return hoverList[0].id;
50
+ }
51
+ if (hoverList.length > 1) {
52
+ const rectSizeList = hoverList.map((rect) => ({size: rect.width * rect.height, id: rect.id})).sort((a, b) => a.size - b.size);
53
+ return rectSizeList[0].id;
54
+ }
55
+ }
56
+ return "";
57
+ };
58
+ this.resultList = [];
59
+ this.hoverID = [];
60
+ this.fillID = [];
61
+ this.render = this.render.bind(this);
62
+ this.drawPolygon = this.drawPolygon.bind(this);
63
+ this.drawRect = this.drawRect.bind(this);
64
+ this.drawTag = this.drawTag.bind(this);
65
+ this.setShowDefaultCursor(true);
66
+ this.forbidOperation = true;
67
+ }
68
+ onMouseDown(e) {
69
+ var _a, _b;
70
+ if (super.onMouseDown(e) || this.forbidMouseOperation || !this.imgInfo) {
71
+ return true;
72
+ }
73
+ const newMouseSelectedID = this.mouseHoverID;
74
+ const currentShowList = (_b = (_a = this.resultList.find((v) => v.toolName === tool.EToolName.Rect)) == null ? void 0 : _a.result) != null ? _b : [];
75
+ if (e.button === 0) {
76
+ let selectedID = [newMouseSelectedID];
77
+ let isShow = true;
78
+ if (newMouseSelectedID && currentShowList.find((rect) => rect.id === newMouseSelectedID && (rect == null ? void 0 : rect.isSelected))) {
79
+ isShow = false;
80
+ }
81
+ if (!newMouseSelectedID) {
82
+ selectedID = currentShowList.map((rect) => rect.id);
83
+ isShow = false;
84
+ }
85
+ this.emit("setSelectedID", selectedID, isShow);
86
+ this.render();
87
+ }
88
+ }
89
+ updateRotate() {
90
+ }
91
+ onMouseMove(e) {
92
+ if (super.onMouseMove(e) || this.forbidMouseOperation || !this.imgInfo) {
93
+ return;
94
+ }
95
+ const oldMouseHoverID = this.mouseHoverID;
96
+ const newMouseHoverID = this.getHoverRectID(e);
97
+ if (oldMouseHoverID !== newMouseHoverID) {
98
+ this.mouseHoverID = newMouseHoverID;
99
+ let hoverID = [newMouseHoverID];
100
+ if (!newMouseHoverID) {
101
+ hoverID = [];
102
+ }
103
+ this.emit("setHoverID", hoverID);
104
+ this.render();
105
+ }
106
+ }
107
+ setResult(result) {
108
+ this.resultList = _.cloneDeep(result);
109
+ this.render();
110
+ }
111
+ drawPolygon(polygonList, config) {
112
+ polygonList == null ? void 0 : polygonList.forEach((polygon) => {
113
+ var _a, _b, _c, _d, _e;
114
+ const toolColor = this.getColor(polygon.attribute, config);
115
+ const toolData = StyleUtils.getStrokeAndFill(toolColor, polygon.valid);
116
+ let thickness = (_b = (_a = this.style) == null ? void 0 : _a.width) != null ? _b : 2;
117
+ if (this.hoverID.includes(polygon.id)) {
118
+ thickness = 4;
119
+ DrawUtils.drawPolygonWithFillAndLine(this.canvas, AxisUtils["default"].changePointListByZoom(polygon.pointList, this.zoom, this.currentPos), {
120
+ fillColor: toolData.fill,
121
+ strokeColor: toolData.stroke,
122
+ pointColor: "white",
123
+ thickness,
124
+ lineCap: "round",
125
+ isClose: true,
126
+ lineType: config == null ? void 0 : config.lineType
127
+ });
128
+ } else {
129
+ DrawUtils.drawPolygon(this.canvas, AxisUtils["default"].changePointListByZoom(polygon.pointList, this.zoom, this.currentPos), {
130
+ color: toolData.fill,
131
+ lineType: (_c = this.config) == null ? void 0 : _c.lineType,
132
+ thickness,
133
+ isClose: true
134
+ });
135
+ }
136
+ let showText = `${(_e = AttributeUtils["default"].getAttributeShowText(polygon.attribute, (_d = config == null ? void 0 : config.attributeList) != null ? _d : [])) != null ? _e : ""}`;
137
+ if ((config == null ? void 0 : config.isShowOrder) && (polygon == null ? void 0 : polygon.order) > 0) {
138
+ showText = `${polygon.order} ${showText}`;
139
+ }
140
+ DrawUtils.drawText(this.canvas, AxisUtils["default"].changePointByZoom(polygon.pointList[0], this.zoom, this.currentPos), showText, __spreadValues({
141
+ color: toolData.stroke
142
+ }, annotation.DEFAULT_TEXT_OFFSET));
143
+ const transformPointList = AxisUtils["default"].changePointListByZoom(polygon.pointList || [], this.zoom, this.currentPos);
144
+ const endPoint = transformPointList[transformPointList.length - 1];
145
+ DrawUtils.drawText(this.canvas, {x: endPoint.x + TEXT_ATTRIBUTE_OFFSET.x, y: endPoint.y + TEXT_ATTRIBUTE_OFFSET.y}, polygon == null ? void 0 : polygon.textAttribute, __spreadValues({
146
+ color: toolData.stroke
147
+ }, annotation.DEFAULT_TEXT_OFFSET));
148
+ });
149
+ }
150
+ drawRect(rectList, config) {
151
+ rectList == null ? void 0 : rectList.forEach((rect) => {
152
+ let thickness = 1;
153
+ if (this.hoverID.includes(rect.id)) {
154
+ thickness = 3;
155
+ }
156
+ const toolColor = this.getColor(rect.attribute, config);
157
+ const renderRect = AxisUtils["default"].changeRectByZoom(rect, this.zoom, this.currentPos);
158
+ DrawUtils.drawRect(this.canvas, renderRect, {
159
+ color: (rect == null ? void 0 : rect.valid) ? toolColor.valid.stroke : toolColor.invalid.stroke,
160
+ thickness
161
+ });
162
+ if (this.fillID.includes(rect.id)) {
163
+ DrawUtils.drawRectWithFill(this.canvas, renderRect, {
164
+ color: (rect == null ? void 0 : rect.valid) ? toolColor.valid.fill : toolColor.invalid.fill
165
+ });
166
+ }
167
+ });
168
+ }
169
+ drawTag(tagList, config) {
170
+ const tagInfoList = tagList.reduce((acc, cur) => {
171
+ return [
172
+ ...acc,
173
+ ...(config == null ? void 0 : config.inputList) ? TagUtils.getTagNameList(cur.result, config.inputList) : TagUtils.getTagnameListWithoutConfig(cur.result)
174
+ ];
175
+ }, []);
176
+ DrawUtils.drawTag(this.canvas, tagInfoList);
177
+ }
178
+ setHoverID(hoverID) {
179
+ this.hoverID = hoverID;
180
+ this.render();
181
+ }
182
+ setFillID(fillID) {
183
+ this.fillID = fillID;
184
+ this.render();
185
+ }
186
+ render() {
187
+ var _a;
188
+ super.render();
189
+ (_a = this.resultList) == null ? void 0 : _a.forEach((item) => {
190
+ switch (item == null ? void 0 : item.toolName) {
191
+ case tool.EToolName.Rect:
192
+ this.drawRect(item.result, CommonToolUtils.jsonParser(item.config));
193
+ break;
194
+ case tool.EToolName.Polygon:
195
+ this.drawPolygon(item.result, CommonToolUtils.jsonParser(item.config));
196
+ break;
197
+ case tool.EToolName.Tag:
198
+ this.drawTag(item.result, CommonToolUtils.jsonParser(item.config));
199
+ break;
200
+ }
201
+ });
202
+ }
203
+ exportData() {
204
+ return [[], {}];
205
+ }
206
+ }
207
+
208
+ module.exports = CheckOperation;