@labelbee/lb-components 1.23.0-alpha.9 → 1.23.0-alpha.91

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 (245) hide show
  1. package/dist/App.js +1 -1
  2. package/dist/_virtual/2DViewWorker.js +1 -0
  3. package/dist/_virtual/highlightSegmentWorker.js +1 -1
  4. package/dist/assets/annotation/icon_link.svg.js +1 -0
  5. package/dist/assets/annotation/icon_unlink.svg.js +1 -0
  6. package/dist/assets/annotation/pointCloudTool/Image2DBoxScale.svg.js +1 -0
  7. package/dist/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
  8. package/dist/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
  9. package/dist/assets/annotation/pointCloudTool/rotate90_black.svg.js +1 -0
  10. package/dist/assets/icons/ad33251.svg +26 -0
  11. package/dist/components/AnnotationView/index.js +1 -1
  12. package/dist/components/DynamicResizer/DynamicResizer.js +1 -0
  13. package/dist/components/DynamicResizer/assets/bottomToZero.svg.js +1 -0
  14. package/dist/components/DynamicResizer/assets/divider.svg.js +1 -0
  15. package/dist/components/DynamicResizer/assets/topToZero.svg.js +1 -0
  16. package/dist/components/DynamicResizer/hooks/useDrag.js +1 -0
  17. package/dist/components/DynamicResizer/hooks/useUpdateHeight.js +1 -0
  18. package/dist/components/DynamicResizer/index.js +1 -0
  19. package/dist/components/LLMToolView/index.js +1 -1
  20. package/dist/components/LLMToolView/questionView/components/header/index.js +1 -1
  21. package/dist/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
  22. package/dist/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
  23. package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
  24. package/dist/components/LLMToolView/sidebar/index.js +1 -1
  25. package/dist/components/LLMToolView/utils/data.js +1 -1
  26. package/dist/components/NLPToolView/index.js +1 -1
  27. package/dist/components/audioAnnotate/audioContext/index.js +1 -1
  28. package/dist/components/audioAnnotate/audioSide/clipSidebar/index.js +2 -1
  29. package/dist/components/audioAnnotate/index.js +1 -1
  30. package/dist/components/audioAnnotate/textInput/index.js +1 -1
  31. package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -1
  32. package/dist/components/audioAnnotate/utils/dataTransform.js +1 -0
  33. package/dist/components/audioPlayer/clipRegion/index.js +1 -1
  34. package/dist/components/audioPlayer/index.js +1 -1
  35. package/dist/components/audioPlayer/useAudioCombine/index.js +3 -2
  36. package/dist/components/audioPlayer/useAudioSegment/index.js +1 -1
  37. package/dist/components/longText/index.js +1 -1
  38. package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
  39. package/dist/components/pointCloud2DRectOperationView/useUpdateRectList.js +1 -0
  40. package/dist/components/pointCloud2DRectOperationView/util.js +1 -0
  41. package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  42. package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
  43. package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
  44. package/dist/components/pointCloudView/PointCloudBackView.js +1 -1
  45. package/dist/components/pointCloudView/PointCloudContext.js +1 -1
  46. package/dist/components/pointCloudView/PointCloudInfos.js +1 -1
  47. package/dist/components/pointCloudView/PointCloudLayout.js +1 -1
  48. package/dist/components/pointCloudView/PointCloudListener.js +1 -1
  49. package/dist/components/pointCloudView/PointCloudSegment2DView.js +1 -1
  50. package/dist/components/pointCloudView/PointCloudSideView.js +1 -1
  51. package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
  52. package/dist/components/pointCloudView/components/HighlightVisible/index.js +1 -1
  53. package/dist/components/pointCloudView/hooks/useBoxes.js +1 -1
  54. package/dist/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
  55. package/dist/components/pointCloudView/hooks/useHighlight.js +1 -1
  56. package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
  57. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  58. package/dist/components/pointCloudView/hooks/usePolygon.js +1 -1
  59. package/dist/components/pointCloudView/hooks/useRotate.js +1 -1
  60. package/dist/components/pointCloudView/hooks/useRotateEdge.js +1 -0
  61. package/dist/components/pointCloudView/hooks/useSingleBox.js +1 -1
  62. package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
  63. package/dist/components/pointCloudView/hooks/useTimeoutFunc.js +1 -0
  64. package/dist/components/pointCloudView/hooks/useWindowKeydownListener.js +1 -0
  65. package/dist/components/pointCloudView/index.js +1 -1
  66. package/dist/components/pointCloudView/utils/event-polyfill.js +1 -0
  67. package/dist/components/pointCloudView/utils/map.js +1 -0
  68. package/dist/components/subAttributeList/index.js +1 -0
  69. package/dist/components/videoAnnotate/videoClipTool/index.js +1 -1
  70. package/dist/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
  71. package/dist/hooks/useToolStyle.js +1 -0
  72. package/dist/index.css +140 -17
  73. package/dist/index.js +1 -1
  74. package/dist/store/Actions.js +1 -1
  75. package/dist/store/annotatedBox/index.js +1 -1
  76. package/dist/store/annotation/actionCreators.js +1 -1
  77. package/dist/store/annotation/reducer.js +1 -1
  78. package/dist/types/App.d.ts +5 -1
  79. package/dist/types/components/AnnotationView/index.d.ts +1 -0
  80. package/dist/types/components/DynamicResizer/DynamicResizer.d.ts +5 -0
  81. package/dist/types/components/DynamicResizer/hooks/useDrag.d.ts +12 -0
  82. package/dist/types/components/DynamicResizer/hooks/useUpdateHeight.d.ts +23 -0
  83. package/dist/types/components/DynamicResizer/index.d.ts +2 -0
  84. package/dist/types/components/DynamicResizer/types/interface.d.ts +17 -0
  85. package/dist/types/components/LLMToolView/utils/data.d.ts +1 -1
  86. package/dist/types/components/audioAnnotate/audioContext/index.d.ts +10 -2
  87. package/dist/types/components/audioAnnotate/textInput/index.d.ts +1 -0
  88. package/dist/types/components/audioAnnotate/utils/dataTransform.d.ts +9 -0
  89. package/dist/types/components/audioPlayer/clipRegion/index.d.ts +1 -0
  90. package/dist/types/components/audioPlayer/index.d.ts +28 -21
  91. package/dist/types/components/longText/index.d.ts +1 -0
  92. package/dist/types/components/pointCloud2DRectOperationView/index.d.ts +1 -0
  93. package/dist/types/components/pointCloud2DRectOperationView/useUpdateRectList.d.ts +2 -0
  94. package/dist/types/components/pointCloud2DRectOperationView/util.d.ts +8 -0
  95. package/dist/types/components/pointCloudView/2DViewWorker.d.ts +1 -0
  96. package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +2 -1
  97. package/dist/types/components/pointCloudView/PointCloudContext.d.ts +28 -4
  98. package/dist/types/components/pointCloudView/PointCloudLayout.d.ts +1 -0
  99. package/dist/types/components/pointCloudView/components/HighlightVisible/index.d.ts +2 -1
  100. package/dist/types/components/pointCloudView/hooks/useDataLinkSwitch.d.ts +19 -0
  101. package/dist/types/components/pointCloudView/hooks/useHighlight.d.ts +1 -1
  102. package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +8 -0
  103. package/dist/types/components/pointCloudView/hooks/useRotateEdge.d.ts +9 -0
  104. package/dist/types/components/pointCloudView/hooks/useSingleBox.d.ts +3 -2
  105. package/dist/types/components/pointCloudView/hooks/useTimeoutFunc.d.ts +6 -0
  106. package/dist/types/components/pointCloudView/hooks/useWindowKeydownListener.d.ts +16 -0
  107. package/dist/types/components/pointCloudView/utils/event-polyfill.d.ts +8 -0
  108. package/dist/types/components/pointCloudView/utils/map.d.ts +11 -0
  109. package/dist/types/components/subAttributeList/index.d.ts +10 -0
  110. package/dist/types/components/videoAnnotate/index.d.ts +2 -1
  111. package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +2 -1
  112. package/dist/types/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.d.ts +1 -1
  113. package/dist/types/hooks/useToolStyle.d.ts +30 -0
  114. package/dist/types/index.d.ts +7 -2
  115. package/dist/types/store/Actions.d.ts +1 -0
  116. package/dist/types/store/annotatedBox/index.d.ts +2 -0
  117. package/dist/types/store/annotation/actionCreators.d.ts +3 -2
  118. package/dist/types/store/annotation/reducer.d.ts +1 -0
  119. package/dist/types/store/annotation/types.d.ts +9 -2
  120. package/dist/types/utils/AnnotationDataUtils.d.ts +58 -1
  121. package/dist/types/utils/ToolPointCloudBoxRenderHelper.d.ts +23 -0
  122. package/dist/types/utils/index.d.ts +31 -1
  123. package/dist/types/views/MainView/sidebar/GeneralOperation/ActionsConfirm.d.ts +1 -0
  124. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.d.ts +3 -0
  125. package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +1 -1
  126. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.d.ts +9 -0
  127. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.d.ts +3 -0
  128. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/index.d.ts +1 -0
  129. package/dist/types/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.d.ts +10 -2
  130. package/dist/types/views/MainView/toolFooter/index.d.ts +1 -1
  131. package/dist/types/views/MainView/toolHeader/StepSwitch/index.d.ts +1 -1
  132. package/dist/types/views/MainView/toolHeader/index.d.ts +1 -1
  133. package/dist/utils/AnnotationDataUtils.js +1 -1
  134. package/dist/utils/ToolPointCloudBoxRenderHelper.js +1 -0
  135. package/dist/utils/index.js +1 -1
  136. package/dist/views/MainView/index.js +1 -1
  137. package/dist/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
  138. package/dist/views/MainView/sidebar/NLPSidebar/NLPAnnotatedList.js +1 -1
  139. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js +1 -0
  140. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.module.scss.js +1 -0
  141. package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  142. package/dist/views/MainView/sidebar/TagSidebar/index.js +1 -1
  143. package/dist/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
  144. package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
  145. package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.js +1 -0
  146. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
  147. package/dist/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
  148. package/dist/views/MainView/toolFooter/index.js +1 -1
  149. package/dist/views/MainView/toolHeader/index.js +1 -1
  150. package/es/App.js +1 -1
  151. package/es/_virtual/2DViewWorker.js +1 -0
  152. package/es/_virtual/highlightSegmentWorker.js +1 -1
  153. package/es/assets/annotation/icon_link.svg.js +1 -0
  154. package/es/assets/annotation/icon_unlink.svg.js +1 -0
  155. package/es/assets/annotation/pointCloudTool/Image2DBoxScale.svg.js +1 -0
  156. package/es/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
  157. package/es/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
  158. package/es/assets/annotation/pointCloudTool/rotate90_black.svg.js +1 -0
  159. package/es/components/AnnotationView/index.js +1 -1
  160. package/es/components/DynamicResizer/DynamicResizer.js +1 -0
  161. package/es/components/DynamicResizer/assets/bottomToZero.svg.js +1 -0
  162. package/es/components/DynamicResizer/assets/divider.svg.js +1 -0
  163. package/es/components/DynamicResizer/assets/topToZero.svg.js +1 -0
  164. package/es/components/DynamicResizer/hooks/useDrag.js +1 -0
  165. package/es/components/DynamicResizer/hooks/useUpdateHeight.js +1 -0
  166. package/es/components/DynamicResizer/index.js +1 -0
  167. package/es/components/LLMToolView/index.js +1 -1
  168. package/es/components/LLMToolView/questionView/components/header/index.js +1 -1
  169. package/es/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
  170. package/es/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
  171. package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
  172. package/es/components/LLMToolView/sidebar/index.js +1 -1
  173. package/es/components/LLMToolView/utils/data.js +1 -1
  174. package/es/components/NLPToolView/index.js +1 -1
  175. package/es/components/audioAnnotate/audioContext/index.js +1 -1
  176. package/es/components/audioAnnotate/audioSide/clipSidebar/index.js +2 -1
  177. package/es/components/audioAnnotate/index.js +1 -1
  178. package/es/components/audioAnnotate/textInput/index.js +1 -1
  179. package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -1
  180. package/es/components/audioAnnotate/utils/dataTransform.js +1 -0
  181. package/es/components/audioPlayer/clipRegion/index.js +1 -1
  182. package/es/components/audioPlayer/index.js +1 -1
  183. package/es/components/audioPlayer/useAudioCombine/index.js +3 -2
  184. package/es/components/audioPlayer/useAudioSegment/index.js +1 -1
  185. package/es/components/longText/index.js +1 -1
  186. package/es/components/pointCloud2DRectOperationView/index.js +1 -1
  187. package/es/components/pointCloud2DRectOperationView/useUpdateRectList.js +1 -0
  188. package/es/components/pointCloud2DRectOperationView/util.js +1 -0
  189. package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  190. package/es/components/pointCloudView/PointCloud2DView.js +1 -1
  191. package/es/components/pointCloudView/PointCloud3DView.js +1 -1
  192. package/es/components/pointCloudView/PointCloudBackView.js +1 -1
  193. package/es/components/pointCloudView/PointCloudContext.js +1 -1
  194. package/es/components/pointCloudView/PointCloudInfos.js +1 -1
  195. package/es/components/pointCloudView/PointCloudLayout.js +1 -1
  196. package/es/components/pointCloudView/PointCloudListener.js +1 -1
  197. package/es/components/pointCloudView/PointCloudSegment2DView.js +1 -1
  198. package/es/components/pointCloudView/PointCloudSideView.js +1 -1
  199. package/es/components/pointCloudView/PointCloudTopView.js +1 -1
  200. package/es/components/pointCloudView/components/HighlightVisible/index.js +1 -1
  201. package/es/components/pointCloudView/hooks/useBoxes.js +1 -1
  202. package/es/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
  203. package/es/components/pointCloudView/hooks/useHighlight.js +1 -1
  204. package/es/components/pointCloudView/hooks/useHistory.js +1 -1
  205. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  206. package/es/components/pointCloudView/hooks/usePolygon.js +1 -1
  207. package/es/components/pointCloudView/hooks/useRotate.js +1 -1
  208. package/es/components/pointCloudView/hooks/useRotateEdge.js +1 -0
  209. package/es/components/pointCloudView/hooks/useSingleBox.js +1 -1
  210. package/es/components/pointCloudView/hooks/useStatus.js +1 -1
  211. package/es/components/pointCloudView/hooks/useTimeoutFunc.js +1 -0
  212. package/es/components/pointCloudView/hooks/useWindowKeydownListener.js +1 -0
  213. package/es/components/pointCloudView/index.js +1 -1
  214. package/es/components/pointCloudView/utils/event-polyfill.js +1 -0
  215. package/es/components/pointCloudView/utils/map.js +1 -0
  216. package/es/components/subAttributeList/index.js +1 -0
  217. package/es/components/videoAnnotate/videoClipTool/index.js +1 -1
  218. package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
  219. package/es/hooks/useToolStyle.js +1 -0
  220. package/es/index.css +140 -17
  221. package/es/index.js +1 -1
  222. package/es/store/Actions.js +1 -1
  223. package/es/store/annotatedBox/index.js +1 -1
  224. package/es/store/annotation/actionCreators.js +1 -1
  225. package/es/store/annotation/reducer.js +1 -1
  226. package/es/utils/AnnotationDataUtils.js +1 -1
  227. package/es/utils/ToolPointCloudBoxRenderHelper.js +1 -0
  228. package/es/utils/index.js +1 -1
  229. package/es/views/MainView/index.js +1 -1
  230. package/es/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
  231. package/es/views/MainView/sidebar/NLPSidebar/NLPAnnotatedList.js +1 -1
  232. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js +1 -0
  233. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.module.scss.js +1 -0
  234. package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  235. package/es/views/MainView/sidebar/TagSidebar/index.js +1 -1
  236. package/es/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
  237. package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
  238. package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.js +1 -0
  239. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
  240. package/es/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
  241. package/es/views/MainView/toolHeader/index.js +1 -1
  242. package/package.json +5 -3
  243. package/dist/assets/annotation/pointCloudTool/rotate180_black.svg.js +0 -1
  244. package/dist/assets/icons/9d70807.svg +0 -5
  245. package/es/assets/annotation/pointCloudTool/rotate180_black.svg.js +0 -1
@@ -1 +1 @@
1
- "use strict";var React=require("react"),icons=require("@ant-design/icons"),dom=require("../../../../utils/dom.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,t)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(e,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(e,t,r[t]);return e};const HighlightVisible=({visible:e,style:r,onClick:t,loading:a})=>{const i={background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,fontSize:16};let o=e?icons.EyeFilled:icons.EyeInvisibleFilled;return a&&(o=icons.LoadingOutlined,Object.assign(i,{borderRadius:100})),React__default.default.createElement(o,{className:dom.getClassName("point-cloud-highlight-view"),style:__spreadValues(__spreadValues({},i),r),onClick:a?()=>{}:t})};module.exports=HighlightVisible;
1
+ "use strict";var React=require("react"),icons=require("@ant-design/icons"),dom=require("../../../../utils/dom.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,t)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(e,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(e,t,r[t]);return e};const HighlightVisible=({visible:e,style:r,onClick:t,loading:a,disabled:o})=>{const l={background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,fontSize:16},s={background:"rgba(0, 0, 0, 0.2)",color:"rgba(255, 255, 255, 0.5)",cursor:"not-allowed"};let i=e?icons.EyeFilled:icons.EyeInvisibleFilled;a&&(i=icons.LoadingOutlined,Object.assign(l,{borderRadius:100}));const n=__spreadValues(__spreadValues({},l),r);return o&&Object.assign(n,s),React__default.default.createElement(i,{disabled:o,className:dom.getClassName("point-cloud-highlight-view"),style:n,onClick:a||o?()=>{}:t})};module.exports=HighlightVisible;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),antd=require("antd"),usePointCloudViews=require("./usePointCloudViews.js"),PointCloudContext=require("../PointCloudContext.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_);const useBoxes=({config:t})=>{const{selectedIDs:l,pointCloudBoxList:c,displayPointCloudList:s,setPointCloudResult:p,syncAllViewPointCloudColor:f}=React.useContext(PointCloudContext.PointCloudContext),[o,a]=React.useState([]),{pointCloudBoxListUpdated:d}=usePointCloudViews.usePointCloudViews(),{t:r,i18n:C}=reactI18next.useTranslation(),x=n=>t.trackConfigurable!==!0?!1:c.some(u=>n.some(e=>e.trackID===u.trackID)),i=React.useMemo(()=>s.filter(n=>l.includes(n.id)),[l,s]),D=React.useCallback(()=>{i.length>0?a(___default.default.cloneDeep(i)):(a([]),antd.message.error(r("CopyEmptyInPointCloud")))},[l,s,C.language]),P=React.useCallback(()=>{if(o.length===0){antd.message.error(r("PasteEmptyInPointCloud"));return}const n=x(o),u=e=>{p(e),d==null||d(e),a([]),f(e)};if(n)antd.Modal.confirm({title:r("HasDuplicateIDHeader"),content:r("HasDuplicateIDMsg"),onOk:()=>{const e=c.filter(g=>!o.find(I=>I.trackID===g.trackID)).concat(o);u(e)}});else{const e=[...s,...o];u(e)}},[o,s,C.language]);return{copySelectedBoxes:D,pasteSelectedBoxes:P,copiedBoxes:o,selectedBoxes:i}};exports.useBoxes=useBoxes;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),antd=require("antd"),usePointCloudViews=require("./usePointCloudViews.js"),PointCloudContext=require("../PointCloudContext.js"),reactI18next=require("react-i18next"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_);const useBoxes=({config:t})=>{const{selectedIDs:l,pointCloudBoxList:c,displayPointCloudList:r,setPointCloudResult:p,syncAllViewPointCloudColor:f}=React.useContext(PointCloudContext.PointCloudContext),[o,i]=React.useState([]),{pointCloudBoxListUpdated:d}=usePointCloudViews.usePointCloudViews(),{t:n,i18n:C}=reactI18next.useTranslation(),x=s=>t.trackConfigurable!==!0?!1:c.some(u=>s.some(e=>e.trackID===u.trackID)),a=React.useMemo(()=>r.filter(s=>l.includes(s.id)),[l,r]),P=React.useCallback(()=>{a.length>0?i(___default.default.cloneDeep(a)):(i([]),antd.message.error(n("CopyEmptyInPointCloud")))},[l,r,C.language]),D=React.useCallback(()=>{if(o.length===0){antd.message.error(n("PasteEmptyInPointCloud"));return}const s=x(o),u=e=>{p(e),d==null||d(e),i([]),f(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiPaste,e)};if(s)antd.Modal.confirm({title:n("HasDuplicateIDHeader"),content:n("HasDuplicateIDMsg"),onOk:()=>{const e=c.filter(g=>!o.find(I=>I.trackID===g.trackID)).concat(o);u(e)}});else{const e=[...r,...o];u(e)}},[o,r,C.language]);return{copySelectedBoxes:P,pasteSelectedBoxes:D,copiedBoxes:o,selectedBoxes:a}};exports.useBoxes=useBoxes;
@@ -0,0 +1 @@
1
+ "use strict";var React=require("react"),ahooks=require("ahooks"),PointCloudContext=require("../PointCloudContext.js"),icon_link=require("../../../assets/annotation/icon_link.svg.js"),icon_unlink=require("../../../assets/annotation/icon_unlink.svg.js"),BatchSwitchConnectIn2DView=require("../../../views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js"),lbAnnotation=require("@labelbee/lb-annotation"),usePointCloudViews=require("./usePointCloudViews.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const useShownIcon=e=>{const{imageNamePointCloudBoxMap:s,linkageImageNameRectMap:l}=React.useContext(PointCloudContext.PointCloudContext),a=React.useMemo(()=>e?s.has(e):(console.error("Missing image name"),!1),[e,s]),d=React.useMemo(()=>{var o,f;return e?((f=(o=l.get(e))==null?void 0:o.size)!=null?f:0)>0:!1},[l,e]),m=React.useMemo(()=>a||d,[a,d]),g=ahooks.useLatest(m);return{visible:m,visibleRef:g}},iconSize={width:16,height:16},useDataLinkSwitch=e=>{e.imageName||console.warn("missing imageName");const[s,l]=React.useState(!0),a=ahooks.useLatest(e.imageName),{addRectFromPointCloudBoxByImageName:d,removeRectByPointCloudBoxId:m,linkageImageNameRectMap:g,pointCloudBoxList:o,rectList:f,updateRectListByReducer:k}=React.useContext(PointCloudContext.PointCloudContext),{visible:v,visibleRef:x}=useShownIcon(e.imageName),{syncToPointCloudBoxList:b}=usePointCloudViews.useSyncRectPositionDimensionToPointCloudList(),R=ahooks.useLatest(d),L=ahooks.useLatest(m),B=ahooks.useLatest(()=>b()),h=React.useCallback(t=>{if(!x.current)return;const n=a.current;if(!n){console.warn("invalid image name");return}l(t),t?L.current(n):R.current(n)},[]),y=ahooks.useLatest(t=>{t&&B.current(),h(t)}),E=React.useMemo(()=>{var t;if(!e.is2DView||!v)return null;const i={zIndex:(t=e.zIndex)!=null?t:999,position:"absolute",top:16,right:16+28+12,background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28};return React__default.default.createElement("div",{style:i},s&&React__default.default.createElement("img",{src:icon_link,style:iconSize}),!s&&React__default.default.createElement("img",{src:icon_unlink,style:iconSize}))},[s,e.is2DView,e.zIndex,v]),M=ahooks.useLatest(g),I=React.useCallback(()=>{var t,n;if(!e.is2DView)return;const i=a.current;if(!i){console.warn("invalid image name");return}const r=[...(n=(t=M.current.get(i))==null?void 0:t.keys())!=null?n:[]];let c=!0;r.length&&(c=!1),h(c)},[e.is2DView,h]);return React.useEffect(()=>{I()},[I,o,f]),React.useEffect(()=>{const t=o.map(i=>i.id),n=new Set(t);k((i,C)=>{const r=[],c=[];return i.forEach(u=>{const w=u.extId;w!==void 0&&n.has(w)===!1?r.push(u):c.push(u)}),r.length?[...r.map(u=>C(u)),...c]:i})},[o]),React.useEffect(()=>{const t=n=>{y.current(n)};return lbAnnotation.EventBus.on(BatchSwitchConnectIn2DView.EventBusEvent.switchConnect,t),()=>lbAnnotation.EventBus.unbind(BatchSwitchConnectIn2DView.EventBusEvent.switchConnect,t)},[]),{rendered:E,isLinking:s}};module.exports=useDataLinkSwitch;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__async=(s,r,t)=>new Promise((u,a)=>{var e=i=>{try{n(t.next(i))}catch(l){a(l)}},d=i=>{try{n(t.throw(i))}catch(l){a(l)}},n=i=>i.done?u(i.value):Promise.resolve(i.value).then(e,d);n((t=t.apply(s,r)).next())});const useHighlight=({currentData:s})=>{var r;const{mainViewInstance:t,topViewInstance:u,pointCloudBoxList:a,highlight2DDataList:e,setHighlight2DDataList:d}=React.useContext(PointCloudContext.PointCloudContext),n=(r=s==null?void 0:s.mappingImgList)!=null?r:[],i=(o,h)=>__async(void 0,null,function*(){var p;let g=[...e];if(e.find(c=>c.url===o)?g=e.filter(c=>c.url!==o):g.push({url:o,calib:h}),d(g),!t||(n==null?void 0:n.length)===0)return;const v=t.pointCloudObject;if(!v)return;const f=yield t.getHighlightIndexByMappingImgList({mappingImgList:g,points:v.geometry.attributes.position.array}),C=yield t.highlightOriginPointCloud(a,f);C&&((p=u==null?void 0:u.pointCloudInstance)==null||p.updateColor(C))}),l=React.useCallback(o=>e.findIndex(h=>h.url===o)>=0,[e]);return{toggle2dVisible:i,isHighlightVisible:l}};exports.useHighlight=useHighlight;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__async=(s,u,t)=>new Promise((g,a)=>{var n=i=>{try{o(t.next(i))}catch(l){a(l)}},d=i=>{try{o(t.throw(i))}catch(l){a(l)}},o=i=>i.done?g(i.value):Promise.resolve(i.value).then(n,d);o((t=t.apply(s,u)).next())});const useHighlight=({currentData:s})=>{var u;const{mainViewInstance:t,topViewInstance:g,pointCloudBoxList:a,highlight2DDataList:n,setHighlight2DDataList:d}=React.useContext(PointCloudContext.PointCloudContext),o=(u=s==null?void 0:s.mappingImgList)!=null?u:[],i=(r,c,C)=>__async(void 0,null,function*(){var p;let h=[...n];if(n.find(e=>e.url===r)?h=n.filter(e=>e.url!==r):h.push({url:r,fallbackUrl:c,calib:C}),d(h),!t||(o==null?void 0:o.length)===0)return;const v=t.pointCloudObject;if(!v)return;const f=yield t.getHighlightIndexByMappingImgList({mappingImgList:h,points:v.geometry.attributes.position.array});try{const e=yield t.highlightOriginPointCloud(a,f);e&&((p=g==null?void 0:g.pointCloudInstance)==null||p.updateColor(e))}catch(e){console.error("toggle2dVisible highlightOriginPointCloud error:",e)}}),l=React.useCallback(r=>n.findIndex(c=>c.url===r)>=0,[n]);return{toggle2dVisible:i,isHighlightVisible:l}};exports.useHighlight=useHighlight;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,s)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s,__spreadValues=(e,n)=>{for(var s in n||(n={}))__hasOwnProp.call(n,s)&&__defNormalProp(e,s,n[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(n))__propIsEnum.call(n,s)&&__defNormalProp(e,s,n[s]);return e};const useHistory=()=>{const{history:e,setPointCloudResult:n,setSelectedIDs:s,pointCloudBoxList:L,pointCloudSphereList:y,setPointCloudSphereList:g,mainViewInstance:u,topViewInstance:d,polygonList:c,setPolygonList:f,lineList:p,setLineList:C,syncAllViewPointCloudColor:P,segmentation:a}=React.useContext(PointCloudContext.PointCloudContext),x=({newBoxParams:t,newPolygon:o,newLine:i,newSphereParams:l})=>{const r={pointCloudBoxList:L,polygonList:c,lineList:p,pointCloudSphereList:y};t&&(r.pointCloudBoxList=L.concat(t)),o&&(r.polygonList=c.concat(o)),i&&(r.lineList=p.concat(i)),l&&(r.pointCloudSphereList=y.concat(l)),e.pushHistory(r)},v=t=>{const o={pointCloudBoxList:L,polygonList:c,lineList:p,pointCloudSphereList:y,segmentation:a};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),t.pointCloudSphereList&&(o.pointCloudSphereList=t.pointCloudSphereList),t.segmentation&&(o.segmentation=t.segmentation),e.pushHistory(o)},S=t=>{if(p.find(i=>i.id===t.id)){const i=p.map(l=>l.id===t.id?t:__spreadValues({},l));e.pushHistory({lineList:i}),C(i)}},_=t=>{if(c.find(i=>i.id===t.id)){const i=c.map(l=>l.id===t.id?t:__spreadValues({},l));e.pushHistory({pointCloudBoxList:L,polygonList:i}),f(i)}},H=({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i})=>{e.initRecord({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i,lineList:p},!0)},h=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:l=[],pointCloudSphereList:r=[]}=t;o&&(L.length!==o.length&&s(),u==null||u.clearAllBox(),u==null||u.generateBoxes(o),n(o),P(o)),r&&(y.length!==r.length&&s(),u==null||u.clearAllSphere(),u==null||u.generateSpheres(r),g(r)),i&&f(i),l&&C(l),d==null||d.updatePolygonList(o!=null?o:[],i!=null?i:[]),d==null||d.updateLineList(l!=null?l:[]),d==null||d.updatePointList(r)};return{addHistory:x,pushHistoryWithList:v,initHistory:H,pushHistoryUnderUpdatePolygon:_,pushHistoryUnderUpdateLine:S,redo:()=>{h(e.redo())},undo:()=>{h(e.undo())}}};exports.useHistory=useHistory;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,n,s)=>n in i?__defProp(i,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[n]=s,__spreadValues=(i,n)=>{for(var s in n||(n={}))__hasOwnProp.call(n,s)&&__defNormalProp(i,s,n[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(n))__propIsEnum.call(n,s)&&__defNormalProp(i,s,n[s]);return i};const useHistory=()=>{const{history:i,setPointCloudResult:n,setSelectedIDs:s,pointCloudBoxList:L,pointCloudSphereList:y,setPointCloudSphereList:h,mainViewInstance:d,topViewInstance:u,polygonList:c,setPolygonList:f,lineList:p,setLineList:C,syncAllViewPointCloudColor:P,segmentation:a}=React.useContext(PointCloudContext.PointCloudContext),x=({newBoxParams:t,newPolygon:o,newLine:e,newSphereParams:l})=>{const r={pointCloudBoxList:L,polygonList:c,lineList:p,pointCloudSphereList:y};t&&(r.pointCloudBoxList=L.concat(t)),o&&(r.polygonList=c.concat(o)),e&&(r.lineList=p.concat(e)),l&&(r.pointCloudSphereList=y.concat(l)),i.pushHistory(r)},v=t=>{const o={pointCloudBoxList:L,polygonList:c,lineList:p,pointCloudSphereList:y,segmentation:a};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),t.pointCloudSphereList&&(o.pointCloudSphereList=t.pointCloudSphereList),t.segmentation&&(o.segmentation=t.segmentation),i.pushHistory(o)},S=t=>{if(p.find(e=>e.id===t.id)){const e=p.map(l=>l.id===t.id?t:__spreadValues({},l));i.pushHistory({lineList:e}),C(e)}},_=t=>{if(c.find(e=>e.id===t.id)){const e=c.map(l=>l.id===t.id?t:__spreadValues({},l));i.pushHistory({pointCloudBoxList:L,polygonList:e}),f(e)}},B=({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:e})=>{i.initRecord({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:e,lineList:p},!0)},g=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:e=[],lineList:l=[],pointCloudSphereList:r=[]}=t;o&&(L.length!==o.length&&s(),d==null||d.clearAllBox(),d==null||d.generateBoxes(o),n(o),P(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.UndoRedo,o)),r&&(y.length!==r.length&&s(),d==null||d.clearAllSphere(),d==null||d.generateSpheres(r),h(r)),e&&f(e),l&&C(l),u==null||u.updatePolygonList(o!=null?o:[],e!=null?e:[]),u==null||u.updateLineList(l!=null?l:[]),u==null||u.updatePointList(r)};return{addHistory:x,pushHistoryWithList:v,initHistory:B,pushHistoryUnderUpdatePolygon:_,pushHistoryUnderUpdateLine:S,redo:()=>{g(i.redo())},undo:()=>{g(i.undo())}}};exports.useHistory=useHistory;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,n)=>new Promise((a,o)=>{var d=u=>{try{c(n.next(u))}catch(f){o(f)}},P=u=>{try{c(n.throw(u))}catch(f){o(f)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(d,P);c((n=n.apply(e,t)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(e,t,n,a,o)=>{const{x:d,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(e,t),{defaultZ:c}=lbUtils.DEFAULT_SPHERE_PARAMS,u={center:{x:d,y:P,z:c},id:e.id},f=a?__spreadValues(__spreadValues({},a),u):__spreadProps(__spreadValues({},u),{attribute:"",valid:!0});return o&&Object.assign(f,o),f},topViewPolygon2PointCloud=(e,t,n,a,o,d)=>{let P=e.pointList.map(y=>lbUtils.PointCloudUtils.transferCanvas2World(y,t)),c=0,u=1,f={};if(n){const y=n.getSensesPointZAxisInPolygon(P,void 0,d);d&&y.fittedCoordinates.length>0&&(P=y.fittedCoordinates),c=(y.maxZ+y.minZ)/2,u=y.maxZ-y.minZ,f={count:y.zCount}}const[v,B,j]=P,_=lbAnnotation.MathUtils.getLineCenterPoint([v,j]),O=lbAnnotation.MathUtils.getLineLength(v,B),I=lbAnnotation.MathUtils.getLineLength(B,j),A=lbAnnotation.MathUtils.getRadiusFromQuadrangle(e.pointList);a&&(c=a.center.z,u=a.depth);const k={center:{x:_.x,y:_.y,z:c},width:d?I+INTELLIGENT_FIT_MARGIN:I,height:d?O+INTELLIGENT_FIT_MARGIN:O,depth:u,rotation:A,id:e.id},R=__spreadValues(a?__spreadValues(__spreadValues({},a),k):__spreadProps(__spreadValues({},k),{attribute:"",valid:!0}),f);o&&Object.assign(R,o);const z=P.map(y=>lbUtils.PointCloudUtils.transferWorld2Canvas(y,t));return{boxParams:R,newPointList:z}},sideViewPoint2PointCloud=(e,t,n)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x-a.x,y:n.center.y,z:n.center.z-a.y}})},sideViewPolygon2PointCloud=(e,t,n,a)=>{const[o,d,P]=e.pointList,[c,u,f]=t.pointList,v=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),B=lbAnnotation.MathUtils.getLineCenterPoint([c,f]),_={x:{x:v.x-B.x,y:v.y-B.y}.x,y:0,z:v.y-B.y},O=lbAnnotation.MathUtils.getLineLength(o,d),I=lbAnnotation.MathUtils.getLineLength(c,u),A=O-I,k=lbAnnotation.MathUtils.getLineLength(d,P),R=lbAnnotation.MathUtils.getLineLength(u,f),z=k-R,{newBoxParams:y}=a.getNewBoxBySideUpdate(_,z,A,n);return y},backViewPoint2PointCloud=(e,t,n)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x,y:n.center.y-a.x,z:n.center.z-a.y}})},backViewPolygon2PointCloud=(e,t,n,a)=>{const[o,d,P]=e.pointList,[c,u,f]=t.pointList,v=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),B=lbAnnotation.MathUtils.getLineCenterPoint([c,f]),_={x:{x:v.x-B.x,y:v.y-B.y}.x,y:0,z:v.y-B.y},O=lbAnnotation.MathUtils.getLineLength(o,d),I=lbAnnotation.MathUtils.getLineLength(c,u),A=O-I,k=lbAnnotation.MathUtils.getLineLength(d,P),R=lbAnnotation.MathUtils.getLineLength(u,f),z=k-R;let{newBoxParams:y}=a.getNewBoxByBackUpdate(_,z,A,n);return y},syncSideViewByPoint=(e,t,n,a,o)=>{var d;if(!n)return;const{toolInstance:P,pointCloudInstance:c}=n;c.loadPCDFile(a,(d=o==null?void 0:o.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(u);const{point2d:f,zoom:v}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=v,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(v),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),f),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeSideView=(e,t,n,a)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:d}=n;d.loadPCDFileByBox(a,e,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Left);d.setInitCameraPosition(P);const{polygon2d:c,zoom:u}=d.getBoxSidePolygon2DCoordinate(e);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncBackViewByPoint=(e,t,n,a,o)=>{var d;if(!n)return;const{toolInstance:P,pointCloudInstance:c}=n;c.loadPCDFile(a,(d=o==null?void 0:o.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(u);const{point2d:f,zoom:v}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=v,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(v),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),f),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeBackView=(e,t,n,a)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:d}=n;d.loadPCDFileByBox(a,e,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Back);d.setInitCameraPosition(P);const{polygon2d:c,zoom:u}=d.getBoxBackPolygon2DCoordinate(e);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncTopViewByPoint=(e,t,n,a)=>{if(!n||!a)return;a.generateSphere(e),a.updateCameraBySphere(e,lbUtils.EPerspectiveView.Top),a.render();const{toolInstance:o,pointCloudInstance:d}=n,{point2d:P}=d.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?__spreadProps(__spreadValues(__spreadValues({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},synchronizeTopView=(e,t,n,a)=>{var o,d;if(!n||!a)return;a.generateBox(e,t.id),a.render();const{pointCloud2dOperation:P,pointCloudInstance:c}=n,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),f=[...P.polygonList],v=f.find(B=>B.id===t.id);v?(v.pointList=u,v.valid=(o=e.valid)!=null?o:!0):f.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(d=e.valid)!=null?d:!0}),P.setResultAndSelectedID(f,t.id)},usePointCloudViews=()=>{const e=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:n,backViewInstance:a,mainViewInstance:o,addPointCloudBox:d,addPointCloudSphere:P,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:f,pointCloudSphereList:v,hideAttributes:B,setHighlight2DDataList:j,cuboidBoxIn2DView:_,imageSizes:O}=e,{addHistory:I,initHistory:A,pushHistoryUnderUpdatePolygon:k}=useHistory.useHistory(),{selectedPolygon:R}=usePolygon.usePolygon(),{getPointCloudSphereByID:z,updatePointCloudSphere:y,selectedSphere:q}=useSphere.useSphere(),{currentData:M,config:w}=ctx.useSelector(i=>{const{stepList:s,step:p,imgList:l,imgIndex:r}=i.annotation;return{currentData:l[r],config:index.jsonParser(StepUtils.getCurrentStepInfo(p,s).config)}}),T=ctx.useDispatch(),tt=ahooks.useLatest(_),W=i=>{if(!tt.current){const{mappingImgList:s=[]}=M,p=s.map(l=>index.getRectPointCloudBox({pointCloudBox:i,mappingData:l,imageSizes:O}));Object.assign(i,{rects:p.filter(l=>l!==void 0)})}},{selectedBox:S,updateSelectedBox:ot,updateSelectedBoxes:Z,getPointCloudByID:et}=useSingleBox.useSingleBox({generateRects:W}),Q=S==null?void 0:S.info;if(!t||!n||!a)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:G}=t,it=i=>{o==null||o.generateBox(i),o==null||o.controls.update(),o==null||o.render()},nt=i=>{o==null||o.generateSphere(i),o==null||o.controls.update(),o==null||o.render()},st=({newPoint:i,size:s,zoom:p,trackConfigurable:l})=>{var r;const C={attribute:(r=t.toolInstance.defaultAttribute)!=null?r:""};l===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const h=topViewPoint2PointCloud(i,s,G,void 0,C);c(i.id);const x=P(h);F(PointCloudView.Top,i,h,p,x,w),I({newSphereParams:h})},lt=({polygon:i,size:s,imgList:p,trackConfigurable:l,zoom:r,intelligentFit:C})=>{var h,x;const g={attribute:(h=t.toolInstance.defaultAttribute)!=null?h:""};l===!0&&Object.assign(g,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:f,extraSphereList:v})});const b=t==null?void 0:t.toolInstance,m=__spreadValues({},i);let{boxParams:L,newPointList:D}=topViewPolygon2PointCloud(m,s,G,void 0,g,C);L=T(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[L],stepConfig:w,action:"viewUpdateBox"}))[0],C&&(D==null?void 0:D.length)&&(m.pointList=D);const U=B.includes(m.attribute);W(L);const N=d(L),J=(x=e==null?void 0:e.polygonList)!=null?x:[];t==null||t.updatePolygonList(N!=null?N:[],J),U?c([]):(c(L.id),b.selection.setSelectedIDs(m.id),E({omitView:PointCloudView.Top,polygon:m,boxParams:L,zoom:r,newPointCloudBoxList:N}),C&&synchronizeTopView(L,m,t,o)),I({newBoxParams:L})},rt=i=>{const{boxID:s,imageName:p,width:l,height:r,x:C,y:h}=i,x=f.find(g=>g.id===s);if(x==null?void 0:x.rects){const{rects:g=[]}=x,b=g.find(m=>m.imageName===p);if(b){let m=g;const L=__spreadProps(__spreadValues({},b),{width:l,height:r,x:C,y:h});m=g.map(U=>U===b?L:U);const D=__spreadProps(__spreadValues({},x),{rects:m}),V=f.map(U=>U===x?D:U);return t==null||t.updatePolygonList(V!=null?V:[]),V}}},at=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:p,newSphereList:l})=>{var r;const C=t==null?void 0:t.toolInstance;if(!(u.length===0||!C)){if(i||(S==null?void 0:S.info)){const h=i!=null?i:S==null?void 0:S.info;(r=C==null?void 0:C.selection)==null||r.setSelectedIDs(u[0]);const x=C.selectedPolygon;if(u.length===1&&h){E({omitView:PointCloudView.Top,polygon:x,boxParams:h,newPointCloudBoxList:s});return}}if((p||q)&&u.length===1){const h=p!=null?p:q;C.setSelectedID(u[0]);const x=C.selectedPoint;h&&F(PointCloudView.Top,x,h,void 0,l,w)}}},X=(i,s,p)=>{if(Q){let l,r;switch(p){case PointCloudView.Back:l=backViewPolygon2PointCloud;break;case PointCloudView.Side:l=sideViewPolygon2PointCloud;break;default:l=sideViewPolygon2PointCloud;break}if(r=l(i,s,Q,n.pointCloudInstance),o){const{count:b}=o.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=__spreadProps(__spreadValues({},r),{count:b})}const h=T(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[r],stepConfig:w,action:"viewUpdateBox"}))[0],x=r.valid!==h.valid;r=h;const g=ot(r);return r=g.find(b=>b.id===r.id),E({omitView:x?void 0:p,polygon:i,boxParams:r,newPointCloudBoxList:g}),g}},Y=(i,s,p)=>{if(q){let l,r;switch(p){case PointCloudView.Back:l=backViewPoint2PointCloud;break;case PointCloudView.Side:l=sideViewPoint2PointCloud;break;default:l=sideViewPoint2PointCloud;break}r=l(i,s,q);const C=y(r);return F(p,i,r,void 0,C,w),C}},dt=(i,s)=>{Y(i,s,PointCloudView.Side)},ct=(i,s)=>{Y(i,s,PointCloudView.Back)},ut=(i,s)=>{X(i,s,PointCloudView.Side)},pt=(i,s)=>{X(i,s,PointCloudView.Back)},Pt=(i,s)=>{const p=z(i.id),l=topViewPoint2PointCloud(i,s,G,p),r=y(l);F(PointCloudView.Top,i,l,void 0,r,w)},Ct=(i,s)=>{if(R){const l=__spreadValues({},i[0].newPolygon);l.pointList=l.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,s)),k(l);return}let p=i.map(({newPolygon:l})=>{const r=et(l.id),{boxParams:C}=topViewPolygon2PointCloud(l,s,t.pointCloudInstance,r);return C});if(p=T(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:p,stepConfig:w,action:"viewUpdateBox"})),p.length===1){const{newPolygon:l}=i[0],r=Z(p);E({polygon:l,boxParams:p[0],newPointCloudBoxList:r})}else{const l=Z(p);l&&e.syncAllViewPointCloudColor(l)}},gt=i=>{var s,p,l,r,C;if(S){const h=Number(i.widthDefault),x=Number(i.depthDefault),g=Number(i.heightDefault),b=S==null?void 0:S.info.trackID,L=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(H=>(H==null?void 0:H.trackID)===b),D={width:(l=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:l.width,height:(C=(r=t==null?void 0:t.toolInstance)==null?void 0:r.basicImgInfo)==null?void 0:C.height},V=L.pointList.map(H=>lbUtils.PointCloudUtils.transferCanvas2World(H,D)),U=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(V,g,h),N=U[0],J=U[2],K=lbAnnotation.MathUtils.getLineCenterPoint([N,J]),ht=S.info.center.z-S.info.depth/2,$=__spreadProps(__spreadValues({},S.info),{center:{x:K.x,y:K.y,z:ht+x/2},width:h,height:g,depth:x,valid:!0}),ft=Z([$]);E({omitView:PointCloudView["3D"],polygon:L,boxParams:$,newPointCloudBoxList:ft})}},F=(i,s,p,l,r,C)=>__async(void 0,null,function*(){const h=M==null?void 0:M.url,x={[PointCloudView.Side]:()=>{syncSideViewByPoint(p,s,n,h,C)},[PointCloudView.Back]:()=>{a&&syncBackViewByPoint(p,s,a,h,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(p,s,t,o)}};Object.keys(x).forEach(g=>{g!==i&&x[g]()}),l&&(o==null||o.updateCameraZoom(l)),nt(p)}),E=i=>__async(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:l,zoom:r,newPointCloudBoxList:C}=i,h=M==null?void 0:M.url;C&&(yield e.syncAllViewPointCloudColor(C));const x={[PointCloudView.Side]:()=>{synchronizeSideView(l,p,n,h)},[PointCloudView.Back]:()=>{a&&synchronizeBackView(l,p,a,h)},[PointCloudView.Top]:()=>{synchronizeTopView(l,p,t,o)}};Object.keys(x).forEach(g=>{g!==s&&x[g]()}),r&&(o==null||o.updateCameraZoom(r)),it(l)});return{topViewAddSphere:st,topViewAddBox:lt,topViewSelectedChanged:at,topViewUpdatePoint:Pt,sideViewUpdatePoint:dt,backViewUpdatePoint:ct,topViewUpdateBox:Ct,sideViewUpdateBox:ut,backViewUpdateBox:pt,pointCloudBoxListUpdated:i=>{t.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const s=lbUtils.PointCloudUtils.getDefaultOrthographicParams(i);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>__async(void 0,[...i],function*(s=M){var p,l,r,C,h,x;if(!(s==null?void 0:s.url)||!o)return;j([]),actionCreators.SetPointCloudLoading(T,!0),actionCreators.SetLoadPCDFileLoading(T,!0),yield o.loadPCDFile(s.url,(p=w==null?void 0:w.radius)!=null?p:DEFAULT_RADIUS),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let g=[],b=[],m=[],L=[];o.updateTopCamera();const D=(r=(l=index.jsonParser(s.result))==null?void 0:l.valid)!=null?r:!0;if(e.setPointCloudValid(D),(C=e.sideViewInstance)==null||C.clearAllData(),(h=e.backViewInstance)==null||h.clearAllData(),s.result){if(g=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),(g==null?void 0:g.length)>0&&s.isPreResult&&(w==null?void 0:w.lowerLimitPointsNumInBox)>0){g=yield o==null?void 0:o.filterPreResult(s.url,w,g);const V=index.jsonParser(s.result);V[lbUtils.POINT_CLOUD_DEFAULT_STEP].result=g,s.result=JSON.stringify(V),e.setPointCloudResult(g)}m=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),b=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),L=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),t.updateData(s.url,s.result,{radius:(x=w==null?void 0:w.radius)!=null?x:DEFAULT_RADIUS}),o==null||o.generateBoxes(g),o==null||o.generateSpheres(L),yield e.syncAllViewPointCloudColor(g,[])}A({pointCloudBoxList:g,polygonList:m,lineList:b,pointCloudSphereList:L}),actionCreators.SetPointCloudLoading(T,!1),actionCreators.SetLoadPCDFileLoading(T,!1)}),updateViewsByDefaultSize:gt,generateRects:W,update2DViewRect:rt}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),_=require("lodash"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,n)=>new Promise((c,o)=>{var p=a=>{try{u(n.next(a))}catch(x){o(x)}},g=a=>{try{u(n.throw(a))}catch(x){o(x)}},u=a=>a.done?c(a.value):Promise.resolve(a.value).then(p,g);u((n=n.apply(e,t)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(e,t,n,c,o)=>{const{x:p,y:g}=lbUtils.PointCloudUtils.transferCanvas2World(e,t),{defaultZ:u}=lbUtils.DEFAULT_SPHERE_PARAMS,a={center:{x:p,y:g,z:u},id:e.id},x=c?__spreadValues(__spreadValues({},c),a):__spreadProps(__spreadValues({},a),{attribute:"",valid:!0});return o&&Object.assign(x,o),x},topViewPolygon2PointCloud=(e,t,n,c,o,p)=>{let g=e.pointList.map(B=>lbUtils.PointCloudUtils.transferCanvas2World(B,t)),u=0,a=1,x={};if(n){const B=n.getSensesPointZAxisInPolygon(g,void 0,p);p&&B.fittedCoordinates.length>0&&(g=B.fittedCoordinates),u=(B.maxZ+B.minZ)/2,a=B.maxZ-B.minZ,x={count:B.zCount}}const[h,L,U]=g,I=lbAnnotation.MathUtils.getLineCenterPoint([h,U]),b=lbAnnotation.MathUtils.getLineLength(h,L),V=lbAnnotation.MathUtils.getLineLength(L,U),k=lbAnnotation.MathUtils.getRadiusFromQuadrangle(e.pointList);c&&(u=c.center.z,a=c.depth);const R={center:{x:I.x,y:I.y,z:u},width:p?V+INTELLIGENT_FIT_MARGIN:V,height:p?b+INTELLIGENT_FIT_MARGIN:b,depth:a,rotation:k,id:e.id},T=__spreadValues(c?__spreadValues(__spreadValues({},c),R):__spreadProps(__spreadValues({},R),{attribute:"",valid:!0}),x);o&&Object.assign(T,o);const A=g.map(B=>lbUtils.PointCloudUtils.transferWorld2Canvas(B,t));return{boxParams:T,newPointList:A}},sideViewPoint2PointCloud=(e,t,n)=>{const c={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x-c.x,y:n.center.y,z:n.center.z-c.y}})},sideViewPolygon2PointCloud=(e,t,n,c)=>{const[o,p,g]=e.pointList,[u,a,x]=t.pointList,h=lbAnnotation.MathUtils.getLineCenterPoint([o,g]),L=lbAnnotation.MathUtils.getLineCenterPoint([u,x]),I={x:{x:h.x-L.x,y:h.y-L.y}.x,y:0,z:h.y-L.y},b=lbAnnotation.MathUtils.getLineLength(o,p),V=lbAnnotation.MathUtils.getLineLength(u,a),k=b-V,R=lbAnnotation.MathUtils.getLineLength(p,g),T=lbAnnotation.MathUtils.getLineLength(a,x),A=R-T,{newBoxParams:B}=c.getNewBoxBySideUpdate(I,A,k,n);return B},backViewPoint2PointCloud=(e,t,n)=>{const c={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x,y:n.center.y-c.x,z:n.center.z-c.y}})},backViewPolygon2PointCloud=(e,t,n,c)=>{const[o,p,g]=e.pointList,[u,a,x]=t.pointList,h=lbAnnotation.MathUtils.getLineCenterPoint([o,g]),L=lbAnnotation.MathUtils.getLineCenterPoint([u,x]),I={x:{x:h.x-L.x,y:h.y-L.y}.x,y:0,z:h.y-L.y},b=lbAnnotation.MathUtils.getLineLength(o,p),V=lbAnnotation.MathUtils.getLineLength(u,a),k=b-V,R=lbAnnotation.MathUtils.getLineLength(p,g),T=lbAnnotation.MathUtils.getLineLength(a,x),A=R-T;let{newBoxParams:B}=c.getNewBoxByBackUpdate(I,A,k,n);return B},syncSideViewByPoint=(e,t,n,c,o)=>{var p;if(!n)return;const{toolInstance:g,pointCloudInstance:u}=n;u.loadPCDFile(c,(p=o==null?void 0:o.radius)!=null?p:DEFAULT_RADIUS);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Left);u.setInitCameraPosition(a);const{point2d:x,zoom:h}=u.getSphereSidePoint2DCoordinate(e);u.camera.zoom=h,u.camera.updateProjectionMatrix(),u.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([__spreadProps(__spreadValues(__spreadValues({},t),x),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},synchronizeSideView=(e,t,n,c)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:p}=n;p.loadPCDFileByBox(c,e,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:g}=p.updateOrthoCamera(e,lbUtils.EPerspectiveView.Left);p.setInitCameraPosition(g);const{polygon2d:u,zoom:a}=p.getBoxSidePolygon2DCoordinate(e);p.camera.zoom=a,p.camera.updateProjectionMatrix(),p.render(),o.initPosition(),o.zoomChangeOnCenter(a),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncBackViewByPoint=(e,t,n,c,o)=>{var p;if(!n)return;const{toolInstance:g,pointCloudInstance:u}=n;u.loadPCDFile(c,(p=o==null?void 0:o.radius)!=null?p:DEFAULT_RADIUS);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Back);u.setInitCameraPosition(a);const{point2d:x,zoom:h}=u.getSphereBackPoint2DCoordinate(e);u.camera.zoom=h,u.camera.updateProjectionMatrix(),u.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([__spreadProps(__spreadValues(__spreadValues({},t),x),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},synchronizeBackView=(e,t,n,c)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:p}=n;p.loadPCDFileByBox(c,e,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:g}=p.updateOrthoCamera(e,lbUtils.EPerspectiveView.Back);p.setInitCameraPosition(g);const{polygon2d:u,zoom:a}=p.getBoxBackPolygon2DCoordinate(e);p.camera.zoom=a,p.camera.updateProjectionMatrix(),p.render(),o.initPosition(),o.zoomChangeOnCenter(a),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncTopViewByPoint=(e,t,n,c)=>{if(!n||!c)return;c.generateSphere(e),c.updateCameraBySphere(e,lbUtils.EPerspectiveView.Top),c.render();const{toolInstance:o,pointCloudInstance:p}=n,{point2d:g}=p.getSphereTopPoint2DCoordinate(e),u=[...o.pointList].map(a=>a.id===t.id?__spreadProps(__spreadValues(__spreadValues({},t),g),{valid:e.valid,textAttribute:"",attribute:e.attribute}):a);o.setResult(u),o.setSelectedID(t.id)},synchronizeTopView=(e,t,n,c)=>{var o,p;if(!n||!c)return;c.generateBox(e,t.id),c.render();const{pointCloud2dOperation:g,pointCloudInstance:u}=n,{polygon2d:a}=u.getBoxTopPolygon2DCoordinate(e),x=[...g.polygonList],h=x.find(L=>L.id===t.id);h?(h.pointList=a,h.valid=(o=e.valid)!=null?o:!0):x.push({id:t.id,pointList:a,textAttribute:"",isRect:!0,valid:(p=e.valid)!=null?p:!0}),g.setResultAndSelectedID(x,t.id)},usePointCloudViews=()=>{const e=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:n,backViewInstance:c,mainViewInstance:o,addPointCloudBox:p,addPointCloudSphere:g,setSelectedIDs:u,selectedIDs:a,pointCloudBoxList:x,pointCloudSphereList:h,hideAttributes:L,setHighlight2DDataList:U,cuboidBoxIn2DView:I,imageSizes:b,history:V,linkageImageNameRectMap:k}=e,{addHistory:R,initHistory:T,pushHistoryUnderUpdatePolygon:A}=useHistory.useHistory(),{selectedPolygon:B}=usePolygon.usePolygon(),{getPointCloudSphereByID:ot,updatePointCloudSphere:Y,selectedSphere:q}=useSphere.useSphere(),{currentData:j,config:m}=ctx.useSelector(s=>{const{stepList:i,step:d,imgList:r,imgIndex:l}=s.annotation;return{currentData:r[l],config:index.jsonParser(StepUtils.getCurrentStepInfo(d,i).config)}}),M=ctx.useDispatch(),it=ahooks.useLatest(I),nt=ahooks.useLatest(k),st=React.useCallback((s,i)=>{const d=nt.current,r=i.id;return s.filter(P=>{if(!P)return!1;const C=d.get(P.imageName);return C===void 0?!0:Boolean(C.get(r))})},[]),Z=s=>{const{enableAutoMap2DRect:i=!1}=m;if(!it.current||i){const{mappingImgList:d=[]}=j;index.generatePointCloudBoxRects({pointCloudBox:s,mappingImgList:d,imageSizes:b},{prepareRectsFn:st})}},{selectedBox:D,updateSelectedBox:rt,updateSelectedBoxes:G,getPointCloudByID:lt}=useSingleBox.useSingleBox({generateRects:Z}),K=D==null?void 0:D.info;if(!t||!n||!c)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:J}=t,at=s=>{o==null||o.generateSphere(s),o==null||o.controls.update(),o==null||o.render()},dt=({newPoint:s,size:i,zoom:d,trackConfigurable:r})=>{var l;const P={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(P,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const C=topViewPoint2PointCloud(s,i,J,void 0,P);u(s.id);const f=g(C);H(PointCloudView.Top,s,C,d,f,m),R({newSphereParams:C})},ut=({polygon:s,size:i,imgList:d,trackConfigurable:r,zoom:l,intelligentFit:P})=>{var C,f,v;const S={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(S,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:x,extraSphereList:h})});const z=t==null?void 0:t.toolInstance,w=__spreadValues({},s);let{boxParams:y,newPointList:O}=topViewPolygon2PointCloud(w,i,J,void 0,S,P);y=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[y],stepConfig:m,action:"viewUpdateBox"}))[0],P&&(O==null?void 0:O.length)&&(w.pointList=O);const X=L.includes(w.attribute);Z(y);const E=p(y),F=(f=e==null?void 0:e.polygonList)!=null?f:[];y.subAttribute=lbAnnotation.TagUtils.getDefaultResultByConfig((m==null?void 0:m.secondaryAttributeConfigurable)?(v=m==null?void 0:m.inputList)!=null?v:[]:[]),t==null||t.updatePolygonList(E!=null?E:[],F),X?u([]):(u(y.id),z.selection.setSelectedIDs(w.id),N({omitView:PointCloudView.Top,polygon:w,boxParams:y,zoom:l,newPointCloudBoxList:E}),P&&synchronizeTopView(y,w,t,o)),R({newBoxParams:y})},ct=s=>{const{boxID:i,imageName:d,width:r,height:l,x:P,y:C}=s,f=x.find(y=>y.id===i);if(!(f==null?void 0:f.rects)||!f.rects.find(y=>y.imageName===d))return;const S=f.rects.map(y=>y.imageName===d?__spreadProps(__spreadValues({},y),{width:r,height:l,x:P,y:C}):y),z=__spreadProps(__spreadValues({},f),{rects:S}),w=x.map(y=>y.id===i?z:y);return t==null||t.updatePolygonList(w!=null?w:[]),w},pt=s=>{const{boxID:i,imageName:d}=s,r=x.find(f=>f.id===i);if(!(r==null?void 0:r.rects))return;const l=r.rects.filter(f=>f.imageName!==d),P=__spreadProps(__spreadValues({},r),{rects:l}),C=x.map(f=>f.id===i?P:f);return t==null||t.updatePolygonList(C!=null?C:[]),C},Pt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:d,newSphereList:r})=>{var l;const P=t==null?void 0:t.toolInstance;if(!(a.length===0||!P)){if(s||(D==null?void 0:D.info)){const C=s!=null?s:D==null?void 0:D.info;(l=P==null?void 0:P.selection)==null||l.setSelectedIDs(a[0]);const f=P.selectedPolygon;if(a.length===1&&C){N({omitView:PointCloudView.Top,polygon:f,boxParams:C,newPointCloudBoxList:i});return}}if((d||q)&&a.length===1){const C=d!=null?d:q;P.setSelectedID(a[0]);const f=P.selectedPoint;C&&H(PointCloudView.Top,f,C,void 0,r,m)}}},$=(s,i,d)=>{if(K){let r,l;switch(d){case PointCloudView.Back:r=backViewPolygon2PointCloud;break;case PointCloudView.Side:r=sideViewPolygon2PointCloud;break;default:r=sideViewPolygon2PointCloud;break}if(l=r(s,i,K,n.pointCloudInstance),o){const{count:S}=o.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=__spreadProps(__spreadValues({},l),{count:S})}const C=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[l],stepConfig:m,action:"viewUpdateBox"}))[0],f=l.valid!==C.valid;l=C;const v=rt(l);return l=v.find(S=>S.id===l.id),N({omitView:f?void 0:d,polygon:s,boxParams:l,newPointCloudBoxList:v}),v}},tt=(s,i,d)=>{if(q){let r,l;switch(d){case PointCloudView.Back:r=backViewPoint2PointCloud;break;case PointCloudView.Side:r=sideViewPoint2PointCloud;break;default:r=sideViewPoint2PointCloud;break}l=r(s,i,q);const P=Y(l);return H(d,s,l,void 0,P,m),P}},gt=(s,i)=>{tt(s,i,PointCloudView.Side)},Ct=(s,i)=>{tt(s,i,PointCloudView.Back)},ft=(s,i)=>{$(s,i,PointCloudView.Side)},xt=(s,i)=>{$(s,i,PointCloudView.Back)},ht=(s,i)=>{const d=ot(s.id),r=topViewPoint2PointCloud(s,i,J,d),l=Y(r);H(PointCloudView.Top,s,r,void 0,l,m)},vt=(s,i)=>{if(B){const r=__spreadValues({},s[0].newPolygon);r.pointList=r.pointList.map(l=>lbUtils.PointCloudUtils.transferCanvas2World(l,i)),A(r);return}let d=s.map(({newPolygon:r})=>{const l=lt(r.id),{boxParams:P}=topViewPolygon2PointCloud(r,i,t.pointCloudInstance,l);return P});if(d=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:d,stepConfig:m,action:"viewUpdateBox"})),d.length===1){const{newPolygon:r}=s[0],l=G(d);N({polygon:r,boxParams:d[0],newPointCloudBoxList:l})}else{const r=G(d);r&&e.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiMove,r)}},yt=s=>{var i,d,r,l,P;if(D){const C=Number(s.widthDefault),f=Number(s.depthDefault),v=Number(s.heightDefault),S=D==null?void 0:D.info.trackID,w=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(W=>(W==null?void 0:W.trackID)===S),y={width:(r=(d=t==null?void 0:t.toolInstance)==null?void 0:d.basicImgInfo)==null?void 0:r.width,height:(P=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:P.height},O=w.pointList.map(W=>lbUtils.PointCloudUtils.transferCanvas2World(W,y)),Q=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(O,v,C),X=Q[0],E=Q[2],F=lbAnnotation.MathUtils.getLineCenterPoint([X,E]),Lt=D.info.center.z-D.info.depth/2,et=__spreadProps(__spreadValues({},D.info),{center:{x:F.x,y:F.y,z:Lt+f/2},width:C,height:v,depth:f,valid:!0}),mt=G([et]);N({omitView:PointCloudView["3D"],polygon:w,boxParams:et,newPointCloudBoxList:mt})}},H=(s,i,d,r,l,P)=>__async(void 0,null,function*(){const C=j==null?void 0:j.url,f={[PointCloudView.Side]:()=>{syncSideViewByPoint(d,i,n,C,P)},[PointCloudView.Back]:()=>{c&&syncBackViewByPoint(d,i,c,C,P)},[PointCloudView.Top]:()=>{syncTopViewByPoint(d,i,t,o)}};Object.keys(f).forEach(v=>{v!==s&&f[v]()}),r&&(o==null||o.updateCameraZoom(r)),at(d)}),N=s=>{const{omitView:i,polygon:d,boxParams:r,zoom:l,newPointCloudBoxList:P}=s,C=j==null?void 0:j.url;P&&e.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single,P);const f={[PointCloudView.Side]:()=>{synchronizeSideView(r,d,n,C)},[PointCloudView.Back]:()=>{c&&synchronizeBackView(r,d,c,C)},[PointCloudView.Top]:()=>{synchronizeTopView(r,d,t,o)}};Object.keys(f).forEach(v=>{v!==i&&f[v]()}),l&&(o==null||o.updateCameraZoom(l))};return{topViewAddSphere:dt,topViewAddBox:ut,topViewSelectedChanged:Pt,topViewUpdatePoint:ht,sideViewUpdatePoint:gt,backViewUpdatePoint:Ct,topViewUpdateBox:vt,sideViewUpdateBox:ft,backViewUpdateBox:xt,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),o==null||o.generateBoxes(s)},initPointCloud3d:s=>{if(!o)return;const i=lbUtils.PointCloudUtils.getDefaultOrthographicParams(s);o.initOrthographicCamera(i),o.initRenderer(),o.render()},updatePointCloudData:(...s)=>__async(void 0,[...s],function*(i=j){var d,r,l,P,C,f;if(!(i==null?void 0:i.url)||!o)return;U([]),actionCreators.SetPointCloudLoading(M,!0),actionCreators.SetLoadPCDFileLoading(M,!0),yield o.loadPCDFile(i.url,(d=m==null?void 0:m.radius)!=null?d:DEFAULT_RADIUS),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let v=[],S=[],z=[],w=[];o.updateTopCamera();const y=(l=(r=index.jsonParser(i.result))==null?void 0:r.valid)!=null?l:!0;if(e.setPointCloudValid(y),(P=e.sideViewInstance)==null||P.clearAllData(),(C=e.backViewInstance)==null||C.clearAllData(),i.result){if(v=lbUtils.PointCloudUtils.getBoxParamsFromResultList(i.result),(v==null?void 0:v.length)>0&&i.isPreResult&&(m==null?void 0:m.lowerLimitPointsNumInBox)>0){v=yield o==null?void 0:o.filterPreResult(i.url,m,v);const O=index.jsonParser(i.result);O[lbUtils.POINT_CLOUD_DEFAULT_STEP].result=v,i.result=JSON.stringify(O),e.setPointCloudResult(v)}z=lbUtils.PointCloudUtils.getPolygonListFromResultList(i.result),S=lbUtils.PointCloudUtils.getLineListFromResultList(i.result),w=lbUtils.PointCloudUtils.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(f=m==null?void 0:m.radius)!=null?f:DEFAULT_RADIUS}),o==null||o.generateBoxes(v),o==null||o.generateSpheres(w),yield e.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,v,[])}T({pointCloudBoxList:v,polygonList:z,lineList:S,pointCloudSphereList:w}),actionCreators.SetPointCloudLoading(M,!1),actionCreators.SetLoadPCDFileLoading(M,!1)}),updateViewsByDefaultSize:yt,generateRects:Z,update2DViewRect:ct,remove2DViewRect:pt}},useSyncRectPositionDimensionToPointCloudList=()=>{const{pointCloudBoxList:e,rectList:t,setPointCloudResult:n}=React.useContext(PointCloudContext.PointCloudContext),c=ahooks.useLatest(e),o=ahooks.useLatest(t);return{syncToPointCloudBoxList:React.useCallback(()=>{const g=c.current,u=o.current;if(u.length===0)return null;const a=new Map,x=new Set;if(u.filter(h=>h.extId!==void 0).forEach(h=>{const L=h.extId,U=h.imageName,I=_.pick(h,["x","y","width","height"]);let b=a.get(L);b||(b=new Map,a.set(L,b)),b.set(U,I),x.add(L)}),a.size){const h=g.map(L=>{var U;const I=L.id;if(x.has(I)){const b=__spreadValues({},L);return(U=b.rects)==null||U.forEach(V=>{var k;const R=V.imageName;Object.assign(V,(k=a.get(I))==null?void 0:k.get(R))}),b}return L});return n(h),h}return null},[])}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews,exports.useSyncRectPositionDimensionToPointCloudList=useSyncRectPositionDimensionToPointCloudList;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useHistory=require("./useHistory.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,e,t)=>e in o?__defProp(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,__spreadValues=(o,e)=>{for(var t in e||(e={}))__hasOwnProp.call(e,t)&&__defNormalProp(o,t,e[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(e))__propIsEnum.call(e,t)&&__defNormalProp(o,t,e[t]);return o},__spreadProps=(o,e)=>__defProps(o,__getOwnPropDescs(e));const usePolygon=()=>{const{polygonList:o,setPolygonList:e,selectedID:t}=React.useContext(PointCloudContext.PointCloudContext),{addHistory:l,pushHistoryWithList:a}=useHistory.useHistory(),i=o.find(r=>r.id===t);return{addPolygon:r=>{e(o.concat(r)),l({newPolygon:r})},deletePolygon:r=>{const s=o.filter(n=>n.id!==r).map(n=>__spreadValues({},n));e(s),a({polygonList:s})},selectedPolygon:i,updateSelectedPolygon:r=>{i&&e(o.map(s=>s.id===t?r:s))},updatePolygonValidByID:r=>{o.find(n=>n.id===r)&&e(o.map(n=>n.id===r?__spreadProps(__spreadValues({},n),{valid:!n.valid}):n))}}};exports.usePolygon=usePolygon;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useHistory=require("./useHistory.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,o,t)=>o in e?__defProp(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,__spreadValues=(e,o)=>{for(var t in o||(o={}))__hasOwnProp.call(o,t)&&__defNormalProp(e,t,o[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(o))__propIsEnum.call(o,t)&&__defNormalProp(e,t,o[t]);return e},__spreadProps=(e,o)=>__defProps(e,__getOwnPropDescs(o));const usePolygon=()=>{const{polygonList:e,pointCloudBoxList:o,setPolygonList:t,selectedID:a}=React.useContext(PointCloudContext.PointCloudContext),{addHistory:p,pushHistoryWithList:u}=useHistory.useHistory(),d=e.find(r=>r.id===a);return{addPolygon:r=>{t(e.concat(r)),p({newPolygon:r})},deletePolygon:r=>{const i=e.filter(s=>s.id!==r).map(s=>__spreadValues({},s));t(i);const n={polygonList:i};try{const s=o.filter(l=>l.id!==r).map(l=>__spreadValues({},l));s.length<o.length&&(n.pointCloudBoxList=s)}catch(s){console.error("exec update history pointCloudBoxList error:",s)}u(n)},selectedPolygon:d,updateSelectedPolygon:r=>{d&&t(e.map(i=>i.id===a?r:i))},updatePolygonValidByID:r=>{e.find(n=>n.id===r)&&t(e.map(n=>n.id===r?__spreadProps(__spreadValues({},n),{valid:!n.valid}):n))}}};exports.usePolygon=usePolygon;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),usePointCloudViews=require("./usePointCloudViews.js"),useSingleBox=require("./useSingleBox.js"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),ahooks=require("ahooks");const{ERotateDirection}=lbAnnotation.cAnnotation,useRotate=({currentData:o})=>{const t=React.useContext(PointCloudContext.PointCloudContext),{selectedBox:i,updateSelectedBox:a}=useSingleBox.useSingleBox(),{run:c}=ahooks.useThrottleFn(s=>{const{topViewInstance:l,mainViewInstance:n,syncAllViewPointCloudColor:d}=t;if(!l||!n)return;const{pointCloud2dOperation:r}=l,e=i==null?void 0:i.info;if(!e||!(o==null?void 0:o.url)||!t.backViewInstance)return;const C=a({rotation:lbUtils.PointCloudUtils.restrictAngleRange(e.rotation+Number(Math.PI*s)/180)});r.rotatePolygon(s,ERotateDirection.Anticlockwise);const u=r.selectedPolygon;n.generateBox(e),d(C),usePointCloudViews.synchronizeSideView(e,u,t.sideViewInstance,o.url),usePointCloudViews.synchronizeBackView(e,u,t.backViewInstance,o.url),n.render()},{wait:800});return{updateRotate:c}};exports.useRotate=useRotate;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),usePointCloudViews=require("./usePointCloudViews.js"),useSingleBox=require("./useSingleBox.js"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),ahooks=require("ahooks");const{ERotateDirection}=lbAnnotation.cAnnotation,useRotate=({currentData:o})=>{const t=React.useContext(PointCloudContext.PointCloudContext),{selectedBox:i,updateSelectedBox:a}=useSingleBox.useSingleBox(),{run:c}=ahooks.useThrottleFn(r=>{const{topViewInstance:l,mainViewInstance:n,syncAllViewPointCloudColor:d}=t;if(!l||!n)return;const{pointCloud2dOperation:s}=l,e=i==null?void 0:i.info;if(!e||!(o==null?void 0:o.url)||!t.backViewInstance)return;const C=a({rotation:lbUtils.PointCloudUtils.restrictAngleRange(e.rotation+Number(Math.PI*r)/180)});s.rotatePolygon(r,ERotateDirection.Anticlockwise);const u=s.selectedPolygon;n.generateBox(e),d(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleRotate,C),usePointCloudViews.synchronizeSideView(e,u,t.sideViewInstance,o.url),usePointCloudViews.synchronizeBackView(e,u,t.backViewInstance,o.url),n.render()},{wait:800});return{updateRotate:c}};exports.useRotate=useRotate;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),usePointCloudViews=require("./usePointCloudViews.js"),useSingleBox=require("./useSingleBox.js"),PointCloudContext=require("../PointCloudContext.js"),ahooks=require("ahooks"),lbUtils=require("@labelbee/lb-utils");const useRotateEdge=({currentData:t})=>{const o=React.useContext(PointCloudContext.PointCloudContext),{selectedBox:r,updateSelectedBox:d}=useSingleBox.useSingleBox(),{run:a}=ahooks.useThrottleFn(c=>{const{topViewInstance:l,mainViewInstance:i}=o;if(!l||!i)return;const{pointCloud2dOperation:s}=l,e=r==null?void 0:r.info;if(!e||!(t==null?void 0:t.url)||!o.backViewInstance)return;const n=s.selectedPolygon.pointList||[],g=n.shift();n.push(g),d({newPointList:n,rotation:lbUtils.PointCloudUtils.restrictAngleRange(e.rotation+Number(Math.PI*c)/180),width:e.height,height:e.width}),s.rotatePolygonEdge(n);const u=s.selectedPolygon;i.generateBox(e),usePointCloudViews.synchronizeSideView(e,u,o.sideViewInstance,t.url),usePointCloudViews.synchronizeBackView(e,u,o.backViewInstance,t.url),i.render()},{wait:800});return{updateRotateEdge:a}};exports.useRotateEdge=useRotateEdge;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(n,e,i)=>e in n?__defProp(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,__spreadValues=(n,e)=>{for(var i in e||(e={}))__hasOwnProp.call(e,i)&&__defNormalProp(n,i,e[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(e))__propIsEnum.call(e,i)&&__defNormalProp(n,i,e[i]);return n},__spreadProps=(n,e)=>__defProps(n,__getOwnPropDescs(e));const{ESortDirection}=lbAnnotation.cAnnotation,useSingleBox=n=>{const{pointCloudBoxList:e,setPointCloudResult:i,topViewInstance:d,backViewInstance:P,sideViewInstance:y,selectedIDs:f,selectedID:x,mainViewInstance:a,setSelectedIDs:m,syncAllViewPointCloudColor:B,polygonList:D,pointCloudPattern:C}=React.useContext(PointCloudContext.PointCloudContext),{selectedPolygon:u,updateSelectedPolygon:V,updatePolygonValidByID:h,deletePolygon:L}=usePolygon.usePolygon(),{pushHistoryWithList:b}=useHistory.useHistory(),r=React.useMemo(()=>{const o=e.findIndex(l=>l.id===x);if(o>-1)return{info:e[o],index:o}},[x,e]),w=React.useCallback(o=>{var l;if(r==null?void 0:r.info){(l=n==null?void 0:n.generateRects)==null||l.call(n,o),e.splice(r.index,1,___default.default.merge(r.info,o));const t=___default.default.cloneDeep(e);return i(t),b({pointCloudBoxList:t}),t}return e},[x,e]),S=React.useCallback((o,l)=>{const t=e.findIndex(s=>s.id===l);if(t>-1){e.splice(t,1,___default.default.merge(e[t],o));const s=___default.default.cloneDeep(e);return i(s),s}return e},[e]),p=React.useCallback(o=>{d==null||d.pointCloud2dOperation.setPolygonValidAndRender(o,!0),y==null||y.pointCloud2dOperation.setPolygonValidAndRender(o,!0),P==null||P.pointCloud2dOperation.setPolygonValidAndRender(o,!0)},[d,y,P]),j=React.useCallback(()=>{if(r==null?void 0:r.info){const{id:o,valid:l=!0}=r.info,t=w({valid:!l});B(t),p(o)}u&&(V(__spreadProps(__spreadValues({},u),{valid:!u.valid})),d==null||d.pointCloud2dOperation.setPolygonValidAndRender(u.id,!0))},[p,r,u]),k=React.useCallback(o=>{const l=e.find(t=>t.id===o);if(l){const{id:t,valid:s=!0}=l,v=S({valid:!s},t);return p(t),v}h(o)},[p,e,D]),I=React.useCallback((o=ESortDirection.ascend,l=!1)=>{if(!d||f.length>1)return;if(C!==lbAnnotation.EToolName.Rect&&C!==lbAnnotation.EToolName.Polygon){l&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:o!==ESortDirection.ascend}));return}const{pointCloud2dOperation:t}=d,s=t.switchToNextPolygon(o);s&&m(s)},[d,C,d==null?void 0:d.toolInstance]),R=(o=!1)=>{I(ESortDirection.descend,o)},A=(o=!1)=>{I(ESortDirection.ascend,o)},O=o=>{const l=e.filter(t=>t.id!==o);i(l),a==null||a.removeObjectByName(o,"box"),a==null||a.render(),B(l)},E=()=>{r&&(O(r.info.id),d==null||d.pointCloud2dOperation.deletePolygon(r.info.id)),u&&(L(u.id),d==null||d.pointCloud2dOperation.deletePolygon(u.id))},N=React.useMemo(()=>e.filter(o=>f.includes(o.id)),[f,e]),q=React.useCallback(o=>{var l;const t=___default.default.cloneDeep(e);let s=!1;for(const v of o){const g=t.findIndex(c=>c.id===v.id);if(g>-1){const c=___default.default.merge(t[g],v);(l=n==null?void 0:n.generateRects)==null||l.call(n,c),t.splice(g,1,c),a==null||a.generateBox(c),s=!0}}if(s)return i(t),b({pointCloudBoxList:t}),a==null||a.render(),t},[f,e]),H=React.useCallback(o=>e.find(l=>l.id===o),[e]);return{selectedBox:r,updateSelectedBox:w,changeSelectedBoxValid:j,changeValidByID:k,selectNextBox:A,selectPrevBox:R,deletePointCloudBox:O,selectedBoxes:N,updateSelectedBoxes:q,getPointCloudByID:H,deleteSelectedPointCloudBoxAndPolygon:E}};exports.useSingleBox=useSingleBox;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(l,t,d)=>t in l?__defProp(l,t,{enumerable:!0,configurable:!0,writable:!0,value:d}):l[t]=d,__spreadValues=(l,t)=>{for(var d in t||(t={}))__hasOwnProp.call(t,d)&&__defNormalProp(l,d,t[d]);if(__getOwnPropSymbols)for(var d of __getOwnPropSymbols(t))__propIsEnum.call(t,d)&&__defNormalProp(l,d,t[d]);return l},__spreadProps=(l,t)=>__defProps(l,__getOwnPropDescs(t));const{ESortDirection}=lbAnnotation.cAnnotation,useSingleBox=l=>{const{pointCloudBoxList:t,setPointCloudResult:d,topViewInstance:s,backViewInstance:I,sideViewInstance:m,selectedIDs:P,selectedID:B,mainViewInstance:f,setSelectedIDs:N,syncAllViewPointCloudColor:R,polygonList:j,pointCloudPattern:b,rectList:h,updateRectIn2DView:Z,removeRectIn2DView:k,addRectIn2DView:A,updateRectListByReducer:O}=React.useContext(PointCloudContext.PointCloudContext),{selectedPolygon:p,updateSelectedPolygon:T,updatePolygonValidByID:q,deletePolygon:H}=usePolygon.usePolygon(),{pushHistoryWithList:S}=useHistory.useHistory(),a=React.useMemo(()=>{const e=t.findIndex(n=>n.id===B);if(e>-1)return{info:t[e],index:e}},[B,t]),D=React.useCallback(e=>{var n;if(a==null?void 0:a.info){(n=l==null?void 0:l.generateRects)==null||n.call(l,e),t.splice(a.index,1,___default.default.merge(a.info,e));const o=___default.default.cloneDeep(t);return d(o),S({pointCloudBoxList:o}),o}return t},[B,t]),M=React.useCallback((e,n)=>{const o=t.findIndex(i=>i.id===n);if(o>-1){t.splice(o,1,___default.default.merge(t[o],e));const i=___default.default.cloneDeep(t);return d(i),i}return t},[t]),y=React.useCallback(e=>{s==null||s.pointCloud2dOperation.setPolygonValidAndRender(e,!0),m==null||m.pointCloud2dOperation.setPolygonValidAndRender(e,!0),I==null||I.pointCloud2dOperation.setPolygonValidAndRender(e,!0)},[s,m,I]),K=React.useCallback(()=>{if(a==null?void 0:a.info){const{id:e,valid:n=!0}=a.info,o=D({valid:!n});R(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleToggleValid,o),y(e)}p&&(T(__spreadProps(__spreadValues({},p),{valid:!p.valid})),s==null||s.pointCloud2dOperation.setPolygonValidAndRender(p.id,!0))},[y,a,p]),U=React.useCallback(e=>{const n=t.find(o=>o.id===e);if(n){const{id:o,valid:i=!0}=n,u=M({valid:!i},o);return y(o),u}q(e)},[y,t,j]),V=React.useCallback((e=ESortDirection.ascend,n=!1)=>{if(!s||P.length>1)return;if(b!==lbAnnotation.EToolName.Rect&&b!==lbAnnotation.EToolName.Polygon){n&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:e!==ESortDirection.ascend}));return}const{pointCloud2dOperation:o}=s,i=o.switchToNextPolygon(e);i&&N(i)},[s,b,s==null?void 0:s.toolInstance]),F=(e=!1)=>{V(ESortDirection.descend,e)},W=(e=!1)=>{V(ESortDirection.ascend,e)},L=(e,n=!0)=>{const o=t.filter(i=>i.id!==e);if(d(o),f==null||f.removeObjectByName(e,"box"),f==null||f.render(),R(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleDelete,o),n){const i=h.filter(r=>r.extId===e),u=new Set(i.map(r=>r.id));O(E(u))}},E=e=>(n,o)=>{let i=!1;const u=n.map(r=>e.has(r.id)?(i=!0,o(r)):r);return i?u:n},z=React.useCallback((e,n)=>{var o,i;const u=new Set((i=(o=n.mappingImgList)==null?void 0:o.map(c=>c.path))!=null?i:[]),r=new Map;e.forEach(c=>{const C=c.id;(c.rects||[]).forEach(w=>{const{imageName:x}=w;if(u.has(x)){let v=r.get(x);v||(v=new Set,r.set(x,v)),v.add(C)}})});const g=h.filter(c=>{var C;const w=c.extId,x=c.imageName;if(x!==void 0&&w!==void 0){const v=r.get(x);return(C=v==null?void 0:v.has(w))!=null?C:!1}return!1}),Y=new Set(g.map(c=>c.id));O(E(Y))},[h,k,A]),G=e=>{a&&(L(a.info.id,!1),s==null||s.pointCloud2dOperation.deletePolygon(a.info.id),z([a.info],e)),p&&(H(p.id),s==null||s.pointCloud2dOperation.deletePolygon(p.id))},J=React.useMemo(()=>t.filter(e=>P.includes(e.id)),[P,t]),Q=React.useCallback(e=>{var n;const o=___default.default.cloneDeep(t);let i=!1;for(const u of e){const r=o.findIndex(g=>g.id===u.id);if(r>-1){const g=___default.default.merge(o[r],u);(n=l==null?void 0:l.generateRects)==null||n.call(l,g),o.splice(r,1,g),f==null||f.generateBox(g),i=!0}}if(i)return d(o),S({pointCloudBoxList:o}),f==null||f.render(),o},[P,t]),X=React.useCallback(e=>t.find(n=>n.id===e),[t]);return{selectedBox:a,updateSelectedBox:D,changeSelectedBoxValid:K,changeValidByID:U,selectNextBox:W,selectPrevBox:F,deletePointCloudBox:L,selectedBoxes:J,updateSelectedBoxes:Q,getPointCloudByID:X,deleteSelectedPointCloudBoxAndPolygon:G}};exports.useSingleBox=useSingleBox;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),lbUtils=require("@labelbee/lb-utils");const{EToolName,EPolygonPattern}=lbAnnotation.cTool,useStatus=()=>{const{topViewInstance:i,sideViewInstance:r,backViewInstance:u,mainViewInstance:o,setPointCloudResult:d,setPointCloudSphereList:P,setPolygonList:C,pointCloudPattern:a,setPointCloudPattern:e,syncAllViewPointCloudColor:v,globalPattern:n,setLineList:b}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:h}=useHistory.useHistory(),p=()=>{o==null||o.clearAllBox(),o==null||o.clearAllSphere(),o==null||o.render(),d([]),C([]),P([]),b([]),i==null||i.toolScheduler.clearStatusAndResult(),v([]),h({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},l=()=>{r==null||r.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()},y=c=>{if(c===a)return;const s=[i,r,u];switch(c){case EToolName.Rect:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.PointCloudPolygon),t==null||t.toolInstance.setPattern(EPolygonPattern.Rect)}),e(EToolName.Rect);break;case EToolName.Polygon:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.PointCloudPolygon),t==null||t.toolInstance.setPattern(EPolygonPattern.Normal)}),e(EToolName.Polygon);break;case EToolName.Point:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.Point)}),e(EToolName.Point);break;case EToolName.Line:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.Line)}),e(EToolName.Line);break}},w=React.useMemo(()=>n===lbUtils.EPointCloudPattern.Detection,[n]),L=React.useMemo(()=>n===lbUtils.EPointCloudPattern.Segmentation,[n]);return{clearAllResult:p,updatePointCloudPattern:y,pointCloudPattern:a,isPointCloudDetectionPattern:w,isPointCloudSegmentationPattern:L}};exports.useStatus=useStatus;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),lbUtils=require("@labelbee/lb-utils"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js");const{EToolName,EPolygonPattern}=lbAnnotation.cTool,useStatus=()=>{const{topViewInstance:i,sideViewInstance:s,backViewInstance:u,mainViewInstance:e,setPointCloudResult:d,setPointCloudSphereList:P,setPolygonList:C,setRectList:v,pointCloudPattern:a,setPointCloudPattern:o,syncAllViewPointCloudColor:b,globalPattern:l,setLineList:h}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:p}=useHistory.useHistory(),R=()=>{e==null||e.clearAllBox(),e==null||e.clearAllSphere(),e==null||e.render(),d([]),C([]),P([]),h([]),v([]),i==null||i.toolScheduler.clearStatusAndResult(),b(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.ClearAll,[]),p({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},n=()=>{s==null||s.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()},y=c=>{if(c===a)return;const r=[i,s,u];switch(c){case EToolName.Rect:n(),r.forEach(t=>{t==null||t.switchToCanvas(EToolName.PointCloudPolygon),t==null||t.toolInstance.setPattern(EPolygonPattern.Rect)}),o(EToolName.Rect);break;case EToolName.Polygon:n(),r.forEach(t=>{t==null||t.switchToCanvas(EToolName.PointCloudPolygon),t==null||t.toolInstance.setPattern(EPolygonPattern.Normal)}),o(EToolName.Polygon);break;case EToolName.Point:n(),r.forEach(t=>{t==null||t.switchToCanvas(EToolName.Point)}),o(EToolName.Point);break;case EToolName.Line:n(),r.forEach(t=>{t==null||t.switchToCanvas(EToolName.Line)}),o(EToolName.Line);break}},g=React.useMemo(()=>l===lbUtils.EPointCloudPattern.Detection,[l]),L=React.useMemo(()=>l===lbUtils.EPointCloudPattern.Segmentation,[l]);return{clearAllResult:R,updatePointCloudPattern:y,pointCloudPattern:a,isPointCloudDetectionPattern:g,isPointCloudSegmentationPattern:L}};exports.useStatus=useStatus;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),ahooks=require("ahooks");const isNumber=t=>typeof t=="number",useTimeoutFunc=(t,e)=>{const s=ahooks.useMemoizedFn(t),u=React.useRef(null),r=React.useCallback(()=>{u.current&&clearTimeout(u.current)},[]),c=React.useCallback((...o)=>{!isNumber(e)||e<0||(r(),u.current=setTimeout(()=>s(...o),e))},[e]);return React.useEffect(()=>r,[r]),{fn:c,clear:r}};exports.default=useTimeoutFunc,exports.isNumber=isNumber;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react");require("../utils/event-polyfill.js");const EmptyCaller=()=>()=>{},getEmptyUseWindowKeydownListener=()=>({appendEventListener:EmptyCaller,preappendEventListener:EmptyCaller,addEventListener:EmptyCaller}),ctor=()=>{},useWindowKeydownListener=()=>{const n=React.useRef([]),c=React.useCallback(e=>{const t=n.current,s=t.findIndex(o=>o===e);s>-1&&t.splice(s,1)},[]),r=React.useCallback((e,t)=>e?(t(e),()=>{c(e)}):(console.warn("invalid listener"),ctor),[c]),i=React.useCallback(e=>r(e,t=>{n.current.push(t)}),[r]),u=React.useCallback(e=>r(e,t=>{n.current.unshift(t)}),[r]);return React.useEffect(()=>()=>{n.current.length=0},[]),React.useEffect(()=>{const e=t=>{const s=n.current.slice(0);for(let o of s){if(t.isImmediatePropagationStopped())break;o(t)}};return window.addEventListener("keydown",e,!1),()=>{window.removeEventListener("keydown",e,!1)}},[]),React.useMemo(()=>({appendEventListener:i,preappendEventListener:u,addEventListener:i}),[i,u])};exports.default=useWindowKeydownListener,exports.getEmptyUseWindowKeydownListener=getEmptyUseWindowKeydownListener;
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),PointCloudSegment2DView=require("./PointCloudSegment2DView.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js"),classNames=require("classnames"),index$2=require("./components/sideAndBackOverView/index.js"),actionCreators=require("../../store/annotation/actionCreators.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=l=>{const{currentData:i,imgList:g,drawLayerSlot:d,checkMode:n,intelligentFit:P,imgIndex:v,config:p,measureVisible:E}=l,e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:c,setGlobalPattern:L,selectedIDs:m}=e,x=ctx.useDispatch(),[a,C]=React.useState(!1),S=(m==null?void 0:m.length)>0&&a,q=index.jsonParser(i.result),{toolInstanceRef:o,clearToolInstance:b}=annotation.useCustomToolInstance({basicInfo:q});if(React.useEffect(()=>{o.current.setPointCloudGlobalPattern=t=>{t!==c&&(L(t),e.clearAllDetectionInstance(),b())}},[c]),React.useEffect(()=>{var t;if(actionCreators.SetLoadPCDFileLoading(x,!0),i){const{boxParamsList:r,polygonList:u,lineList:s,sphereParamsList:j,segmentation:w}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((t=i==null?void 0:i.result)!=null?t:"");e.setPointCloudResult(r),e.setPolygonList(u),e.setLineList(s),e.setPointCloudSphereList(j),e.setSegmentation(w)}},[v]),React.useEffect(()=>{o.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],o.current.exportCustomData=()=>{var t,r,u,s;return{resultPolygon:(t=e.polygonList)!=null?t:[],resultLine:(r=e.lineList)!=null?r:[],resultPoint:(u=e.pointCloudSphereList)!=null?u:[],segmentation:(s=e.segmentation)!=null?s:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),g.length===0)return null;if(c===lbUtils.EPointCloudPattern.Segmentation)return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:n,toolInstanceRef:o}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout")},React__default.default.createElement(PointCloudSegment,{checkMode:n}),React__default.default.createElement(PointCloudSegment2DView,null)),React__default.default.createElement(PointCloudSegmentStatus,{config:p}),d==null?void 0:d({direct:!0}));let f=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left-bottom")},React__default.default.createElement(PointCloudBackView,{checkMode:n}),React__default.default.createElement(PointCloudSideView,{checkMode:n}));return a&&(f=React__default.default.createElement(index$2,{selectAndEnlarge:S,checkMode:n})),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:n,toolInstanceRef:o}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:t=>t.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left")},React__default.default.createElement(PointCloud3DView,null),f),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right")]:!0,[dom.getClassName("point-cloud-container","rightZoom")]:a})},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:d,checkMode:n,intelligentFit:P,setIsEnlargeTopView:C,onExitZoom:()=>{C(!1)},isEnlargeTopView:a}),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right-bottom")]:!a,[dom.getClassName("point-cloud-container","right-bottom-floatLeft")]:a})},React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:a,thumbnailWidth:a?300:455,checkMode:n,measureVisible:E})))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
1
+ "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),PointCloudSegment2DView=require("./PointCloudSegment2DView.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js"),classNames=require("classnames"),index$2=require("./components/sideAndBackOverView/index.js"),actionCreators=require("../../store/annotation/actionCreators.js");function _interopDefaultLegacy(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=a=>{const{currentData:i,imgList:P,drawLayerSlot:c,checkMode:n,intelligentFit:v,imgIndex:p,config:L,measureVisible:E}=a,e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:m,setGlobalPattern:x,selectedIDs:C}=e,S=ctx.useDispatch(),[l,f]=React.useState(!1),q=(C==null?void 0:C.length)>0&&l,b=index.jsonParser(i.result),{toolInstanceRef:o,clearToolInstance:j}=annotation.useCustomToolInstance({basicInfo:b});if(React.useEffect(()=>{o.current.setPointCloudGlobalPattern=t=>{t!==m&&(x(t),e.clearAllDetectionInstance(),j())}},[m]),React.useEffect(()=>{var t;if(actionCreators.SetLoadPCDFileLoading(S,!0),i){const{boxParamsList:r,polygonList:s,lineList:u,sphereParamsList:d,segmentation:w,rectList:N}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((t=i==null?void 0:i.result)!=null?t:"");e.setPointCloudResult(r),e.setPolygonList(s),e.setLineList(u),e.setPointCloudSphereList(d),e.setRectList(N),e.setSegmentation(w)}},[p]),React.useEffect(()=>{o.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],o.current.exportCustomData=()=>{var t,r,s,u,d;return{resultPolygon:(t=e.polygonList)!=null?t:[],resultLine:(r=e.lineList)!=null?r:[],resultPoint:(s=e.pointCloudSphereList)!=null?s:[],resultRect:(u=e.rectList)!=null?u:[],segmentation:(d=e.segmentation)!=null?d:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),P.length===0)return null;if(m===lbUtils.EPointCloudPattern.Segmentation)return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:n,toolInstanceRef:o}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout")},React__default.default.createElement(PointCloudSegment,{checkMode:n}),React__default.default.createElement(PointCloudSegment2DView,null)),React__default.default.createElement(PointCloudSegmentStatus,{config:L}),c==null?void 0:c({direct:!0}));let g=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left-bottom")},React__default.default.createElement(PointCloudBackView,{checkMode:n}),React__default.default.createElement(PointCloudSideView,{checkMode:n}));return l&&(g=React__default.default.createElement(index$2,{selectAndEnlarge:q,checkMode:n})),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:n,toolInstanceRef:o}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:t=>t.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left")},React__default.default.createElement(PointCloud3DView,null),g),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right")]:!0,[dom.getClassName("point-cloud-container","rightZoom")]:l})},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:c,checkMode:n,intelligentFit:v,setIsEnlargeTopView:f,onExitZoom:()=>{f(!1)},isEnlargeTopView:l}),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right-bottom")]:!l,[dom.getClassName("point-cloud-container","right-bottom-floatLeft")]:l})},React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:n,measureVisible:E})))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
@@ -0,0 +1 @@
1
+ "use strict";const stopImmediatePropagationOriginal=Event.prototype.stopImmediatePropagation;Event.prototype.isImmediatePropagationStopped=()=>!1,Event.prototype.stopImmediatePropagation=function(t){stopImmediatePropagationOriginal.bind(this).call(t),this.isImmediatePropagationStopped=()=>!0};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const addMapIndirectWeakSetItem=(r,d,s,a)=>{let e=r.get(d);e||(e=new Map,r.set(d,e));let t=e.get(s);return t||(t=new WeakSet,e.set(s,t)),t.add(a),r};exports.addMapIndirectWeakSetItem=addMapIndirectWeakSetItem;
@@ -0,0 +1 @@
1
+ "use strict";var React=require("react"),antd=require("antd"),reactI18next=require("react-i18next"),index=require("../attributeList/index.js"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(l,r,t)=>r in l?__defProp(l,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[r]=t,__spreadValues=(l,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(l,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(l,t,r[t]);return l};const subTitleStyle={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},SubAttributeList=l=>{const{subAttributeList:r,setSubAttribute:t,getValue:o,lang:i}=l,{t:u}=reactI18next.useTranslation();React.useEffect(()=>{var e;i&&((e=lbUtils.i18n)==null||e.changeLanguage(i))},[]);const d=(e,n)=>{if(Array.isArray(n)){t(e,n.join(";"));return}t(e,n)},c=e=>{const n=o(e);return(e==null?void 0:e.isMulti)?n?n==null?void 0:n.split(";"):[]:n};return React__default.default.createElement(React__default.default.Fragment,null,r.map(e=>{var n;return(e==null?void 0:e.subSelected)&&React__default.default.createElement("div",{style:{marginTop:12},key:e.value},React__default.default.createElement("div",{style:subTitleStyle},u("SubAttribute"),"-",e.key),((n=e.subSelected)==null?void 0:n.length)<5?(e==null?void 0:e.isMulti)?React__default.default.createElement(antd.Checkbox.Group,{style:{padding:"0px 20px 16px 16px"},options:e.subSelected.map(a=>({label:a.key,value:a.value})),value:c(e),onChange:a=>d(e.value,a)}):React__default.default.createElement(index.default,{list:e.subSelected.map(a=>({label:a.key,value:a.value})),selectedAttribute:o(e),num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:a=>t(e.value,a),style:{marginBottom:12}}):React__default.default.createElement(antd.Select,{style:{margin:"0px 20px 16px 16px",width:"87%"},mode:(e==null?void 0:e.isMulti)?"multiple":void 0,value:c(e),placeholder:u("PleaseSelect"),onChange:a=>d(e.value,a),allowClear:!0},e.subSelected.map(a=>React__default.default.createElement(antd.Select.Option,{key:a.value,value:a.value},a.key))),React__default.default.createElement(antd.Divider,{style:{margin:0}}))}))},WrapSubAttributeList=l=>React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(SubAttributeList,__spreadValues({},l)));module.exports=WrapSubAttributeList;
@@ -1 +1 @@
1
- "use strict";var lbAnnotation=require("@labelbee/lb-annotation"),index$2=require("../../../utils/index.js"),audio=require("../../../utils/audio.js"),antd=require("antd"),_=require("lodash"),React=require("react"),index_module=require("./index.module.scss.js"),VideoClipToolContext=require("./VideoClipToolContext.js"),constant=require("./constant.js"),index=require("../../videoPlayer/index.js"),index$1=require("./components/videoTimeSlicesOverVideo/index.js"),icon_videoCutting=require("../../../assets/annotation/video/icon_videoCutting.svg.js"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(S){return S&&typeof S=="object"&&"default"in S?S:{default:S}}var ___default=_interopDefaultLegacy(_),React__default=_interopDefaultLegacy(React);class VideoClipTool extends React__default.default.Component{constructor(r){super(r);this.fns=new Map,this.throttledUpdateTime=___default.default.throttle(t=>{this.videoPlayer.currentTime=t},100,{trailing:!0}),this.stepInfo=()=>this.props.stepInfo,this.emitEvent=t=>{const e=this.fns.get(t);e&&e.forEach(i=>{i&&i()})},this.setValid=t=>{this.setState({valid:t}),t===!1&&(this.clearResult(),this.updateSidebar())},this.updateSidebar=()=>{this.emitEvent("changeClipSidebar"),this.emitEvent("updateTextAttribute"),this.emitEvent("changeAttributeSidebar")},this.exportData=()=>{var t,e;const i=(e=(t=this.videoRef)==null?void 0:t.duration)!=null?e:0;return[this.state.result.filter(s=>s.end!==null),{valid:this.state.valid,duration:i}]},this.updateSelectedSliceTimeStartByPer=t=>{var e,i;if(this.state.clipStatus===constant.EClipStatus.Clipping){antd.message.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0,{end:a,start:n,type:l}=this.state.result[this.selectedSliceIndex],u=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(n,t),[0,audio.precisionMinus(l===constant.ETimeSliceType.Time?s:a,constant.PER_SLICE_CHANGE)]);this.updateSelectedSliceTimeProperty(u,"start")}},this.updateSelectedSliceTimeEndByPer=t=>{var e,i;if(this.state.clipStatus===constant.EClipStatus.Clipping){antd.message.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u7ED3\u675F\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=this.state.result[this.selectedSliceIndex],a=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0;if(s.type===constant.ETimeSliceType.Time){antd.message.info("\u65F6\u95F4\u70B9\u4EC5\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}const{end:n,start:l}=s,u=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(n,t),[audio.precisionAdd(l,constant.PER_SLICE_CHANGE),a]);this.updateSelectedSliceTimeProperty(u,"end")}},this.updateSelectedSliceTimeProperty=(t,e)=>{if(this.selectedSliceIndex>-1){const{result:i}=this.state;i[this.selectedSliceIndex][e]=t,this.setState({result:___default.default.cloneDeep(i)}),this.updateSidebar()}},this.keyDownEvents=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t))return;const e=t.target;switch(e&&(e==null?void 0:e.tag)==="INPUT"&&(e==null?void 0:e.type)==="radio"&&t.preventDefault(),t.key.toLocaleLowerCase()){case"x":this.toggleClipStatus();break;case"e":this.addTime();break;case"escape":this.cancelClipped();break;case"-":this.updateSelectedSliceTimeStartByPer(-constant.PER_SLICE_CHANGE);break;case"=":this.updateSelectedSliceTimeStartByPer(constant.PER_SLICE_CHANGE);break;case"[":this.updateSelectedSliceTimeEndByPer(-constant.PER_SLICE_CHANGE);break;case"]":this.updateSelectedSliceTimeEndByPer(constant.PER_SLICE_CHANGE);break}},this.setVideoError=(t,e,i)=>{if(t){const{clipStatus:s}=this.state;s===constant.EClipStatus.Clipping&&this.toggleClipStatus(i)}this.setState({videoError:t,loading:!1})},this.clearResult=()=>{this.setState({result:[],selectedID:"",textValue:""}),this.updateSidebar()},this.cancelClipped=()=>{const{result:t,selectedID:e,clipStatus:i}=this.state;if(i!==constant.EClipStatus.Clipping)return;const s=t.findIndex(a=>a.id===e);s>-1&&(t.splice(s,1),this.setState({result:t,selectedID:"",clipStatus:constant.EClipStatus.Stop}),this.updateSidebar())},this.toggleClipStatus=t=>{var e,i,s;if(this.disabled)return;const{clipStatus:a,selectedAttribute:n}=this.state,l=a!==constant.EClipStatus.Clipping;let u=l?constant.EClipStatus.Clipping:constant.EClipStatus.Stop,{result:d,selectedID:o,textValue:p}=this.state;const c=___default.default.cloneDeep(d),h=t||((e=this.videoPlayer)==null?void 0:e.currentTime),f=(i=this.videoPlayer)==null?void 0:i.duration;if(f===void 0||h===void 0)return;const C=utils.decimalReserved(h,2);if(l){const m=lbAnnotation.uuid();o=m,c.push({start:C,end:null,attribute:n,textAttribute:this.defaultTextAttribute,duration:f,id:m,type:constant.ETimeSliceType.Period}),p=this.defaultTextAttribute}else{const m=c.findIndex(v=>v.id===o),g=c[m];g&&(h-g.start<constant.SLICE_MIN_TIME?(c.splice(m,1),antd.message.info(`\u622A\u53D6\u7247\u6BB5\u4E0D\u80FD\u77ED\u4E8E${constant.SLICE_MIN_TIME}s`),u=constant.EClipStatus.Stop,o="",p=""):(c[m].end=utils.decimalReserved(h,2),(s=this.videoPlayer)==null||s.pause(),antd.message.success(`\u5DF2\u622A\u53D6\u7247\u6BB5${d.length}`)))}this.setState({clipStatus:u,result:c,selectedID:o,textValue:p}),this.updateSidebar()},this.addTime=()=>{var t,e,i,s;if(this.disabled)return;const{result:a,selectedAttribute:n,selectedID:l}=this.state,u=lbAnnotation.uuid(),d=___default.default.cloneDeep(a),o=((t=this.videoPlayer)==null?void 0:t.currentTime)||0;d.push({start:o,end:o,attribute:n,textAttribute:this.defaultTextAttribute,id:u,type:constant.ETimeSliceType.Time,duration:(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0});const p={result:d,selectedID:u,textValue:this.defaultTextAttribute},c=d.find(h=>h.id===l);this.isClipping&&c?(delete p.selectedID,delete p.textValue,antd.message.success(`\u5DF2\u622A\u53D6\u65F6\u95F4\u70B9${d.length-1}`)):(s=this.videoPlayer)==null||s.pause(),this.setState(p),this.updateSidebar()},this.updateCurrentTime=t=>{this.setState({currentTime:t})},this.contextToCancel=t=>{this.state.clipStatus===constant.EClipStatus.Stop&&(t.preventDefault(),this.setState({selectedID:""}),this.updateSidebar())},this.onTrackResize=(t,e,i)=>{var s,a;const{result:n}=this.state,l=n.find(u=>u.id===t);if(l){const u=l.duration,d=e==="left",o=d?"start":"end",p=d?-u*i:u*i,c=d?[0,Math.max(((s=l.end)!=null?s:0)-constant.SLICE_MIN_TIME,0)]:[l.start+constant.SLICE_MIN_TIME,u],h=lbAnnotation.MathUtils.withinRange(p+((a=l==null?void 0:l[o])!=null?a:0),c);l[o]=h,this.throttledUpdateTime(h)}this.setState({result:[...n]}),this.updateSidebar()},this.renderMediaContent=()=>{var t;const{pageForward:e,pageJump:i,pageBackward:s}=this.props,{result:a,videoError:n,valid:l,currentTime:u}=this.state;return React__default.default.createElement("div",{className:index_module.clipContainer},React__default.default.createElement(index.VideoPlayer,{imgIndex:this.props.imgIndex,imgList:this.props.imgList,pageBackward:s,pageForward:e,pageJump:i,valid:l,setVideoRef:d=>{this.videoPlayer=d},showVideoTrack:!n,onTrackResize:this.onTrackResize,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.props.onVideoLoaded,toggleClipStatus:this.toggleClipStatus,addTime:this.addTime,updateCurrentTime:this.updateCurrentTime}),React__default.default.createElement(index$1,{key:(t=this.videoPlayer)==null?void 0:t.currentTime,result:a,currentTime:u,attributeList:this.props.config.attributeList,extraStyle:{top:this.props.drawLayerSlot?40:0}}),this.isClipping&&React__default.default.createElement("i",{className:index_module.clipping,style:{backgroundImage:icon_videoCutting}}))},this.onSelectedTimeSlice=t=>{var e;this.isClipping||(this.setState({selectedID:t.id,selectedAttribute:t.attribute,textValue:t.textAttribute,currentTime:t.start}),this.updateSidebar(),(e=this.videoPlayer)==null||e.pause(),this.videoPlayer.currentTime=t.start)},this.removeTimeSlice=t=>{const{result:e}=this.state,i=this.state.selectedID===t.id?"":this.state.selectedID,s=e.findIndex(a=>a.id===t.id);s>-1&&(e.splice(s,1),this.setState({result:[...e],selectedID:i}),this.updateSidebar())},this.setResult=(t=!0,e=this.props)=>{try{const{imgIndex:i,imgList:s}=e;if(!s[i])return;const n=index$2.jsonParser(s[i].result)[`step_${this.stepInfo().step}`],l=(n==null?void 0:n.result)||[],u=audio.isImageValue(s[i].result||"[]");this.setState({result:l,loading:t,selectedID:"",textValue:"",selectedAttribute:"",clipStatus:constant.EClipStatus.Stop,valid:u},()=>{this.updateSidebar(),u||antd.message.info("\u65E0\u6548\u89C6\u9891\uFF0C\u8BF7\u8DF3\u8FC7")})}catch(i){console.error("\u6570\u636E\u89E3\u6790\u5931\u8D25"),this.setState({result:[],loading:!1,selectedID:"",textValue:"",selectedAttribute:"",valid:!0},()=>{this.updateSidebar()})}},this.setDefaultAttribute=t=>{const{result:e,selectedID:i}=this.state,s=e.find(a=>a.id===i);s&&i&&(s.attribute=t),this.setState({selectedAttribute:t,result:[...e]}),this.updateSidebar()},this.textChange=t=>{const{result:e,selectedID:i}=this.state;if(this.setState({textValue:t}),i){const s=e.find(a=>a.id===i);s&&(s.textAttribute=t,this.setState({result:[...e]}),this.updateSidebar())}},this.state={result:[],selectedAttribute:"",textValue:"",clipStatus:constant.EClipStatus.Stop,selectedID:"",loading:!1,videoError:!1,remainingTime:0,currentTime:0,configLoading:!1,valid:!0}}get videoUrl(){var r;const{imgIndex:t,imgList:e}=this.props;return((r=e[t])==null?void 0:r.url)||""}get isClipping(){return this.state.clipStatus===constant.EClipStatus.Clipping}get resultJSON(){const{imgIndex:r,imgList:t}=this.props;return t.length===0||!t[r]?"[]":t[r].result}get disabled(){return!this.state.valid||this.state.videoError}get loading(){return this.state.loading||this.state.configLoading}get defaultTextAttribute(){return lbAnnotation.AttributeUtils.getTextAttribute(this.state.result,this.props.config.textCheckType)}get defaultAttribute(){return this.state.selectedAttribute}get selectedID(){return this.state.selectedID}get selectedSliceIndex(){return this.state.result.findIndex(r=>r.id===this.state.selectedID)}get exportContext(){return{selectedID:this.state.selectedID,result:this.state.result,clipStatus:this.state.clipStatus,videoPlayer:this.videoPlayer,attributeList:this.props.config.attributeList,onSelectedTimeSlice:this.onSelectedTimeSlice,removeTimeSlice:this.removeTimeSlice,updateSelectedSliceTimeProperty:this.updateSelectedSliceTimeProperty}}get valid(){return this.state.valid}get config(){var r;return index$2.jsonParser((r=this.props.stepInfo)==null?void 0:r.config)}get selectedText(){var r,t;return(t=(r=this.state.result)==null?void 0:r[this.selectedSliceIndex])==null?void 0:t.textAttribute}componentDidMount(){this.setState({loading:!1}),this.setResult(!1),this.props.onMounted(this),window.addEventListener("keydown",this.keyDownEvents)}componentWillUnmount(){this.props.onUnmounted(),window.removeEventListener("keydown",this.keyDownEvents)}shouldComponentUpdate(r,t){const e=r.imgIndex-this.props.imgIndex,i=r.step-this.props.step;return(e!==0||i!==0)&&(this.setResult(!0,r),i!==0&&this.setState({loading:!1})),!0}singleOn(r,t){this.fns.set(r,[t])}on(r,t){this.singleOn(r,t)}unbindAll(r){this.fns.delete(r)}render(){const{selectedID:r,result:t,clipStatus:e,selectedAttribute:i}=this.state;return React__default.default.createElement(VideoClipToolContext.VideoClipToolContextProvider,{value:{videoPlayer:this.videoPlayer,result:t,selectedID:r,attributeList:this.props.config.attributeList,clipStatus:e,selectedAttribute:i,contextToCancel:this.contextToCancel}},this.renderMediaContent())}}module.exports=VideoClipTool;
1
+ "use strict";var lbAnnotation=require("@labelbee/lb-annotation"),index$2=require("../../../utils/index.js"),audio=require("../../../utils/audio.js"),antd=require("antd"),_=require("lodash"),React=require("react"),index_module=require("./index.module.scss.js"),VideoClipToolContext=require("./VideoClipToolContext.js"),constant=require("./constant.js"),index=require("../../videoPlayer/index.js"),index$1=require("./components/videoTimeSlicesOverVideo/index.js"),icon_videoCutting=require("../../../assets/annotation/video/icon_videoCutting.svg.js"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(S){return S&&typeof S=="object"&&"default"in S?S:{default:S}}var ___default=_interopDefaultLegacy(_),React__default=_interopDefaultLegacy(React);class VideoClipTool extends React__default.default.Component{constructor(r){super(r);this.fns=new Map,this.throttledUpdateTime=___default.default.throttle(t=>{this.videoPlayer.currentTime=t},100,{trailing:!0}),this.stepInfo=()=>this.props.stepInfo,this.emitEvent=t=>{const e=this.fns.get(t);e&&e.forEach(i=>{i&&i()})},this.setValid=t=>{this.setState({valid:t}),t===!1&&(this.clearResult(),this.updateSidebar())},this.updateSidebar=()=>{this.emitEvent("changeClipSidebar"),this.emitEvent("updateTextAttribute"),this.emitEvent("changeAttributeSidebar")},this.exportData=()=>{var t,e;const i=(e=(t=this.videoRef)==null?void 0:t.duration)!=null?e:0;return[this.state.result.filter(s=>s.end!==null),{valid:this.state.valid,duration:i}]},this.updateSelectedSliceTimeStartByPer=t=>{var e,i;if(this.state.clipStatus===constant.EClipStatus.Clipping){antd.message.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0,{end:a,start:n,type:l}=this.state.result[this.selectedSliceIndex],u=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(n,t),[0,audio.precisionMinus(l===constant.ETimeSliceType.Time?s:a,constant.PER_SLICE_CHANGE)]);this.updateSelectedSliceTimeProperty(u,"start")}},this.updateSelectedSliceTimeEndByPer=t=>{var e,i;if(this.state.clipStatus===constant.EClipStatus.Clipping){antd.message.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u7ED3\u675F\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=this.state.result[this.selectedSliceIndex],a=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0;if(s.type===constant.ETimeSliceType.Time){antd.message.info("\u65F6\u95F4\u70B9\u4EC5\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}const{end:n,start:l}=s,u=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(n,t),[audio.precisionAdd(l,constant.PER_SLICE_CHANGE),a]);this.updateSelectedSliceTimeProperty(u,"end")}},this.updateSelectedSliceTimeProperty=(t,e)=>{if(this.selectedSliceIndex>-1){const{result:i}=this.state;i[this.selectedSliceIndex][e]=t,this.setState({result:___default.default.cloneDeep(i)}),this.updateSidebar()}},this.keyDownEvents=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t))return;const e=t.target;switch(e&&(e==null?void 0:e.tag)==="INPUT"&&(e==null?void 0:e.type)==="radio"&&t.preventDefault(),t.key.toLocaleLowerCase()){case"x":this.toggleClipStatus();break;case"e":this.addTime();break;case"escape":this.cancelClipped();break;case"-":this.updateSelectedSliceTimeStartByPer(-constant.PER_SLICE_CHANGE);break;case"=":this.updateSelectedSliceTimeStartByPer(constant.PER_SLICE_CHANGE);break;case"[":this.updateSelectedSliceTimeEndByPer(-constant.PER_SLICE_CHANGE);break;case"]":this.updateSelectedSliceTimeEndByPer(constant.PER_SLICE_CHANGE);break}},this.setVideoError=(t,e,i)=>{if(t){const{clipStatus:s}=this.state;s===constant.EClipStatus.Clipping&&this.toggleClipStatus(i)}this.setState({videoError:t,loading:!1})},this.clearResult=()=>{this.setState({result:[],selectedID:"",textValue:""}),this.updateSidebar()},this.cancelClipped=()=>{const{result:t,selectedID:e,clipStatus:i}=this.state;if(i!==constant.EClipStatus.Clipping)return;const s=t.findIndex(a=>a.id===e);s>-1&&(t.splice(s,1),this.setState({result:t,selectedID:"",clipStatus:constant.EClipStatus.Stop}),this.updateSidebar())},this.toggleClipStatus=t=>{var e,i;if(typeof((e=this.props)==null?void 0:e.annotationBefore)=="function"){(i=this.props)==null||i.annotationBefore(()=>this.setClipResult(t));return}this.setClipResult(t)},this.setClipResult=t=>{var e,i,s;if(this.disabled)return;const{clipStatus:a,selectedAttribute:n}=this.state,l=a!==constant.EClipStatus.Clipping;let u=l?constant.EClipStatus.Clipping:constant.EClipStatus.Stop,{result:d,selectedID:o,textValue:p}=this.state;const c=___default.default.cloneDeep(d),h=t||((e=this.videoPlayer)==null?void 0:e.currentTime),v=(i=this.videoPlayer)==null?void 0:i.duration;if(v===void 0||h===void 0)return;const C=utils.decimalReserved(h,2);if(l){const f=lbAnnotation.uuid();o=f,c.push({start:C,end:null,attribute:n,textAttribute:this.defaultTextAttribute,duration:v,id:f,type:constant.ETimeSliceType.Period}),p=this.defaultTextAttribute}else{const f=c.findIndex(g=>g.id===o),m=c[f];m&&(h-m.start<constant.SLICE_MIN_TIME?(c.splice(f,1),antd.message.info(`\u622A\u53D6\u7247\u6BB5\u4E0D\u80FD\u77ED\u4E8E${constant.SLICE_MIN_TIME}s`),u=constant.EClipStatus.Stop,o="",p=""):(c[f].end=utils.decimalReserved(h,2),(s=this.videoPlayer)==null||s.pause(),antd.message.success(`\u5DF2\u622A\u53D6\u7247\u6BB5${d.length}`)))}this.setState({clipStatus:u,result:c,selectedID:o,textValue:p}),this.updateSidebar()},this.addTime=()=>{var t,e,i,s;if(this.disabled)return;const{result:a,selectedAttribute:n,selectedID:l}=this.state,u=lbAnnotation.uuid(),d=___default.default.cloneDeep(a),o=((t=this.videoPlayer)==null?void 0:t.currentTime)||0;d.push({start:o,end:o,attribute:n,textAttribute:this.defaultTextAttribute,id:u,type:constant.ETimeSliceType.Time,duration:(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0});const p={result:d,selectedID:u,textValue:this.defaultTextAttribute},c=d.find(h=>h.id===l);this.isClipping&&c?(delete p.selectedID,delete p.textValue,antd.message.success(`\u5DF2\u622A\u53D6\u65F6\u95F4\u70B9${d.length-1}`)):(s=this.videoPlayer)==null||s.pause(),this.setState(p),this.updateSidebar()},this.updateCurrentTime=t=>{this.setState({currentTime:t})},this.contextToCancel=t=>{this.state.clipStatus===constant.EClipStatus.Stop&&(t.preventDefault(),this.setState({selectedID:""}),this.updateSidebar())},this.onTrackResize=(t,e,i)=>{var s,a;const{result:n}=this.state,l=n.find(u=>u.id===t);if(l){const u=l.duration,d=e==="left",o=d?"start":"end",p=d?-u*i:u*i,c=d?[0,Math.max(((s=l.end)!=null?s:0)-constant.SLICE_MIN_TIME,0)]:[l.start+constant.SLICE_MIN_TIME,u],h=lbAnnotation.MathUtils.withinRange(p+((a=l==null?void 0:l[o])!=null?a:0),c);l[o]=h,this.throttledUpdateTime(h)}this.setState({result:[...n]}),this.updateSidebar()},this.renderMediaContent=()=>{var t;const{pageForward:e,pageJump:i,pageBackward:s}=this.props,{result:a,videoError:n,valid:l,currentTime:u}=this.state;return React__default.default.createElement("div",{className:index_module.clipContainer},React__default.default.createElement(index.VideoPlayer,{imgIndex:this.props.imgIndex,imgList:this.props.imgList,pageBackward:s,pageForward:e,pageJump:i,valid:l,setVideoRef:d=>{this.videoPlayer=d},showVideoTrack:!n,onTrackResize:this.onTrackResize,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.props.onVideoLoaded,toggleClipStatus:this.toggleClipStatus,addTime:this.addTime,updateCurrentTime:this.updateCurrentTime}),React__default.default.createElement(index$1,{key:(t=this.videoPlayer)==null?void 0:t.currentTime,result:a,currentTime:u,attributeList:this.props.config.attributeList,extraStyle:{top:this.props.drawLayerSlot?40:0}}),this.isClipping&&React__default.default.createElement("i",{className:index_module.clipping,style:{backgroundImage:icon_videoCutting}}))},this.onSelectedTimeSlice=t=>{var e;this.isClipping||(this.setState({selectedID:t.id,selectedAttribute:t.attribute,textValue:t.textAttribute,currentTime:t.start}),this.updateSidebar(),(e=this.videoPlayer)==null||e.pause(),this.videoPlayer.currentTime=t.start)},this.removeTimeSlice=t=>{const{result:e}=this.state,i=this.state.selectedID===t.id?"":this.state.selectedID,s=e.findIndex(a=>a.id===t.id);s>-1&&(e.splice(s,1),this.setState({result:[...e],selectedID:i}),this.updateSidebar())},this.setResult=(t=!0,e=this.props)=>{try{const{imgIndex:i,imgList:s}=e;if(!s[i])return;const n=index$2.jsonParser(s[i].result)[`step_${this.stepInfo().step}`],l=(n==null?void 0:n.result)||[],u=audio.isImageValue(s[i].result||"[]");this.setState({result:l,loading:t,selectedID:"",textValue:"",selectedAttribute:"",clipStatus:constant.EClipStatus.Stop,valid:u},()=>{this.updateSidebar(),u||antd.message.info("\u65E0\u6548\u89C6\u9891\uFF0C\u8BF7\u8DF3\u8FC7")})}catch(i){console.error("\u6570\u636E\u89E3\u6790\u5931\u8D25"),this.setState({result:[],loading:!1,selectedID:"",textValue:"",selectedAttribute:"",valid:!0},()=>{this.updateSidebar()})}},this.setDefaultAttribute=t=>{const{result:e,selectedID:i}=this.state,s=e.find(a=>a.id===i);s&&i&&(s.attribute=t),this.setState({selectedAttribute:t,result:[...e]}),this.updateSidebar()},this.textChange=t=>{const{result:e,selectedID:i}=this.state;if(this.setState({textValue:t}),i){const s=e.find(a=>a.id===i);s&&(s.textAttribute=t,this.setState({result:[...e]}),this.updateSidebar())}},this.state={result:[],selectedAttribute:"",textValue:"",clipStatus:constant.EClipStatus.Stop,selectedID:"",loading:!1,videoError:!1,remainingTime:0,currentTime:0,configLoading:!1,valid:!0}}get videoUrl(){var r;const{imgIndex:t,imgList:e}=this.props;return((r=e[t])==null?void 0:r.url)||""}get isClipping(){return this.state.clipStatus===constant.EClipStatus.Clipping}get resultJSON(){const{imgIndex:r,imgList:t}=this.props;return t.length===0||!t[r]?"[]":t[r].result}get disabled(){return!this.state.valid||this.state.videoError}get loading(){return this.state.loading||this.state.configLoading}get defaultTextAttribute(){return lbAnnotation.AttributeUtils.getTextAttribute(this.state.result,this.props.config.textCheckType)}get defaultAttribute(){return this.state.selectedAttribute}get selectedID(){return this.state.selectedID}get selectedSliceIndex(){return this.state.result.findIndex(r=>r.id===this.state.selectedID)}get exportContext(){return{selectedID:this.state.selectedID,result:this.state.result,clipStatus:this.state.clipStatus,videoPlayer:this.videoPlayer,attributeList:this.props.config.attributeList,onSelectedTimeSlice:this.onSelectedTimeSlice,removeTimeSlice:this.removeTimeSlice,updateSelectedSliceTimeProperty:this.updateSelectedSliceTimeProperty}}get valid(){return this.state.valid}get config(){var r;return index$2.jsonParser((r=this.props.stepInfo)==null?void 0:r.config)}get selectedText(){var r,t;return(t=(r=this.state.result)==null?void 0:r[this.selectedSliceIndex])==null?void 0:t.textAttribute}componentDidMount(){this.setState({loading:!1}),this.setResult(!1),this.props.onMounted(this),window.addEventListener("keydown",this.keyDownEvents)}componentWillUnmount(){this.props.onUnmounted(),window.removeEventListener("keydown",this.keyDownEvents)}shouldComponentUpdate(r,t){const e=r.imgIndex-this.props.imgIndex,i=r.step-this.props.step;return(e!==0||i!==0)&&(this.setResult(!0,r),i!==0&&this.setState({loading:!1})),!0}singleOn(r,t){this.fns.set(r,[t])}on(r,t){this.singleOn(r,t)}unbindAll(r){this.fns.delete(r)}render(){const{selectedID:r,result:t,clipStatus:e,selectedAttribute:i}=this.state;return React__default.default.createElement(VideoClipToolContext.VideoClipToolContextProvider,{value:{videoPlayer:this.videoPlayer,result:t,selectedID:r,attributeList:this.props.config.attributeList,clipStatus:e,selectedAttribute:i,contextToCancel:this.contextToCancel}},this.renderMediaContent())}}module.exports=VideoClipTool;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),VideoTagLayer=require("../../videoPlayer/VideoTagLayer.js"),_=require("lodash"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(d){return d&&typeof d=="object"&&"default"in d?d:{default:d}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);class TagToolInstanceAdaptor extends React__default.default.Component{constructor(s){super(s);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,e)=>{const l=e?this.state.tagResult.map(i=>((i==null?void 0:i.result[e])&&delete i.result[e],i)):[];this.setState({tagResult:l},()=>this.emitEvent("render"))},this.exportData=()=>{var t,e;const l=(e=(t=this.videoPlayer)==null?void 0:t.duration)!=null?e:0;return[this.state.tagResult,{valid:this.state.valid,duration:l}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,e={})=>{var l,i;const{isMulti:n}=t,{key:r,value:a}=t.value;if(n){let o=(i=(l=e[r])==null?void 0:l.split(";"))!=null?i:[];o.includes(a)?o=o.filter(h=>h!==a):o.push(a);const u=new Set(o);return e[r]=Array.from(u).join(";"),___default.default.pickBy(e,h=>h)}return e[r]=e[r]===a?void 0:a,___default.default.pickBy(e,o=>o)},this.setResult=t=>{this.setState({tagResult:t}),this.fns.render&&this.fns.render()},this.setLabel=(t,e)=>{this.setLabelBySelectedList(t,e)},this.keydown=t=>{var e;const l=utils.getKeyCodeNumber(t.keyCode);if(l){const i=l-1;if(((e=this.config.inputList)==null?void 0:e.length)===1){this.labelSelectedList=[0,i],this.setLabel(0,i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],i],this.setLabel(this.labelSelectedList[0],i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[i],this.emitEvent("expend"))}},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({tagResult:[]}),this.emitEvent("render")},this.setResultFromImgList=t=>{const{imgList:e,imgIndex:l,stepInfo:i}=t;if(!e[l])return;const n=index.jsonParser(e[l].result),r=n[`step_${i.step}`],a=this.getInitResultList();this.setState({tagResult:r?r==null?void 0:r.result:a,valid:(n==null?void 0:n.valid)===void 0?!0:n.valid},()=>this.emitEvent("render"))},this.getInitResultList=()=>{var t;return lbAnnotation.TagUtils.getDefaultTagResult((t=this.config.inputList)!=null?t:[],[])},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var s;return index.jsonParser((s=this.props.stepInfo)==null?void 0:s.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var s;return(s=this.state.tagResult[0])!=null?s:{}}get valid(){return this.state.valid}singleOn(s,t){this.fns[s]=t}on(s,t){this.singleOn(s,t)}unbindAll(s){delete this.fns[s]}getTagResultByCode(s,t){var e,l,i;try{const n=(l=(e=this.config)==null?void 0:e.inputList)!=null?l:[],r=(n==null?void 0:n.length)>1,a=t!==void 0?s:0,o=t!==void 0?t:s,u=r?n[a]:n[0],h=((i=u.subSelected)!=null?i:[])[o];if(u&&h)return{value:{key:u.value,value:h.value},isMulti:u.isMulti}}catch(n){return}}setLabelBySelectedList(s,t){var e,l,i,n;const r=this.getTagResultByCode(s,t);if(r){const a=this.combineResult(r,(l=(e=this.state.tagResult[0])==null?void 0:e.result)!=null?l:{}),o=[{sourceID:lbAnnotation.CommonToolUtils.getSourceID(),id:(n=(i=this.currentTagResult)==null?void 0:i.id)!=null?n:lbAnnotation.uuid(8,62),result:a}];this.setState({tagResult:o},()=>this.emitEvent("render"))}}componentDidMount(){document.addEventListener("keydown",this.keydown),this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){document.addEventListener("keydown",this.keydown),this.props.onUnmounted()}shouldComponentUpdate(s){return s.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(s),!0}render(){var s;const{imgIndex:t,imgList:e,pageForward:l,pageJump:i,pageBackward:n}=this.props,{tagResult:r,valid:a}=this.state;return React__default.default.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},React__default.default.createElement(index$1.VideoPlayer,{imgIndex:t,imgList:e,pageBackward:n,pageForward:l,pageJump:i,valid:a,setVideoRef:o=>{this.videoPlayer=o},dataLoaded:this.props.onVideoLoaded,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}),React__default.default.createElement(VideoTagLayer.VideoTagLayer,{result:r,inputList:(s=this.config)==null?void 0:s.inputList,hasPromptLayer:!!this.props.drawLayerSlot}))}}exports.TagToolInstanceAdaptor=TagToolInstanceAdaptor;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),VideoTagLayer=require("../../videoPlayer/VideoTagLayer.js"),_=require("lodash"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(h){return h&&typeof h=="object"&&"default"in h?h:{default:h}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);class TagToolInstanceAdaptor extends React__default.default.Component{constructor(e){super(e);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,s)=>{const n=s?this.state.tagResult.map(i=>((i==null?void 0:i.result[s])&&delete i.result[s],i)):[];this.setState({tagResult:n},()=>this.emitEvent("render"))},this.exportData=()=>{var t,s;const n=(s=(t=this.videoPlayer)==null?void 0:t.duration)!=null?s:0;return[this.state.tagResult,{valid:this.state.valid,duration:n}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,s={})=>{var n,i;const l=_.cloneDeep(s),{isMulti:o}=t,{key:a,value:u}=t.value;if(o){let r=(i=(n=l[a])==null?void 0:n.split(";"))!=null?i:[];r.includes(u)?r=r.filter(c=>c!==u):r.push(u);const d=new Set(r);return l[a]=Array.from(d).join(";"),___default.default.pickBy(l,c=>c)}return l[a]=l[a]===u?void 0:u,___default.default.pickBy(l,r=>r)},this.setResult=t=>{this.setState({tagResult:t}),this.fns.render&&this.fns.render()},this.setLabel=(t,s)=>{this.setLabelBySelectedList(t,s)},this.keydown=t=>{var s;const n=utils.getKeyCodeNumber(t.keyCode);if(n){const i=n-1;if(((s=this.config.inputList)==null?void 0:s.length)===1){this.labelSelectedList=[0,i],this.setLabel(0,i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],i],this.setLabel(this.labelSelectedList[0],i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[i],this.emitEvent("expend"))}},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({tagResult:[]}),this.emitEvent("render")},this.setResultFromImgList=t=>{const{imgList:s,imgIndex:n,stepInfo:i}=t;if(!s[n])return;const l=index.jsonParser(s[n].result),o=l[`step_${i.step}`],a=this.getInitResultList();this.setState({tagResult:o?o==null?void 0:o.result:a,valid:(l==null?void 0:l.valid)===void 0?!0:l.valid},()=>this.emitEvent("render"))},this.getInitResultList=()=>{var t;return lbAnnotation.TagUtils.getDefaultTagResult((t=this.config.inputList)!=null?t:[],[])},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var e;return index.jsonParser((e=this.props.stepInfo)==null?void 0:e.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var e;return(e=this.state.tagResult[0])!=null?e:{}}get valid(){return this.state.valid}singleOn(e,t){this.fns[e]=t}on(e,t){this.singleOn(e,t)}unbindAll(e){delete this.fns[e]}getTagResultByCode(e,t){var s,n,i;try{const l=(n=(s=this.config)==null?void 0:s.inputList)!=null?n:[],o=(l==null?void 0:l.length)>1,a=t!==void 0?e:0,u=t!==void 0?t:e,r=o?l[a]:l[0],d=((i=r.subSelected)!=null?i:[])[u];if(r&&d)return{value:{key:r.value,value:d.value},isMulti:r.isMulti}}catch(l){return}}setLabelBySelectedList(e,t){var s,n,i,l,o,a;const u=this.getTagResultByCode(e,t);if(u){const r=this.combineResult(u,(n=(s=this.state.tagResult[0])==null?void 0:s.result)!=null?n:{}),d=[{sourceID:lbAnnotation.CommonToolUtils.getSourceID(),id:(l=(i=this.currentTagResult)==null?void 0:i.id)!=null?l:lbAnnotation.uuid(8,62),result:r}];if(typeof((o=this.props)==null?void 0:o.annotationBefore)=="function"){(a=this.props)==null||a.annotationBefore(()=>this.setState({tagResult:d},()=>this.emitEvent("render")));return}this.setState({tagResult:d},()=>this.emitEvent("render"))}}componentDidMount(){document.addEventListener("keydown",this.keydown),this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){document.addEventListener("keydown",this.keydown),this.props.onUnmounted()}shouldComponentUpdate(e){return e.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(e),!0}render(){var e;const{imgIndex:t,imgList:s,pageForward:n,pageJump:i,pageBackward:l}=this.props,{tagResult:o,valid:a}=this.state;return React__default.default.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},React__default.default.createElement(index$1.VideoPlayer,{imgIndex:t,imgList:s,pageBackward:l,pageForward:n,pageJump:i,valid:a,setVideoRef:u=>{this.videoPlayer=u},dataLoaded:this.props.onVideoLoaded,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}),React__default.default.createElement(VideoTagLayer.VideoTagLayer,{result:o,inputList:(e=this.config)==null?void 0:e.inputList,hasPromptLayer:!!this.props.drawLayerSlot}))}}exports.TagToolInstanceAdaptor=TagToolInstanceAdaptor;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e};const validFields=["hiddenText"],initialValue={hiddenText:!1},ToolStyleContext=React.createContext({value:initialValue,updateValue:()=>{}}),useToolStyleContext=()=>React.useContext(ToolStyleContext),ToolStyleProvider=e=>{const[t,r]=React.useState(()=>__spreadValues({},initialValue)),a=React.useCallback(o=>{r(l=>!o||typeof o=="object"&&Object.keys(o).length===0?l:__spreadValues(__spreadValues({},l),o))},[]),n=React.useMemo(()=>({value:t,updateValue:a}),[t,a]);return React.useEffect(()=>{const o=e.value;if(!o)return;const l=_.pick(o,validFields);Object.keys(l).length!==0&&a(l)},[e.value,a]),React__default.default.createElement(ToolStyleContext.Provider,{value:n},e.children)};exports.ToolStyleContext=ToolStyleContext,exports.ToolStyleProvider=ToolStyleProvider,exports.useToolStyleContext=useToolStyleContext;