@labelbee/lb-components 1.15.1 → 1.16.0-alpha.10

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 (209) hide show
  1. package/dist/App.js +1 -1
  2. package/dist/assets/annotation/audio/clip.svg.js +1 -0
  3. package/dist/assets/annotation/audio/clipA.svg.js +1 -0
  4. package/dist/assets/annotation/audio/clipASmall.svg.js +1 -0
  5. package/dist/assets/annotation/audio/clipSmall.svg.js +1 -0
  6. package/dist/assets/annotation/audio/delete.svg.js +1 -0
  7. package/dist/assets/annotation/audio/loop.svg.js +1 -0
  8. package/dist/assets/annotation/audio/loopA.svg.js +1 -0
  9. package/dist/assets/annotation/audio/progressDot.svg.js +1 -0
  10. package/dist/assets/annotation/audio/progressDotA.svg.js +1 -0
  11. package/dist/assets/annotation/audio/tag.svg.js +1 -0
  12. package/dist/assets/annotation/audio/tagA.svg.js +1 -0
  13. package/dist/assets/annotation/toolHotKeyIcon/deleteRemark.svg.js +1 -0
  14. package/dist/assets/annotation/toolHotKeyIcon/icon_down.svg.js +1 -0
  15. package/dist/assets/annotation/toolHotKeyIcon/icon_eyeLock_kj.svg.js +1 -0
  16. package/dist/assets/annotation/toolHotKeyIcon/icon_polygonCut_kj.svg.js +1 -0
  17. package/dist/assets/annotation/toolHotKeyIcon/icon_up.svg.js +1 -0
  18. package/dist/assets/annotation/toolHotKeyIcon/nextRemark.svg.js +1 -0
  19. package/dist/assets/annotation/toolHotKeyIcon/preRemark.svg.js +1 -0
  20. package/dist/assets/annotation/video/icon_clip.svg.js +1 -0
  21. package/dist/components/audioAnnotate/audioContext/index.js +1 -0
  22. package/dist/components/audioAnnotate/audioContext/index.module.scss.js +1 -0
  23. package/dist/components/audioAnnotate/audioSide/LabelDetailPopover/index.js +1 -0
  24. package/dist/components/audioAnnotate/audioSide/LabelDetailPopover/index.module.scss.js +1 -0
  25. package/dist/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -0
  26. package/dist/components/audioAnnotate/audioSide/clipSidebar/index.module.scss.js +1 -0
  27. package/dist/components/audioAnnotate/audioSide/labelFilterInput/index.js +1 -0
  28. package/dist/components/audioAnnotate/audioSide/labelFilterInput/index.module.scss.js +1 -0
  29. package/dist/components/audioAnnotate/audioSide/labelSidebar/index.js +1 -0
  30. package/dist/components/audioAnnotate/audioSide/labelSidebar/index.module.scss.js +1 -0
  31. package/dist/components/audioAnnotate/index.js +1 -0
  32. package/dist/components/audioAnnotate/index.module.scss.js +1 -0
  33. package/dist/components/audioAnnotate/tagResultShow/index.js +1 -0
  34. package/dist/components/audioAnnotate/tagResultShow/index.module.scss.js +1 -0
  35. package/dist/components/audioAnnotate/textInput/index.js +1 -0
  36. package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -0
  37. package/dist/components/audioAnnotate/utils/getWebPcm2Wac.js +1 -0
  38. package/dist/components/audioPlayer/clipRegion/index.js +1 -0
  39. package/dist/components/audioPlayer/clipRegion/index.module.scss.js +1 -0
  40. package/dist/components/audioPlayer/clipTip/index.js +1 -0
  41. package/dist/components/audioPlayer/combineTip/index.js +1 -0
  42. package/dist/components/audioPlayer/index.js +1 -0
  43. package/dist/components/audioPlayer/index.module.scss.js +1 -0
  44. package/dist/components/audioPlayer/labelDisplayToggle/index.js +1 -0
  45. package/dist/components/audioPlayer/labelDisplayToggle/index.module.scss.js +1 -0
  46. package/dist/components/audioPlayer/progressDot/index.js +1 -0
  47. package/dist/components/audioPlayer/progressDot/index.module.scss.js +1 -0
  48. package/dist/components/audioPlayer/segmentTip/index.js +1 -0
  49. package/dist/components/audioPlayer/useAudioCombine/index.js +2 -0
  50. package/dist/components/audioPlayer/useAudioScroll/index.js +1 -0
  51. package/dist/components/audioPlayer/useAudioSegment/index.js +1 -0
  52. package/dist/components/audioPlayer/useSwitchHotkey/index.js +1 -0
  53. package/dist/components/audioPlayer/zoomSlider/index.js +1 -0
  54. package/dist/components/audioPlayer/zoomSlider/index.module.scss.js +1 -0
  55. package/dist/components/imageError/index.js +1 -0
  56. package/dist/components/invalidPage/index.js +1 -0
  57. package/dist/components/pointCloud2DRectOperationView/index.js +1 -0
  58. package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  59. package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
  60. package/dist/components/pointCloudView/PointCloudContext.js +1 -1
  61. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  62. package/dist/components/pointCloudView/hooks/useSingleBox.js +1 -1
  63. package/dist/components/pointCloudView/index.js +1 -1
  64. package/dist/components/videoPlayer/components/SpeedController/index.js +1 -0
  65. package/dist/components/videoPlayer/components/SpeedController/index.module.scss.js +1 -0
  66. package/dist/components/videoPlayer/components/controller/index.js +1 -1
  67. package/dist/components/videoPlayer/index.js +1 -1
  68. package/dist/index.css +721 -0
  69. package/dist/index.js +1 -1
  70. package/dist/store/annotation/reducer.js +1 -1
  71. package/dist/types/App.d.ts +1 -0
  72. package/dist/types/components/AnnotationView/index.d.ts +1 -1
  73. package/dist/types/components/attributeList/index.d.ts +1 -0
  74. package/dist/types/components/audioAnnotate/audioContext/index.d.ts +40 -0
  75. package/dist/types/components/audioAnnotate/audioSide/LabelDetailPopover/index.d.ts +9 -0
  76. package/dist/types/components/audioAnnotate/audioSide/clipSidebar/index.d.ts +11 -0
  77. package/dist/types/components/audioAnnotate/audioSide/labelFilterInput/index.d.ts +7 -0
  78. package/dist/types/components/audioAnnotate/audioSide/labelSidebar/index.d.ts +49 -0
  79. package/dist/types/components/audioAnnotate/index.d.ts +12 -0
  80. package/dist/types/components/audioAnnotate/tagResultShow/index.d.ts +3 -0
  81. package/dist/types/components/audioAnnotate/textInput/index.d.ts +52 -0
  82. package/dist/types/components/audioAnnotate/utils/getWebPcm2Wac.d.ts +1 -0
  83. package/dist/types/components/audioPlayer/clipRegion/index.d.ts +22 -0
  84. package/dist/types/components/audioPlayer/clipTip/index.d.ts +15 -0
  85. package/dist/types/components/audioPlayer/combineTip/index.d.ts +12 -0
  86. package/dist/types/components/audioPlayer/index.d.ts +43 -0
  87. package/dist/types/components/audioPlayer/labelDisplayToggle/index.d.ts +6 -0
  88. package/dist/types/components/audioPlayer/progressDot/index.d.ts +6 -0
  89. package/dist/types/components/audioPlayer/segmentTip/index.d.ts +12 -0
  90. package/dist/types/components/audioPlayer/useAudioCombine/index.d.ts +30 -0
  91. package/dist/types/components/audioPlayer/useAudioScroll/index.d.ts +17 -0
  92. package/dist/types/components/audioPlayer/useAudioSegment/index.d.ts +31 -0
  93. package/dist/types/components/audioPlayer/useSwitchHotkey/index.d.ts +12 -0
  94. package/dist/types/components/audioPlayer/zoomSlider/index.d.ts +13 -0
  95. package/dist/types/components/imageError/index.d.ts +14 -0
  96. package/dist/types/components/invalidPage/index.d.ts +9 -0
  97. package/dist/types/components/pointCloud2DRectOperationView/index.d.ts +15 -0
  98. package/dist/types/components/pointCloudView/PointCloud2DSingleView.d.ts +2 -1
  99. package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +3 -1
  100. package/dist/types/components/pointCloudView/PointCloudContext.d.ts +10 -1
  101. package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +8 -3
  102. package/dist/types/components/pointCloudView/hooks/useSingleBox.d.ts +5 -1
  103. package/dist/types/components/videoPlayer/components/SpeedController/index.d.ts +16 -0
  104. package/dist/types/components/videoPlayer/components/controller/index.d.ts +11 -0
  105. package/dist/types/hooks/annotation.d.ts +1 -1
  106. package/dist/types/index.d.ts +2 -1
  107. package/dist/types/utils/StepUtils.d.ts +7 -0
  108. package/dist/types/utils/ToolUtils.d.ts +1 -0
  109. package/dist/types/utils/audio.d.ts +132 -0
  110. package/dist/types/utils/index.d.ts +23 -0
  111. package/dist/types/views/MainView/toolFooter/FooterTips/ToolHotKey/audioText/index.d.ts +18 -0
  112. package/dist/types/views/MainView/toolFooter/FooterTips/ToolHotKey/common/index.d.ts +39 -0
  113. package/dist/types/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.d.ts +3 -0
  114. package/dist/utils/StepUtils.js +1 -1
  115. package/dist/utils/ToolUtils.js +1 -1
  116. package/dist/utils/audio.js +1 -0
  117. package/dist/utils/index.js +1 -1
  118. package/dist/views/MainView/index.js +1 -1
  119. package/dist/views/MainView/sidebar/ToolStyle/index.js +1 -1
  120. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/audioText/index.js +1 -0
  121. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/common/index.js +1 -1
  122. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
  123. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/line/index.js +1 -1
  124. package/dist/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -0
  125. package/dist/views/MainView/toolFooter/index.js +1 -1
  126. package/dist/views/MainView/toolHeader/headerOption/index.js +1 -1
  127. package/es/App.js +1 -1
  128. package/es/assets/annotation/audio/clip.svg.js +1 -0
  129. package/es/assets/annotation/audio/clipA.svg.js +1 -0
  130. package/es/assets/annotation/audio/clipASmall.svg.js +1 -0
  131. package/es/assets/annotation/audio/clipSmall.svg.js +1 -0
  132. package/es/assets/annotation/audio/delete.svg.js +1 -0
  133. package/es/assets/annotation/audio/loop.svg.js +1 -0
  134. package/es/assets/annotation/audio/loopA.svg.js +1 -0
  135. package/es/assets/annotation/audio/progressDot.svg.js +1 -0
  136. package/es/assets/annotation/audio/progressDotA.svg.js +1 -0
  137. package/es/assets/annotation/audio/tag.svg.js +1 -0
  138. package/es/assets/annotation/audio/tagA.svg.js +1 -0
  139. package/es/assets/annotation/toolHotKeyIcon/deleteRemark.svg.js +1 -0
  140. package/es/assets/annotation/toolHotKeyIcon/icon_down.svg.js +1 -0
  141. package/es/assets/annotation/toolHotKeyIcon/icon_eyeLock_kj.svg.js +1 -0
  142. package/es/assets/annotation/toolHotKeyIcon/icon_polygonCut_kj.svg.js +1 -0
  143. package/es/assets/annotation/toolHotKeyIcon/icon_up.svg.js +1 -0
  144. package/es/assets/annotation/toolHotKeyIcon/nextRemark.svg.js +1 -0
  145. package/es/assets/annotation/toolHotKeyIcon/preRemark.svg.js +1 -0
  146. package/es/assets/annotation/video/icon_clip.svg.js +1 -0
  147. package/es/components/audioAnnotate/audioContext/index.js +1 -0
  148. package/es/components/audioAnnotate/audioContext/index.module.scss.js +1 -0
  149. package/es/components/audioAnnotate/audioSide/LabelDetailPopover/index.js +1 -0
  150. package/es/components/audioAnnotate/audioSide/LabelDetailPopover/index.module.scss.js +1 -0
  151. package/es/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -0
  152. package/es/components/audioAnnotate/audioSide/clipSidebar/index.module.scss.js +1 -0
  153. package/es/components/audioAnnotate/audioSide/labelFilterInput/index.js +1 -0
  154. package/es/components/audioAnnotate/audioSide/labelFilterInput/index.module.scss.js +1 -0
  155. package/es/components/audioAnnotate/audioSide/labelSidebar/index.js +1 -0
  156. package/es/components/audioAnnotate/audioSide/labelSidebar/index.module.scss.js +1 -0
  157. package/es/components/audioAnnotate/index.js +1 -0
  158. package/es/components/audioAnnotate/index.module.scss.js +1 -0
  159. package/es/components/audioAnnotate/tagResultShow/index.js +1 -0
  160. package/es/components/audioAnnotate/tagResultShow/index.module.scss.js +1 -0
  161. package/es/components/audioAnnotate/textInput/index.js +1 -0
  162. package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -0
  163. package/es/components/audioAnnotate/utils/getWebPcm2Wac.js +1 -0
  164. package/es/components/audioPlayer/clipRegion/index.js +1 -0
  165. package/es/components/audioPlayer/clipRegion/index.module.scss.js +1 -0
  166. package/es/components/audioPlayer/clipTip/index.js +1 -0
  167. package/es/components/audioPlayer/combineTip/index.js +1 -0
  168. package/es/components/audioPlayer/index.js +1 -0
  169. package/es/components/audioPlayer/index.module.scss.js +1 -0
  170. package/es/components/audioPlayer/labelDisplayToggle/index.js +1 -0
  171. package/es/components/audioPlayer/labelDisplayToggle/index.module.scss.js +1 -0
  172. package/es/components/audioPlayer/progressDot/index.js +1 -0
  173. package/es/components/audioPlayer/progressDot/index.module.scss.js +1 -0
  174. package/es/components/audioPlayer/segmentTip/index.js +1 -0
  175. package/es/components/audioPlayer/useAudioCombine/index.js +2 -0
  176. package/es/components/audioPlayer/useAudioScroll/index.js +1 -0
  177. package/es/components/audioPlayer/useAudioSegment/index.js +1 -0
  178. package/es/components/audioPlayer/useSwitchHotkey/index.js +1 -0
  179. package/es/components/audioPlayer/zoomSlider/index.js +1 -0
  180. package/es/components/audioPlayer/zoomSlider/index.module.scss.js +1 -0
  181. package/es/components/imageError/index.js +1 -0
  182. package/es/components/invalidPage/index.js +1 -0
  183. package/es/components/pointCloud2DRectOperationView/index.js +1 -0
  184. package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  185. package/es/components/pointCloudView/PointCloud2DView.js +1 -1
  186. package/es/components/pointCloudView/PointCloudContext.js +1 -1
  187. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  188. package/es/components/pointCloudView/hooks/useSingleBox.js +1 -1
  189. package/es/components/pointCloudView/index.js +1 -1
  190. package/es/components/videoPlayer/components/SpeedController/index.js +1 -0
  191. package/es/components/videoPlayer/components/SpeedController/index.module.scss.js +1 -0
  192. package/es/components/videoPlayer/components/controller/index.js +1 -1
  193. package/es/index.css +721 -0
  194. package/es/index.js +1 -1
  195. package/es/store/annotation/reducer.js +1 -1
  196. package/es/utils/StepUtils.js +1 -1
  197. package/es/utils/ToolUtils.js +1 -1
  198. package/es/utils/audio.js +1 -0
  199. package/es/utils/index.js +1 -1
  200. package/es/views/MainView/index.js +1 -1
  201. package/es/views/MainView/sidebar/ToolStyle/index.js +1 -1
  202. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/audioText/index.js +1 -0
  203. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/common/index.js +1 -1
  204. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
  205. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/line/index.js +1 -1
  206. package/es/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -0
  207. package/es/views/MainView/toolFooter/index.js +1 -1
  208. package/es/views/MainView/toolHeader/headerOption/index.js +1 -1
  209. package/package.json +9 -5
@@ -1 +1 @@
1
- import{EPointCloudName as tt,MathUtils as v,getCuboidFromPointCloudBox as Zt}from"@labelbee/lb-annotation";import{EPerspectiveView as M,PointCloudUtils as D,DEFAULT_SPHERE_PARAMS as Mt}from"@labelbee/lb-utils";import{useContext as Gt}from"react";import{PointCloudContext as Qt}from"../PointCloudContext.js";import{useSingleBox as ft}from"./useSingleBox.js";import{useSphere as Xt}from"./useSphere.js";import{useSelector as Yt,useDispatch as qt}from"../../../store/ctx.js";import Jt from"../../../utils/StepUtils.js";import{jsonParser as gt}from"../../../utils/index.js";import{PreDataProcess as ot,SetPointCloudLoading as Pt,SetLoadPCDFileLoading as Ct}from"../../../store/annotation/actionCreators.js";import{message as Kt}from"antd";import{useTranslation as $t}from"react-i18next";import{useHistory as to}from"./useHistory.js";import{usePolygon as oo}from"./usePolygon.js";var eo=Object.defineProperty,no=Object.defineProperties,io=Object.getOwnPropertyDescriptors,ht=Object.getOwnPropertySymbols,so=Object.prototype.hasOwnProperty,ro=Object.prototype.propertyIsEnumerable,mt=(e,t,n)=>t in e?eo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L=(e,t)=>{for(var n in t||(t={}))so.call(t,n)&&mt(e,n,t[n]);if(ht)for(var n of ht(t))ro.call(t,n)&&mt(e,n,t[n]);return e},k=(e,t)=>no(e,io(t)),et=(e,t,n)=>new Promise((d,o)=>{var a=u=>{try{c(n.next(u))}catch(C){o(C)}},f=u=>{try{c(n.throw(u))}catch(C){o(C)}},c=u=>u.done?d(u.value):Promise.resolve(u.value).then(a,f);c((n=n.apply(e,t)).next())});const q=5,J=90,xt=.01,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},nt=(e,t,n,d,o)=>{const{x:a,y:f}=D.transferCanvas2World(e,t),{defaultZ:c}=Mt,u={center:{x:a,y:f,z:c},id:e.id},C=d?L(L({},d),u):k(L({},u),{attribute:"",valid:!0});return o&&Object.assign(C,o),C},it=(e,t,n,d,o,a)=>{let f=e.pointList.map(B=>D.transferCanvas2World(B,t)),c=0,u=1,C={};if(n){const B=n.getSensesPointZAxisInPolygon(f,void 0,a);a&&B.fittedCoordinates.length>0&&(f=B.fittedCoordinates),c=(B.maxZ+B.minZ)/2,u=B.maxZ-B.minZ,C={count:B.zCount}}const[h,I,H]=f,O=v.getLineCenterPoint([h,H]),A=v.getLineLength(h,I),z=v.getLineLength(I,H),R=v.getRadiusFromQuadrangle(e.pointList);d&&(c=d.center.z,u=d.depth);const T={center:{x:O.x,y:O.y,z:c},width:a?z+xt:z,height:a?A+xt:A,depth:u,rotation:R,id:e.id},j=L(d?L(L({},d),T):k(L({},T),{attribute:"",valid:!0}),C);o&&Object.assign(j,o);const U=f.map(B=>D.transferWorld2Canvas(B,t));return{boxParams:j,newPointList:U}},yt=(e,t,n)=>{const d={x:e.x-t.x,y:e.y-t.y};return k(L({},n),{center:{x:n.center.x-d.x,y:n.center.y,z:n.center.z-d.y}})},Lt=(e,t,n,d)=>{const[o,a,f]=e.pointList,[c,u,C]=t.pointList,h=v.getLineCenterPoint([o,f]),I=v.getLineCenterPoint([c,C]),O={x:{x:h.x-I.x,y:h.y-I.y}.x,y:0,z:h.y-I.y},A=v.getLineLength(o,a),z=v.getLineLength(c,u),R=A-z,T=v.getLineLength(a,f),j=v.getLineLength(u,C),U=T-j,{newBoxParams:B}=d.getNewBoxBySideUpdate(O,U,R,n);return B},lo=(e,t,n)=>{const d={x:e.x-t.x,y:e.y-t.y};return k(L({},n),{center:{x:n.center.x,y:n.center.y-d.x,z:n.center.z-d.y}})},ao=(e,t,n,d)=>{const[o,a,f]=e.pointList,[c,u,C]=t.pointList,h=v.getLineCenterPoint([o,f]),I=v.getLineCenterPoint([c,C]),O={x:{x:h.x-I.x,y:h.y-I.y}.x,y:0,z:h.y-I.y},A=v.getLineLength(o,a),z=v.getLineLength(c,u),R=A-z,T=v.getLineLength(a,f),j=v.getLineLength(u,C),U=T-j;let{newBoxParams:B}=d.getNewBoxByBackUpdate(O,U,R,n);return B},vt=(e,t,n,d,o)=>{var a;if(!n)return;const{toolInstance:f,pointCloudInstance:c}=n;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:J);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,M.Left);c.setInitCameraPosition(u);const{point2d:C,zoom:h}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),f.initPosition(),f.zoomChangeOnCenter(h),f.setResult([k(L(L({},t),C),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(t.id)},Bt=(e,t,n,d)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=n;a.loadPCDFileByBox(d,e,{width:q,depth:q});const{cameraPositionVector:f}=a.updateOrthoCamera(e,M.Left);a.setInitCameraPosition(f);const{polygon2d:c,zoom:u}=a.getBoxSidePolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},bt=(e,t,n,d,o)=>{var a;if(!n)return;const{toolInstance:f,pointCloudInstance:c}=n;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:J);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,M.Back);c.setInitCameraPosition(u);const{point2d:C,zoom:h}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),f.initPosition(),f.zoomChangeOnCenter(h),f.setResult([k(L(L({},t),C),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(t.id)},wt=(e,t,n,d)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=n;a.loadPCDFileByBox(d,e,{height:q,depth:q});const{cameraPositionVector:f}=a.updateOrthoCamera(e,M.Back);a.setInitCameraPosition(f);const{polygon2d:c,zoom:u}=a.getBoxBackPolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},It=(e,t,n,d)=>{if(!n||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,M.Top),d.render();const{toolInstance:o,pointCloudInstance:a}=n,{point2d:f}=a.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?k(L(L({},t),f),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},st=(e,t,n,d)=>{var o,a;if(!n||!d)return;d.generateBox(e,t.id),d.render();const{pointCloud2dOperation:f,pointCloudInstance:c}=n,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),C=[...f.polygonList],h=C.find(I=>I.id===t.id);h?(h.pointList=u,h.valid=(o=e.valid)!=null?o:!0):C.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(a=e.valid)!=null?a:!0}),f.setResultAndSelectedID(C,t.id)},co=()=>{const e=Gt(Qt),{topViewInstance:t,sideViewInstance:n,backViewInstance:d,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:f,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:C,pointCloudSphereList:h,hideAttributes:I,setHighlight2DDataList:H}=e,{addHistory:O,initHistory:A,pushHistoryUnderUpdatePolygon:z,pushHistoryUnderUpdateLine:R}=to(),{selectedPolygon:T}=oo(),{updateSelectedBox:j,updateSelectedBoxes:U,getPointCloudByID:B}=ft(),{getPointCloudSphereByID:St,updatePointCloudSphere:rt,selectedSphere:G}=Xt(),{currentData:F,config:w}=Yt(i=>{const{stepList:s,step:p,imgList:l,imgIndex:r}=i.annotation;return{currentData:l[r],config:gt(Jt.getCurrentStepInfo(p,s).config)}}),N=qt(),{selectedBox:S}=ft(),{t:Dt}=$t(),lt=S==null?void 0:S.info;if(!t||!n||!d)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:K}=t,_t=i=>{o==null||o.generateBox(i),o==null||o.controls.update(),o==null||o.render()},Vt=i=>{o==null||o.generateSphere(i),o==null||o.controls.update(),o==null||o.render()},Ot=({newPoint:i,size:s,zoom:p,trackConfigurable:l})=>{var r;const g={attribute:(r=t.toolInstance.defaultAttribute)!=null?r:""};l===!0&&Object.assign(g,{trackID:D.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const P=nt(i,s,K,void 0,g);c(i.id);const m=f(P);Q(y.Top,i,P,p,m,w),O({newSphereParams:P})},Ut=({polygon:i,size:s,imgList:p,trackConfigurable:l,zoom:r,intelligentFit:g})=>{var P,m;const x={attribute:(P=t.toolInstance.defaultAttribute)!=null?P:""};l===!0&&Object.assign(x,{trackID:D.getNextTrackID({imgList:[],extraBoxList:C,extraSphereList:h})});const _=t==null?void 0:t.toolInstance,V=L({},i);let{boxParams:b,newPointList:E}=it(V,s,K,void 0,x,g);if(b=N(ot({tool:tt.PointCloud,dataList:[b],stepConfig:w,action:"viewUpdateBox"}))[0],(w==null?void 0:w.lowerLimitPointsNumInBox)&&typeof b.count=="number"&&b.count<w.lowerLimitPointsNumInBox){Kt.info(Dt("LowerLimitPointsNumInBox",{num:w.lowerLimitPointsNumInBox})),_.deletePolygon(b.id);return}g&&(E==null?void 0:E.length)&&(V.pointList=E);const X=I.includes(V.attribute),Z=a(b),$=(m=e==null?void 0:e.polygonList)!=null?m:[];t==null||t.updatePolygonList(Z!=null?Z:[],$),X?c([]):(c(b.id),_.selection.setSelectedIDs(V.id),W({omitView:y.Top,polygon:V,boxParams:b,zoom:r,newPointCloudBoxList:Z}),g&&st(b,V,t,o)),O({newBoxParams:b})},kt=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:p,newSphereList:l})=>{var r;const g=t==null?void 0:t.toolInstance;if(!(u.length===0||!g)){if(i||(S==null?void 0:S.info)){const P=i!=null?i:S==null?void 0:S.info;(r=g==null?void 0:g.selection)==null||r.setSelectedIDs(u[0]);const m=g.selectedPolygon;if(u.length===1&&P){W({omitView:y.Top,polygon:m,boxParams:P,newPointCloudBoxList:s});return}}if((p||G)&&u.length===1){const P=p!=null?p:G;g.setSelectedID(u[0]);const m=g.selectedPoint;P&&Q(y.Top,m,P,void 0,l,w)}}},dt=(i,s,p)=>{if(lt){let l,r;switch(p){case y.Back:l=ao;break;case y.Side:l=Lt;break;default:l=Lt;break}r=l(i,s,lt,n.pointCloudInstance);const P=N(ot({tool:tt.PointCloud,dataList:[r],stepConfig:w,action:"viewUpdateBox"}))[0],m=r.valid!==P.valid;if(r=P,o){const{count:_}=o.getSensesPointZAxisInPolygon(Zt(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=k(L({},r),{count:_})}const x=j(r);return r=x.find(_=>_.id===r.id),W({omitView:m?void 0:p,polygon:i,boxParams:r,newPointCloudBoxList:x}),x}},at=(i,s,p)=>{if(G){let l,r;switch(p){case y.Back:l=lo;break;case y.Side:l=yt;break;default:l=yt;break}r=l(i,s,G);const g=rt(r);return Q(p,i,r,void 0,g,w),g}},At=(i,s)=>{at(i,s,y.Side)},zt=(i,s)=>{at(i,s,y.Back)},Tt=(i,s)=>{dt(i,s,y.Side)},jt=(i,s)=>{dt(i,s,y.Back)},Rt=(i,s)=>{R(i)},Nt=(i,s)=>{const p=St(i.id),l=nt(i,s,K,p),r=rt(l);Q(y.Top,i,l,void 0,r,w)},Et=(i,s)=>{if(T){const l=i[0].newPolygon;l.pointList=l.pointList.map(r=>D.transferCanvas2World(r,s)),z(i[0].newPolygon);return}let p=i.map(({newPolygon:l})=>{const r=B(l.id),{boxParams:g}=it(l,s,t.pointCloudInstance,r);return g});if(p=N(ot({tool:tt.PointCloud,dataList:p,stepConfig:w,action:"viewUpdateBox"})),p.length===1){const{newPolygon:l}=i[0],r=U(p);W({polygon:l,boxParams:p[0],newPointCloudBoxList:r})}else{const l=U(p);l&&e.syncAllViewPointCloudColor(l)}},Ht=i=>{var s,p,l,r,g;if(S){const P=Number(i.widthDefault),m=Number(i.depthDefault),x=Number(i.heightDefault),_=S==null?void 0:S.info.trackID,b=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(Y=>(Y==null?void 0:Y.trackID)===_),E={width:(l=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:l.width,height:(g=(r=t==null?void 0:t.toolInstance)==null?void 0:r.basicImgInfo)==null?void 0:g.height},ct=b.pointList.map(Y=>D.transferCanvas2World(Y,E)),X=v.getModifiedRectangleCoordinates(ct,x,P),Z=X[0],$=X[2],ut=v.getLineCenterPoint([Z,$]),Ft=S.info.center.z-S.info.depth/2,pt=k(L({},S.info),{center:{x:ut.x,y:ut.y,z:Ft+m/2},width:P,height:x,depth:m,valid:!0}),Wt=U([pt]);W({omitView:y["3D"],polygon:b,boxParams:pt,newPointCloudBoxList:Wt})}},Q=(i,s,p,l,r,g)=>et(void 0,null,function*(){const P=F==null?void 0:F.url,m={[y.Side]:()=>{vt(p,s,n,P,g)},[y.Back]:()=>{d&&bt(p,s,d,P,g)},[y.Top]:()=>{It(p,s,t,o)}};Object.keys(m).forEach(x=>{x!==i&&m[x]()}),l&&(o==null||o.updateCameraZoom(l)),Vt(p)}),W=i=>et(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:l,zoom:r,newPointCloudBoxList:g}=i,P=F==null?void 0:F.url;g&&(yield e.syncAllViewPointCloudColor(g));const m={[y.Side]:()=>{Bt(l,p,n,P)},[y.Back]:()=>{d&&wt(l,p,d,P)},[y.Top]:()=>{st(l,p,t,o)}};Object.keys(m).forEach(x=>{x!==s&&m[x]()}),r&&(o==null||o.updateCameraZoom(r)),_t(l)});return{topViewAddSphere:Ot,topViewAddBox:Ut,topViewSelectedChanged:kt,topViewUpdatePoint:Nt,sideViewUpdatePoint:At,backViewUpdatePoint:zt,topViewUpdateBox:Et,topViewUpdateLine:Rt,sideViewUpdateBox:Tt,backViewUpdateBox:jt,pointCloudBoxListUpdated:i=>{t.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const s=D.getDefaultOrthographicParams(i);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>et(void 0,[...i],function*(s=F){var p,l,r,g,P,m;if(!(s==null?void 0:s.url)||!o)return;H([]),Pt(N,!0),Ct(N,!0),yield o.loadPCDFile(s.url,(p=w==null?void 0:w.radius)!=null?p:J),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let x=[],_=[],V=[],b=[];o.updateTopCamera();const E=(r=(l=gt(s.result))==null?void 0:l.valid)!=null?r:!0;e.setPointCloudValid(E),(g=e.sideViewInstance)==null||g.clearAllData(),(P=e.backViewInstance)==null||P.clearAllData(),t.updateData(s.url,s.result,{radius:(m=w==null?void 0:w.radius)!=null?m:J}),s.result&&(x=D.getBoxParamsFromResultList(s.result),V=D.getPolygonListFromResultList(s.result),_=D.getLineListFromResultList(s.result),b=D.getSphereParamsFromResultList(s.result),o==null||o.generateBoxes(x),o==null||o.generateSpheres(b),yield e.syncAllViewPointCloudColor(x,[])),A({pointCloudBoxList:x,polygonList:V,lineList:_,pointCloudSphereList:b}),Pt(N,!1),Ct(N,!1)}),updateViewsByDefaultSize:Ht}};export{bt as syncBackViewByPoint,vt as syncSideViewByPoint,It as syncTopViewByPoint,wt as synchronizeBackView,Bt as synchronizeSideView,st as synchronizeTopView,nt as topViewPoint2PointCloud,it as topViewPolygon2PointCloud,co as usePointCloudViews};
1
+ import{EPointCloudName as nt,MathUtils as w,getCuboidFromPointCloudBox as Gt}from"@labelbee/lb-annotation";import{EPerspectiveView as Q,PointCloudUtils as V,DEFAULT_SPHERE_PARAMS as Qt}from"@labelbee/lb-utils";import{useContext as Xt}from"react";import{PointCloudContext as Yt}from"../PointCloudContext.js";import{useSingleBox as qt}from"./useSingleBox.js";import{useSphere as Jt}from"./useSphere.js";import{useSelector as Kt,useDispatch as $t}from"../../../store/ctx.js";import to from"../../../utils/StepUtils.js";import{jsonParser as ft,getRectPointCloudBox as oo}from"../../../utils/index.js";import{PreDataProcess as it,SetPointCloudLoading as Ct,SetLoadPCDFileLoading as Pt}from"../../../store/annotation/actionCreators.js";import{message as eo}from"antd";import{useTranslation as no}from"react-i18next";import{useHistory as io}from"./useHistory.js";import{usePolygon as so}from"./usePolygon.js";import{useLatest as ro}from"ahooks";var lo=Object.defineProperty,ao=Object.defineProperties,co=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,xt=(e,t,i)=>t in e?lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,L=(e,t)=>{for(var i in t||(t={}))uo.call(t,i)&&xt(e,i,t[i]);if(mt)for(var i of mt(t))po.call(t,i)&&xt(e,i,t[i]);return e},O=(e,t)=>ao(e,co(t)),st=(e,t,i)=>new Promise((d,o)=>{var a=u=>{try{c(i.next(u))}catch(P){o(P)}},g=u=>{try{c(i.throw(u))}catch(P){o(P)}},c=u=>u.done?d(u.value):Promise.resolve(u.value).then(a,g);c((i=i.apply(e,t)).next())});const J=5,K=90,ht=.01,v={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},rt=(e,t,i,d,o)=>{const{x:a,y:g}=V.transferCanvas2World(e,t),{defaultZ:c}=Qt,u={center:{x:a,y:g,z:c},id:e.id},P=d?L(L({},d),u):O(L({},u),{attribute:"",valid:!0});return o&&Object.assign(P,o),P},lt=(e,t,i,d,o,a)=>{let g=e.pointList.map(B=>V.transferCanvas2World(B,t)),c=0,u=1,P={};if(i){const B=i.getSensesPointZAxisInPolygon(g,void 0,a);a&&B.fittedCoordinates.length>0&&(g=B.fittedCoordinates),c=(B.maxZ+B.minZ)/2,u=B.maxZ-B.minZ,P={count:B.zCount}}const[h,S,F]=g,R=w.getLineCenterPoint([h,F]),z=w.getLineLength(h,S),A=w.getLineLength(S,F),N=w.getRadiusFromQuadrangle(e.pointList);d&&(c=d.center.z,u=d.depth);const T={center:{x:R.x,y:R.y,z:c},width:a?A+ht:A,height:a?z+ht:z,depth:u,rotation:N,id:e.id},j=L(d?L(L({},d),T):O(L({},T),{attribute:"",valid:!0}),P);o&&Object.assign(j,o);const E=g.map(B=>V.transferWorld2Canvas(B,t));return{boxParams:j,newPointList:E}},Lt=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x-d.x,y:i.center.y,z:i.center.z-d.y}})},yt=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),S=w.getLineCenterPoint([c,P]),R={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j,{newBoxParams:B}=d.getNewBoxBySideUpdate(R,E,N,i);return B},go=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x,y:i.center.y-d.x,z:i.center.z-d.y}})},fo=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),S=w.getLineCenterPoint([c,P]),R={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j;let{newBoxParams:B}=d.getNewBoxByBackUpdate(R,E,N,i);return B},vt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Left);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},Bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{width:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Left);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxSidePolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},wt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Back);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{height:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Back);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxBackPolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},It=(e,t,i,d)=>{if(!i||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,Q.Top),d.render();const{toolInstance:o,pointCloudInstance:a}=i,{point2d:g}=a.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?O(L(L({},t),g),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},dt=(e,t,i,d)=>{var o,a;if(!i||!d)return;d.generateBox(e,t.id),d.render();const{pointCloud2dOperation:g,pointCloudInstance:c}=i,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),P=[...g.polygonList],h=P.find(S=>S.id===t.id);h?(h.pointList=u,h.valid=(o=e.valid)!=null?o:!0):P.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(a=e.valid)!=null?a:!0}),g.setResultAndSelectedID(P,t.id)},Co=()=>{const e=Xt(Yt),{topViewInstance:t,sideViewInstance:i,backViewInstance:d,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:g,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:P,pointCloudSphereList:h,hideAttributes:S,setHighlight2DDataList:F,cuboidBoxIn2DView:R,imageSizes:z}=e,{addHistory:A,initHistory:N,pushHistoryUnderUpdatePolygon:T}=io(),{selectedPolygon:j}=so(),{getPointCloudSphereByID:E,updatePointCloudSphere:B,selectedSphere:X}=Jt(),{currentData:W,config:b}=Kt(n=>{const{stepList:s,step:p,imgList:r,imgIndex:l}=n.annotation;return{currentData:r[l],config:ft(to.getCurrentStepInfo(p,s).config)}}),H=$t(),Dt=ro(R),$=n=>{if(!Dt.current){const{mappingImgList:s=[]}=W,p=s.map(r=>oo({pointCloudBox:n,mappingData:r,imageSizes:z}));Object.assign(n,{rects:p.filter(r=>r!==void 0)})}},{selectedBox:_,updateSelectedBox:St,updateSelectedBoxes:tt,getPointCloudByID:_t}=qt({generateRects:$}),{t:Vt}=no(),at=_==null?void 0:_.info;if(!t||!i||!d)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:ot}=t,Ot=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},kt=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},At=({newPoint:n,size:s,zoom:p,trackConfigurable:r})=>{var l;const f={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(f,{trackID:V.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const C=rt(n,s,ot,void 0,f);c(n.id);const m=g(C);Y(v.Top,n,C,p,m,b),A({newSphereParams:C})},Ut=({polygon:n,size:s,imgList:p,trackConfigurable:r,zoom:l,intelligentFit:f})=>{var C,m;const x={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(x,{trackID:V.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:h})});const I=t==null?void 0:t.toolInstance,D=L({},n);let{boxParams:y,newPointList:U}=lt(D,s,ot,void 0,x,f);if(y=H(it({tool:nt.PointCloud,dataList:[y],stepConfig:b,action:"viewUpdateBox"}))[0],(b==null?void 0:b.lowerLimitPointsNumInBox)&&typeof y.count=="number"&&y.count<b.lowerLimitPointsNumInBox){eo.info(Vt("LowerLimitPointsNumInBox",{num:b.lowerLimitPointsNumInBox})),I.deletePolygon(y.id);return}f&&(U==null?void 0:U.length)&&(D.pointList=U);const k=S.includes(D.attribute);$(y);const G=a(y),et=(m=e==null?void 0:e.polygonList)!=null?m:[];t==null||t.updatePolygonList(G!=null?G:[],et),k?c([]):(c(y.id),I.selection.setSelectedIDs(D.id),M({omitView:v.Top,polygon:D,boxParams:y,zoom:l,newPointCloudBoxList:G}),f&&dt(y,D,t,o)),A({newBoxParams:y})},Rt=n=>{const{boxID:s,imageName:p,width:r,height:l,x:f,y:C}=n,m=P.find(x=>x.id===s);if(m==null?void 0:m.rects){const{rects:x=[]}=m,I=x.find(D=>D.imageName===p);if(I){let D=x;const y=O(L({},I),{width:r,height:l,x:f,y:C});D=x.map(k=>k===I?y:k);const U=O(L({},m),{rects:D}),Z=P.map(k=>k===m?U:k);return t==null||t.updatePolygonList(Z!=null?Z:[]),Z}}},zt=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:r})=>{var l;const f=t==null?void 0:t.toolInstance;if(!(u.length===0||!f)){if(n||(_==null?void 0:_.info)){const C=n!=null?n:_==null?void 0:_.info;(l=f==null?void 0:f.selection)==null||l.setSelectedIDs(u[0]);const m=f.selectedPolygon;if(u.length===1&&C){M({omitView:v.Top,polygon:m,boxParams:C,newPointCloudBoxList:s});return}}if((p||X)&&u.length===1){const C=p!=null?p:X;f.setSelectedID(u[0]);const m=f.selectedPoint;C&&Y(v.Top,m,C,void 0,r,b)}}},ct=(n,s,p)=>{if(at){let r,l;switch(p){case v.Back:r=fo;break;case v.Side:r=yt;break;default:r=yt;break}l=r(n,s,at,i.pointCloudInstance);const C=H(it({tool:nt.PointCloud,dataList:[l],stepConfig:b,action:"viewUpdateBox"}))[0],m=l.valid!==C.valid;if(l=C,o){const{count:I}=o.getSensesPointZAxisInPolygon(Gt(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=O(L({},l),{count:I})}const x=St(l);return l=x.find(I=>I.id===l.id),M({omitView:m?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:x}),x}},ut=(n,s,p)=>{if(X){let r,l;switch(p){case v.Back:r=go;break;case v.Side:r=Lt;break;default:r=Lt;break}l=r(n,s,X);const f=B(l);return Y(p,n,l,void 0,f,b),f}},Tt=(n,s)=>{ut(n,s,v.Side)},jt=(n,s)=>{ut(n,s,v.Back)},Nt=(n,s)=>{ct(n,s,v.Side)},Et=(n,s)=>{ct(n,s,v.Back)},Ht=(n,s)=>{const p=E(n.id),r=rt(n,s,ot,p),l=B(r);Y(v.Top,n,r,void 0,l,b)},Ft=(n,s)=>{if(j){const r=n[0].newPolygon;r.pointList=r.pointList.map(l=>V.transferCanvas2World(l,s)),T(n[0].newPolygon);return}let p=n.map(({newPolygon:r})=>{const l=_t(r.id),{boxParams:f}=lt(r,s,t.pointCloudInstance,l);return f});if(p=H(it({tool:nt.PointCloud,dataList:p,stepConfig:b,action:"viewUpdateBox"})),p.length===1){const{newPolygon:r}=n[0],l=tt(p);M({polygon:r,boxParams:p[0],newPointCloudBoxList:l})}else{const r=tt(p);r&&e.syncAllViewPointCloudColor(r)}},Wt=n=>{var s,p,r,l,f;if(_){const C=Number(n.widthDefault),m=Number(n.depthDefault),x=Number(n.heightDefault),I=_==null?void 0:_.info.trackID,y=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(q=>(q==null?void 0:q.trackID)===I),U={width:(r=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:r.width,height:(f=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:f.height},Z=y.pointList.map(q=>V.transferCanvas2World(q,U)),k=w.getModifiedRectangleCoordinates(Z,x,C),G=k[0],et=k[2],pt=w.getLineCenterPoint([G,et]),Zt=_.info.center.z-_.info.depth/2,gt=O(L({},_.info),{center:{x:pt.x,y:pt.y,z:Zt+m/2},width:C,height:x,depth:m,valid:!0}),Mt=tt([gt]);M({omitView:v["3D"],polygon:y,boxParams:gt,newPointCloudBoxList:Mt})}},Y=(n,s,p,r,l,f)=>st(void 0,null,function*(){const C=W==null?void 0:W.url,m={[v.Side]:()=>{vt(p,s,i,C,f)},[v.Back]:()=>{d&&wt(p,s,d,C,f)},[v.Top]:()=>{It(p,s,t,o)}};Object.keys(m).forEach(x=>{x!==n&&m[x]()}),r&&(o==null||o.updateCameraZoom(r)),kt(p)}),M=n=>st(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:r,zoom:l,newPointCloudBoxList:f}=n,C=W==null?void 0:W.url;f&&(yield e.syncAllViewPointCloudColor(f));const m={[v.Side]:()=>{Bt(r,p,i,C)},[v.Back]:()=>{d&&bt(r,p,d,C)},[v.Top]:()=>{dt(r,p,t,o)}};Object.keys(m).forEach(x=>{x!==s&&m[x]()}),l&&(o==null||o.updateCameraZoom(l)),Ot(r)});return{topViewAddSphere:At,topViewAddBox:Ut,topViewSelectedChanged:zt,topViewUpdatePoint:Ht,sideViewUpdatePoint:Tt,backViewUpdatePoint:jt,topViewUpdateBox:Ft,sideViewUpdateBox:Nt,backViewUpdateBox:Et,pointCloudBoxListUpdated:n=>{t.updatePolygonList(n),o==null||o.generateBoxes(n)},initPointCloud3d:n=>{if(!o)return;const s=V.getDefaultOrthographicParams(n);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...n)=>st(void 0,[...n],function*(s=W){var p,r,l,f,C,m;if(!(s==null?void 0:s.url)||!o)return;F([]),Ct(H,!0),Pt(H,!0),yield o.loadPCDFile(s.url,(p=b==null?void 0:b.radius)!=null?p:K),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let x=[],I=[],D=[],y=[];o.updateTopCamera();const U=(l=(r=ft(s.result))==null?void 0:r.valid)!=null?l:!0;e.setPointCloudValid(U),(f=e.sideViewInstance)==null||f.clearAllData(),(C=e.backViewInstance)==null||C.clearAllData(),t.updateData(s.url,s.result,{radius:(m=b==null?void 0:b.radius)!=null?m:K}),s.result&&(x=V.getBoxParamsFromResultList(s.result),D=V.getPolygonListFromResultList(s.result),I=V.getLineListFromResultList(s.result),y=V.getSphereParamsFromResultList(s.result),o==null||o.generateBoxes(x),o==null||o.generateSpheres(y),yield e.syncAllViewPointCloudColor(x,[])),N({pointCloudBoxList:x,polygonList:D,lineList:I,pointCloudSphereList:y}),Ct(H,!1),Pt(H,!1)}),updateViewsByDefaultSize:Wt,generateRects:$,update2DViewRect:Rt}};export{wt as syncBackViewByPoint,vt as syncSideViewByPoint,It as syncTopViewByPoint,bt as synchronizeBackView,Bt as synchronizeSideView,dt as synchronizeTopView,rt as topViewPoint2PointCloud,lt as topViewPolygon2PointCloud,Co as usePointCloudViews};
@@ -1 +1 @@
1
- import{useContext as z,useMemo as b,useCallback as a}from"react";import u from"lodash";import{PointCloudContext as F}from"../PointCloudContext.js";import{EToolName as h,cAnnotation as G}from"@labelbee/lb-annotation";import{useHistory as J}from"./useHistory.js";import{usePolygon as Q}from"./usePolygon.js";var U=Object.defineProperty,X=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,V=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable,D=(e,i,t)=>i in e?U(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t,ee=(e,i)=>{for(var t in i||(i={}))Z.call(i,t)&&D(e,t,i[t]);if(V)for(var t of V(i))$.call(i,t)&&D(e,t,i[t]);return e},oe=(e,i)=>X(e,Y(i));const{ESortDirection:y}=G,ne=()=>{const{pointCloudBoxList:e,setPointCloudResult:i,topViewInstance:t,backViewInstance:v,sideViewInstance:g,selectedIDs:f,selectedID:C,mainViewInstance:s,setSelectedIDs:L,syncAllViewPointCloudColor:B,polygonList:S,pointCloudPattern:m}=z(F),{selectedPolygon:c,updateSelectedPolygon:j,updatePolygonValidByID:A,deletePolygon:E}=Q(),{pushHistoryWithList:w}=J(),l=b(()=>{const o=e.findIndex(n=>n.id===C);if(o>-1)return{info:e[o],index:o}},[C,e]),I=a(o=>{if(l==null?void 0:l.info){e.splice(l.index,1,u.merge(l.info,o));const n=u.cloneDeep(e);return i(n),w({pointCloudBoxList:n}),n}return e},[C,e]),N=a((o,n)=>{const d=e.findIndex(r=>r.id===n);if(d>-1){e.splice(d,1,u.merge(e[d],o));const r=u.cloneDeep(e);return i(r),r}return e},[e]),P=a(o=>{t==null||t.pointCloud2dOperation.setPolygonValidAndRender(o,!0),g==null||g.pointCloud2dOperation.setPolygonValidAndRender(o,!0),v==null||v.pointCloud2dOperation.setPolygonValidAndRender(o,!0)},[t,g,v]),R=a(()=>{if(l==null?void 0:l.info){const{id:o,valid:n=!0}=l.info,d=I({valid:!n});B(d),P(o)}c&&(j(oe(ee({},c),{valid:!c.valid})),t==null||t.pointCloud2dOperation.setPolygonValidAndRender(c.id,!0))},[P,l,c]),H=a(o=>{const n=e.find(d=>d.id===o);if(n){const{id:d,valid:r=!0}=n,p=N({valid:!r},d);return P(d),p}A(o)},[P,e,S]),O=a((o=y.ascend,n=!1)=>{if(!t||f.length>1)return;if(m!==h.Rect&&m!==h.Polygon){n&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:o!==y.ascend}));return}const{pointCloud2dOperation:d}=t,r=d.switchToNextPolygon(o);r&&L(r)},[t,m,t==null?void 0:t.toolInstance]),T=(o=!1)=>{O(y.descend,o)},k=(o=!1)=>{O(y.ascend,o)},_=o=>{const n=e.filter(d=>d.id!==o);i(n),s==null||s.removeObjectByName(o,"box"),s==null||s.render(),B(n)},K=()=>{l&&(_(l.info.id),t==null||t.pointCloud2dOperation.deletePolygon(l.info.id)),c&&(E(c.id),t==null||t.pointCloud2dOperation.deletePolygon(c.id))},M=b(()=>e.filter(o=>f.includes(o.id)),[f,e]),W=a(o=>{const n=u.cloneDeep(e);let d=!1;if(o.forEach(r=>{const p=n.findIndex(x=>x.id===r.id);if(p>-1){const x=u.merge(n[p],r);n.splice(p,1,x),s==null||s.generateBox(x),d=!0}}),d)return i(n),w({pointCloudBoxList:n}),s==null||s.render(),n},[f,e]),q=a(o=>e.find(n=>n.id===o),[e]);return{selectedBox:l,updateSelectedBox:I,changeSelectedBoxValid:R,changeValidByID:H,selectNextBox:k,selectPrevBox:T,deletePointCloudBox:_,selectedBoxes:M,updateSelectedBoxes:W,getPointCloudByID:q,deleteSelectedPointCloudBoxAndPolygon:K}};export{ne as useSingleBox};
1
+ import{useContext as G,useMemo as h,useCallback as u}from"react";import f from"lodash";import{PointCloudContext as J}from"../PointCloudContext.js";import{EToolName as D,cAnnotation as Q}from"@labelbee/lb-annotation";import{useHistory as U}from"./useHistory.js";import{usePolygon as X}from"./usePolygon.js";var Y=Object.defineProperty,Z=Object.defineProperties,$=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable,S=(i,e,l)=>e in i?Y(i,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[e]=l,ne=(i,e)=>{for(var l in e||(e={}))ee.call(e,l)&&S(i,l,e[l]);if(L)for(var l of L(e))oe.call(e,l)&&S(i,l,e[l]);return i},te=(i,e)=>Z(i,$(e));const{ESortDirection:y}=Q,ie=i=>{const{pointCloudBoxList:e,setPointCloudResult:l,topViewInstance:d,backViewInstance:g,sideViewInstance:C,selectedIDs:P,selectedID:m,mainViewInstance:c,setSelectedIDs:j,syncAllViewPointCloudColor:I,polygonList:R,pointCloudPattern:B}=G(J),{selectedPolygon:a,updateSelectedPolygon:A,updatePolygonValidByID:E,deletePolygon:N}=X(),{pushHistoryWithList:_}=U(),r=h(()=>{const o=e.findIndex(t=>t.id===m);if(o>-1)return{info:e[o],index:o}},[m,e]),O=u(o=>{var t;if(r==null?void 0:r.info){(t=i==null?void 0:i.generateRects)==null||t.call(i,o),e.splice(r.index,1,f.merge(r.info,o));const n=f.cloneDeep(e);return l(n),_({pointCloudBoxList:n}),n}return e},[m,e]),H=u((o,t)=>{const n=e.findIndex(s=>s.id===t);if(n>-1){e.splice(n,1,f.merge(e[n],o));const s=f.cloneDeep(e);return l(s),s}return e},[e]),v=u(o=>{d==null||d.pointCloud2dOperation.setPolygonValidAndRender(o,!0),C==null||C.pointCloud2dOperation.setPolygonValidAndRender(o,!0),g==null||g.pointCloud2dOperation.setPolygonValidAndRender(o,!0)},[d,C,g]),T=u(()=>{if(r==null?void 0:r.info){const{id:o,valid:t=!0}=r.info,n=O({valid:!t});I(n),v(o)}a&&(A(te(ne({},a),{valid:!a.valid})),d==null||d.pointCloud2dOperation.setPolygonValidAndRender(a.id,!0))},[v,r,a]),k=u(o=>{const t=e.find(n=>n.id===o);if(t){const{id:n,valid:s=!0}=t,x=H({valid:!s},n);return v(n),x}E(o)},[v,e,R]),b=u((o=y.ascend,t=!1)=>{if(!d||P.length>1)return;if(B!==D.Rect&&B!==D.Polygon){t&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:o!==y.ascend}));return}const{pointCloud2dOperation:n}=d,s=n.switchToNextPolygon(o);s&&j(s)},[d,B,d==null?void 0:d.toolInstance]),K=(o=!1)=>{b(y.descend,o)},M=(o=!1)=>{b(y.ascend,o)},V=o=>{const t=e.filter(n=>n.id!==o);l(t),c==null||c.removeObjectByName(o,"box"),c==null||c.render(),I(t)},W=()=>{r&&(V(r.info.id),d==null||d.pointCloud2dOperation.deletePolygon(r.info.id)),a&&(N(a.id),d==null||d.pointCloud2dOperation.deletePolygon(a.id))},q=h(()=>e.filter(o=>P.includes(o.id)),[P,e]),z=u(o=>{var t;const n=f.cloneDeep(e);let s=!1;for(const x of o){const w=n.findIndex(p=>p.id===x.id);if(w>-1){const p=f.merge(n[w],x);(t=i==null?void 0:i.generateRects)==null||t.call(i,p),n.splice(w,1,p),c==null||c.generateBox(p),s=!0}}if(s)return l(n),_({pointCloudBoxList:n}),c==null||c.render(),n},[P,e]),F=u(o=>e.find(t=>t.id===o),[e]);return{selectedBox:r,updateSelectedBox:O,changeSelectedBoxValid:T,changeValidByID:k,selectNextBox:M,selectPrevBox:K,deletePointCloudBox:V,selectedBoxes:q,updateSelectedBoxes:z,getPointCloudByID:F,deleteSelectedPointCloudBoxAndPolygon:W}};export{ie as useSingleBox};
@@ -1 +1 @@
1
- import{getClassName as n}from"../../utils/dom.js";import t,{useContext as h,useState as D,useEffect as p}from"react";import N from"./PointCloud3DView.js";import T from"./PointCloudBackView.js";import I from"./PointCloudTopView.js";import B from"./PointCloudSideView.js";import F from"./PointCloud2DView.js";import R from"./PointCloudListener.js";import _ from"./PointCloudSegmentListener.js";import y from"./PointCloudSegment.js";import G from"./PointCloudSegmentStatus.js";import O from"./PointCloudSegmentToolbar.js";import{connect as Z}from"react-redux";import{LabelBeeContext as U,useDispatch as W}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as $,AnnotatedAttributesPanelFixedRight as k}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as q}from"./PointCloudContext.js";import{PointCloudUtils as z,EPointCloudPattern as H}from"@labelbee/lb-utils";import{useCustomToolInstance as J}from"../../hooks/annotation.js";import{jsonParser as K}from"../../utils/index.js";import{a2MapStateToProps as Q}from"../../store/annotation/map.js";import g from"classnames";import X from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as Y}from"../../store/annotation/actionCreators.js";const M=({currentData:s,imgList:E,drawLayerSlot:d,checkMode:l,intelligentFit:L,imgIndex:x,loadPCDFileLoading:et})=>{const e=h(q),{globalPattern:c,setGlobalPattern:S,selectedIDs:C}=e,b=W(),[i,P]=D(!1),j=(C==null?void 0:C.length)>0&&i,v=K(s.result),{toolInstanceRef:r,clearToolInstance:w}=J({basicInfo:v});if(p(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==c&&(S(o),e.clearAllDetectionInstance(),w())}},[c]),p(()=>{var o;if(Y(b,!0),s){const{boxParamsList:a,polygonList:m,lineList:u,sphereParamsList:V,segmentation:A}=z.parsePointCloudCurrentResult((o=s==null?void 0:s.result)!=null?o:"");e.setPointCloudResult(a),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(V),e.setSegmentation(A)}},[x]),p(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,a,m,u;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(a=e.lineList)!=null?a:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],segmentation:(u=e.segmentation)!=null?u:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),E.length===0)return null;if(c===H.Segmentation)return t.createElement(t.Fragment,null,t.createElement(_,{checkMode:l,toolInstanceRef:r}),t.createElement(O,null),t.createElement(y,{checkMode:l}),t.createElement(G,null),d==null?void 0:d({direct:!0}));let f=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(T,{checkMode:l}),t.createElement(B,{checkMode:l}));return i&&(f=t.createElement(X,{selectAndEnlarge:j,checkMode:l})),t.createElement(t.Fragment,null,t.createElement(R,{checkMode:l,toolInstanceRef:r}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement($,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(N,null),f),t.createElement("div",{className:g({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:i})},t.createElement(I,{drawLayerSlot:d,checkMode:l,intelligentFit:L,setIsEnlargeTopView:P,onExitZoom:()=>{P(!1)},isEnlargeTopView:i}),t.createElement("div",{className:g({[n("point-cloud-container","right-bottom")]:!i,[n("point-cloud-container","right-bottom-floatLeft")]:i})},t.createElement(F,{isEnlargeTopView:i,thumbnailWidth:i?300:455})))),t.createElement(k,null))))};var tt=Z(Q,null,null,{context:U})(M);export{tt as default};
1
+ import{getClassName as n}from"../../utils/dom.js";import t,{useContext as h,useState as D,useEffect as p}from"react";import N from"./PointCloud3DView.js";import T from"./PointCloudBackView.js";import I from"./PointCloudTopView.js";import B from"./PointCloudSideView.js";import F from"./PointCloud2DView.js";import R from"./PointCloudListener.js";import _ from"./PointCloudSegmentListener.js";import y from"./PointCloudSegment.js";import G from"./PointCloudSegmentStatus.js";import O from"./PointCloudSegmentToolbar.js";import{connect as Z}from"react-redux";import{LabelBeeContext as U,useDispatch as W}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as $,AnnotatedAttributesPanelFixedRight as q}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as z}from"./PointCloudContext.js";import{PointCloudUtils as H,EPointCloudPattern as J}from"@labelbee/lb-utils";import{useCustomToolInstance as K}from"../../hooks/annotation.js";import{jsonParser as Q}from"../../utils/index.js";import{a2MapStateToProps as X}from"../../store/annotation/map.js";import g from"classnames";import Y from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as k}from"../../store/annotation/actionCreators.js";const M=({currentData:s,imgList:E,drawLayerSlot:d,checkMode:i,intelligentFit:L,imgIndex:x,loadPCDFileLoading:et})=>{const e=h(z),{globalPattern:c,setGlobalPattern:S,selectedIDs:C}=e,b=W(),[l,P]=D(!1),j=(C==null?void 0:C.length)>0&&l,v=Q(s.result),{toolInstanceRef:r,clearToolInstance:w}=K({basicInfo:v});if(p(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==c&&(S(o),e.clearAllDetectionInstance(),w())}},[c]),p(()=>{var o;if(k(b,!0),s){const{boxParamsList:a,polygonList:m,lineList:u,sphereParamsList:V,segmentation:A}=H.parsePointCloudCurrentResult((o=s==null?void 0:s.result)!=null?o:"");e.setPointCloudResult(a),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(V),e.setSegmentation(A)}},[x]),p(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,a,m,u;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(a=e.lineList)!=null?a:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],segmentation:(u=e.segmentation)!=null?u:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),E.length===0)return null;if(c===J.Segmentation)return t.createElement(t.Fragment,null,t.createElement(_,{checkMode:i,toolInstanceRef:r}),t.createElement(O,null),t.createElement(y,{checkMode:i}),t.createElement(G,null),d==null?void 0:d({direct:!0}));let f=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(T,{checkMode:i}),t.createElement(B,{checkMode:i}));return l&&(f=t.createElement(Y,{selectAndEnlarge:j,checkMode:i})),t.createElement(t.Fragment,null,t.createElement(R,{checkMode:i,toolInstanceRef:r}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement($,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(N,null),f),t.createElement("div",{className:g({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:l})},t.createElement(I,{drawLayerSlot:d,checkMode:i,intelligentFit:L,setIsEnlargeTopView:P,onExitZoom:()=>{P(!1)},isEnlargeTopView:l}),t.createElement("div",{className:g({[n("point-cloud-container","right-bottom")]:!l,[n("point-cloud-container","right-bottom-floatLeft")]:l})},t.createElement(F,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:i})))),t.createElement(q,null))))};var tt=Z(X,null,null,{context:U})(M);export{tt as default};
@@ -0,0 +1 @@
1
+ import{CaretUpOutlined as w,CaretDownOutlined as k}from"@ant-design/icons";import t,{useState as I,useEffect as K}from"react";import d from"./index.module.scss.js";import{cKeyCode as L,CommonToolUtils as x}from"@labelbee/lb-annotation";const E=L.default,m=[.5,1,1.5,2,4,6,8,16],A=[.5,.75,1,1.25,1.5,1.75,2];var c;(function(e){e[e.Video=0]="Video",e[e.Audio=1]="Audio"})(c||(c={}));var u;(function(e){e[e.Increase=0]="Increase",e[e.Reduce=1]="Reduce"})(u||(u={}));const f={[0]:m,[1]:A},S=e=>{const{onChange:C,playerType:_}=e,o=f[_],P=o.slice(-1)[0],R=o[0],[s,p]=I(1),r=n=>{const a=n===0?1:-1;if(a===1&&s===P||a===-1&&s===R)return;const y=o.findIndex(D=>D===s)+a,l=o[y];p(l),C(l)},i=n=>{!x.hotkeyFilter(n)||(n.keyCode===E.Up&&r(0),n.keyCode===E.Down&&r(1))};return K(()=>(window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i))),t.createElement("div",{className:d.speedControllerWrap},t.createElement("span",{style:{display:"flex",alignItems:"center"}},t.createElement("span",{style:{fontSize:12}},"\u500D\u901F"),s,"x"),t.createElement("span",{className:d.speedController},t.createElement(w,{onClick:()=>r(0)}),t.createElement(k,{onClick:()=>r(1)})))};export{A as AUDIO_PLAYBACK_RATE_SPEED,c as EPlayerType,f as PLAYER_TYPE_RATE_SPEED,m as VIDEO_PLAYBACK_RATE_SPEED,S as default};
@@ -0,0 +1 @@
1
+ var e={speedControllerWrap:"index-module_speedControllerWrap__aFz7r",speedController:"index-module_speedController__zBRST"};export{e as default};
@@ -1 +1 @@
1
- import e from"react";import{getClassName as o}from"../../../../utils/dom.js";import{PauseOutlined as y,CaretRightOutlined as N,CaretUpOutlined as C,CaretDownOutlined as T}from"@ant-design/icons";import{VideoPlayerCtx as c}from"../../index.js";import{Pagination as x}from"../../../../views/MainView/toolFooter/Pagination.js";import P from"../../../../assets/annotation/video/icon_keyboard_h.svg.js";import h from"../../../../views/MainView/toolFooter/FooterTips/ToolHotKey/index.js";import{useTranslation as u}from"react-i18next";import{decimalReserved as d}from"../../utils.js";import{cTool as w}from"@labelbee/lb-annotation";const{EVideoToolName:V}=w,p=t=>{const n=Math.floor(t/60),r=~~(t%60).toFixed(),a=(t*10).toString().split("").pop(),l=s=>s<10?`0${s}`:s;return`${l(n)}:${l(r)}:${a}`},k=()=>{const{currentTime:t,duration:n,buffered:r,setCurrentTime:a}=e.useContext(c),l=e.useRef(null),s=`${d(r/n*100,1)}%`,m=`${d(t/n*100,1)}%`,v=i=>{if(l.current){const E=i.clientX,f=l.current.clientWidth,g=d(E/f*n,1);a(g)}};return e.createElement("div",{className:o("video-progress"),ref:l,onClick:i=>{i.stopPropagation(),i.nativeEvent.stopImmediatePropagation(),v(i)}},e.createElement("div",{className:o("video-slider")},e.createElement("div",{className:o("video-slider","played"),style:{width:m}}),e.createElement("div",{className:o("video-slider","loaded"),style:{width:s}}),e.createElement("div",{className:o("video-slider","played"),style:{width:m}})),e.createElement("div",{className:o("video-slider-bar"),style:{left:m}}))},b=()=>{const{updateNextPlaybackRate:t,playbackRate:n}=e.useContext(c),{t:r}=u();return e.createElement("span",{className:o("video-controller","speed")},e.createElement("span",null,r("Speed")),e.createElement("span",{className:o("video-controller","speedNum")},`${n}x`),e.createElement("span",{className:o("video-controller","speedButton")},e.createElement(C,{onClick:()=>{t()}}),e.createElement(T,{onClick:()=>{t(!1)}})))},$=()=>{const{t}=u();return e.createElement(h,{title:e.createElement("span",{className:o("video-controller","hotkey")},e.createElement("img",{src:P}),t("Hotkeys")),style:{},toolName:V.VideoTagTool})},R=()=>{const{imgIndex:t,imgList:n,pageBackward:r,pageJump:a,pageForward:l}=e.useContext(c);return e.createElement(x,{isVideo:!0,pageBackward:r,imgIndex:t,pageJump:a,totalPage:n.length,pageForward:l,footerCls:o("video-controller")})},j=()=>{const{currentTime:t,duration:n}=e.useContext(c),r=n*10-t*10,a=(r>0?r:0)/10;return e.createElement("div",{className:o("video-controller","time")},`${p(t)} / -${p(a)}`)},F=()=>{const{playPause:t,isPlay:n}=e.useContext(c);return e.createElement("div",{className:o("video-controller","wrapper")},e.createElement(k,null),e.createElement("div",{className:o("video-controller")},e.createElement("span",{onClick:()=>{t()},className:o("video-controller","playButton")},n?e.createElement(y,null):e.createElement(N,null)),e.createElement(j,null),e.createElement(b,null),e.createElement("div",{className:o("video-controller","holder")}),e.createElement(R,null),e.createElement($,null)))};export{F as default};
1
+ import e from"react";import{getClassName as o}from"../../../../utils/dom.js";import{PauseOutlined as C,CaretRightOutlined as y,CaretUpOutlined as x,CaretDownOutlined as T}from"@ant-design/icons";import{VideoPlayerCtx as c}from"../../index.js";import{Pagination as V}from"../../../../views/MainView/toolFooter/Pagination.js";import h from"../../../../assets/annotation/video/icon_keyboard_h.svg.js";import w from"../../../../views/MainView/toolFooter/FooterTips/ToolHotKey/index.js";import{useTranslation as v}from"react-i18next";import{decimalReserved as m}from"../../utils.js";import{cTool as P}from"@labelbee/lb-annotation";const{EVideoToolName:k}=P,u=t=>{const n=Math.floor(t/60),r=~~(t%60).toFixed(),a=(t*10).toString().split("").pop(),l=s=>s<10?`0${s}`:s;return`${l(n)}:${l(r)}:${a}`};var p;(function(t){t[t.Video=0]="Video",t[t.Audio=1]="Audio"})(p||(p={}));const b=()=>{const{currentTime:t,duration:n,buffered:r,setCurrentTime:a}=e.useContext(c),l=e.useRef(null),s=`${m(r/n*100,1)}%`,d=`${m(t/n*100,1)}%`,E=i=>{if(l.current){const f=i.clientX,g=l.current.clientWidth,N=m(f/g*n,1);a(N)}};return e.createElement("div",{className:o("video-progress"),ref:l,onClick:i=>{i.stopPropagation(),i.nativeEvent.stopImmediatePropagation(),E(i)}},e.createElement("div",{className:o("video-slider")},e.createElement("div",{className:o("video-slider","played"),style:{width:d}}),e.createElement("div",{className:o("video-slider","loaded"),style:{width:s}}),e.createElement("div",{className:o("video-slider","played"),style:{width:d}})),e.createElement("div",{className:o("video-slider-bar"),style:{left:d}}))},$=()=>{const{updateNextPlaybackRate:t,playbackRate:n}=e.useContext(c),{t:r}=v();return e.createElement("span",{className:o("video-controller","speed")},e.createElement("span",null,r("Speed")),e.createElement("span",{className:o("video-controller","speedNum")},`${n}x`),e.createElement("span",{className:o("video-controller","speedButton")},e.createElement(x,{onClick:()=>{t()}}),e.createElement(T,{onClick:()=>{t(!1)}})))},R=()=>{const{t}=v();return e.createElement(w,{title:e.createElement("span",{className:o("video-controller","hotkey")},e.createElement("img",{src:h}),t("Hotkeys")),style:{},toolName:k.VideoTagTool})},j=()=>{const{imgIndex:t,imgList:n,pageBackward:r,pageJump:a,pageForward:l}=e.useContext(c);return e.createElement(V,{isVideo:!0,pageBackward:r,imgIndex:t,pageJump:a,totalPage:n.length,pageForward:l,footerCls:o("video-controller")})},F=()=>{const{currentTime:t,duration:n}=e.useContext(c),r=n*10-t*10,a=(r>0?r:0)/10;return e.createElement("div",{className:o("video-controller","time")},`${u(t)} / -${u(a)}`)},B=()=>{const{playPause:t,isPlay:n}=e.useContext(c);return e.createElement("div",{className:o("video-controller","wrapper")},e.createElement(b,null),e.createElement("div",{className:o("video-controller")},e.createElement("span",{onClick:()=>{t()},className:o("video-controller","playButton")},n?e.createElement(C,null):e.createElement(y,null)),e.createElement(F,null),e.createElement($,null),e.createElement("div",{className:o("video-controller","holder")}),e.createElement(j,null),e.createElement(R,null)))};export{p as EPlayerType,B as default,u as videoTimeFormat};