@labelbee/lb-components 1.23.0-alpha.7 → 1.23.0-alpha.71
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.
- package/dist/App.js +1 -1
- package/dist/_virtual/2DViewWorker.js +1 -0
- package/dist/_virtual/highlightSegmentWorker.js +1 -1
- package/dist/assets/annotation/icon_link.svg.js +1 -0
- package/dist/assets/annotation/icon_unlink.svg.js +1 -0
- package/dist/assets/annotation/pointCloudTool/Image2DBoxScale.svg.js +1 -0
- package/dist/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
- package/dist/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
- package/dist/assets/annotation/pointCloudTool/rotate90_black.svg.js +1 -0
- package/dist/assets/icons/ad33251.svg +26 -0
- package/dist/components/AnnotationView/index.js +1 -1
- package/dist/components/LLMToolView/index.js +1 -1
- package/dist/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/dist/components/LLMToolView/sidebar/index.js +1 -1
- package/dist/components/LLMToolView/utils/data.js +1 -1
- package/dist/components/NLPToolView/index.js +1 -1
- package/dist/components/audioAnnotate/audioContext/index.js +1 -1
- package/dist/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -1
- package/dist/components/audioAnnotate/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -1
- package/dist/components/audioAnnotate/utils/dataTransform.js +1 -0
- package/dist/components/audioPlayer/clipRegion/index.js +1 -1
- package/dist/components/audioPlayer/index.js +1 -1
- package/dist/components/audioPlayer/useAudioCombine/index.js +3 -2
- package/dist/components/audioPlayer/useAudioSegment/index.js +1 -1
- package/dist/components/longText/index.js +1 -1
- package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
- package/dist/components/pointCloud2DRectOperationView/useUpdateRectList.js +1 -0
- package/dist/components/pointCloud2DRectOperationView/util.js +1 -0
- package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
- package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudBackView.js +1 -1
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/PointCloudInfos.js +1 -1
- package/dist/components/pointCloudView/PointCloudLayout.js +1 -1
- package/dist/components/pointCloudView/PointCloudListener.js +1 -1
- package/dist/components/pointCloudView/PointCloudSegment2DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudSideView.js +1 -1
- package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
- package/dist/components/pointCloudView/components/HighlightVisible/index.js +1 -1
- package/dist/components/pointCloudView/hooks/useBoxes.js +1 -1
- package/dist/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
- package/dist/components/pointCloudView/hooks/useHighlight.js +1 -1
- package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/components/pointCloudView/hooks/usePolygon.js +1 -1
- package/dist/components/pointCloudView/hooks/useRotate.js +1 -1
- package/dist/components/pointCloudView/hooks/useRotateEdge.js +1 -0
- package/dist/components/pointCloudView/hooks/useSingleBox.js +1 -1
- package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
- package/dist/components/pointCloudView/hooks/useTimeoutFunc.js +1 -0
- package/dist/components/pointCloudView/hooks/useWindowKeydownListener.js +1 -0
- package/dist/components/pointCloudView/index.js +1 -1
- package/dist/components/pointCloudView/utils/event-polyfill.js +1 -0
- package/dist/components/pointCloudView/utils/map.js +1 -0
- package/dist/components/subAttributeList/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/index.js +1 -1
- package/dist/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
- package/dist/hooks/useToolStyle.js +1 -0
- package/dist/index.css +59 -17
- package/dist/index.js +1 -1
- package/dist/store/Actions.js +1 -1
- package/dist/store/annotatedBox/index.js +1 -1
- package/dist/store/annotation/actionCreators.js +1 -1
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/types/App.d.ts +5 -1
- package/dist/types/components/AnnotationView/index.d.ts +1 -0
- package/dist/types/components/LLMToolView/utils/data.d.ts +1 -1
- package/dist/types/components/audioAnnotate/audioContext/index.d.ts +10 -2
- package/dist/types/components/audioAnnotate/textInput/index.d.ts +1 -0
- package/dist/types/components/audioAnnotate/utils/dataTransform.d.ts +9 -0
- package/dist/types/components/audioPlayer/index.d.ts +28 -21
- package/dist/types/components/longText/index.d.ts +1 -0
- package/dist/types/components/pointCloud2DRectOperationView/index.d.ts +1 -0
- package/dist/types/components/pointCloud2DRectOperationView/useUpdateRectList.d.ts +2 -0
- package/dist/types/components/pointCloud2DRectOperationView/util.d.ts +8 -0
- package/dist/types/components/pointCloudView/2DViewWorker.d.ts +1 -0
- package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +2 -1
- package/dist/types/components/pointCloudView/PointCloudContext.d.ts +28 -4
- package/dist/types/components/pointCloudView/PointCloudLayout.d.ts +1 -0
- package/dist/types/components/pointCloudView/components/HighlightVisible/index.d.ts +2 -1
- package/dist/types/components/pointCloudView/hooks/useDataLinkSwitch.d.ts +19 -0
- package/dist/types/components/pointCloudView/hooks/useHighlight.d.ts +1 -1
- package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +8 -0
- package/dist/types/components/pointCloudView/hooks/useRotateEdge.d.ts +9 -0
- package/dist/types/components/pointCloudView/hooks/useSingleBox.d.ts +3 -2
- package/dist/types/components/pointCloudView/hooks/useTimeoutFunc.d.ts +6 -0
- package/dist/types/components/pointCloudView/hooks/useWindowKeydownListener.d.ts +16 -0
- package/dist/types/components/pointCloudView/utils/event-polyfill.d.ts +8 -0
- package/dist/types/components/pointCloudView/utils/map.d.ts +11 -0
- package/dist/types/components/subAttributeList/index.d.ts +10 -0
- package/dist/types/components/videoAnnotate/index.d.ts +2 -1
- package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +2 -1
- package/dist/types/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.d.ts +1 -1
- package/dist/types/hooks/useToolStyle.d.ts +30 -0
- package/dist/types/index.d.ts +7 -2
- package/dist/types/store/Actions.d.ts +1 -0
- package/dist/types/store/annotatedBox/index.d.ts +2 -0
- package/dist/types/store/annotation/actionCreators.d.ts +3 -2
- package/dist/types/store/annotation/reducer.d.ts +1 -0
- package/dist/types/store/annotation/types.d.ts +9 -2
- package/dist/types/utils/AnnotationDataUtils.d.ts +58 -1
- package/dist/types/utils/ToolPointCloudBoxRenderHelper.d.ts +23 -0
- package/dist/types/utils/index.d.ts +31 -1
- package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.d.ts +3 -0
- package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +1 -1
- package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.d.ts +9 -0
- package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.d.ts +3 -0
- package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/index.d.ts +1 -0
- package/dist/types/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.d.ts +10 -2
- package/dist/types/views/MainView/toolFooter/index.d.ts +1 -1
- package/dist/types/views/MainView/toolHeader/StepSwitch/index.d.ts +1 -1
- package/dist/types/views/MainView/toolHeader/index.d.ts +1 -1
- package/dist/utils/AnnotationDataUtils.js +1 -1
- package/dist/utils/ToolPointCloudBoxRenderHelper.js +1 -0
- package/dist/utils/index.js +1 -1
- package/dist/views/MainView/index.js +1 -1
- package/dist/views/MainView/sidebar/NLPSidebar/NLPAnnotatedList.js +1 -1
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js +1 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.module.scss.js +1 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/TagSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
- package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
- package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.js +1 -0
- package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
- package/dist/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
- package/dist/views/MainView/toolFooter/index.js +1 -1
- package/es/App.js +1 -1
- package/es/_virtual/2DViewWorker.js +1 -0
- package/es/_virtual/highlightSegmentWorker.js +1 -1
- package/es/assets/annotation/icon_link.svg.js +1 -0
- package/es/assets/annotation/icon_unlink.svg.js +1 -0
- package/es/assets/annotation/pointCloudTool/Image2DBoxScale.svg.js +1 -0
- package/es/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
- package/es/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
- package/es/assets/annotation/pointCloudTool/rotate90_black.svg.js +1 -0
- package/es/components/AnnotationView/index.js +1 -1
- package/es/components/LLMToolView/index.js +1 -1
- package/es/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
- package/es/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
- package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/es/components/LLMToolView/sidebar/index.js +1 -1
- package/es/components/LLMToolView/utils/data.js +1 -1
- package/es/components/NLPToolView/index.js +1 -1
- package/es/components/audioAnnotate/audioContext/index.js +1 -1
- package/es/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -1
- package/es/components/audioAnnotate/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -1
- package/es/components/audioAnnotate/utils/dataTransform.js +1 -0
- package/es/components/audioPlayer/clipRegion/index.js +1 -1
- package/es/components/audioPlayer/index.js +1 -1
- package/es/components/audioPlayer/useAudioCombine/index.js +3 -2
- package/es/components/audioPlayer/useAudioSegment/index.js +1 -1
- package/es/components/longText/index.js +1 -1
- package/es/components/pointCloud2DRectOperationView/index.js +1 -1
- package/es/components/pointCloud2DRectOperationView/useUpdateRectList.js +1 -0
- package/es/components/pointCloud2DRectOperationView/util.js +1 -0
- package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
- package/es/components/pointCloudView/PointCloud2DView.js +1 -1
- package/es/components/pointCloudView/PointCloud3DView.js +1 -1
- package/es/components/pointCloudView/PointCloudBackView.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/PointCloudInfos.js +1 -1
- package/es/components/pointCloudView/PointCloudLayout.js +1 -1
- package/es/components/pointCloudView/PointCloudListener.js +1 -1
- package/es/components/pointCloudView/PointCloudSegment2DView.js +1 -1
- package/es/components/pointCloudView/PointCloudSideView.js +1 -1
- package/es/components/pointCloudView/PointCloudTopView.js +1 -1
- package/es/components/pointCloudView/components/HighlightVisible/index.js +1 -1
- package/es/components/pointCloudView/hooks/useBoxes.js +1 -1
- package/es/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
- package/es/components/pointCloudView/hooks/useHighlight.js +1 -1
- package/es/components/pointCloudView/hooks/useHistory.js +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/components/pointCloudView/hooks/usePolygon.js +1 -1
- package/es/components/pointCloudView/hooks/useRotate.js +1 -1
- package/es/components/pointCloudView/hooks/useRotateEdge.js +1 -0
- package/es/components/pointCloudView/hooks/useSingleBox.js +1 -1
- package/es/components/pointCloudView/hooks/useStatus.js +1 -1
- package/es/components/pointCloudView/hooks/useTimeoutFunc.js +1 -0
- package/es/components/pointCloudView/hooks/useWindowKeydownListener.js +1 -0
- package/es/components/pointCloudView/index.js +1 -1
- package/es/components/pointCloudView/utils/event-polyfill.js +1 -0
- package/es/components/pointCloudView/utils/map.js +1 -0
- package/es/components/subAttributeList/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/index.js +1 -1
- package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
- package/es/hooks/useToolStyle.js +1 -0
- package/es/index.css +59 -17
- package/es/index.js +1 -1
- package/es/store/Actions.js +1 -1
- package/es/store/annotatedBox/index.js +1 -1
- package/es/store/annotation/actionCreators.js +1 -1
- package/es/store/annotation/reducer.js +1 -1
- package/es/utils/AnnotationDataUtils.js +1 -1
- package/es/utils/ToolPointCloudBoxRenderHelper.js +1 -0
- package/es/utils/index.js +1 -1
- package/es/views/MainView/index.js +1 -1
- package/es/views/MainView/sidebar/NLPSidebar/NLPAnnotatedList.js +1 -1
- package/es/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js +1 -0
- package/es/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.module.scss.js +1 -0
- package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/TagSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
- package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
- package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.js +1 -0
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
- package/es/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
- package/package.json +4 -3
- package/dist/assets/annotation/pointCloudTool/rotate180_black.svg.js +0 -1
- package/dist/assets/icons/9d70807.svg +0 -5
- package/es/assets/annotation/pointCloudTool/rotate180_black.svg.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EPointCloudName as nt,MathUtils as B,getCuboidFromPointCloudBox as Mt}from"@labelbee/lb-annotation";import{EPerspectiveView as J,PointCloudUtils as V,POINT_CLOUD_DEFAULT_STEP as Gt,DEFAULT_SPHERE_PARAMS as Jt}from"@labelbee/lb-utils";import{useContext as Qt}from"react";import{PointCloudContext as Xt}from"../PointCloudContext.js";import{useSingleBox as Yt}from"./useSingleBox.js";import{useSphere as qt}from"./useSphere.js";import{useSelector as Kt,useDispatch as $t}from"../../../store/ctx.js";import to from"../../../utils/StepUtils.js";import{jsonParser as it,getRectPointCloudBox as oo}from"../../../utils/index.js";import{PreDataProcess as st,SetPointCloudLoading as Ct,SetLoadPCDFileLoading as Pt}from"../../../store/annotation/actionCreators.js";import{useHistory as eo}from"./useHistory.js";import{usePolygon as no}from"./usePolygon.js";import{useLatest as io}from"ahooks";var so=Object.defineProperty,ro=Object.defineProperties,lo=Object.getOwnPropertyDescriptors,ht=Object.getOwnPropertySymbols,ao=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable,xt=(e,t,i)=>t in e?so(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,L=(e,t)=>{for(var i in t||(t={}))ao.call(t,i)&&xt(e,i,t[i]);if(ht)for(var i of ht(t))co.call(t,i)&&xt(e,i,t[i]);return e},O=(e,t)=>ro(e,lo(t)),rt=(e,t,i)=>new Promise((d,o)=>{var a=u=>{try{c(i.next(u))}catch(h){o(h)}},g=u=>{try{c(i.throw(u))}catch(h){o(h)}},c=u=>u.done?d(u.value):Promise.resolve(u.value).then(a,g);c((i=i.apply(e,t)).next())});const q=5,K=90,mt=.01,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},lt=(e,t,i,d,o)=>{const{x:a,y:g}=V.transferCanvas2World(e,t),{defaultZ:c}=Jt,u={center:{x:a,y:g,z:c},id:e.id},h=d?L(L({},d),u):O(L({},u),{attribute:"",valid:!0});return o&&Object.assign(h,o),h},dt=(e,t,i,d,o,a)=>{let g=e.pointList.map(v=>V.transferCanvas2World(v,t)),c=0,u=1,h={};if(i){const v=i.getSensesPointZAxisInPolygon(g,void 0,a);a&&v.fittedCoordinates.length>0&&(g=v.fittedCoordinates),c=(v.maxZ+v.minZ)/2,u=v.maxZ-v.minZ,h={count:v.zCount}}const[m,I,W]=g,z=B.getLineCenterPoint([m,W]),T=B.getLineLength(m,I),R=B.getLineLength(I,W),E=B.getRadiusFromQuadrangle(e.pointList);d&&(c=d.center.z,u=d.depth);const j={center:{x:z.x,y:z.y,z:c},width:a?R+mt:R,height:a?T+mt:T,depth:u,rotation:E,id:e.id},N=L(d?L(L({},d),j):O(L({},j),{attribute:"",valid:!0}),h);o&&Object.assign(N,o);const F=g.map(v=>V.transferWorld2Canvas(v,t));return{boxParams:N,newPointList:F}},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,h]=t.pointList,m=B.getLineCenterPoint([o,g]),I=B.getLineCenterPoint([c,h]),z={x:{x:m.x-I.x,y:m.y-I.y}.x,y:0,z:m.y-I.y},T=B.getLineLength(o,a),R=B.getLineLength(c,u),E=T-R,j=B.getLineLength(a,g),N=B.getLineLength(u,h),F=j-N,{newBoxParams:v}=d.getNewBoxBySideUpdate(z,F,E,i);return v},uo=(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}})},po=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,h]=t.pointList,m=B.getLineCenterPoint([o,g]),I=B.getLineCenterPoint([c,h]),z={x:{x:m.x-I.x,y:m.y-I.y}.x,y:0,z:m.y-I.y},T=B.getLineLength(o,a),R=B.getLineLength(c,u),E=T-R,j=B.getLineLength(a,g),N=B.getLineLength(u,h),F=j-N;let{newBoxParams:v}=d.getNewBoxByBackUpdate(z,F,E,i);return v},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,J.Left);c.setInitCameraPosition(u);const{point2d:h,zoom:m}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=m,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(m),g.setResult([O(L(L({},t),h),{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:q,depth:q});const{cameraPositionVector:g}=a.updateOrthoCamera(e,J.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)},bt=(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,J.Back);c.setInitCameraPosition(u);const{point2d:h,zoom:m}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=m,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(m),g.setResult([O(L(L({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},wt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{height:q,depth:q});const{cameraPositionVector:g}=a.updateOrthoCamera(e,J.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,J.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)},at=(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),h=[...g.polygonList],m=h.find(I=>I.id===t.id);m?(m.pointList=u,m.valid=(o=e.valid)!=null?o:!0):h.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(a=e.valid)!=null?a:!0}),g.setResultAndSelectedID(h,t.id)},go=()=>{const e=Qt(Xt),{topViewInstance:t,sideViewInstance:i,backViewInstance:d,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:g,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:h,pointCloudSphereList:m,hideAttributes:I,setHighlight2DDataList:W,cuboidBoxIn2DView:z,imageSizes:T}=e,{addHistory:R,initHistory:E,pushHistoryUnderUpdatePolygon:j}=eo(),{selectedPolygon:N}=no(),{getPointCloudSphereByID:F,updatePointCloudSphere:v,selectedSphere:Q}=qt(),{currentData:Z,config:S}=Kt(n=>{const{stepList:s,step:p,imgList:r,imgIndex:l}=n.annotation;return{currentData:r[l],config:it(to.getCurrentStepInfo(p,s).config)}}),H=$t(),St=io(z),$=n=>{if(!St.current){const{mappingImgList:s=[]}=Z,p=s.map(r=>oo({pointCloudBox:n,mappingData:r,imageSizes:T}));Object.assign(n,{rects:p.filter(r=>r!==void 0)})}},{selectedBox:_,updateSelectedBox:Dt,updateSelectedBoxes:tt,getPointCloudByID:_t}=Yt({generateRects:$}),ct=_==null?void 0:_.info;if(!t||!i||!d)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:ot}=t,Vt=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},Ot=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},kt=({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:m})});const P=lt(n,s,ot,void 0,f);c(n.id);const x=g(P);X(y.Top,n,P,p,x,S),R({newSphereParams:P})},Rt=({polygon:n,size:s,imgList:p,trackConfigurable:r,zoom:l,intelligentFit:f})=>{var P,x;const C={attribute:(P=t.toolInstance.defaultAttribute)!=null?P:""};r===!0&&Object.assign(C,{trackID:V.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:m})});const D=t==null?void 0:t.toolInstance,w=L({},n);let{boxParams:b,newPointList:A}=dt(w,s,ot,void 0,C,f);b=H(st({tool:nt.PointCloud,dataList:[b],stepConfig:S,action:"viewUpdateBox"}))[0],f&&(A==null?void 0:A.length)&&(w.pointList=A);const k=I.includes(w.attribute);$(b);const G=a(b),et=(x=e==null?void 0:e.polygonList)!=null?x:[];t==null||t.updatePolygonList(G!=null?G:[],et),k?c([]):(c(b.id),D.selection.setSelectedIDs(w.id),M({omitView:y.Top,polygon:w,boxParams:b,zoom:l,newPointCloudBoxList:G}),f&&at(b,w,t,o)),R({newBoxParams:b})},At=n=>{const{boxID:s,imageName:p,width:r,height:l,x:f,y:P}=n,x=h.find(C=>C.id===s);if(x==null?void 0:x.rects){const{rects:C=[]}=x,D=C.find(w=>w.imageName===p);if(D){let w=C;const b=O(L({},D),{width:r,height:l,x:f,y:P});w=C.map(k=>k===D?b:k);const A=O(L({},x),{rects:w}),U=h.map(k=>k===x?A:k);return t==null||t.updatePolygonList(U!=null?U:[]),U}}},Ut=({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 P=n!=null?n:_==null?void 0:_.info;(l=f==null?void 0:f.selection)==null||l.setSelectedIDs(u[0]);const x=f.selectedPolygon;if(u.length===1&&P){M({omitView:y.Top,polygon:x,boxParams:P,newPointCloudBoxList:s});return}}if((p||Q)&&u.length===1){const P=p!=null?p:Q;f.setSelectedID(u[0]);const x=f.selectedPoint;P&&X(y.Top,x,P,void 0,r,S)}}},ut=(n,s,p)=>{if(ct){let r,l;switch(p){case y.Back:r=po;break;case y.Side:r=yt;break;default:r=yt;break}if(l=r(n,s,ct,i.pointCloudInstance),o){const{count:D}=o.getSensesPointZAxisInPolygon(Mt(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=O(L({},l),{count:D})}const P=H(st({tool:nt.PointCloud,dataList:[l],stepConfig:S,action:"viewUpdateBox"}))[0],x=l.valid!==P.valid;l=P;const C=Dt(l);return l=C.find(D=>D.id===l.id),M({omitView:x?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:C}),C}},pt=(n,s,p)=>{if(Q){let r,l;switch(p){case y.Back:r=uo;break;case y.Side:r=Lt;break;default:r=Lt;break}l=r(n,s,Q);const f=v(l);return X(p,n,l,void 0,f,S),f}},zt=(n,s)=>{pt(n,s,y.Side)},Tt=(n,s)=>{pt(n,s,y.Back)},jt=(n,s)=>{ut(n,s,y.Side)},Nt=(n,s)=>{ut(n,s,y.Back)},Et=(n,s)=>{const p=F(n.id),r=lt(n,s,ot,p),l=v(r);X(y.Top,n,r,void 0,l,S)},Ft=(n,s)=>{if(N){const r=L({},n[0].newPolygon);r.pointList=r.pointList.map(l=>V.transferCanvas2World(l,s)),j(r);return}let p=n.map(({newPolygon:r})=>{const l=_t(r.id),{boxParams:f}=dt(r,s,t.pointCloudInstance,l);return f});if(p=H(st({tool:nt.PointCloud,dataList:p,stepConfig:S,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)}},Ht=n=>{var s,p,r,l,f;if(_){const P=Number(n.widthDefault),x=Number(n.depthDefault),C=Number(n.heightDefault),D=_==null?void 0:_.info.trackID,b=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(Y=>(Y==null?void 0:Y.trackID)===D),A={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},U=b.pointList.map(Y=>V.transferCanvas2World(Y,A)),k=B.getModifiedRectangleCoordinates(U,C,P),G=k[0],et=k[2],gt=B.getLineCenterPoint([G,et]),Wt=_.info.center.z-_.info.depth/2,ft=O(L({},_.info),{center:{x:gt.x,y:gt.y,z:Wt+x/2},width:P,height:C,depth:x,valid:!0}),Zt=tt([ft]);M({omitView:y["3D"],polygon:b,boxParams:ft,newPointCloudBoxList:Zt})}},X=(n,s,p,r,l,f)=>rt(void 0,null,function*(){const P=Z==null?void 0:Z.url,x={[y.Side]:()=>{vt(p,s,i,P,f)},[y.Back]:()=>{d&&bt(p,s,d,P,f)},[y.Top]:()=>{It(p,s,t,o)}};Object.keys(x).forEach(C=>{C!==n&&x[C]()}),r&&(o==null||o.updateCameraZoom(r)),Ot(p)}),M=n=>rt(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:r,zoom:l,newPointCloudBoxList:f}=n,P=Z==null?void 0:Z.url;f&&(yield e.syncAllViewPointCloudColor(f));const x={[y.Side]:()=>{Bt(r,p,i,P)},[y.Back]:()=>{d&&wt(r,p,d,P)},[y.Top]:()=>{at(r,p,t,o)}};Object.keys(x).forEach(C=>{C!==s&&x[C]()}),l&&(o==null||o.updateCameraZoom(l)),Vt(r)});return{topViewAddSphere:kt,topViewAddBox:Rt,topViewSelectedChanged:Ut,topViewUpdatePoint:Et,sideViewUpdatePoint:zt,backViewUpdatePoint:Tt,topViewUpdateBox:Ft,sideViewUpdateBox:jt,backViewUpdateBox:Nt,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)=>rt(void 0,[...n],function*(s=Z){var p,r,l,f,P,x;if(!(s==null?void 0:s.url)||!o)return;W([]),Ct(H,!0),Pt(H,!0),yield o.loadPCDFile(s.url,(p=S==null?void 0:S.radius)!=null?p:K),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let C=[],D=[],w=[],b=[];o.updateTopCamera();const A=(l=(r=it(s.result))==null?void 0:r.valid)!=null?l:!0;if(e.setPointCloudValid(A),(f=e.sideViewInstance)==null||f.clearAllData(),(P=e.backViewInstance)==null||P.clearAllData(),s.result){if(C=V.getBoxParamsFromResultList(s.result),(C==null?void 0:C.length)>0&&s.isPreResult&&(S==null?void 0:S.lowerLimitPointsNumInBox)>0){C=yield o==null?void 0:o.filterPreResult(s.url,S,C);const U=it(s.result);U[Gt].result=C,s.result=JSON.stringify(U),e.setPointCloudResult(C)}w=V.getPolygonListFromResultList(s.result),D=V.getLineListFromResultList(s.result),b=V.getSphereParamsFromResultList(s.result),t.updateData(s.url,s.result,{radius:(x=S==null?void 0:S.radius)!=null?x:K}),o==null||o.generateBoxes(C),o==null||o.generateSpheres(b),yield e.syncAllViewPointCloudColor(C,[])}E({pointCloudBoxList:C,polygonList:w,lineList:D,pointCloudSphereList:b}),Ct(H,!1),Pt(H,!1)}),updateViewsByDefaultSize:Ht,generateRects:$,update2DViewRect:At}};export{bt as syncBackViewByPoint,vt as syncSideViewByPoint,It as syncTopViewByPoint,wt as synchronizeBackView,Bt as synchronizeSideView,at as synchronizeTopView,lt as topViewPoint2PointCloud,dt as topViewPolygon2PointCloud,go as usePointCloudViews};
|
|
1
|
+
import{EPointCloudName as st,TagUtils as to,MathUtils as w,getCuboidFromPointCloudBox as oo}from"@labelbee/lb-annotation";import{EPerspectiveView as G,PointCloudUtils as k,POINT_CLOUD_DEFAULT_STEP as eo,DEFAULT_SPHERE_PARAMS as no}from"@labelbee/lb-utils";import{useContext as mt,useCallback as xt}from"react";import{PointCloudContext as ht}from"../PointCloudContext.js";import{useSingleBox as io}from"./useSingleBox.js";import{useSphere as so}from"./useSphere.js";import{pick as ro}from"lodash";import{useSelector as lo,useDispatch as ao}from"../../../store/ctx.js";import co from"../../../utils/StepUtils.js";import{EPointCloudBoxRenderTrigger as rt}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import{jsonParser as lt,generatePointCloudBoxRects as uo}from"../../../utils/index.js";import{PreDataProcess as dt,SetPointCloudLoading as Lt,SetLoadPCDFileLoading as vt}from"../../../store/annotation/actionCreators.js";import{useHistory as po}from"./useHistory.js";import{usePolygon as go}from"./usePolygon.js";import{useLatest as q}from"ahooks";var fo=Object.defineProperty,Co=Object.defineProperties,Po=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,mo=Object.prototype.hasOwnProperty,xo=Object.prototype.propertyIsEnumerable,Bt=(o,t,i)=>t in o?fo(o,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[t]=i,v=(o,t)=>{for(var i in t||(t={}))mo.call(t,i)&&Bt(o,i,t[i]);if(yt)for(var i of yt(t))xo.call(t,i)&&Bt(o,i,t[i]);return o},O=(o,t)=>Co(o,Po(t)),bt=(o,t,i)=>new Promise((u,e)=>{var p=d=>{try{c(i.next(d))}catch(m){e(m)}},f=d=>{try{c(i.throw(d))}catch(m){e(m)}},c=d=>d.done?u(d.value):Promise.resolve(d.value).then(p,f);c((i=i.apply(o,t)).next())});const K=5,$=90,wt=.01,B={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},at=(o,t,i,u,e)=>{const{x:p,y:f}=k.transferCanvas2World(o,t),{defaultZ:c}=no,d={center:{x:p,y:f,z:c},id:o.id},m=u?v(v({},u),d):O(v({},d),{attribute:"",valid:!0});return e&&Object.assign(m,e),m},ct=(o,t,i,u,e,p)=>{let f=o.pointList.map(I=>k.transferCanvas2World(I,t)),c=0,d=1,m={};if(i){const I=i.getSensesPointZAxisInPolygon(f,void 0,p);p&&I.fittedCoordinates.length>0&&(f=I.fittedCoordinates),c=(I.maxZ+I.minZ)/2,d=I.maxZ-I.minZ,m={count:I.zCount}}const[x,y,A]=f,R=w.getLineCenterPoint([x,A]),S=w.getLineLength(x,y),U=w.getLineLength(y,A),z=w.getRadiusFromQuadrangle(o.pointList);u&&(c=u.center.z,d=u.depth);const T={center:{x:R.x,y:R.y,z:c},width:p?U+wt:U,height:p?S+wt:S,depth:d,rotation:z,id:o.id},N=v(u?v(v({},u),T):O(v({},T),{attribute:"",valid:!0}),m);e&&Object.assign(N,e);const E=f.map(I=>k.transferWorld2Canvas(I,t));return{boxParams:N,newPointList:E}},It=(o,t,i)=>{const u={x:o.x-t.x,y:o.y-t.y};return O(v({},i),{center:{x:i.center.x-u.x,y:i.center.y,z:i.center.z-u.y}})},Dt=(o,t,i,u)=>{const[e,p,f]=o.pointList,[c,d,m]=t.pointList,x=w.getLineCenterPoint([e,f]),y=w.getLineCenterPoint([c,m]),R={x:{x:x.x-y.x,y:x.y-y.y}.x,y:0,z:x.y-y.y},S=w.getLineLength(e,p),U=w.getLineLength(c,d),z=S-U,T=w.getLineLength(p,f),N=w.getLineLength(d,m),E=T-N,{newBoxParams:I}=u.getNewBoxBySideUpdate(R,E,z,i);return I},ho=(o,t,i)=>{const u={x:o.x-t.x,y:o.y-t.y};return O(v({},i),{center:{x:i.center.x,y:i.center.y-u.x,z:i.center.z-u.y}})},Lo=(o,t,i,u)=>{const[e,p,f]=o.pointList,[c,d,m]=t.pointList,x=w.getLineCenterPoint([e,f]),y=w.getLineCenterPoint([c,m]),R={x:{x:x.x-y.x,y:x.y-y.y}.x,y:0,z:x.y-y.y},S=w.getLineLength(e,p),U=w.getLineLength(c,d),z=S-U,T=w.getLineLength(p,f),N=w.getLineLength(d,m),E=T-N;let{newBoxParams:I}=u.getNewBoxByBackUpdate(R,E,z,i);return I},St=(o,t,i,u,e)=>{var p;if(!i)return;const{toolInstance:f,pointCloudInstance:c}=i;c.loadPCDFile(u,(p=e==null?void 0:e.radius)!=null?p:$);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,G.Left);c.setInitCameraPosition(d);const{point2d:m,zoom:x}=c.getSphereSidePoint2DCoordinate(o);c.camera.zoom=x,c.camera.updateProjectionMatrix(),c.render(),f.initPosition(),f.zoomChangeOnCenter(x),f.setResult([O(v(v({},t),m),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),f.setSelectedID(t.id)},Rt=(o,t,i,u)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:p}=i;p.loadPCDFileByBox(u,o,{width:K,depth:K});const{cameraPositionVector:f}=p.updateOrthoCamera(o,G.Left);p.setInitCameraPosition(f);const{polygon2d:c,zoom:d}=p.getBoxSidePolygon2DCoordinate(o);p.camera.zoom=d,p.camera.updateProjectionMatrix(),p.render(),e.initPosition(),e.zoomChangeOnCenter(d),e.setResultAndSelectedID([{id:t.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],t.id)},_t=(o,t,i,u,e)=>{var p;if(!i)return;const{toolInstance:f,pointCloudInstance:c}=i;c.loadPCDFile(u,(p=e==null?void 0:e.radius)!=null?p:$);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,G.Back);c.setInitCameraPosition(d);const{point2d:m,zoom:x}=c.getSphereBackPoint2DCoordinate(o);c.camera.zoom=x,c.camera.updateProjectionMatrix(),c.render(),f.initPosition(),f.zoomChangeOnCenter(x),f.setResult([O(v(v({},t),m),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),f.setSelectedID(t.id)},Vt=(o,t,i,u)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:p}=i;p.loadPCDFileByBox(u,o,{height:K,depth:K});const{cameraPositionVector:f}=p.updateOrthoCamera(o,G.Back);p.setInitCameraPosition(f);const{polygon2d:c,zoom:d}=p.getBoxBackPolygon2DCoordinate(o);p.camera.zoom=d,p.camera.updateProjectionMatrix(),p.render(),e.initPosition(),e.zoomChangeOnCenter(d),e.setResultAndSelectedID([{id:t.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],t.id)},kt=(o,t,i,u)=>{if(!i||!u)return;u.generateSphere(o),u.updateCameraBySphere(o,G.Top),u.render();const{toolInstance:e,pointCloudInstance:p}=i,{point2d:f}=p.getSphereTopPoint2DCoordinate(o),c=[...e.pointList].map(d=>d.id===t.id?O(v(v({},t),f),{valid:o.valid,textAttribute:"",attribute:o.attribute}):d);e.setResult(c),e.setSelectedID(t.id)},ut=(o,t,i,u)=>{var e,p;if(!i||!u)return;u.generateBox(o,t.id),u.render();const{pointCloud2dOperation:f,pointCloudInstance:c}=i,{polygon2d:d}=c.getBoxTopPolygon2DCoordinate(o),m=[...f.polygonList],x=m.find(y=>y.id===t.id);x?(x.pointList=d,x.valid=(e=o.valid)!=null?e:!0):m.push({id:t.id,pointList:d,textAttribute:"",isRect:!0,valid:(p=o.valid)!=null?p:!0}),f.setResultAndSelectedID(m,t.id)},vo=()=>{const o=mt(ht),{topViewInstance:t,sideViewInstance:i,backViewInstance:u,mainViewInstance:e,addPointCloudBox:p,addPointCloudSphere:f,setSelectedIDs:c,selectedIDs:d,pointCloudBoxList:m,pointCloudSphereList:x,hideAttributes:y,setHighlight2DDataList:A,cuboidBoxIn2DView:R,imageSizes:S,history:U,linkageImageNameRectMap:z}=o,{addHistory:T,initHistory:N,pushHistoryUnderUpdatePolygon:E}=po(),{selectedPolygon:I}=go(),{getPointCloudSphereByID:Ot,updatePointCloudSphere:pt,selectedSphere:J}=so(),{currentData:H,config:b}=lo(s=>{const{stepList:n,step:a,imgList:r,imgIndex:l}=s.annotation;return{currentData:r[l],config:lt(co.getCurrentStepInfo(a,n).config)}}),M=ao(),At=q(R),Tt=q(z),Ut=xt((s,n)=>{const a=Tt.current,r=n.id;return s.filter(g=>{if(!g)return!1;const C=a.get(g.imageName);return C===void 0?!0:Boolean(C.get(r))})},[]),tt=s=>{const{enableAutoMap2DRect:n=!1}=b;if(!At.current||n){const{mappingImgList:a=[]}=H;uo({pointCloudBox:s,mappingImgList:a,imageSizes:S},{prepareRectsFn:Ut})}},{selectedBox:V,updateSelectedBox:zt,updateSelectedBoxes:ot,getPointCloudByID:Nt}=io({generateRects:tt}),gt=V==null?void 0:V.info;if(!t||!i||!u)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:et}=t,jt=s=>{e==null||e.generateSphere(s),e==null||e.controls.update(),e==null||e.render()},Et=({newPoint:s,size:n,zoom:a,trackConfigurable:r})=>{var l;const g={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(g,{trackID:k.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:x})});const C=at(s,n,et,void 0,g);c(s.id);const P=f(C);Q(B.Top,s,C,a,P,b),T({newSphereParams:C})},Mt=({polygon:s,size:n,imgList:a,trackConfigurable:r,zoom:l,intelligentFit:g})=>{var C,P,h;const _={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(_,{trackID:k.getNextTrackID({imgList:[],extraBoxList:m,extraSphereList:x})});const F=t==null?void 0:t.toolInstance,D=v({},s);let{boxParams:L,newPointList:j}=ct(D,n,et,void 0,_,g);L=M(dt({tool:st.PointCloud,dataList:[L],stepConfig:b,action:"viewUpdateBox"}))[0],g&&(j==null?void 0:j.length)&&(D.pointList=j);const it=y.includes(D.attribute);tt(L);const Z=p(L),X=(P=o==null?void 0:o.polygonList)!=null?P:[];L.subAttribute=to.getDefaultResultByConfig((b==null?void 0:b.secondaryAttributeConfigurable)?(h=b==null?void 0:b.inputList)!=null?h:[]:[]),t==null||t.updatePolygonList(Z!=null?Z:[],X),it?c([]):(c(L.id),F.selection.setSelectedIDs(D.id),W({omitView:B.Top,polygon:D,boxParams:L,zoom:l,newPointCloudBoxList:Z}),g&&ut(L,D,t,e)),T({newBoxParams:L})},Ft=s=>{const{boxID:n,imageName:a,width:r,height:l,x:g,y:C}=s,P=m.find(L=>L.id===n);if(!(P==null?void 0:P.rects)||!P.rects.find(L=>L.imageName===a))return;const _=P.rects.map(L=>L.imageName===a?O(v({},L),{width:r,height:l,x:g,y:C}):L),F=O(v({},P),{rects:_}),D=m.map(L=>L.id===n?F:L);return t==null||t.updatePolygonList(D!=null?D:[]),D},Ht=s=>{const{boxID:n,imageName:a}=s,r=m.find(P=>P.id===n);if(!(r==null?void 0:r.rects))return;const l=r.rects.filter(P=>P.imageName!==a),g=O(v({},r),{rects:l}),C=m.map(P=>P.id===n?g:P);return t==null||t.updatePolygonList(C!=null?C:[]),C},Wt=({newSelectedBox:s,newPointCloudList:n,newSelectedSphere:a,newSphereList:r})=>{var l;const g=t==null?void 0:t.toolInstance;if(!(d.length===0||!g)){if(s||(V==null?void 0:V.info)){const C=s!=null?s:V==null?void 0:V.info;(l=g==null?void 0:g.selection)==null||l.setSelectedIDs(d[0]);const P=g.selectedPolygon;if(d.length===1&&C){W({omitView:B.Top,polygon:P,boxParams:C,newPointCloudBoxList:n});return}}if((a||J)&&d.length===1){const C=a!=null?a:J;g.setSelectedID(d[0]);const P=g.selectedPoint;C&&Q(B.Top,P,C,void 0,r,b)}}},ft=(s,n,a)=>{if(gt){let r,l;switch(a){case B.Back:r=Lo;break;case B.Side:r=Dt;break;default:r=Dt;break}if(l=r(s,n,gt,i.pointCloudInstance),e){const{count:_}=e.getSensesPointZAxisInPolygon(oo(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=O(v({},l),{count:_})}const C=M(dt({tool:st.PointCloud,dataList:[l],stepConfig:b,action:"viewUpdateBox"}))[0],P=l.valid!==C.valid;l=C;const h=zt(l);return l=h.find(_=>_.id===l.id),W({omitView:P?void 0:a,polygon:s,boxParams:l,newPointCloudBoxList:h}),h}},Ct=(s,n,a)=>{if(J){let r,l;switch(a){case B.Back:r=ho;break;case B.Side:r=It;break;default:r=It;break}l=r(s,n,J);const g=pt(l);return Q(a,s,l,void 0,g,b),g}},Zt=(s,n)=>{Ct(s,n,B.Side)},Gt=(s,n)=>{Ct(s,n,B.Back)},Jt=(s,n)=>{ft(s,n,B.Side)},Qt=(s,n)=>{ft(s,n,B.Back)},Xt=(s,n)=>{const a=Ot(s.id),r=at(s,n,et,a),l=pt(r);Q(B.Top,s,r,void 0,l,b)},Yt=(s,n)=>{if(I){const r=v({},s[0].newPolygon);r.pointList=r.pointList.map(l=>k.transferCanvas2World(l,n)),E(r);return}let a=s.map(({newPolygon:r})=>{const l=Nt(r.id),{boxParams:g}=ct(r,n,t.pointCloudInstance,l);return g});if(a=M(dt({tool:st.PointCloud,dataList:a,stepConfig:b,action:"viewUpdateBox"})),a.length===1){const{newPolygon:r}=s[0],l=ot(a);W({polygon:r,boxParams:a[0],newPointCloudBoxList:l})}else{const r=ot(a);r&&o.syncAllViewPointCloudColor(rt.MultiMove,r)}},qt=s=>{var n,a,r,l,g;if(V){const C=Number(s.widthDefault),P=Number(s.depthDefault),h=Number(s.heightDefault),_=V==null?void 0:V.info.trackID,D=((n=t==null?void 0:t.toolInstance)==null?void 0:n.polygonList).find(Y=>(Y==null?void 0:Y.trackID)===_),L={width:(r=(a=t==null?void 0:t.toolInstance)==null?void 0:a.basicImgInfo)==null?void 0:r.width,height:(g=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:g.height},j=D.pointList.map(Y=>k.transferCanvas2World(Y,L)),nt=w.getModifiedRectangleCoordinates(j,h,C),it=nt[0],Z=nt[2],X=w.getLineCenterPoint([it,Z]),Kt=V.info.center.z-V.info.depth/2,Pt=O(v({},V.info),{center:{x:X.x,y:X.y,z:Kt+P/2},width:C,height:h,depth:P,valid:!0}),$t=ot([Pt]);W({omitView:B["3D"],polygon:D,boxParams:Pt,newPointCloudBoxList:$t})}},Q=(s,n,a,r,l,g)=>bt(void 0,null,function*(){const C=H==null?void 0:H.url,P={[B.Side]:()=>{St(a,n,i,C,g)},[B.Back]:()=>{u&&_t(a,n,u,C,g)},[B.Top]:()=>{kt(a,n,t,e)}};Object.keys(P).forEach(h=>{h!==s&&P[h]()}),r&&(e==null||e.updateCameraZoom(r)),jt(a)}),W=s=>{const{omitView:n,polygon:a,boxParams:r,zoom:l,newPointCloudBoxList:g}=s,C=H==null?void 0:H.url;g&&o.syncAllViewPointCloudColor(rt.Single,g);const P={[B.Side]:()=>{Rt(r,a,i,C)},[B.Back]:()=>{u&&Vt(r,a,u,C)},[B.Top]:()=>{ut(r,a,t,e)}};Object.keys(P).forEach(h=>{h!==n&&P[h]()}),l&&(e==null||e.updateCameraZoom(l))};return{topViewAddSphere:Et,topViewAddBox:Mt,topViewSelectedChanged:Wt,topViewUpdatePoint:Xt,sideViewUpdatePoint:Zt,backViewUpdatePoint:Gt,topViewUpdateBox:Yt,sideViewUpdateBox:Jt,backViewUpdateBox:Qt,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),e==null||e.generateBoxes(s)},initPointCloud3d:s=>{if(!e)return;const n=k.getDefaultOrthographicParams(s);e.initOrthographicCamera(n),e.initRenderer(),e.render()},updatePointCloudData:(...s)=>bt(void 0,[...s],function*(n=H){var a,r,l,g,C,P;if(!(n==null?void 0:n.url)||!e)return;A([]),Lt(M,!0),vt(M,!0),yield e.loadPCDFile(n.url,(a=b==null?void 0:b.radius)!=null?a:$),e==null||e.clearAllBox(),e==null||e.clearAllSphere();let h=[],_=[],F=[],D=[];e.updateTopCamera();const L=(l=(r=lt(n.result))==null?void 0:r.valid)!=null?l:!0;if(o.setPointCloudValid(L),(g=o.sideViewInstance)==null||g.clearAllData(),(C=o.backViewInstance)==null||C.clearAllData(),n.result){if(h=k.getBoxParamsFromResultList(n.result),(h==null?void 0:h.length)>0&&n.isPreResult&&(b==null?void 0:b.lowerLimitPointsNumInBox)>0){h=yield e==null?void 0:e.filterPreResult(n.url,b,h);const j=lt(n.result);j[eo].result=h,n.result=JSON.stringify(j),o.setPointCloudResult(h)}F=k.getPolygonListFromResultList(n.result),_=k.getLineListFromResultList(n.result),D=k.getSphereParamsFromResultList(n.result),t.updateData(n.url,n.result,{radius:(P=b==null?void 0:b.radius)!=null?P:$}),e==null||e.generateBoxes(h),e==null||e.generateSpheres(D),yield o.syncAllViewPointCloudColor(rt.Default,h,[])}N({pointCloudBoxList:h,polygonList:F,lineList:_,pointCloudSphereList:D}),Lt(M,!1),vt(M,!1)}),updateViewsByDefaultSize:qt,generateRects:tt,update2DViewRect:Ft,remove2DViewRect:Ht}},yo=()=>{const{pointCloudBoxList:o,rectList:t,setPointCloudResult:i}=mt(ht),u=q(o),e=q(t);return{syncToPointCloudBoxList:xt(()=>{const f=u.current,c=e.current;if(c.length===0)return null;const d=new Map,m=new Set;if(c.filter(x=>x.extId!==void 0).forEach(x=>{const y=x.extId,A=x.imageName,R=ro(x,["x","y","width","height"]);let S=d.get(y);S||(S=new Map,d.set(y,S)),S.set(A,R),m.add(y)}),d.size){const x=f.map(y=>{var A;const R=y.id;if(m.has(R)){const S=v({},y);return(A=S.rects)==null||A.forEach(U=>{var z;const T=U.imageName;Object.assign(U,(z=d.get(R))==null?void 0:z.get(T))}),S}return y});return i(x),x}return null},[])}};export{_t as syncBackViewByPoint,St as syncSideViewByPoint,kt as syncTopViewByPoint,Vt as synchronizeBackView,Rt as synchronizeSideView,ut as synchronizeTopView,at as topViewPoint2PointCloud,ct as topViewPolygon2PointCloud,vo as usePointCloudViews,yo as useSyncRectPositionDimensionToPointCloudList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as
|
|
1
|
+
import{useContext as f}from"react";import{PointCloudContext as g}from"../PointCloudContext.js";import{useHistory as _}from"./useHistory.js";var m=Object.defineProperty,O=Object.defineProperties,w=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,y=(o,t,e)=>t in o?m(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,p=(o,t)=>{for(var e in t||(t={}))x.call(t,e)&&y(o,e,t[e]);if(c)for(var e of c(t))C.call(t,e)&&y(o,e,t[e]);return o},L=(o,t)=>O(o,w(t));const h=()=>{const{polygonList:o,pointCloudBoxList:t,setPolygonList:e,selectedID:a}=f(g),{addHistory:u,pushHistoryWithList:P}=_(),d=o.find(r=>r.id===a);return{addPolygon:r=>{e(o.concat(r)),u({newPolygon:r})},deletePolygon:r=>{const i=o.filter(s=>s.id!==r).map(s=>p({},s));e(i);const n={polygonList:i};try{const s=t.filter(l=>l.id!==r).map(l=>p({},l));s.length<t.length&&(n.pointCloudBoxList=s)}catch(s){console.error("exec update history pointCloudBoxList error:",s)}P(n)},selectedPolygon:d,updateSelectedPolygon:r=>{d&&e(o.map(i=>i.id===a?r:i))},updatePolygonValidByID:r=>{o.find(n=>n.id===r)&&e(o.map(n=>n.id===r?L(p({},n),{valid:!n.valid}):n))}}};export{h as usePolygon};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as p}from"react";import{synchronizeSideView as C,synchronizeBackView as P}from"./usePointCloudViews.js";import{useSingleBox as
|
|
1
|
+
import{useContext as p}from"react";import{synchronizeSideView as C,synchronizeBackView as P}from"./usePointCloudViews.js";import{useSingleBox as x}from"./useSingleBox.js";import{PointCloudContext as w}from"../PointCloudContext.js";import{cAnnotation as f}from"@labelbee/lb-annotation";import{PointCloudUtils as g}from"@labelbee/lb-utils";import{EPointCloudBoxRenderTrigger as b}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import{useThrottleFn as B}from"ahooks";const{ERotateDirection:V}=f,y=({currentData:t})=>{const e=p(w),{selectedBox:i,updateSelectedBox:u}=x(),{run:d}=B(l=>{const{topViewInstance:r,mainViewInstance:n,syncAllViewPointCloudColor:a}=e;if(!r||!n)return;const{pointCloud2dOperation:s}=r,o=i==null?void 0:i.info;if(!o||!(t==null?void 0:t.url)||!e.backViewInstance)return;const m=u({rotation:g.restrictAngleRange(o.rotation+Number(Math.PI*l)/180)});s.rotatePolygon(l,V.Anticlockwise);const c=s.selectedPolygon;n.generateBox(o),a(b.SingleRotate,m),C(o,c,e.sideViewInstance,t.url),P(o,c,e.backViewInstance,t.url),n.render()},{wait:800});return{updateRotate:d}};export{y as useRotate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useContext as g}from"react";import{synchronizeSideView as m,synchronizeBackView as P}from"./usePointCloudViews.js";import{useSingleBox as h}from"./useSingleBox.js";import{PointCloudContext as w}from"../PointCloudContext.js";import{useThrottleFn as x}from"ahooks";import{PointCloudUtils as C}from"@labelbee/lb-utils";const f=({currentData:t})=>{const e=g(w),{selectedBox:l,updateSelectedBox:c}=h(),{run:u}=x(a=>{const{topViewInstance:r,mainViewInstance:i}=e;if(!r||!i)return;const{pointCloud2dOperation:s}=r,o=l==null?void 0:l.info;if(!o||!(t==null?void 0:t.url)||!e.backViewInstance)return;const n=s.selectedPolygon.pointList||[],p=n.shift();n.push(p),c({newPointList:n,rotation:C.restrictAngleRange(o.rotation+Number(Math.PI*a)/180),width:o.height,height:o.width}),s.rotatePolygonEdge(n);const d=s.selectedPolygon;i.generateBox(o),m(o,d,e.sideViewInstance,t.url),P(o,d,e.backViewInstance,t.url),i.render()},{wait:800});return{updateRotateEdge:u}};export{f as useRotateEdge};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as
|
|
1
|
+
import{useContext as de,useMemo as A,useCallback as f}from"react";import m from"lodash";import{PointCloudContext as le}from"../PointCloudContext.js";import{EToolName as T,cAnnotation as re}from"@labelbee/lb-annotation";import{useHistory as se}from"./useHistory.js";import{usePolygon as ae}from"./usePolygon.js";import{EPointCloudBoxRenderTrigger as H}from"../../../utils/ToolPointCloudBoxRenderHelper.js";var ce=Object.defineProperty,ue=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,k=(d,t,l)=>t in d?ce(d,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):d[t]=l,xe=(d,t)=>{for(var l in t||(t={}))pe.call(t,l)&&k(d,l,t[l]);if(M)for(var l of M(t))ge.call(t,l)&&k(d,l,t[l]);return d},Pe=(d,t)=>ue(d,fe(t));const{ESortDirection:B}=re,ve=d=>{const{pointCloudBoxList:t,setPointCloudResult:l,topViewInstance:s,backViewInstance:_,sideViewInstance:h,selectedIDs:y,selectedID:O,mainViewInstance:p,setSelectedIDs:K,syncAllViewPointCloudColor:V,polygonList:U,pointCloudPattern:R,rectList:S,updateRectIn2DView:me,removeRectIn2DView:F,addRectIn2DView:W,updateRectListByReducer:D}=de(le),{selectedPolygon:g,updateSelectedPolygon:q,updatePolygonValidByID:z,deletePolygon:G}=ae(),{pushHistoryWithList:b}=se(),a=A(()=>{const e=t.findIndex(n=>n.id===O);if(e>-1)return{info:t[e],index:e}},[O,t]),L=f(e=>{var n;if(a==null?void 0:a.info){(n=d==null?void 0:d.generateRects)==null||n.call(d,e),t.splice(a.index,1,m.merge(a.info,e));const o=m.cloneDeep(t);return l(o),b({pointCloudBoxList:o}),o}return t},[O,t]),J=f((e,n)=>{const o=t.findIndex(i=>i.id===n);if(o>-1){t.splice(o,1,m.merge(t[o],e));const i=m.cloneDeep(t);return l(i),i}return t},[t]),w=f(e=>{s==null||s.pointCloud2dOperation.setPolygonValidAndRender(e,!0),h==null||h.pointCloud2dOperation.setPolygonValidAndRender(e,!0),_==null||_.pointCloud2dOperation.setPolygonValidAndRender(e,!0)},[s,h,_]),Q=f(()=>{if(a==null?void 0:a.info){const{id:e,valid:n=!0}=a.info,o=L({valid:!n});V(H.SingleToggleValid,o),w(e)}g&&(q(Pe(xe({},g),{valid:!g.valid})),s==null||s.pointCloud2dOperation.setPolygonValidAndRender(g.id,!0))},[w,a,g]),X=f(e=>{const n=t.find(o=>o.id===e);if(n){const{id:o,valid:i=!0}=n,c=J({valid:!i},o);return w(o),c}z(e)},[w,t,U]),E=f((e=B.ascend,n=!1)=>{if(!s||y.length>1)return;if(R!==T.Rect&&R!==T.Polygon){n&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:e!==B.ascend}));return}const{pointCloud2dOperation:o}=s,i=o.switchToNextPolygon(e);i&&K(i)},[s,R,s==null?void 0:s.toolInstance]),Y=(e=!1)=>{E(B.descend,e)},Z=(e=!1)=>{E(B.ascend,e)},N=(e,n=!0)=>{const o=t.filter(i=>i.id!==e);if(l(o),p==null||p.removeObjectByName(e,"box"),p==null||p.render(),V(H.SingleDelete,o),n){const i=S.filter(r=>r.extId===e),c=new Set(i.map(r=>r.id));D(j(c))}},j=e=>(n,o)=>{let i=!1;const c=n.map(r=>e.has(r.id)?(i=!0,o(r)):r);return i?c:n},$=f((e,n)=>{var o,i;const c=new Set((i=(o=n.mappingImgList)==null?void 0:o.map(u=>u.path))!=null?i:[]),r=new Map;e.forEach(u=>{const I=u.id;(u.rects||[]).forEach(C=>{const{imageName:v}=C;if(c.has(v)){let P=r.get(v);P||(P=new Set,r.set(v,P)),P.add(I)}})});const x=S.filter(u=>{var I;const C=u.extId,v=u.imageName;if(v!==void 0&&C!==void 0){const P=r.get(v);return(I=P==null?void 0:P.has(C))!=null?I:!1}return!1}),ie=new Set(x.map(u=>u.id));D(j(ie))},[S,F,W]),ee=e=>{a&&(N(a.info.id,!1),s==null||s.pointCloud2dOperation.deletePolygon(a.info.id),$([a.info],e)),g&&(G(g.id),s==null||s.pointCloud2dOperation.deletePolygon(g.id))},te=A(()=>t.filter(e=>y.includes(e.id)),[y,t]),oe=f(e=>{var n;const o=m.cloneDeep(t);let i=!1;for(const c of e){const r=o.findIndex(x=>x.id===c.id);if(r>-1){const x=m.merge(o[r],c);(n=d==null?void 0:d.generateRects)==null||n.call(d,x),o.splice(r,1,x),p==null||p.generateBox(x),i=!0}}if(i)return l(o),b({pointCloudBoxList:o}),p==null||p.render(),o},[y,t]),ne=f(e=>t.find(n=>n.id===e),[t]);return{selectedBox:a,updateSelectedBox:L,changeSelectedBoxValid:Q,changeValidByID:X,selectNextBox:Z,selectPrevBox:Y,deletePointCloudBox:N,selectedBoxes:te,updateSelectedBoxes:oe,getPointCloudByID:ne,deleteSelectedPointCloudBoxAndPolygon:ee}};export{ve as useSingleBox};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as
|
|
1
|
+
import{useContext as x,useMemo as P}from"react";import{PointCloudContext as E}from"../PointCloudContext.js";import{cTool as I}from"@labelbee/lb-annotation";import{useHistory as T}from"./useHistory.js";import{EPointCloudPattern as C}from"@labelbee/lb-utils";import{EPointCloudBoxRenderTrigger as A}from"../../../utils/ToolPointCloudBoxRenderHelper.js";const{EToolName:t,EPolygonPattern:p}=I,V=()=>{const{topViewInstance:s,sideViewInstance:a,backViewInstance:u,mainViewInstance:e,setPointCloudResult:m,setPointCloudSphereList:v,setPolygonList:h,setRectList:b,pointCloudPattern:c,setPointCloudPattern:l,syncAllViewPointCloudColor:g,globalPattern:n,setLineList:L}=x(E),{pushHistoryWithList:R}=T(),f=()=>{e==null||e.clearAllBox(),e==null||e.clearAllSphere(),e==null||e.render(),m([]),h([]),v([]),L([]),b([]),s==null||s.toolScheduler.clearStatusAndResult(),g(A.ClearAll,[]),R({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},i=()=>{a==null||a.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()},w=d=>{if(d===c)return;const r=[s,a,u];switch(d){case t.Rect:i(),r.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(p.Rect)}),l(t.Rect);break;case t.Polygon:i(),r.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(p.Normal)}),l(t.Polygon);break;case t.Point:i(),r.forEach(o=>{o==null||o.switchToCanvas(t.Point)}),l(t.Point);break;case t.Line:i(),r.forEach(o=>{o==null||o.switchToCanvas(t.Line)}),l(t.Line);break}},y=P(()=>n===C.Detection,[n]),S=P(()=>n===C.Segmentation,[n]);return{clearAllResult:f,updatePointCloudPattern:w,pointCloudPattern:c,isPointCloudDetectionPattern:y,isPointCloudSegmentationPattern:S}};export{V as useStatus};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useRef as f,useCallback as n,useEffect as i}from"react";import{useMemoizedFn as a}from"ahooks";const o=r=>typeof r=="number",l=(r,e)=>{const c=a(r),u=f(null),t=n(()=>{u.current&&clearTimeout(u.current)},[]),s=n((...m)=>{!o(e)||e<0||(t(),u.current=setTimeout(()=>c(...m),e))},[e]);return i(()=>t,[t]),{fn:s,clear:t}};export{l as default,o as isNumber};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useRef as l,useCallback as i,useEffect as a,useMemo as f}from"react";import"../utils/event-polyfill.js";const c=()=>()=>{},L=()=>({appendEventListener:c,preappendEventListener:c,addEventListener:c}),w=()=>{},v=()=>{const t=l([]),p=i(e=>{const n=t.current,s=n.findIndex(d=>d===e);s>-1&&n.splice(s,1)},[]),r=i((e,n)=>e?(n(e),()=>{p(e)}):(console.warn("invalid listener"),w),[p]),o=i(e=>r(e,n=>{t.current.push(n)}),[r]),u=i(e=>r(e,n=>{t.current.unshift(n)}),[r]);return a(()=>()=>{t.current.length=0},[]),a(()=>{const e=n=>{const s=t.current.slice(0);for(let d of s){if(n.isImmediatePropagationStopped())break;d(n)}};return window.addEventListener("keydown",e,!1),()=>{window.removeEventListener("keydown",e,!1)}},[]),f(()=>({appendEventListener:o,preappendEventListener:u,addEventListener:o}),[o,u])};export{v as default,L as getEmptyUseWindowKeydownListener};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as n}from"../../utils/dom.js";import t,{useContext as
|
|
1
|
+
import{getClassName as n}from"../../utils/dom.js";import t,{useContext as T,useState as y,useEffect as C}from"react";import _ from"./PointCloud3DView.js";import k from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import F from"./PointCloudSideView.js";import R from"./PointCloud2DView.js";import M from"./PointCloudListener.js";import G from"./PointCloudSegmentListener.js";import O from"./PointCloudSegment.js";import Z from"./PointCloudSegmentStatus.js";import U from"./PointCloudSegmentToolbar.js";import W from"./PointCloudSegment2DView.js";import{connect as $}from"react-redux";import{LabelBeeContext as q,useDispatch as z}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as H,AnnotatedAttributesPanelFixedRight as J}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as K}from"./PointCloudContext.js";import{PointCloudUtils as Q,EPointCloudPattern as X}from"@labelbee/lb-utils";import{useCustomToolInstance as Y}from"../../hooks/annotation.js";import{jsonParser as tt}from"../../utils/index.js";import{a2MapStateToProps as et}from"../../store/annotation/map.js";import L from"classnames";import ot from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as nt}from"../../store/annotation/actionCreators.js";const it=E=>{const{currentData:a,imgList:S,drawLayerSlot:d,checkMode:i,intelligentFit:w,imgIndex:x,config:b,measureVisible:j}=E,e=T(K),{globalPattern:p,setGlobalPattern:v,selectedIDs:P}=e,V=z(),[l,f]=y(!1),h=(P==null?void 0:P.length)>0&&l,D=tt(a.result),{toolInstanceRef:r,clearToolInstance:A}=Y({basicInfo:D});if(C(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==p&&(v(o),e.clearAllDetectionInstance(),A())}},[p]),C(()=>{var o;if(nt(V,!0),a){const{boxParamsList:s,polygonList:m,lineList:u,sphereParamsList:c,segmentation:N,rectList:I}=Q.parsePointCloudCurrentResult((o=a==null?void 0:a.result)!=null?o:"");e.setPointCloudResult(s),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(c),e.setRectList(I),e.setSegmentation(N)}},[x]),C(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,s,m,u,c;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(s=e.lineList)!=null?s:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],resultRect:(u=e.rectList)!=null?u:[],segmentation:(c=e.segmentation)!=null?c:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),S.length===0)return null;if(p===X.Segmentation)return t.createElement(t.Fragment,null,t.createElement(G,{checkMode:i,toolInstanceRef:r}),t.createElement(U,null),t.createElement("div",{className:n("point-cloud-layout")},t.createElement(O,{checkMode:i}),t.createElement(W,null)),t.createElement(Z,{config:b}),d==null?void 0:d({direct:!0}));let g=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(k,{checkMode:i}),t.createElement(F,{checkMode:i}));return l&&(g=t.createElement(ot,{selectAndEnlarge:h,checkMode:i})),t.createElement(t.Fragment,null,t.createElement(M,{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(H,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(_,null),g),t.createElement("div",{className:L({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:l})},t.createElement(B,{drawLayerSlot:d,checkMode:i,intelligentFit:w,setIsEnlargeTopView:f,onExitZoom:()=>{f(!1)},isEnlargeTopView:l}),t.createElement("div",{className:L({[n("point-cloud-container","right-bottom")]:!l,[n("point-cloud-container","right-bottom-floatLeft")]:l})},t.createElement(R,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:i,measureVisible:j})))),t.createElement(J,null))))};var lt=$(et,null,null,{context:q})(it);export{lt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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
|
+
const s=(n,r,d,a)=>{let e=n.get(r);e||(e=new Map,n.set(r,e));let t=e.get(d);return t||(t=new WeakSet,e.set(d,t)),t.add(a),n};export{s as addMapIndirectWeakSetItem};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o,{useEffect as g}from"react";import{Checkbox as y,Select as u,Divider as x}from"antd";import{I18nextProvider as S,useTranslation as _}from"react-i18next";import E from"../attributeList/index.js";import{i18n as v}from"@labelbee/lb-utils";var h=Object.defineProperty,s=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,f=(t,a,r)=>a in t?h(t,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[a]=r,P=(t,a)=>{for(var r in a||(a={}))w.call(a,r)&&f(t,r,a[r]);if(s)for(var r of s(a))O.call(a,r)&&f(t,r,a[r]);return t};const k={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},C=t=>{const{subAttributeList:a,setSubAttribute:r,getValue:i,lang:p}=t,{t:c}=_();g(()=>{var e;p&&((e=v)==null||e.changeLanguage(p))},[]);const m=(e,n)=>{if(Array.isArray(n)){r(e,n.join(";"));return}r(e,n)},d=e=>{const n=i(e);return(e==null?void 0:e.isMulti)?n?n==null?void 0:n.split(";"):[]:n};return o.createElement(o.Fragment,null,a.map(e=>{var n;return(e==null?void 0:e.subSelected)&&o.createElement("div",{style:{marginTop:12},key:e.value},o.createElement("div",{style:k},c("SubAttribute"),"-",e.key),((n=e.subSelected)==null?void 0:n.length)<5?(e==null?void 0:e.isMulti)?o.createElement(y.Group,{style:{padding:"0px 20px 16px 16px"},options:e.subSelected.map(l=>({label:l.key,value:l.value})),value:d(e),onChange:l=>m(e.value,l)}):o.createElement(E,{list:e.subSelected.map(l=>({label:l.key,value:l.value})),selectedAttribute:i(e),num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:l=>r(e.value,l),style:{marginBottom:12}}):o.createElement(u,{style:{margin:"0px 20px 16px 16px",width:"87%"},mode:(e==null?void 0:e.isMulti)?"multiple":void 0,value:d(e),placeholder:c("PleaseSelect"),onChange:l=>m(e.value,l),allowClear:!0},e.subSelected.map(l=>o.createElement(u.Option,{key:l.value,value:l.value},l.key))),o.createElement(x,{style:{margin:0}}))}))},L=t=>o.createElement(S,{i18n:v},o.createElement(C,P({},t)));export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MathUtils as C,CommonToolUtils as F,uuid as A,AttributeUtils as k}from"@labelbee/lb-annotation";import{jsonParser as P}from"../../../utils/index.js";import{precisionAdd as I,precisionMinus as V,isImageValue as R}from"../../../utils/audio.js";import{message as m}from"antd";import b from"lodash";import g from"react";import _ from"./index.module.scss.js";import{VideoClipToolContextProvider as B}from"./VideoClipToolContext.js";import{EClipStatus as o,ETimeSliceType as T,PER_SLICE_CHANGE as v,SLICE_MIN_TIME as x}from"./constant.js";import{VideoPlayer as j}from"../../videoPlayer/index.js";import M from"./components/videoTimeSlicesOverVideo/index.js";import U from"../../../assets/annotation/video/icon_videoCutting.svg.js";import{decimalReserved as L}from"../../videoPlayer/utils.js";class N extends g.Component{constructor(r){super(r);this.fns=new Map,this.throttledUpdateTime=b.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===o.Clipping){m.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:l,start:u,type:a}=this.state.result[this.selectedSliceIndex],n=C.withinRange(I(u,t),[0,V(a===T.Time?s:l,v)]);this.updateSelectedSliceTimeProperty(n,"start")}},this.updateSelectedSliceTimeEndByPer=t=>{var e,i;if(this.state.clipStatus===o.Clipping){m.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],l=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0;if(s.type===T.Time){m.info("\u65F6\u95F4\u70B9\u4EC5\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}const{end:u,start:a}=s,n=C.withinRange(I(u,t),[I(a,v),l]);this.updateSelectedSliceTimeProperty(n,"end")}},this.updateSelectedSliceTimeProperty=(t,e)=>{if(this.selectedSliceIndex>-1){const{result:i}=this.state;i[this.selectedSliceIndex][e]=t,this.setState({result:b.cloneDeep(i)}),this.updateSidebar()}},this.keyDownEvents=t=>{if(!F.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(-v);break;case"=":this.updateSelectedSliceTimeStartByPer(v);break;case"[":this.updateSelectedSliceTimeEndByPer(-v);break;case"]":this.updateSelectedSliceTimeEndByPer(v);break}},this.setVideoError=(t,e,i)=>{if(t){const{clipStatus:s}=this.state;s===o.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!==o.Clipping)return;const s=t.findIndex(l=>l.id===e);s>-1&&(t.splice(s,1),this.setState({result:t,selectedID:"",clipStatus:o.Stop}),this.updateSidebar())},this.toggleClipStatus=t=>{var e,i,s;if(this.disabled)return;const{clipStatus:l,selectedAttribute:u}=this.state,a=l!==o.Clipping;let n=a?o.Clipping:o.Stop,{result:d,selectedID:c,textValue:p}=this.state;const h=b.cloneDeep(d),S=t||((e=this.videoPlayer)==null?void 0:e.currentTime),y=(i=this.videoPlayer)==null?void 0:i.duration;if(y===void 0||S===void 0)return;const w=L(S,2);if(a){const f=A();c=f,h.push({start:w,end:null,attribute:u,textAttribute:this.defaultTextAttribute,duration:y,id:f,type:T.Period}),p=this.defaultTextAttribute}else{const f=h.findIndex(E=>E.id===c),D=h[f];D&&(S-D.start<x?(h.splice(f,1),m.info(`\u622A\u53D6\u7247\u6BB5\u4E0D\u80FD\u77ED\u4E8E${x}s`),n=o.Stop,c="",p=""):(h[f].end=L(S,2),(s=this.videoPlayer)==null||s.pause(),m.success(`\u5DF2\u622A\u53D6\u7247\u6BB5${d.length}`)))}this.setState({clipStatus:n,result:h,selectedID:c,textValue:p}),this.updateSidebar()},this.addTime=()=>{var t,e,i,s;if(this.disabled)return;const{result:l,selectedAttribute:u,selectedID:a}=this.state,n=A(),d=b.cloneDeep(l),c=((t=this.videoPlayer)==null?void 0:t.currentTime)||0;d.push({start:c,end:c,attribute:u,textAttribute:this.defaultTextAttribute,id:n,type:T.Time,duration:(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0});const p={result:d,selectedID:n,textValue:this.defaultTextAttribute},h=d.find(S=>S.id===a);this.isClipping&&h?(delete p.selectedID,delete p.textValue,m.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===o.Stop&&(t.preventDefault(),this.setState({selectedID:""}),this.updateSidebar())},this.onTrackResize=(t,e,i)=>{var s,l;const{result:u}=this.state,a=u.find(n=>n.id===t);if(a){const n=a.duration,d=e==="left",c=d?"start":"end",p=d?-n*i:n*i,h=d?[0,Math.max(((s=a.end)!=null?s:0)-x,0)]:[a.start+x,n],S=C.withinRange(p+((l=a==null?void 0:a[c])!=null?l:0),h);a[c]=S,this.throttledUpdateTime(S)}this.setState({result:[...u]}),this.updateSidebar()},this.renderMediaContent=()=>{var t;const{pageForward:e,pageJump:i,pageBackward:s}=this.props,{result:l,videoError:u,valid:a,currentTime:n}=this.state;return g.createElement("div",{className:_.clipContainer},g.createElement(j,{imgIndex:this.props.imgIndex,imgList:this.props.imgList,pageBackward:s,pageForward:e,pageJump:i,valid:a,setVideoRef:d=>{this.videoPlayer=d},showVideoTrack:!u,onTrackResize:this.onTrackResize,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.props.onVideoLoaded,toggleClipStatus:this.toggleClipStatus,addTime:this.addTime,updateCurrentTime:this.updateCurrentTime}),g.createElement(M,{key:(t=this.videoPlayer)==null?void 0:t.currentTime,result:l,currentTime:n,attributeList:this.props.config.attributeList,extraStyle:{top:this.props.drawLayerSlot?40:0}}),this.isClipping&&g.createElement("i",{className:_.clipping,style:{backgroundImage:U}}))},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(l=>l.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 u=P(s[i].result)[`step_${this.stepInfo().step}`],a=(u==null?void 0:u.result)||[],n=R(s[i].result||"[]");this.setState({result:a,loading:t,selectedID:"",textValue:"",selectedAttribute:"",clipStatus:o.Stop,valid:n},()=>{this.updateSidebar(),n||m.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(l=>l.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(l=>l.id===i);s&&(s.textAttribute=t,this.setState({result:[...e]}),this.updateSidebar())}},this.state={result:[],selectedAttribute:"",textValue:"",clipStatus:o.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===o.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 k.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 P((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 g.createElement(B,{value:{videoPlayer:this.videoPlayer,result:t,selectedID:r,attributeList:this.props.config.attributeList,clipStatus:e,selectedAttribute:i,contextToCancel:this.contextToCancel}},this.renderMediaContent())}}export{N as default};
|
|
1
|
+
import{MathUtils as C,CommonToolUtils as F,uuid as A,AttributeUtils as R}from"@labelbee/lb-annotation";import{jsonParser as P}from"../../../utils/index.js";import{precisionAdd as y,precisionMinus as k,isImageValue as V}from"../../../utils/audio.js";import{message as m}from"antd";import b from"lodash";import g from"react";import _ from"./index.module.scss.js";import{VideoClipToolContextProvider as B}from"./VideoClipToolContext.js";import{EClipStatus as d,ETimeSliceType as T,PER_SLICE_CHANGE as v,SLICE_MIN_TIME as x}from"./constant.js";import{VideoPlayer as j}from"../../videoPlayer/index.js";import M from"./components/videoTimeSlicesOverVideo/index.js";import U from"../../../assets/annotation/video/icon_videoCutting.svg.js";import{decimalReserved as L}from"../../videoPlayer/utils.js";class N extends g.Component{constructor(r){super(r);this.fns=new Map,this.throttledUpdateTime=b.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===d.Clipping){m.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:l,start:u,type:a}=this.state.result[this.selectedSliceIndex],n=C.withinRange(y(u,t),[0,k(a===T.Time?s:l,v)]);this.updateSelectedSliceTimeProperty(n,"start")}},this.updateSelectedSliceTimeEndByPer=t=>{var e,i;if(this.state.clipStatus===d.Clipping){m.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],l=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0;if(s.type===T.Time){m.info("\u65F6\u95F4\u70B9\u4EC5\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}const{end:u,start:a}=s,n=C.withinRange(y(u,t),[y(a,v),l]);this.updateSelectedSliceTimeProperty(n,"end")}},this.updateSelectedSliceTimeProperty=(t,e)=>{if(this.selectedSliceIndex>-1){const{result:i}=this.state;i[this.selectedSliceIndex][e]=t,this.setState({result:b.cloneDeep(i)}),this.updateSidebar()}},this.keyDownEvents=t=>{if(!F.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(-v);break;case"=":this.updateSelectedSliceTimeStartByPer(v);break;case"[":this.updateSelectedSliceTimeEndByPer(-v);break;case"]":this.updateSelectedSliceTimeEndByPer(v);break}},this.setVideoError=(t,e,i)=>{if(t){const{clipStatus:s}=this.state;s===d.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!==d.Clipping)return;const s=t.findIndex(l=>l.id===e);s>-1&&(t.splice(s,1),this.setState({result:t,selectedID:"",clipStatus:d.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:l,selectedAttribute:u}=this.state,a=l!==d.Clipping;let n=a?d.Clipping:d.Stop,{result:o,selectedID:c,textValue:h}=this.state;const p=b.cloneDeep(o),S=t||((e=this.videoPlayer)==null?void 0:e.currentTime),I=(i=this.videoPlayer)==null?void 0:i.duration;if(I===void 0||S===void 0)return;const w=L(S,2);if(a){const f=A();c=f,p.push({start:w,end:null,attribute:u,textAttribute:this.defaultTextAttribute,duration:I,id:f,type:T.Period}),h=this.defaultTextAttribute}else{const f=p.findIndex(E=>E.id===c),D=p[f];D&&(S-D.start<x?(p.splice(f,1),m.info(`\u622A\u53D6\u7247\u6BB5\u4E0D\u80FD\u77ED\u4E8E${x}s`),n=d.Stop,c="",h=""):(p[f].end=L(S,2),(s=this.videoPlayer)==null||s.pause(),m.success(`\u5DF2\u622A\u53D6\u7247\u6BB5${o.length}`)))}this.setState({clipStatus:n,result:p,selectedID:c,textValue:h}),this.updateSidebar()},this.addTime=()=>{var t,e,i,s;if(this.disabled)return;const{result:l,selectedAttribute:u,selectedID:a}=this.state,n=A(),o=b.cloneDeep(l),c=((t=this.videoPlayer)==null?void 0:t.currentTime)||0;o.push({start:c,end:c,attribute:u,textAttribute:this.defaultTextAttribute,id:n,type:T.Time,duration:(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0});const h={result:o,selectedID:n,textValue:this.defaultTextAttribute},p=o.find(S=>S.id===a);this.isClipping&&p?(delete h.selectedID,delete h.textValue,m.success(`\u5DF2\u622A\u53D6\u65F6\u95F4\u70B9${o.length-1}`)):(s=this.videoPlayer)==null||s.pause(),this.setState(h),this.updateSidebar()},this.updateCurrentTime=t=>{this.setState({currentTime:t})},this.contextToCancel=t=>{this.state.clipStatus===d.Stop&&(t.preventDefault(),this.setState({selectedID:""}),this.updateSidebar())},this.onTrackResize=(t,e,i)=>{var s,l;const{result:u}=this.state,a=u.find(n=>n.id===t);if(a){const n=a.duration,o=e==="left",c=o?"start":"end",h=o?-n*i:n*i,p=o?[0,Math.max(((s=a.end)!=null?s:0)-x,0)]:[a.start+x,n],S=C.withinRange(h+((l=a==null?void 0:a[c])!=null?l:0),p);a[c]=S,this.throttledUpdateTime(S)}this.setState({result:[...u]}),this.updateSidebar()},this.renderMediaContent=()=>{var t;const{pageForward:e,pageJump:i,pageBackward:s}=this.props,{result:l,videoError:u,valid:a,currentTime:n}=this.state;return g.createElement("div",{className:_.clipContainer},g.createElement(j,{imgIndex:this.props.imgIndex,imgList:this.props.imgList,pageBackward:s,pageForward:e,pageJump:i,valid:a,setVideoRef:o=>{this.videoPlayer=o},showVideoTrack:!u,onTrackResize:this.onTrackResize,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.props.onVideoLoaded,toggleClipStatus:this.toggleClipStatus,addTime:this.addTime,updateCurrentTime:this.updateCurrentTime}),g.createElement(M,{key:(t=this.videoPlayer)==null?void 0:t.currentTime,result:l,currentTime:n,attributeList:this.props.config.attributeList,extraStyle:{top:this.props.drawLayerSlot?40:0}}),this.isClipping&&g.createElement("i",{className:_.clipping,style:{backgroundImage:U}}))},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(l=>l.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 u=P(s[i].result)[`step_${this.stepInfo().step}`],a=(u==null?void 0:u.result)||[],n=V(s[i].result||"[]");this.setState({result:a,loading:t,selectedID:"",textValue:"",selectedAttribute:"",clipStatus:d.Stop,valid:n},()=>{this.updateSidebar(),n||m.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(l=>l.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(l=>l.id===i);s&&(s.textAttribute=t,this.setState({result:[...e]}),this.updateSidebar())}},this.state={result:[],selectedAttribute:"",textValue:"",clipStatus:d.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===d.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 R.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 P((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 g.createElement(B,{value:{videoPlayer:this.videoPlayer,result:t,selectedID:r,attributeList:this.props.config.attributeList,clipStatus:e,selectedAttribute:i,contextToCancel:this.contextToCancel}},this.renderMediaContent())}}export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import h from"react";import{TagUtils as
|
|
1
|
+
import h from"react";import{TagUtils as m,CommonToolUtils as f,uuid as v}from"@labelbee/lb-annotation";import{jsonParser as g}from"../../../utils/index.js";import{VideoPlayer as y}from"../../videoPlayer/index.js";import{VideoTagLayer as L}from"../../videoPlayer/VideoTagLayer.js";import p,{cloneDeep as R}from"lodash";import{getKeyCodeNumber as b}from"../../videoPlayer/utils.js";class S extends h.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=R(s),{isMulti:a}=t,{key:r,value:d}=t.value;if(a){let o=(i=(n=l[r])==null?void 0:n.split(";"))!=null?i:[];o.includes(d)?o=o.filter(c=>c!==d):o.push(d);const u=new Set(o);return l[r]=Array.from(u).join(";"),p.pickBy(l,c=>c)}return l[r]=l[r]===d?void 0:d,p.pickBy(l,o=>o)},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=b(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=g(s[n].result),a=l[`step_${i.step}`],r=this.getInitResultList();this.setState({tagResult:a?a==null?void 0:a.result:r,valid:(l==null?void 0:l.valid)===void 0?!0:l.valid},()=>this.emitEvent("render"))},this.getInitResultList=()=>{var t;return m.getDefaultTagResult((t=this.config.inputList)!=null?t:[],[])},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var e;return g((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:[],a=(l==null?void 0:l.length)>1,r=t!==void 0?e:0,d=t!==void 0?t:e,o=a?l[r]:l[0],u=((i=o.subSelected)!=null?i:[])[d];if(o&&u)return{value:{key:o.value,value:u.value},isMulti:o.isMulti}}catch(l){return}}setLabelBySelectedList(e,t){var s,n,i,l,a,r;const d=this.getTagResultByCode(e,t);if(d){const o=this.combineResult(d,(n=(s=this.state.tagResult[0])==null?void 0:s.result)!=null?n:{}),u=[{sourceID:f.getSourceID(),id:(l=(i=this.currentTagResult)==null?void 0:i.id)!=null?l:v(8,62),result:o}];if(typeof((a=this.props)==null?void 0:a.annotationBefore)=="function"){(r=this.props)==null||r.annotationBefore(()=>this.setState({tagResult:u},()=>this.emitEvent("render")));return}this.setState({tagResult:u},()=>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:a,valid:r}=this.state;return h.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},h.createElement(y,{imgIndex:t,imgList:s,pageBackward:l,pageForward:n,pageJump:i,valid:r,setVideoRef:d=>{this.videoPlayer=d},dataLoaded:this.props.onVideoLoaded,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}),h.createElement(L,{result:a,inputList:(e=this.config)==null?void 0:e.inputList,hasPromptLayer:!!this.props.drawLayerSlot}))}}export{S as TagToolInstanceAdaptor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import p,{createContext as d,useContext as _,useState as y,useCallback as m,useMemo as v,useEffect as O}from"react";import{pick as P}from"lodash";var h=Object.defineProperty,c=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,s=(r,e,t)=>e in r?h(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,l=(r,e)=>{for(var t in e||(e={}))x.call(e,t)&&s(r,t,e[t]);if(c)for(var t of c(e))V.call(e,t)&&s(r,t,e[t]);return r};const w=["hiddenText"],i={hiddenText:!1},u=d({value:i,updateValue:()=>{}}),T=()=>_(u),b=r=>{const[e,t]=y(()=>l({},i)),a=m(o=>{t(n=>!o||typeof o=="object"&&Object.keys(o).length===0?n:l(l({},n),o))},[]),f=v(()=>({value:e,updateValue:a}),[e,a]);return O(()=>{const o=r.value;if(!o)return;const n=P(o,w);Object.keys(n).length!==0&&a(n)},[r.value,a]),p.createElement(u.Provider,{value:f},r.children)};export{u as ToolStyleContext,b as ToolStyleProvider,T as useToolStyleContext};
|
package/es/index.css
CHANGED
|
@@ -49,13 +49,19 @@
|
|
|
49
49
|
right: -5px;
|
|
50
50
|
top: -5px;
|
|
51
51
|
}
|
|
52
|
+
.index-module_rectRotateSensitivitySlider__tGjUn {
|
|
53
|
+
padding: 12px 20px;
|
|
54
|
+
}
|
|
55
|
+
.index-module_rectRotateSensitivitySlider__tGjUn .index-module_title__aAJW6 {
|
|
56
|
+
margin-bottom: 16px;
|
|
57
|
+
}
|
|
52
58
|
.index-module_container__RwV5P {
|
|
53
59
|
padding: 12px 20px;
|
|
54
60
|
}
|
|
55
61
|
.index-module_container__RwV5P .index-module_content__vHpS9 {
|
|
56
62
|
display: flex;
|
|
57
63
|
justify-content: space-between;
|
|
58
|
-
margin-top:
|
|
64
|
+
margin-top: 16px;
|
|
59
65
|
}
|
|
60
66
|
.index-module_latexEditor__0fK8G {
|
|
61
67
|
line-height: 32px;
|
|
@@ -132,6 +138,12 @@
|
|
|
132
138
|
.index-module_outputDisplay__5dS48 .index-module_content__Iml6l .markdown-body {
|
|
133
139
|
font-size: 14px;
|
|
134
140
|
}
|
|
141
|
+
|
|
142
|
+
.index-module_tip__NFru6 {
|
|
143
|
+
margin-bottom: 8px;
|
|
144
|
+
color: rgba(0, 0, 0, 0.45);
|
|
145
|
+
font-size: 14px;
|
|
146
|
+
}
|
|
135
147
|
.index-module_tagList__cvWor {
|
|
136
148
|
padding: 0px 16px 16px 16px;
|
|
137
149
|
}
|
|
@@ -720,6 +732,16 @@
|
|
|
720
732
|
font-family: SourceHanSansCN-Medium;
|
|
721
733
|
font-size: 14px;
|
|
722
734
|
}
|
|
735
|
+
.index-module_label__xE6hM .index-module_labelText__Zg1c4 {
|
|
736
|
+
display: flex;
|
|
737
|
+
overflow: hidden;
|
|
738
|
+
width: 60%;
|
|
739
|
+
align-items: center;
|
|
740
|
+
}
|
|
741
|
+
.index-module_label__xE6hM .index-module_labelText__Zg1c4 .index-module_titleText__BRM44 {
|
|
742
|
+
max-width: calc(100% - 20px);
|
|
743
|
+
overflow: hidden;
|
|
744
|
+
}
|
|
723
745
|
.index-module_label__xE6hM .index-module_required__iElYl::before {
|
|
724
746
|
display: inline-block;
|
|
725
747
|
margin-right: 4px;
|
|
@@ -732,6 +754,7 @@
|
|
|
732
754
|
.index-module_label__xE6hM .index-module_extra__PW5Qk {
|
|
733
755
|
float: right;
|
|
734
756
|
margin-right: 5px;
|
|
757
|
+
width: 40%;
|
|
735
758
|
}
|
|
736
759
|
|
|
737
760
|
.index-module_textareaContainer__dTIv4 {
|
|
@@ -862,6 +885,7 @@
|
|
|
862
885
|
flex-wrap: wrap;
|
|
863
886
|
align-items: center;
|
|
864
887
|
justify-content: center;
|
|
888
|
+
overflow: hidden;
|
|
865
889
|
}
|
|
866
890
|
.index-module_placeholderHotkey__0SKPo .text {
|
|
867
891
|
color: #333;
|
|
@@ -878,7 +902,10 @@
|
|
|
878
902
|
|
|
879
903
|
.index-module_attribute__g8Vbl {
|
|
880
904
|
height: 22px;
|
|
881
|
-
padding:
|
|
905
|
+
padding: 0px 8px;
|
|
906
|
+
width: max-content;
|
|
907
|
+
max-width: 100%;
|
|
908
|
+
margin-left: auto;
|
|
882
909
|
}
|
|
883
910
|
|
|
884
911
|
.index-module_clearIcon__ZBZqI {
|
|
@@ -1141,7 +1168,8 @@
|
|
|
1141
1168
|
}
|
|
1142
1169
|
.index-module_clipSidebar__z2E8x .index-module_attributeList__2wnCE {
|
|
1143
1170
|
flex: 1;
|
|
1144
|
-
overflow:
|
|
1171
|
+
overflow-x: hidden;
|
|
1172
|
+
overflow-y: auto;
|
|
1145
1173
|
}
|
|
1146
1174
|
.index-module_clipSidebar__z2E8x .index-module_attributeList__2wnCE .sensebee-radio-group,
|
|
1147
1175
|
.index-module_clipSidebar__z2E8x .index-module_attributeList__2wnCE .sensebee-radio-group-no-limit-height .ant-radio-group {
|
|
@@ -1489,6 +1517,7 @@
|
|
|
1489
1517
|
.bee-sidebar #style-width .ant-slider .ant-slider-track,
|
|
1490
1518
|
.bee-sidebar #style-color .ant-slider .ant-slider-track,
|
|
1491
1519
|
.bee-sidebar #style-fillOpacity .ant-slider .ant-slider-track,
|
|
1520
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider .ant-slider-track,
|
|
1492
1521
|
.bee-sidebar #style-borderOpacity .ant-slider .ant-slider-track {
|
|
1493
1522
|
background: #f5f5f5;
|
|
1494
1523
|
}
|
|
@@ -1498,6 +1527,7 @@
|
|
|
1498
1527
|
.bee-sidebar #style-width .ant-slider .ant-slider-dot,
|
|
1499
1528
|
.bee-sidebar #style-color .ant-slider .ant-slider-dot,
|
|
1500
1529
|
.bee-sidebar #style-fillOpacity .ant-slider .ant-slider-dot,
|
|
1530
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider .ant-slider-dot,
|
|
1501
1531
|
.bee-sidebar #style-borderOpacity .ant-slider .ant-slider-dot {
|
|
1502
1532
|
width: 0;
|
|
1503
1533
|
height: 0;
|
|
@@ -1509,6 +1539,7 @@
|
|
|
1509
1539
|
.bee-sidebar #style-width .ant-slider .ant-slider-handle,
|
|
1510
1540
|
.bee-sidebar #style-color .ant-slider .ant-slider-handle,
|
|
1511
1541
|
.bee-sidebar #style-fillOpacity .ant-slider .ant-slider-handle,
|
|
1542
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider .ant-slider-handle,
|
|
1512
1543
|
.bee-sidebar #style-borderOpacity .ant-slider .ant-slider-handle {
|
|
1513
1544
|
background-image: url("../dist/assets/icons/cc550fff.svg");
|
|
1514
1545
|
background-repeat: no-repeat;
|
|
@@ -1526,6 +1557,7 @@
|
|
|
1526
1557
|
.bee-sidebar #style-width .ant-slider .ant-slider-handle:focus,
|
|
1527
1558
|
.bee-sidebar #style-color .ant-slider .ant-slider-handle:focus,
|
|
1528
1559
|
.bee-sidebar #style-fillOpacity .ant-slider .ant-slider-handle:focus,
|
|
1560
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider .ant-slider-handle:focus,
|
|
1529
1561
|
.bee-sidebar #style-borderOpacity .ant-slider .ant-slider-handle:focus {
|
|
1530
1562
|
box-shadow: none;
|
|
1531
1563
|
}
|
|
@@ -1535,6 +1567,7 @@
|
|
|
1535
1567
|
.bee-sidebar #style-width .ant-slider .ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow,
|
|
1536
1568
|
.bee-sidebar #style-color .ant-slider .ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow,
|
|
1537
1569
|
.bee-sidebar #style-fillOpacity .ant-slider .ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow,
|
|
1570
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider .ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow,
|
|
1538
1571
|
.bee-sidebar #style-borderOpacity .ant-slider .ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow {
|
|
1539
1572
|
color: inherit;
|
|
1540
1573
|
font-style: normal;
|
|
@@ -1558,6 +1591,7 @@
|
|
|
1558
1591
|
.bee-sidebar #style-width .ant-slider .ant-collapse > .ant-collapse-item > .ant-collapse-header,
|
|
1559
1592
|
.bee-sidebar #style-color .ant-slider .ant-collapse > .ant-collapse-item > .ant-collapse-header,
|
|
1560
1593
|
.bee-sidebar #style-fillOpacity .ant-slider .ant-collapse > .ant-collapse-item > .ant-collapse-header,
|
|
1594
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider .ant-collapse > .ant-collapse-item > .ant-collapse-header,
|
|
1561
1595
|
.bee-sidebar #style-borderOpacity .ant-slider .ant-collapse > .ant-collapse-item > .ant-collapse-header {
|
|
1562
1596
|
position: relative;
|
|
1563
1597
|
color: rgba(0, 0, 0, 0.85);
|
|
@@ -1584,6 +1618,9 @@
|
|
|
1584
1618
|
.bee-sidebar #style-fillOpacity .ant-slider-rail,
|
|
1585
1619
|
.bee-sidebar #style-fillOpacity .ant-slider-track,
|
|
1586
1620
|
.bee-sidebar #style-fillOpacity .ant-slider-step,
|
|
1621
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider-rail,
|
|
1622
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider-track,
|
|
1623
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider-step,
|
|
1587
1624
|
.bee-sidebar #style-borderOpacity .ant-slider-rail,
|
|
1588
1625
|
.bee-sidebar #style-borderOpacity .ant-slider-track,
|
|
1589
1626
|
.bee-sidebar #style-borderOpacity .ant-slider-step {
|
|
@@ -1596,38 +1633,46 @@
|
|
|
1596
1633
|
.bee-sidebar #style-width .ant-slider .ant-slider-track,
|
|
1597
1634
|
.bee-sidebar #style-color .ant-slider .ant-slider-track,
|
|
1598
1635
|
.bee-sidebar #style-fillOpacity .ant-slider .ant-slider-track,
|
|
1636
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider .ant-slider-track,
|
|
1599
1637
|
.bee-sidebar #style-borderOpacity .ant-slider .ant-slider-track {
|
|
1600
1638
|
background: none;
|
|
1601
1639
|
}
|
|
1602
1640
|
.bee-sidebar #style-radius .ant-slider-step .ant-slider-dot,
|
|
1603
|
-
.bee-sidebar #style-width .ant-slider-step .ant-slider-dot
|
|
1641
|
+
.bee-sidebar #style-width .ant-slider-step .ant-slider-dot,
|
|
1642
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider-step .ant-slider-dot {
|
|
1604
1643
|
height: 12px;
|
|
1605
1644
|
background: #666666;
|
|
1606
1645
|
border-radius: 0;
|
|
1607
1646
|
margin-left: -2px;
|
|
1608
1647
|
}
|
|
1609
1648
|
.bee-sidebar #style-radius .ant-slider-step .ant-slider-dot:nth-of-type(1),
|
|
1610
|
-
.bee-sidebar #style-width .ant-slider-step .ant-slider-dot:nth-of-type(1)
|
|
1649
|
+
.bee-sidebar #style-width .ant-slider-step .ant-slider-dot:nth-of-type(1),
|
|
1650
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider-step .ant-slider-dot:nth-of-type(1) {
|
|
1611
1651
|
width: 1px;
|
|
1612
1652
|
}
|
|
1613
1653
|
.bee-sidebar #style-radius .ant-slider-step .ant-slider-dot:nth-of-type(2),
|
|
1614
|
-
.bee-sidebar #style-width .ant-slider-step .ant-slider-dot:nth-of-type(2)
|
|
1654
|
+
.bee-sidebar #style-width .ant-slider-step .ant-slider-dot:nth-of-type(2),
|
|
1655
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider-step .ant-slider-dot:nth-of-type(2) {
|
|
1615
1656
|
width: 2px;
|
|
1616
1657
|
}
|
|
1617
1658
|
.bee-sidebar #style-radius .ant-slider-step .ant-slider-dot:nth-of-type(3),
|
|
1618
|
-
.bee-sidebar #style-width .ant-slider-step .ant-slider-dot:nth-of-type(3)
|
|
1659
|
+
.bee-sidebar #style-width .ant-slider-step .ant-slider-dot:nth-of-type(3),
|
|
1660
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider-step .ant-slider-dot:nth-of-type(3) {
|
|
1619
1661
|
width: 3px;
|
|
1620
1662
|
}
|
|
1621
1663
|
.bee-sidebar #style-radius .ant-slider-step .ant-slider-dot:nth-of-type(4),
|
|
1622
|
-
.bee-sidebar #style-width .ant-slider-step .ant-slider-dot:nth-of-type(4)
|
|
1664
|
+
.bee-sidebar #style-width .ant-slider-step .ant-slider-dot:nth-of-type(4),
|
|
1665
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider-step .ant-slider-dot:nth-of-type(4) {
|
|
1623
1666
|
width: 4px;
|
|
1624
1667
|
}
|
|
1625
1668
|
.bee-sidebar #style-radius .ant-slider-step .ant-slider-dot:nth-of-type(5),
|
|
1626
|
-
.bee-sidebar #style-width .ant-slider-step .ant-slider-dot:nth-of-type(5)
|
|
1669
|
+
.bee-sidebar #style-width .ant-slider-step .ant-slider-dot:nth-of-type(5),
|
|
1670
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider-step .ant-slider-dot:nth-of-type(5) {
|
|
1627
1671
|
width: 5px;
|
|
1628
1672
|
}
|
|
1629
1673
|
.bee-sidebar #style-radius .ant-slider:hover .ant-slider-rail,
|
|
1630
|
-
.bee-sidebar #style-width .ant-slider:hover .ant-slider-rail
|
|
1674
|
+
.bee-sidebar #style-width .ant-slider:hover .ant-slider-rail,
|
|
1675
|
+
.bee-sidebar #style-rectRotateSensitivity .ant-slider:hover .ant-slider-rail {
|
|
1631
1676
|
background: #f5f5f5;
|
|
1632
1677
|
}
|
|
1633
1678
|
.bee-sidebar #style-color .ant-slider-rail {
|
|
@@ -2494,14 +2539,14 @@
|
|
|
2494
2539
|
margin-right: 16px;
|
|
2495
2540
|
background-image: url("../dist/assets/icons/7eadb9c4.svg");
|
|
2496
2541
|
}
|
|
2497
|
-
.bee-point-cloud-wrapper .bee-point-cloud-container__header-toolbar .bee-point-cloud__rotate-
|
|
2542
|
+
.bee-point-cloud-wrapper .bee-point-cloud-container__header-toolbar .bee-point-cloud__rotate-90 {
|
|
2498
2543
|
display: inline-block;
|
|
2499
2544
|
height: 24px;
|
|
2500
2545
|
width: 24px;
|
|
2501
2546
|
background-repeat: no-repeat;
|
|
2502
2547
|
cursor: pointer;
|
|
2503
2548
|
flex: none;
|
|
2504
|
-
background-image: url("../dist/assets/icons/
|
|
2549
|
+
background-image: url("../dist/assets/icons/ad33251.svg");
|
|
2505
2550
|
}
|
|
2506
2551
|
.bee-point-cloud-wrapper .bee-point-cloud-container__header-toolbar .bee-point-cloud__next {
|
|
2507
2552
|
font-size: 24px;
|
|
@@ -3080,15 +3125,12 @@
|
|
|
3080
3125
|
display: block;
|
|
3081
3126
|
}
|
|
3082
3127
|
.bee-sidebar__content__NLPList__item__text {
|
|
3083
|
-
flex: 1 1;
|
|
3084
|
-
padding: 16px;
|
|
3085
3128
|
font-weight: 400;
|
|
3086
3129
|
font-size: 12px;
|
|
3087
3130
|
line-height: 20px;
|
|
3088
3131
|
color: #666666;
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
white-space: nowrap;
|
|
3132
|
+
padding: 16px;
|
|
3133
|
+
width: 100%;
|
|
3092
3134
|
}
|
|
3093
3135
|
.bee-sidebar__content__NLPList__item__active {
|
|
3094
3136
|
background-color: #eeefff;
|
package/es/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";export{default as QuestionView}from"./components/LLMToolView/questionView/index.js";export{default as TextContent}from"./components/NLPToolView/textContent/index.js";import{i18n as
|
|
1
|
+
export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";export{default as QuestionView}from"./components/LLMToolView/questionView/index.js";export{default as TextContent}from"./components/NLPToolView/textContent/index.js";import{i18n as s}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import n,{useState as c,useImperativeHandle as m}from"react";import{initReactI18next as u,I18nextProvider as f}from"react-i18next";import{Provider as x}from"react-redux";import w from"./App.js";import P from"./configureStore.js";import{PageBackward as v,PageForward as T,PageJump as j}from"./store/annotation/actionCreators.js";export{VideoTagTool}from"./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js";import{PointCloudProvider as S}from"./components/pointCloudView/PointCloudContext.js";import{LabelBeeContext as b}from"./store/ctx.js";export{default as PredictTracking}from"./components/predictTracking/predictTrackingIcon/index.js";export{default as LLMToolView}from"./components/LLMToolView/index.js";export{default as SwitchCuboidBoxIn2DView,SwitchCuboidBoxIn2DViewStateMode}from"./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js";export{default as BatchSwitchConnectIn2DView}from"./views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js";export{default as MeasureCanvas}from"./components/measureCanvas/index.js";export{default as AnnotatedBox}from"./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js";export{default as RectRotateSensitivitySlider}from"./views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js";export{FindTrackIDIndexInCheckMode as FindTrackIDIndex}from"./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js";export{WrapAudioPlayer as AudioPlayer}from"./components/audioPlayer/index.js";export{generatePointCloudBoxRects}from"./utils/index.js";export{default as SubAttributeList}from"./components/subAttributeList/index.js";import{ToolStyleProvider as I}from"./hooks/useToolStyle.js";export{EDataFormatType,ELLMDataType,EStepType,ESubmitType,componentCls,prefix}from"./constant/index.js";var V=Object.defineProperty,g=Object.defineProperties,C=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,l=(o,e,t)=>e in o?V(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,h=(o,e)=>{for(var t in e||(e={}))_.call(e,t)&&l(o,t,e[t]);if(d)for(var t of d(e))y.call(e,t)&&l(o,t,e[t]);return o},A=(o,e)=>g(o,C(e));const r=P();s.use(u),s.options.react={useSuspense:!1};const B=(o,e)=>{const[t,p]=c();return m(e,()=>({toolInstance:t,annotationEngine:r.getState().annotation.annotationEngine,pageBackwardActions:()=>r.dispatch(v()),pageForwardActions:()=>r.dispatch(T()),pageJump:a=>{const i=~~a-1;r.dispatch(j(i))},hello:()=>alert("hello labelBee!!!")}),[t]),n.createElement(x,{store:r,context:b},n.createElement(f,{i18n:s},n.createElement(I,{value:o.toolStyle},n.createElement(S,null,n.createElement(w,A(h({},o),{setToolInstance:a=>{var i;p(a),(i=o.onLoad)==null||i.call(o,{toolInstance:a})}}))))))};var D=n.forwardRef(B);export{D as default,r as store};
|
package/es/store/Actions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const T={INIT_ALL_STATE:"@@INIT_ALL_STATE",UPDATE_TOOL_INSTANCE:"@@UPDATE_TOOL_INSTANCE",UPDATE_IMG_LIST:"@@UPDATE_IMG_LIST",UPDATE_ANNOTATION_CONFIG:"@@UPDATE_ANNOTATION_CONFIG",LOAD_FILE_DATA:"@@LOAD_FILE_DATA",SUBMIT_FILE_DATA:"@@SUBMIT_FILE_DATA",SET_TASK_CONFIG:"@@SET_TASK_CONFIG",INIT_TOOL:"@@INIT_TOOL",SET_TOOL:"@@SET_TOOL",UPDATE_ON_SUBMIT:"@@UPDATE_ON_SUBMIT",UPDATE_ON_SAVE:"@@UPDATE_ON_SAVE",UPDATE_ON_PAGE_CHANGE:"@@UPDATE_ON_PAGE_CHANGE",UPDATE_ON_STEP_CHANGE:"@@UPDATE_ON_STEP_CHANGE",UPDATE_ROTATE:"@@UPDATE_ROTATE",UPDATE_GET_FILE_DATA:"@@UPDATE_GET_FILE_DATA",UPDATE_PAGE_SIZE:"@@UPDATE_PAGE_SIZE",UPDATE_LOAD_FILE_LIST:"@@UPDATE_LOAD_FILE_LIST",GET_FILE_DATA:"@@GET_FILE_DATA",SET_FILE_DATA:"@@SET_FILE_DATA",COPY_BACKWARD_RESULT:"@@COPY_BACKWARD_RESULT",SET_STEP:"@@SET_STEP",SUBMIT_RESULT:"@@SUBMIT_RESULT",SAVE_RESULT:"@@SAVE_RESULT",SET_BASIC_INDEX:"@@SET_BASIC_INDEX",CALC_STEP_PROGRESS:"@@CALC_STEP_PROGRESS",SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:"@@SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED",SKIP_BEFORE_PAGE_TURNING:"@@SKIP_BEFORE_PAGE_TURNING",UPDATE_BEFORE_ROTATE:"@@UPDATE_BEFORE_ROTATE",SET_LOADING:"@@SET_LOADING",SET_LOADPCDFILE_LOADING:"@@SET_LOADPCDFILE_LOADING",SET_POINT_CLOUD_LOADING:"@@SET_POINT_CLOUD_LOADING",SET_CHECK_MODE:"@@SET_CHECK_MODE",SET_TASK_STEP_LIST:"@@SET_TASK_STEP_LIST",UPDATE_ANNOTATION_VALID:"@@UPDATE_ANNOTATION_VALID",BATCH_UPDATE_TRACK_ID:"@@BATCH_UPDATE_TRACK_ID",BATCH_UPDATE_RESULT_BY_TRACK_ID:"@@BATCH_UPDATE_RESULT_BY_TRACK_ID",BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:"@@BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT",SET_PREDICT_RESULT_VISIBLE:"@@SET_PREDICT_RESULT_VISIBLE",SET_PREDICT_RESULT:"@@SET_PREDICT_RESULT",SET_HIGHLIGHT_ATTRIBUTE:"@@SET_HIGHLIGHT_ATTRIBUTE",UPDATE_PRE_DATA_PROCESS:"@@UPDATE_PRE_DATA_PROCESS"},_={UPDATE_IMG_ATTRIBUTE:"@@UPDATE_IMG_ATTRIBUTE",INIT_IMG_ATTRIBUTE:"@@INIT_IMG_ATTRIBUTE"},E={INIT_TOOL_STYLE_CONFIG:"@@INIT_TOOL_STYLE_CONFIG",UPDATE_TOOL_STYLE_CONFIG:"@@UPDATE_TOOL_STYLE_CONFIG"};export{T as ANNOTATION_ACTIONS,_ as IMAGE_ATTRIBUTE_ACTIONS,E as TOOL_STYLE_ACTIONS};
|
|
1
|
+
const T={INIT_ALL_STATE:"@@INIT_ALL_STATE",UPDATE_TOOL_INSTANCE:"@@UPDATE_TOOL_INSTANCE",UPDATE_IMG_LIST:"@@UPDATE_IMG_LIST",UPDATE_ANNOTATION_CONFIG:"@@UPDATE_ANNOTATION_CONFIG",LOAD_FILE_DATA:"@@LOAD_FILE_DATA",SUBMIT_FILE_DATA:"@@SUBMIT_FILE_DATA",SET_TASK_CONFIG:"@@SET_TASK_CONFIG",INIT_TOOL:"@@INIT_TOOL",SET_TOOL:"@@SET_TOOL",UPDATE_ON_SUBMIT:"@@UPDATE_ON_SUBMIT",UPDATE_ON_SAVE:"@@UPDATE_ON_SAVE",UPDATE_ON_PAGE_CHANGE:"@@UPDATE_ON_PAGE_CHANGE",UPDATE_ON_STEP_CHANGE:"@@UPDATE_ON_STEP_CHANGE",UPDATE_ROTATE:"@@UPDATE_ROTATE",UPDATE_GET_FILE_DATA:"@@UPDATE_GET_FILE_DATA",UPDATE_PAGE_SIZE:"@@UPDATE_PAGE_SIZE",UPDATE_LOAD_FILE_LIST:"@@UPDATE_LOAD_FILE_LIST",GET_FILE_DATA:"@@GET_FILE_DATA",SET_FILE_DATA:"@@SET_FILE_DATA",COPY_BACKWARD_RESULT:"@@COPY_BACKWARD_RESULT",SET_STEP:"@@SET_STEP",SUBMIT_RESULT:"@@SUBMIT_RESULT",SAVE_RESULT:"@@SAVE_RESULT",SET_BASIC_INDEX:"@@SET_BASIC_INDEX",CALC_STEP_PROGRESS:"@@CALC_STEP_PROGRESS",SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:"@@SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED",SKIP_BEFORE_PAGE_TURNING:"@@SKIP_BEFORE_PAGE_TURNING",UPDATE_BEFORE_ROTATE:"@@UPDATE_BEFORE_ROTATE",SET_LOADING:"@@SET_LOADING",SET_LOADPCDFILE_LOADING:"@@SET_LOADPCDFILE_LOADING",SET_POINT_CLOUD_LOADING:"@@SET_POINT_CLOUD_LOADING",SET_CHECK_MODE:"@@SET_CHECK_MODE",SET_TASK_STEP_LIST:"@@SET_TASK_STEP_LIST",UPDATE_ANNOTATION_VALID:"@@UPDATE_ANNOTATION_VALID",BATCH_UPDATE_TRACK_ID:"@@BATCH_UPDATE_TRACK_ID",BATCH_UPDATE_RESULT_BY_TRACK_ID:"@@BATCH_UPDATE_RESULT_BY_TRACK_ID",BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:"@@BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT",SET_PREDICT_RESULT_VISIBLE:"@@SET_PREDICT_RESULT_VISIBLE",SET_PREDICT_RESULT:"@@SET_PREDICT_RESULT",SET_HIGHLIGHT_ATTRIBUTE:"@@SET_HIGHLIGHT_ATTRIBUTE",UPDATE_PRE_DATA_PROCESS:"@@UPDATE_PRE_DATA_PROCESS",UPDATE_IMG_INDEX_BY_EXTERNAL:"@@UPDATE_IMG_INDEX_BY_EXTERNAL"},_={UPDATE_IMG_ATTRIBUTE:"@@UPDATE_IMG_ATTRIBUTE",INIT_IMG_ATTRIBUTE:"@@INIT_IMG_ATTRIBUTE"},E={INIT_TOOL_STYLE_CONFIG:"@@INIT_TOOL_STYLE_CONFIG",UPDATE_TOOL_STYLE_CONFIG:"@@UPDATE_TOOL_STYLE_CONFIG"};export{T as ANNOTATION_ACTIONS,_ as IMAGE_ATTRIBUTE_ACTIONS,E as TOOL_STYLE_ACTIONS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{create as
|
|
1
|
+
import{create as i}from"zustand";const o=i(e=>({ptCtx:{},pointCloudBoxList:[],setPointCloudBoxList:t=>e(s=>({pointCloudBoxList:t})),highlightIDs:[],setHighlightIDs:t=>e(s=>({highlightIDs:t})),selectedIDs:[],setSelectedIDs:t=>e(s=>({selectedIDs:t})),rectRotateSensitivity:2,setRectRotateSensitivity:t=>e(s=>({rectRotateSensitivity:t})),setPtCtx:t=>e(s=>({ptCtx:t}))}));export{o as default};
|