@labelbee/lb-components 1.23.0-alpha.71 → 1.23.0-alpha.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/dist/components/DynamicResizer/DynamicResizer.js +1 -0
  2. package/dist/components/DynamicResizer/assets/bottomToZero.svg.js +1 -0
  3. package/dist/components/DynamicResizer/assets/topToZero.svg.js +1 -0
  4. package/dist/components/DynamicResizer/hooks/useDrag.js +1 -0
  5. package/dist/components/DynamicResizer/hooks/useUpdateHeight.js +1 -0
  6. package/dist/components/DynamicResizer/index.js +1 -0
  7. package/dist/components/pointCloudView/PointCloudContext.js +1 -1
  8. package/dist/index.css +71 -0
  9. package/dist/types/components/DynamicResizer/DynamicResizer.d.ts +5 -0
  10. package/dist/types/components/DynamicResizer/hooks/useDrag.d.ts +12 -0
  11. package/dist/types/components/DynamicResizer/hooks/useUpdateHeight.d.ts +23 -0
  12. package/dist/types/components/DynamicResizer/index.d.ts +2 -0
  13. package/dist/types/components/DynamicResizer/types/interface.d.ts +16 -0
  14. package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  15. package/es/components/DynamicResizer/DynamicResizer.js +1 -0
  16. package/es/components/DynamicResizer/assets/bottomToZero.svg.js +1 -0
  17. package/es/components/DynamicResizer/assets/topToZero.svg.js +1 -0
  18. package/es/components/DynamicResizer/hooks/useDrag.js +1 -0
  19. package/es/components/DynamicResizer/hooks/useUpdateHeight.js +1 -0
  20. package/es/components/DynamicResizer/index.js +1 -0
  21. package/es/components/pointCloudView/PointCloudContext.js +1 -1
  22. package/es/index.css +71 -0
  23. package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  24. package/package.json +2 -1
@@ -0,0 +1 @@
1
+ "use strict";var React=require("react"),useDrag=require("./hooks/useDrag.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const DynamicResizer=e=>{const{minTopHeight:r=0,minBottomHeight:i=0,defaultHeight:s=50,axis:c="y",children:t,localKey:n="dynamicResizerHeights",customDivider:o}=e,a=React.useRef(null),{rendered:l,topStyle:u,bottomStyle:d}=useDrag({containerRef:a,minTopHeight:r,minBottomHeight:i,defaultHeight:s,axis:c,localKey:n,customDivider:o});return React__default.default.createElement("div",{className:"dynamic-resizer-content",ref:a},React__default.default.createElement("div",{className:"dynamic-resizer-top",style:u},t[0]),l,React__default.default.createElement("div",{className:"dynamic-resizer-bottom",style:d},t[1]))};module.exports=DynamicResizer;
@@ -0,0 +1 @@
1
+ "use strict";require("react");var img="data:image/svg+xml,%3csvg t='1720421473527' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='5364' width='200' height='200'%3e %3cpath d='M94.8 304.5L512 721.8l416-416-833.2-1.3z m0 0' p-id='5365'%3e%3c/path%3e%3c/svg%3e";module.exports=img;
@@ -0,0 +1 @@
1
+ "use strict";require("react");var img="data:image/svg+xml,%3csvg t='1720421409111' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='5202' width='200' height='200'%3e %3cpath d='M928 721.8L510.8 304.5l-416 416 833.2 1.3z m0 0' p-id='5203'%3e%3c/path%3e%3c/svg%3e";module.exports=img;
@@ -0,0 +1 @@
1
+ "use strict";var React=require("react"),Draggable1=require("react-draggable"),ahooks=require("ahooks"),useUpdateHeight=require("./useUpdateHeight.js"),topToZero=require("../assets/topToZero.svg.js"),bottomToZero=require("../assets/bottomToZero.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),Draggable1__default=_interopDefaultLegacy(Draggable1);const Draggable=Draggable1__default.default,useDrag=({containerRef:e,minTopHeight:g=0,minBottomHeight:n=0,defaultHeight:p=50,axis:a,localKey:m})=>{const r=m||"dynamicResizerHeights",{topHeight:o,position:s,bounds:l,topStyle:v,bottomStyle:b,updateELHeight:c,setTopHeightToZero:h,setBottomHeightToZero:f}=useUpdateHeight(e,g,n,p,r),[D,d]=ahooks.useLocalStorageState(r),H=React.useCallback(()=>{e.current&&e.current.classList.add("hide-scrollbar")},[e]),i=React.useCallback((t,T)=>{t.stopPropagation(),c(T.y)},[c]),u=React.useCallback(t=>{t.stopPropagation(),e.current&&e.current.classList.remove("hide-scrollbar"),d(o)},[e,d,o]);return{rendered:React.useMemo(()=>{const t=React__default.default.createElement("div",{className:"divider"},React__default.default.createElement("img",{src:topToZero,className:"divider-top",draggable:"false",onClick:h}),React__default.default.createElement("div",{className:"divider-icon",draggable:"false"}),React__default.default.createElement("img",{src:bottomToZero,className:"divider-bottom",draggable:"false",onClick:f}));return React__default.default.createElement(Draggable,{axis:a,position:s,handle:".divider",onStart:H,onDrag:i,onStop:u,bounds:l},t)},[a,s,i,u,l]),topStyle:v,bottomStyle:b}};module.exports=useDrag;
@@ -0,0 +1 @@
1
+ "use strict";var React=require("react"),ahooks=require("ahooks");const useUpdateHeight=(e,r,H,p,v)=>{const[i,d]=React.useState(0),[g,f]=React.useState(0),[u,M]=React.useState(0),[h,T]=React.useState(0),[b,a]=ahooks.useLocalStorageState(v);React.useEffect(()=>{L();const t=b;let o=0;t!=null?o=isNaN(Number(t))?0:Number(t):o=i||p,l(o)},[]);const S=React.useMemo(()=>({x:0,y:i}),[i]),_=React.useMemo(()=>{var t;return{top:u,bottom:(((t=e.current)==null?void 0:t.offsetHeight)||0)-h}},[i,e]),x=React.useMemo(()=>({height:i+"px"}),[i]),B=React.useMemo(()=>({height:g+"px"}),[g]),L=()=>{var t,o,s,c;if(e){let n=r,m=H;r>=(((t=e.current)==null?void 0:t.offsetHeight)||0)/2&&(n=(((o=e.current)==null?void 0:o.offsetHeight)||0)/2),H>=(((s=e.current)==null?void 0:s.offsetHeight)||0)/2&&(m=(((c=e.current)==null?void 0:c.offsetHeight)||0)/2),M(n||1e-5),T(m)}},l=React.useCallback(t=>{var o;if(e){const s=((o=e==null?void 0:e.current)==null?void 0:o.offsetHeight)||0,c=s-h;t>=u&&t<=c&&(d(t),f(s-t))}},[e,u,h]);return{topHeight:i,bottomHeight:g,position:S,bounds:_,topStyle:x,bottomStyle:B,updateELHeight:l,setBottomHeightToZero:()=>{var t;if(e){const o=((t=e==null?void 0:e.current)==null?void 0:t.offsetHeight)||0;l(o-h||0),a(o-h||0)}},setTopHeightToZero:()=>{e&&(l(u||0),a(u||0))}}};module.exports=useUpdateHeight;
@@ -0,0 +1 @@
1
+ "use strict";var DynamicResizer=require("./DynamicResizer.js");module.exports=DynamicResizer;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),ToolPointCloudBoxRenderHelper=require("../../utils/ToolPointCloudBoxRenderHelper.js"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../store/annotatedBox/index.js"),_=require("lodash"),map=require("./utils/map.js"),useTimeoutFunc=require("./hooks/useTimeoutFunc.js"),useWindowKeydownListener=require("./hooks/useWindowKeydownListener.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(l,n,d)=>n in l?__defProp(l,n,{enumerable:!0,configurable:!0,writable:!0,value:d}):l[n]=d,__spreadValues=(l,n)=>{for(var d in n||(n={}))__hasOwnProp.call(n,d)&&__defNormalProp(l,d,n[d]);if(__getOwnPropSymbols)for(var d of __getOwnPropSymbols(n))__propIsEnum.call(n,d)&&__defNormalProp(l,d,n[d]);return l},__spreadProps=(l,n)=>__defProps(l,__getOwnPropDescs(n)),__async=(l,n,d)=>new Promise((S,y)=>{var R=c=>{try{f(d.next(c))}catch(b){y(b)}},N=c=>{try{f(d.throw(c))}catch(b){y(b)}},f=c=>c.done?S(c.value):Promise.resolve(c.value).then(R,N);f((d=d.apply(l,n)).next())});const pickRectObject=l=>___default.default.pick(l,["id","attribute","width","height","x","y","imageName"]),PointCloudContext=React__default.default.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:l=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:l=>!1,removeRectBySpecifyId:(l,n,d)=>!1,removeRectByPointCloudBoxId:l=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:useWindowKeydownListener.getEmptyUseWindowKeydownListener()}),PointCloudProvider=({children:l})=>{const[n,d]=React.useState([]),[S,y]=React.useState([]),[R,N]=React.useState([]),[f,c]=React.useState([]),[b,me]=React.useState([]),[h,D]=React.useState([]),[w,H]=React.useState([]),[W,ve]=React.useState(!0),[K,Ce]=React.useState(2),[G,Ie]=React.useState(!0),[U,Pe]=React.useState(1),[u,Z]=React.useState(),[J,Q]=React.useState(),[X,Y]=React.useState(),[a,$]=React.useState(),[ee,Se]=React.useState(""),[A,be]=React.useState(lbAnnotation.EToolName.Rect),B=React.useRef(new lbAnnotation.ActionsHistory).current,[g,O]=React.useState([]),[te,we]=React.useState(""),[k,ye]=React.useState(lbUtils.EPointCloudPattern.Detection),[P,oe]=React.useState(void 0),[E,Re]=React.useState([]),[j,xe]=React.useState([]),[ne,Le]=React.useState(!1),p=index(),[ie,De]=React.useState({}),Ae=ctx.useDispatch(),Be=e=>{const{imgNode:t,path:o}=e;o&&t&&De(i=>__spreadProps(__spreadValues({},i),{[o]:{width:t.width,height:t.height}}))},q=React.useMemo(()=>h.length===1?h[0]:"",[h]),se=useWindowKeydownListener.default(),V=React.useCallback((e,t,o="extId")=>{const i=o||"id",s=new Set(t);return c(r=>{let C=!1;const m=r.filter(L=>{const I=L[i],v=s.has(I)?L.imageName!==e:!0;return v||(C=!0),v});return C?m:r}),!0},[]),le=React.useCallback(e=>{const t=n.map(o=>o.id);return V(e,t,"extId")},[n,V]),re=React.useCallback(e=>{if(!e)return!1;const t=n.filter(o=>Array.isArray(o.rects)).map(o=>{const{id:i,attribute:s,trackID:r}=o,C=o.rects.find(m=>m.imageName===e);if(C){const m=___default.default.pick(C,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},m),{id:lbAnnotation.uuid(),attribute:s,order:r,extId:i,lineDash:[]})}return null}).filter(o=>o!==null);return t.length?(c(o=>{const i=new Set(o.filter(r=>e===r.imageName).map(r=>r.extId)),s=t.filter(r=>i.has(r.extId)===!1);return s.length?[...o,...s]:o}),!0):!1},[n]),ae=React.useMemo(()=>n.filter(t=>Array.isArray(t.rects)&&t.rects.length>0).reduce((t,o)=>{var i;return(i=o.rects)==null||i.forEach(s=>{const{imageName:r}=s;if(!r){console.warn("Missing image name"),console.trace(s,o);return}map.addMapIndirectWeakSetItem(t,r,o.id,o)}),t},new Map),[n]),de=React.useCallback(e=>{c(t=>e(t,pickRectObject))},[pickRectObject]),ue=React.useMemo(()=>f.filter(e=>e.extId!==void 0&&e.id!==void 0).reduce((e,t)=>{const o=t.imageName;return o?(map.addMapIndirectWeakSetItem(e,o,t.extId,t),e):(console.warn("missing image name"),console.log(t,f),e)},new Map),[f]),{fn:_e}=useTimeoutFunc.default(e=>{D(t=>{const o=e,i=new Set(o);let s=!1;const r=t.filter(C=>{const m=i.has(C);return m||(s=!0),m});return s?r:t})},200),ce=React.useCallback(e=>{const t=e.map(o=>o.id);d(e),_e(t)},[]),ge=React.useMemo(()=>n.find(e=>e.id===q),[n,q]),F=React.useMemo(()=>n.filter(e=>!g.includes(e.attribute)),[n,g]),T=React.useMemo(()=>S.filter(e=>!g.includes(e.attribute)),[S,g]),z=React.useMemo(()=>b.filter(e=>e.attribute&&!g.includes(e.attribute)),[b,g]),ke=React.useCallback(e=>{const t=n.concat(e);return ce(t),t},[n]),Ve=React.useCallback(e=>{const t=S.concat(e);return y(t),t},[S]),Me=React.useCallback(e=>{ve(e!==!1)},[]),x=React.useCallback(e=>{e===void 0&&D([]),typeof e=="string"&&D([e]),Array.isArray(e)&&D(Array.from(new Set(e)))},[]),Ne=React.useCallback(e=>{h.includes(e)?x(h.filter(t=>t!==e)):x([...h,e])},[h]),He=React.useCallback(e=>{const t=pickRectObject(e);c(o=>[...o,t])},[f]),Oe=React.useCallback((e,t=!1)=>{const o=pickRectObject(e);c(i=>i.map(s=>s.id===e.id?t?__spreadValues(__spreadValues({},s),o):o:s))},[f]),Ee=React.useCallback(e=>{c(t=>t.filter(o=>!e.find(i=>i.id===o.id)))},[f]),je=React.useCallback(e=>{w.includes(e)?H([]):H([e])},[w]),qe=React.useCallback(()=>{if(A===lbAnnotation.EToolName.Rect){const e=n.map(t=>t.id);x(e),u==null||u.pointCloud2dOperation.setSelectedIDs(e)}},[A,n,u,u==null?void 0:u.pointCloud2dOperation]),Fe=React.useCallback(e=>{x(n.filter(t=>t.attribute===e).map(t=>t.id))},[n]),Te=React.useCallback(e=>{if(g.includes(e))O(g.filter(t=>t!==e));else{const t=g.concat(e);O(t)}},[g]),ze=React.useCallback((e=F,t=R,o=T,i=z,s=E)=>{var r;a==null||a.clearAllBox(),a==null||a.clearAllSphere(),u==null||u.updatePolygonList(e,t),u==null||u.updatePointList(o),u==null||u.updateLineList(i),a==null||a.generateBoxes(e),a==null||a.generateSpheres(o),(r=P==null?void 0:P.store)==null||r.updateCurrentSegment(s),fe(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,e)},[a,u,P,P==null?void 0:P.store]),We=React.useCallback(()=>{Z(void 0),Q(void 0),Y(void 0),$(void 0)},[]),fe=React.useCallback((e,t,o)=>__async(void 0,null,function*(){var i,s,r;if(!a)return;const C=a.pointCloudObject;if(!C)return;let m=[],L=[];try{if(t&&B.record.length){const{record:I,recordIndex:v}=B;let pe=v;v>0&&(e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleToggleValid||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleRotate||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single&&t.length===((i=I[v])==null?void 0:i.pointCloudBoxList.length))&&(pe=v-1);let Ue=(s=I[pe])==null?void 0:s.pointCloudBoxList;const he=ToolPointCloudBoxRenderHelper.calcResetAreasAndBoxIds(e,t,Ue);m=he.modifiedBoxIds,L=he.resetAreas}}catch(I){console.error("call calcResetAreasAndBoxIds error",I)}try{const I=yield a.getHighlightIndexByMappingImgList({mappingImgList:o!=null?o:j,points:C.geometry.attributes.position.array}),v=yield a==null?void 0:a.highlightOriginPointCloud(t,I,{modifiedBoxIds:m,resetAreas:L});return v&&((r=u==null?void 0:u.pointCloudInstance)==null||r.updateColor(v)),v}catch(I){console.error("call highlightOriginPointCloud error",I)}}),[a,a==null?void 0:a.pointCloudObject,B]),Ke=React.useCallback(e=>{k!==e&&(Ae(actionCreators.ChangeSave),ye(e),e===lbUtils.EPointCloudPattern.Detection&&oe(void 0))},[k]),M=React.useMemo(()=>({selectedID:q,pointCloudBoxList:n,pointCloudSphereList:S,displayPointCloudList:F,displaySphereList:T,displayLineList:z,selectedIDs:h,setPointCloudResult:ce,setSelectedIDs:x,addPointCloudBox:ke,addPointCloudSphere:Ve,setPointCloudSphereList:y,valid:W,selectedPointCloudBox:ge,setPointCloudValid:Me,addSelectedID:Ne,addHighlightID:je,selectedAllBoxes:qe,topViewInstance:u,setTopViewInstance:Z,sideViewInstance:J,setSideViewInstance:Q,backViewInstance:X,setBackViewInstance:Y,mainViewInstance:a,setMainViewInstance:$,polygonList:R,setPolygonList:N,rectList:f,setRectList:c,addRectIn2DView:He,removeRectIn2DView:Ee,updateRectIn2DView:Oe,lineList:b,setLineList:me,zoom:U,setZoom:Pe,history:B,toggleAttributesVisible:Te,hideAttributes:g,setHideAttributes:O,reRender:ze,attrPanelLayout:te,setAttrPanelLayout:we,syncAllViewPointCloudColor:fe,defaultAttribute:ee,setDefaultAttribute:Se,pointCloudPattern:A,setPointCloudPattern:be,selectSpecAttr:Fe,globalPattern:k,setGlobalPattern:Ke,ptSegmentInstance:P,setPtSegmentInstance:oe,segmentation:E,setSegmentation:Re,clearAllDetectionInstance:We,highlight2DDataList:j,setHighlight2DDataList:xe,highlight2DLoading:ne,setHighlight2DLoading:Le,cuboidBoxIn2DView:G,setCuboidBoxIn2DView:Ie,imageSizes:ie,cacheImageNodeSize:Be,highlightIDs:w,setHighlightIDs:H,removeRectByPointCloudBoxId:le,removeRectBySpecifyId:V,addRectFromPointCloudBoxByImageName:re,rectRotateSensitivity:K,setRectRotateSensitivity:Ce,imageNamePointCloudBoxMap:ae,linkageImageNameRectMap:ue,updateRectListByReducer:de,windowKeydownListenerHook:se}),[W,ge,F,T,z,R,f,u,J,X,a,U,te,ee,A,k,P,E,j,ne,G,ie,w,le,V,re,K,ae,ue,de,se]);React.useEffect(()=>{var e,t,o;(e=p==null?void 0:p.setPointCloudBoxList)==null||e.call(p,n),(t=p==null?void 0:p.setHighlightIDs)==null||t.call(p,w),(o=p==null?void 0:p.setSelectedIDs)==null||o.call(p,h)},[n,h,w]),React.useEffect(()=>{var e;(e=p==null?void 0:p.setPtCtx)==null||e.call(p,M)},[M]);const Ge=()=>{const e=n.filter(s=>g.includes(s.attribute)),{setSelectedIDs:t,reRender:o}=M,i=e.map(s=>s.id);i.length>0&&t(h.filter(s=>!i.includes(s))),o()};return React.useEffect(()=>{var e,t,o,i;Ge(),(t=(e=u==null?void 0:u.toolInstance)==null?void 0:e.setHiddenAttributes)==null||t.call(e,g),(i=(o=P==null?void 0:P.store)==null?void 0:o.setHiddenAttributes)==null||i.call(o,g)},[g]),React__default.default.createElement(PointCloudContext.Provider,{value:M},l)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),ToolPointCloudBoxRenderHelper=require("../../utils/ToolPointCloudBoxRenderHelper.js"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../store/annotatedBox/index.js"),_=require("lodash"),map=require("./utils/map.js"),useTimeoutFunc=require("./hooks/useTimeoutFunc.js"),useWindowKeydownListener=require("./hooks/useWindowKeydownListener.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(l,n,d)=>n in l?__defProp(l,n,{enumerable:!0,configurable:!0,writable:!0,value:d}):l[n]=d,__spreadValues=(l,n)=>{for(var d in n||(n={}))__hasOwnProp.call(n,d)&&__defNormalProp(l,d,n[d]);if(__getOwnPropSymbols)for(var d of __getOwnPropSymbols(n))__propIsEnum.call(n,d)&&__defNormalProp(l,d,n[d]);return l},__spreadProps=(l,n)=>__defProps(l,__getOwnPropDescs(n)),__async=(l,n,d)=>new Promise((S,y)=>{var R=c=>{try{f(d.next(c))}catch(b){y(b)}},H=c=>{try{f(d.throw(c))}catch(b){y(b)}},f=c=>c.done?S(c.value):Promise.resolve(c.value).then(R,H);f((d=d.apply(l,n)).next())});const pickRectObject=l=>___default.default.pick(l,["id","attribute","width","height","x","y","imageName"]),PointCloudContext=React__default.default.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:l=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:l=>!1,removeRectBySpecifyId:(l,n,d)=>!1,removeRectByPointCloudBoxId:l=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:useWindowKeydownListener.getEmptyUseWindowKeydownListener()}),PointCloudProvider=({children:l})=>{const[n,d]=React.useState([]),[S,y]=React.useState([]),[R,H]=React.useState([]),[f,c]=React.useState([]),[b,me]=React.useState([]),[h,D]=React.useState([]),[w,O]=React.useState([]),[W,ve]=React.useState(!0),[K,Ce]=React.useState(2),[G,Ie]=React.useState(!0),[U,Pe]=React.useState(1),[u,Z]=React.useState(),[J,Q]=React.useState(),[X,Y]=React.useState(),[a,$]=React.useState(),[ee,Se]=React.useState(""),[A,be]=React.useState(lbAnnotation.EToolName.Rect),B=React.useRef(new lbAnnotation.ActionsHistory).current,[g,E]=React.useState([]),[te,we]=React.useState(""),[k,ye]=React.useState(lbUtils.EPointCloudPattern.Detection),[P,oe]=React.useState(void 0),[j,Re]=React.useState([]),[V,xe]=React.useState([]),[ne,Le]=React.useState(!1),p=index(),[ie,De]=React.useState({}),Ae=ctx.useDispatch(),Be=e=>{const{imgNode:t,path:o}=e;o&&t&&De(i=>__spreadProps(__spreadValues({},i),{[o]:{width:t.width,height:t.height}}))},q=React.useMemo(()=>h.length===1?h[0]:"",[h]),se=useWindowKeydownListener.default(),M=React.useCallback((e,t,o="extId")=>{const i=o||"id",s=new Set(t);return c(r=>{let C=!1;const m=r.filter(L=>{const I=L[i],v=s.has(I)?L.imageName!==e:!0;return v||(C=!0),v});return C?m:r}),!0},[]),le=React.useCallback(e=>{const t=n.map(o=>o.id);return M(e,t,"extId")},[n,M]),re=React.useCallback(e=>{if(!e)return!1;const t=n.filter(o=>Array.isArray(o.rects)).map(o=>{const{id:i,attribute:s,trackID:r}=o,C=o.rects.find(m=>m.imageName===e);if(C){const m=___default.default.pick(C,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},m),{id:lbAnnotation.uuid(),attribute:s,order:r,extId:i,lineDash:[]})}return null}).filter(o=>o!==null);return t.length?(c(o=>{const i=new Set(o.filter(r=>e===r.imageName).map(r=>r.extId)),s=t.filter(r=>i.has(r.extId)===!1);return s.length?[...o,...s]:o}),!0):!1},[n]),ae=React.useMemo(()=>n.filter(t=>Array.isArray(t.rects)&&t.rects.length>0).reduce((t,o)=>{var i;return(i=o.rects)==null||i.forEach(s=>{const{imageName:r}=s;if(!r){console.warn("Missing image name"),console.trace(s,o);return}map.addMapIndirectWeakSetItem(t,r,o.id,o)}),t},new Map),[n]),de=React.useCallback(e=>{c(t=>e(t,pickRectObject))},[pickRectObject]),ue=React.useMemo(()=>f.filter(e=>e.extId!==void 0&&e.id!==void 0).reduce((e,t)=>{const o=t.imageName;return o?(map.addMapIndirectWeakSetItem(e,o,t.extId,t),e):(console.warn("missing image name"),console.log(t,f),e)},new Map),[f]),{fn:_e}=useTimeoutFunc.default(e=>{D(t=>{const o=e,i=new Set(o);let s=!1;const r=t.filter(C=>{const m=i.has(C);return m||(s=!0),m});return s?r:t})},200),ce=React.useCallback(e=>{const t=e.map(o=>o.id);d(e),_e(t)},[]),ge=React.useMemo(()=>n.find(e=>e.id===q),[n,q]),F=React.useMemo(()=>n.filter(e=>!g.includes(e.attribute)),[n,g]),T=React.useMemo(()=>S.filter(e=>!g.includes(e.attribute)),[S,g]),z=React.useMemo(()=>b.filter(e=>e.attribute&&!g.includes(e.attribute)),[b,g]),ke=React.useCallback(e=>{const t=n.concat(e);return ce(t),t},[n]),Ve=React.useCallback(e=>{const t=S.concat(e);return y(t),t},[S]),Me=React.useCallback(e=>{ve(e!==!1)},[]),x=React.useCallback(e=>{e===void 0&&D([]),typeof e=="string"&&D([e]),Array.isArray(e)&&D(Array.from(new Set(e)))},[]),Ne=React.useCallback(e=>{h.includes(e)?x(h.filter(t=>t!==e)):x([...h,e])},[h]),He=React.useCallback(e=>{const t=pickRectObject(e);c(o=>[...o,t])},[f]),Oe=React.useCallback((e,t=!1)=>{const o=pickRectObject(e);c(i=>i.map(s=>s.id===e.id?t?__spreadValues(__spreadValues({},s),o):o:s))},[f]),Ee=React.useCallback(e=>{c(t=>t.filter(o=>!e.find(i=>i.id===o.id)))},[f]),je=React.useCallback(e=>{w.includes(e)?O([]):O([e])},[w]),qe=React.useCallback(()=>{if(A===lbAnnotation.EToolName.Rect){const e=n.map(t=>t.id);x(e),u==null||u.pointCloud2dOperation.setSelectedIDs(e)}},[A,n,u,u==null?void 0:u.pointCloud2dOperation]),Fe=React.useCallback(e=>{x(n.filter(t=>t.attribute===e).map(t=>t.id))},[n]),Te=React.useCallback(e=>{if(g.includes(e))E(g.filter(t=>t!==e));else{const t=g.concat(e);E(t)}},[g]),ze=React.useCallback((e=F,t=R,o=T,i=z,s=j)=>{var r;a==null||a.clearAllBox(),a==null||a.clearAllSphere(),u==null||u.updatePolygonList(e,t),u==null||u.updatePointList(o),u==null||u.updateLineList(i),a==null||a.generateBoxes(e),a==null||a.generateSpheres(o),(r=P==null?void 0:P.store)==null||r.updateCurrentSegment(s),fe(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,e)},[a,u,P,P==null?void 0:P.store]),We=React.useCallback(()=>{Z(void 0),Q(void 0),Y(void 0),$(void 0)},[]),fe=React.useCallback((e,t,o)=>__async(void 0,null,function*(){var i,s,r;if(!a)return;const C=a.pointCloudObject;if(!C)return;let m=[],L=[];try{if(t&&B.record.length){const{record:I,recordIndex:v}=B;let pe=v;v>0&&(e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleToggleValid||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleRotate||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single&&t.length===((i=I[v])==null?void 0:i.pointCloudBoxList.length))&&(pe=v-1);let Ue=(s=I[pe])==null?void 0:s.pointCloudBoxList;const he=ToolPointCloudBoxRenderHelper.calcResetAreasAndBoxIds(e,t,Ue);m=he.modifiedBoxIds,L=he.resetAreas}}catch(I){console.error("call calcResetAreasAndBoxIds error",I)}try{const I=yield a.getHighlightIndexByMappingImgList({mappingImgList:o!=null?o:V,points:C.geometry.attributes.position.array}),v=yield a==null?void 0:a.highlightOriginPointCloud(t,I,{modifiedBoxIds:m,resetAreas:L});return v&&((r=u==null?void 0:u.pointCloudInstance)==null||r.updateColor(v)),v}catch(I){console.error("call highlightOriginPointCloud error",I)}}),[a,a==null?void 0:a.pointCloudObject,B,V]),Ke=React.useCallback(e=>{k!==e&&(Ae(actionCreators.ChangeSave),ye(e),e===lbUtils.EPointCloudPattern.Detection&&oe(void 0))},[k]),N=React.useMemo(()=>({selectedID:q,pointCloudBoxList:n,pointCloudSphereList:S,displayPointCloudList:F,displaySphereList:T,displayLineList:z,selectedIDs:h,setPointCloudResult:ce,setSelectedIDs:x,addPointCloudBox:ke,addPointCloudSphere:Ve,setPointCloudSphereList:y,valid:W,selectedPointCloudBox:ge,setPointCloudValid:Me,addSelectedID:Ne,addHighlightID:je,selectedAllBoxes:qe,topViewInstance:u,setTopViewInstance:Z,sideViewInstance:J,setSideViewInstance:Q,backViewInstance:X,setBackViewInstance:Y,mainViewInstance:a,setMainViewInstance:$,polygonList:R,setPolygonList:H,rectList:f,setRectList:c,addRectIn2DView:He,removeRectIn2DView:Ee,updateRectIn2DView:Oe,lineList:b,setLineList:me,zoom:U,setZoom:Pe,history:B,toggleAttributesVisible:Te,hideAttributes:g,setHideAttributes:E,reRender:ze,attrPanelLayout:te,setAttrPanelLayout:we,syncAllViewPointCloudColor:fe,defaultAttribute:ee,setDefaultAttribute:Se,pointCloudPattern:A,setPointCloudPattern:be,selectSpecAttr:Fe,globalPattern:k,setGlobalPattern:Ke,ptSegmentInstance:P,setPtSegmentInstance:oe,segmentation:j,setSegmentation:Re,clearAllDetectionInstance:We,highlight2DDataList:V,setHighlight2DDataList:xe,highlight2DLoading:ne,setHighlight2DLoading:Le,cuboidBoxIn2DView:G,setCuboidBoxIn2DView:Ie,imageSizes:ie,cacheImageNodeSize:Be,highlightIDs:w,setHighlightIDs:O,removeRectByPointCloudBoxId:le,removeRectBySpecifyId:M,addRectFromPointCloudBoxByImageName:re,rectRotateSensitivity:K,setRectRotateSensitivity:Ce,imageNamePointCloudBoxMap:ae,linkageImageNameRectMap:ue,updateRectListByReducer:de,windowKeydownListenerHook:se}),[W,ge,F,T,z,R,f,u,J,X,a,U,te,ee,A,k,P,j,V,ne,G,ie,w,le,M,re,K,ae,ue,de,se]);React.useEffect(()=>{var e,t,o;(e=p==null?void 0:p.setPointCloudBoxList)==null||e.call(p,n),(t=p==null?void 0:p.setHighlightIDs)==null||t.call(p,w),(o=p==null?void 0:p.setSelectedIDs)==null||o.call(p,h)},[n,h,w]),React.useEffect(()=>{var e;(e=p==null?void 0:p.setPtCtx)==null||e.call(p,N)},[N]);const Ge=()=>{const e=n.filter(s=>g.includes(s.attribute)),{setSelectedIDs:t,reRender:o}=N,i=e.map(s=>s.id);i.length>0&&t(h.filter(s=>!i.includes(s))),o()};return React.useEffect(()=>{var e,t,o,i;Ge(),(t=(e=u==null?void 0:u.toolInstance)==null?void 0:e.setHiddenAttributes)==null||t.call(e,g),(i=(o=P==null?void 0:P.store)==null?void 0:o.setHiddenAttributes)==null||i.call(o,g)},[g]),React__default.default.createElement(PointCloudContext.Provider,{value:N},l)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
package/dist/index.css CHANGED
@@ -63,6 +63,77 @@
63
63
  justify-content: space-between;
64
64
  margin-top: 16px;
65
65
  }
66
+ .dynamic-resizer-content {
67
+ width: 100%;
68
+ height: 100%;
69
+ flex-shrink: 0;
70
+ flex-grow: 0;
71
+ position: relative;
72
+ }
73
+
74
+ .divider {
75
+ height: 10px;
76
+ width: 100%;
77
+ position: absolute;
78
+ top: -5px;
79
+ left: 0;
80
+ cursor: row-resize;
81
+ user-select: none;
82
+ display: flex;
83
+ align-items: center;
84
+ flex-direction: column;
85
+ justify-content: center;
86
+ }
87
+
88
+ .divider:hover .divider-top, .divider:hover .divider-bottom {
89
+ display: block;
90
+ }
91
+
92
+ .divider-top,
93
+ .divider-bottom {
94
+ width: 20px;
95
+ height: 20px;
96
+ cursor: pointer;
97
+ display: none;
98
+ user-select: none;
99
+ }
100
+
101
+ .divider-icon {
102
+ width: 100%;
103
+ height: 20px;
104
+ position: relative;
105
+ }
106
+ .divider-icon::after {
107
+ content: "";
108
+ display: block;
109
+ position: absolute;
110
+ top: 50%;
111
+ left: 0;
112
+ right: 0;
113
+ width: 90%;
114
+ height: 1px;
115
+ background: #ccc;
116
+ margin: 0 auto;
117
+ }
118
+
119
+ .dynamic-resizer-top {
120
+ width: 100%;
121
+ overflow-y: auto;
122
+ }
123
+
124
+ .dynamic-resizer-bottom {
125
+ width: 100%;
126
+ overflow-y: auto;
127
+ }
128
+
129
+ .hide-scrollbar * {
130
+ scrollbar-width: none; /* Firefox */
131
+ -ms-overflow-style: none; /* IE and Edge */
132
+ }
133
+
134
+ .hide-scrollbar *::-webkit-scrollbar {
135
+ display: none; /* Chrome, Safari, Opera */
136
+ }
66
137
  .index-module_latexEditor__0fK8G {
67
138
  line-height: 32px;
68
139
  background-color: #ededed;
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import './DynamicResizer.scss';
3
+ import { DynamicResizerProps } from './types/interface';
4
+ declare const DynamicResizer: FC<DynamicResizerProps>;
5
+ export default DynamicResizer;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { DragProps } from '../types/interface';
3
+ declare const useDrag: ({ containerRef, minTopHeight, minBottomHeight, defaultHeight, axis, localKey, }: DragProps) => {
4
+ rendered: React.JSX.Element;
5
+ topStyle: {
6
+ height: string;
7
+ };
8
+ bottomStyle: {
9
+ height: string;
10
+ };
11
+ };
12
+ export default useDrag;
@@ -0,0 +1,23 @@
1
+ import { RefObject } from 'react';
2
+ declare const useUpdateHeight: (containerRef: RefObject<HTMLDivElement>, minTopHeight: number, minBottomHeight: number, defaultHeight: number, cacheKey: string) => {
3
+ topHeight: number;
4
+ bottomHeight: number;
5
+ position: {
6
+ x: number;
7
+ y: number;
8
+ };
9
+ bounds: {
10
+ top: number;
11
+ bottom: number;
12
+ };
13
+ topStyle: {
14
+ height: string;
15
+ };
16
+ bottomStyle: {
17
+ height: string;
18
+ };
19
+ updateELHeight: (newTopHeight: number) => void;
20
+ setBottomHeightToZero: () => void;
21
+ setTopHeightToZero: () => void;
22
+ };
23
+ export default useUpdateHeight;
@@ -0,0 +1,2 @@
1
+ import DynamicResizer from './DynamicResizer';
2
+ export default DynamicResizer;
@@ -0,0 +1,16 @@
1
+ import { ReactElement, RefObject } from 'react';
2
+ interface Common {
3
+ defaultHeight?: number;
4
+ minTopHeight?: number;
5
+ minBottomHeight?: number;
6
+ axis?: 'x' | 'y';
7
+ localKey?: string;
8
+ customDivider?: ReactElement;
9
+ }
10
+ export interface DynamicResizerProps extends Common {
11
+ children: ReactElement[] | Element[] | Boolean[];
12
+ }
13
+ export interface DragProps extends Common {
14
+ containerRef: RefObject<HTMLDivElement>;
15
+ }
16
+ export {};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),icons=require("@ant-design/icons"),ToolIcons=require("../ToolIcons.js"),ToolType=require("../../../../data/enums/ToolType.js"),lbAnnotation=require("@labelbee/lb-annotation"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),StepUtils=require("../../../../utils/StepUtils.js"),reactRedux=require("react-redux"),index=require("../../../../utils/index.js"),useStatus=require("../../../../components/pointCloudView/hooks/useStatus.js"),useSingleBox=require("../../../../components/pointCloudView/hooks/useSingleBox.js"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),index$4=require("./components/batchUpdateModal/index.js"),index$1=require("./components/annotatedBox/index.js"),index$3=require("./components/rectRotateSensitivitySlider/index.js"),index$2=require("./components/findTrackIDIndex/index.js"),lbUtils=require("@labelbee/lb-utils"),index$5=require("../../../../components/attributeList/index.js"),useAttribute=require("../../../../components/pointCloudView/hooks/useAttribute.js"),lassoSelector=require("../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js"),lassoSelector_a=require("../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js"),circleSelector=require("../../../../assets/annotation/pointCloudTool/circleSelector.svg.js"),circleSelector_a=require("../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js"),icon_rect=require("../../../../assets/annotation/rectTool/icon_rect.svg.js"),icon_rect_a=require("../../../../assets/annotation/rectTool/icon_rect_a.svg.js"),index$7=require("../index.js"),actionCreators=require("../../../../store/annotation/actionCreators.js"),usePointCloudViews=require("../../../../components/pointCloudView/hooks/usePointCloudViews.js"),index$6=require("../../../../components/subAttributeList/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,n)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,__spreadValues=(t,e)=>{for(var n in e||(e={}))__hasOwnProp.call(e,n)&&__defNormalProp(t,n,e[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(e))__propIsEnum.call(e,n)&&__defNormalProp(t,n,e[n]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const BoxTrackIDInput=()=>{const[t,e]=React.useState(!1),n=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:s}=n,{selectedBox:i,updateSelectedBox:o}=useSingleBox.useSingleBox(),[u,c]=React.useState(""),{t:v}=reactI18next.useTranslation(),m=i==null?void 0:i.info.trackID,a=d=>!!s.find(g=>g.trackID===d&&g.id!==(i==null?void 0:i.info.id)),l=(d=!1)=>{const p=parseInt(u,10);if(d&&e(!1),isNaN(p)){antd.message.error(v("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){antd.message.error(v("NotAllowDecimalPointsInTrackID"));return}if(a(p)){antd.message.error(v("DuplicateTrackIDsExist"));return}if(!(p>0)){antd.message.error(v("PositiveIntegerCheck"));return}S(p)};React.useEffect(()=>{e(!1)},[m]);const S=d=>{var p;const g=o({trackID:d});(p=n==null?void 0:n.topViewInstance)==null||p.updatePolygonList(g!=null?g:[])};return React__default.default.createElement("div",{style:{padding:24}},React__default.default.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},React__default.default.createElement("span",null,v("CurrentBoxTrackIDs")),m&&React__default.default.createElement(index$4,{id:m,updateCurrentPolygonList:d=>S(d)})),React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},t&&m?React__default.default.createElement(antd.Input,{defaultValue:m,onChange:d=>{c(d.target.value)},disabled:!m,size:"small",onBlur:()=>{l()},onPressEnter:()=>{l(!0)}}):React__default.default.createElement("span",null,m),React__default.default.createElement(icons.EditFilled,{style:{color:"#999",marginLeft:16,cursor:typeof m!="undefined"?"pointer":"not-allowed"},onClick:()=>{m&&e(!t)}})))},isAllowUpdateInSegment=({segmentStatus:t,globalPattern:e})=>e===lbUtils.EPointCloudPattern.Segmentation&&![lbUtils.EPointCloudSegmentStatus.Edit,lbUtils.EPointCloudSegmentStatus.Ready].includes(t),AttributeUpdater=({attributeList:t,subAttributeList:e,toolInstance:n,config:s,stepList:i,stepInfo:o,enableColorPicker:u})=>{const[c,v]=React.useState({segmentStatus:lbUtils.EPointCloudSegmentStatus.Ready}),{selectedBox:m}=useSingleBox.useSingleBox(),a=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:l}=a,{t:S}=reactI18next.useTranslation(),{defaultAttribute:d}=useAttribute.useAttribute(),p=usePointCloudViews.usePointCloudViews(),{isPointCloudSegmentationPattern:g}=useStatus.useStatus(),T=ctx.useDispatch(),w={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};React.useEffect(()=>{if(!!l)return l.on("syncPointCloudStatus",v),()=>{l.unbind("syncPointCloudStatus",v)}},[l]);const j=(r,C)=>{var b,x,_,E,y;const P=(b=s==null?void 0:s.attributeList)==null?void 0:b.map(f=>f.value===r?__spreadProps(__spreadValues({},f),{color:C}):f),I=__spreadProps(__spreadValues({},s),{attributeList:P}),A=JSON.stringify(I),B=i==null?void 0:i.map(f=>(f==null?void 0:f.step)===(o==null?void 0:o.step)?__spreadProps(__spreadValues({},f),{config:A}):f);(x=a==null?void 0:a.topViewInstance)==null||x.updateAttributeList(P),(_=a==null?void 0:a.sideViewInstance)==null||_.updateAttributeList(P),(E=a==null?void 0:a.backViewInstance)==null||E.updateAttributeList(P),(y=a==null?void 0:a.mainViewInstance)==null||y.setConfig(I),T(actionCreators.SetTaskStepList({stepList:B}))},D=r=>{p.updateViewsByDefaultSize&&p.updateViewsByDefaultSize(r)},L=r=>{isAllowUpdateInSegment({globalPattern:a.globalPattern,segmentStatus:c.segmentStatus})||n.setDefaultAttribute(r)},q=(r,C)=>{isAllowUpdateInSegment({globalPattern:a.globalPattern,segmentStatus:c.segmentStatus})||n.setSubAttribute(r,C)},h=t.map(r=>({label:r.key,value:r.value,color:r==null?void 0:r.color,limit:r==null?void 0:r.limit,isDefault:r==null?void 0:r.isDefault})),k=m||c.cacheSegData&&c.segmentStatus===lbUtils.EPointCloudSegmentStatus.Edit,V=g;return React__default.default.createElement("div",{style:{flex:1,overflowX:"hidden",overflowY:"auto"}},React__default.default.createElement("div",{style:w},S("Attribute")),React__default.default.createElement(index$5.default,{list:h,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:r=>L(r),updateColorConfig:j,enableColorPicker:u,updateSize:D,forbidShowLimitPopover:V}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),k&&React__default.default.createElement(index$6,{subAttributeList:e,setSubAttribute:q,getValue:r=>{var C,b,x,_;return((b=(C=a.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:b[r.value])||((_=(x=c.cacheSegData)==null?void 0:x.subAttribute)==null?void 0:_[r.value])}}))},renderSegmentTools=[{toolName:"LassoSelector",commonSvg:lassoSelector,selectedSvg:lassoSelector_a},{toolName:"RectSelector",commonSvg:icon_rect,selectedSvg:icon_rect_a},{toolName:"CircleSelector",commonSvg:circleSelector,selectedSvg:circleSelector_a}],PointCloudSegToolIcon=({toolInstance:t})=>{const{ptSegmentInstance:e}=React.useContext(PointCloudContext.PointCloudContext),[n,s]=React.useState("LassoSelector"),{t:i}=reactI18next.useTranslation();return React.useEffect(()=>{if(!e)return;const o=()=>{s("LassoSelector")},u=()=>{s("RectSelector")},c=()=>{s("CircleSelector")};return e.on("LassoSelector",o),e.on("RectSelector",u),e.on("CircleSelector",c),()=>{e.unbind("LassoSelector",o),e.unbind("RectSelector",u),e.unbind("CircleSelector",c)}},[e]),React__default.default.createElement("div",{className:`${index$7.sidebarCls}__level`},renderSegmentTools.map(o=>{const u=n===o.toolName;return React__default.default.createElement("span",{className:`${index$7.sidebarCls}__toolOption`,key:o.toolName,onClick:()=>e==null?void 0:e.emit(o.toolName)},React__default.default.createElement("img",{className:`${index$7.sidebarCls}__singleTool`,src:u?o==null?void 0:o.selectedSvg:o==null?void 0:o.commonSvg}),React__default.default.createElement("span",{className:index.classnames({[`${index$7.sidebarCls}__toolOption__selected`]:u})},i(o.toolName)))}))},PointCloudToolSidebar=({stepInfo:t,toolInstance:e,imgList:n,imgIndex:s,stepList:i,enableColorPicker:o})=>{var u,c;const{updatePointCloudPattern:v,pointCloudPattern:m,isPointCloudSegmentationPattern:a}=useStatus.useStatus(),l=index.jsonParser(t.config),S=(u=l==null?void 0:l.attributeList)!=null?u:[],d=(l==null?void 0:l.secondaryAttributeConfigurable)===!0?(c=l==null?void 0:l.inputList)!=null?c:[]:[];return a?React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegToolIcon,{toolInstance:e}),React__default.default.createElement(AttributeUpdater,{toolInstance:e,attributeList:S,subAttributeList:d,config:l,stepList:i,stepInfo:t,enableColorPicker:o})):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ToolIcons.ToolIcons,{toolName:lbAnnotation.cTool.EPointCloudName.PointCloud,selectedToolName:m,onChange:p=>v==null?void 0:v(p)}),React__default.default.createElement(AttributeUpdater,{toolInstance:e,attributeList:S,subAttributeList:d,config:l,stepList:i,stepInfo:t,enableColorPicker:o}),(l==null?void 0:l.trackConfigurable)===!0&&m===ToolType.EToolName.Rect&&React__default.default.createElement("div",{style:{flexShrink:0,height:280,overflow:"auto"}},React__default.default.createElement(BoxTrackIDInput,null),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$1,{imgList:n,imgIndex:s}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$2.default,{imgList:n,imgIndex:s}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$3,null)))},mapStateToProps=t=>{var e,n,s,i;const o=StepUtils.getCurrentStepInfo((e=t.annotation)==null?void 0:e.step,(n=t.annotation)==null?void 0:n.stepList),u=(s=t.annotation)==null?void 0:s.toolInstance,c=(i=t.annotation)==null?void 0:i.stepList;return{stepInfo:o,toolInstance:u,imgList:t.annotation.imgList,imgIndex:t.annotation.imgIndex,stepList:c}};var PointCloudToolSidebar$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudToolSidebar);exports.PointCloudSegToolIcon=PointCloudSegToolIcon,exports.default=PointCloudToolSidebar$1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),icons=require("@ant-design/icons"),ToolIcons=require("../ToolIcons.js"),ToolType=require("../../../../data/enums/ToolType.js"),lbAnnotation=require("@labelbee/lb-annotation"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),StepUtils=require("../../../../utils/StepUtils.js"),reactRedux=require("react-redux"),index=require("../../../../utils/index.js"),useStatus=require("../../../../components/pointCloudView/hooks/useStatus.js"),useSingleBox=require("../../../../components/pointCloudView/hooks/useSingleBox.js"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),index$4=require("./components/batchUpdateModal/index.js"),index$1=require("./components/annotatedBox/index.js"),index$3=require("./components/rectRotateSensitivitySlider/index.js"),index$2=require("./components/findTrackIDIndex/index.js"),lbUtils=require("@labelbee/lb-utils"),index$5=require("../../../../components/attributeList/index.js"),useAttribute=require("../../../../components/pointCloudView/hooks/useAttribute.js"),lassoSelector=require("../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js"),lassoSelector_a=require("../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js"),circleSelector=require("../../../../assets/annotation/pointCloudTool/circleSelector.svg.js"),circleSelector_a=require("../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js"),icon_rect=require("../../../../assets/annotation/rectTool/icon_rect.svg.js"),icon_rect_a=require("../../../../assets/annotation/rectTool/icon_rect_a.svg.js"),index$7=require("../index.js"),actionCreators=require("../../../../store/annotation/actionCreators.js"),usePointCloudViews=require("../../../../components/pointCloudView/hooks/usePointCloudViews.js"),index$6=require("../../../../components/subAttributeList/index.js"),DynamicResizer=require("../../../../components/DynamicResizer/DynamicResizer.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const BoxTrackIDInput=()=>{const[e,t]=React.useState(!1),n=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:i}=n,{selectedBox:s,updateSelectedBox:o}=useSingleBox.useSingleBox(),[u,c]=React.useState(""),{t:p}=reactI18next.useTranslation(),m=s==null?void 0:s.info.trackID,a=d=>!!i.find(S=>S.trackID===d&&S.id!==(s==null?void 0:s.info.id)),r=(d=!1)=>{const v=parseInt(u,10);if(d&&t(!1),isNaN(v)){antd.message.error(p("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){antd.message.error(p("NotAllowDecimalPointsInTrackID"));return}if(a(v)){antd.message.error(p("DuplicateTrackIDsExist"));return}if(!(v>0)){antd.message.error(p("PositiveIntegerCheck"));return}g(v)};React.useEffect(()=>{t(!1)},[m]);const g=d=>{var v;const S=o({trackID:d});(v=n==null?void 0:n.topViewInstance)==null||v.updatePolygonList(S!=null?S:[])};return React__default.default.createElement("div",{style:{padding:24}},React__default.default.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},React__default.default.createElement("span",null,p("CurrentBoxTrackIDs")),m&&React__default.default.createElement(index$4,{id:m,updateCurrentPolygonList:d=>g(d)})),React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},e&&m?React__default.default.createElement(antd.Input,{defaultValue:m,onChange:d=>{c(d.target.value)},disabled:!m,size:"small",onBlur:()=>{r()},onPressEnter:()=>{r(!0)}}):React__default.default.createElement("span",null,m),React__default.default.createElement(icons.EditFilled,{style:{color:"#999",marginLeft:16,cursor:typeof m!="undefined"?"pointer":"not-allowed"},onClick:()=>{m&&t(!e)}})))},isAllowUpdateInSegment=({segmentStatus:e,globalPattern:t})=>t===lbUtils.EPointCloudPattern.Segmentation&&![lbUtils.EPointCloudSegmentStatus.Edit,lbUtils.EPointCloudSegmentStatus.Ready].includes(e),AttributeUpdater=({attributeList:e,subAttributeList:t,toolInstance:n,config:i,stepList:s,stepInfo:o,enableColorPicker:u})=>{const[c,p]=React.useState({segmentStatus:lbUtils.EPointCloudSegmentStatus.Ready}),{selectedBox:m}=useSingleBox.useSingleBox(),a=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:r}=a,{t:g}=reactI18next.useTranslation(),{defaultAttribute:d}=useAttribute.useAttribute(),v=usePointCloudViews.usePointCloudViews(),{isPointCloudSegmentationPattern:S}=useStatus.useStatus(),T=ctx.useDispatch(),w={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};React.useEffect(()=>{if(!!r)return r.on("syncPointCloudStatus",p),()=>{r.unbind("syncPointCloudStatus",p)}},[r]);const j=(l,C)=>{var b,x,_,E,y;const P=(b=i==null?void 0:i.attributeList)==null?void 0:b.map(f=>f.value===l?__spreadProps(__spreadValues({},f),{color:C}):f),D=__spreadProps(__spreadValues({},i),{attributeList:P}),A=JSON.stringify(D),B=s==null?void 0:s.map(f=>(f==null?void 0:f.step)===(o==null?void 0:o.step)?__spreadProps(__spreadValues({},f),{config:A}):f);(x=a==null?void 0:a.topViewInstance)==null||x.updateAttributeList(P),(_=a==null?void 0:a.sideViewInstance)==null||_.updateAttributeList(P),(E=a==null?void 0:a.backViewInstance)==null||E.updateAttributeList(P),(y=a==null?void 0:a.mainViewInstance)==null||y.setConfig(D),T(actionCreators.SetTaskStepList({stepList:B}))},I=l=>{v.updateViewsByDefaultSize&&v.updateViewsByDefaultSize(l)},q=l=>{isAllowUpdateInSegment({globalPattern:a.globalPattern,segmentStatus:c.segmentStatus})||n.setDefaultAttribute(l)},L=(l,C)=>{isAllowUpdateInSegment({globalPattern:a.globalPattern,segmentStatus:c.segmentStatus})||n.setSubAttribute(l,C)},h=e.map(l=>({label:l.key,value:l.value,color:l==null?void 0:l.color,limit:l==null?void 0:l.limit,isDefault:l==null?void 0:l.isDefault})),k=m||c.cacheSegData&&c.segmentStatus===lbUtils.EPointCloudSegmentStatus.Edit,V=S;return React__default.default.createElement("div",{style:{height:"100%",overflow:"auto",display:"flex",flexDirection:"column"}},React__default.default.createElement("div",{style:w},g("Attribute")),React__default.default.createElement("div",{style:{height:0,flex:1,overflowY:"auto",overflowX:"hidden"}},React__default.default.createElement(index$5.default,{list:h,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:l=>q(l),updateColorConfig:j,enableColorPicker:u,updateSize:I,forbidShowLimitPopover:V}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),k&&React__default.default.createElement(index$6,{subAttributeList:t,setSubAttribute:L,getValue:l=>{var C,b,x,_;return((b=(C=a.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:b[l.value])||((_=(x=c.cacheSegData)==null?void 0:x.subAttribute)==null?void 0:_[l.value])}})))},renderSegmentTools=[{toolName:"LassoSelector",commonSvg:lassoSelector,selectedSvg:lassoSelector_a},{toolName:"RectSelector",commonSvg:icon_rect,selectedSvg:icon_rect_a},{toolName:"CircleSelector",commonSvg:circleSelector,selectedSvg:circleSelector_a}],PointCloudSegToolIcon=({toolInstance:e})=>{const{ptSegmentInstance:t}=React.useContext(PointCloudContext.PointCloudContext),[n,i]=React.useState("LassoSelector"),{t:s}=reactI18next.useTranslation();return React.useEffect(()=>{if(!t)return;const o=()=>{i("LassoSelector")},u=()=>{i("RectSelector")},c=()=>{i("CircleSelector")};return t.on("LassoSelector",o),t.on("RectSelector",u),t.on("CircleSelector",c),()=>{t.unbind("LassoSelector",o),t.unbind("RectSelector",u),t.unbind("CircleSelector",c)}},[t]),React__default.default.createElement("div",{className:`${index$7.sidebarCls}__level`},renderSegmentTools.map(o=>{const u=n===o.toolName;return React__default.default.createElement("span",{className:`${index$7.sidebarCls}__toolOption`,key:o.toolName,onClick:()=>t==null?void 0:t.emit(o.toolName)},React__default.default.createElement("img",{className:`${index$7.sidebarCls}__singleTool`,src:u?o==null?void 0:o.selectedSvg:o==null?void 0:o.commonSvg}),React__default.default.createElement("span",{className:index.classnames({[`${index$7.sidebarCls}__toolOption__selected`]:u})},s(o.toolName)))}))},PointCloudToolSidebar=({stepInfo:e,toolInstance:t,imgList:n,imgIndex:i,stepList:s,enableColorPicker:o})=>{var u,c;const{updatePointCloudPattern:p,pointCloudPattern:m,isPointCloudSegmentationPattern:a}=useStatus.useStatus(),r=index.jsonParser(e.config),g=(u=r==null?void 0:r.attributeList)!=null?u:[],d=(r==null?void 0:r.secondaryAttributeConfigurable)===!0?(c=r==null?void 0:r.inputList)!=null?c:[]:[];return a?React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegToolIcon,{toolInstance:t}),React__default.default.createElement(AttributeUpdater,{toolInstance:t,attributeList:g,subAttributeList:d,config:r,stepList:s,stepInfo:e,enableColorPicker:o})):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ToolIcons.ToolIcons,{toolName:lbAnnotation.cTool.EPointCloudName.PointCloud,selectedToolName:m,onChange:v=>p==null?void 0:p(v)}),React__default.default.createElement("div",{style:{flex:1,overflow:"hidden"}},React__default.default.createElement(DynamicResizer,{minTopHeight:42,defaultHeight:100,localKey:"id:"+(e==null?void 0:e.id)+"taskID:"+(e==null?void 0:e.taskID)+"step:"+(e==null?void 0:e.step)+"type:"+(e==null?void 0:e.type)},React__default.default.createElement(AttributeUpdater,{toolInstance:t,attributeList:g,subAttributeList:d,config:r,stepList:s,stepInfo:e,enableColorPicker:o}),(r==null?void 0:r.trackConfigurable)===!0&&m===ToolType.EToolName.Rect?React__default.default.createElement("div",{style:{height:"100%",overflow:"auto"}},React__default.default.createElement(BoxTrackIDInput,null),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$1,{imgList:n,imgIndex:i}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$2.default,{imgList:n,imgIndex:i}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$3,null)):React__default.default.createElement("div",null))))},mapStateToProps=e=>{var t,n,i,s;const o=StepUtils.getCurrentStepInfo((t=e.annotation)==null?void 0:t.step,(n=e.annotation)==null?void 0:n.stepList),u=(i=e.annotation)==null?void 0:i.toolInstance,c=(s=e.annotation)==null?void 0:s.stepList;return{stepInfo:o,toolInstance:u,imgList:e.annotation.imgList,imgIndex:e.annotation.imgIndex,stepList:c}};var PointCloudToolSidebar$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudToolSidebar);exports.PointCloudSegToolIcon=PointCloudSegToolIcon,exports.default=PointCloudToolSidebar$1;
@@ -0,0 +1 @@
1
+ import e,{useRef as u}from"react";import f from"./hooks/useDrag.js";const g=i=>{const{minTopHeight:s=0,minBottomHeight:a=0,defaultHeight:o=50,axis:c="y",children:t,localKey:n="dynamicResizerHeights",customDivider:m}=i,r=u(null),{rendered:l,topStyle:d,bottomStyle:y}=f({containerRef:r,minTopHeight:s,minBottomHeight:a,defaultHeight:o,axis:c,localKey:n,customDivider:m});return e.createElement("div",{className:"dynamic-resizer-content",ref:r},e.createElement("div",{className:"dynamic-resizer-top",style:d},t[0]),l,e.createElement("div",{className:"dynamic-resizer-bottom",style:y},t[1]))};export{g as default};
@@ -0,0 +1 @@
1
+ import"react";var t="data:image/svg+xml,%3csvg t='1720421473527' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='5364' width='200' height='200'%3e %3cpath d='M94.8 304.5L512 721.8l416-416-833.2-1.3z m0 0' p-id='5365'%3e%3c/path%3e%3c/svg%3e";export{t as default};
@@ -0,0 +1 @@
1
+ import"react";var t="data:image/svg+xml,%3csvg t='1720421409111' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='5202' width='200' height='200'%3e %3cpath d='M928 721.8L510.8 304.5l-416 416 833.2 1.3z m0 0' p-id='5203'%3e%3c/path%3e%3c/svg%3e";export{t as default};
@@ -0,0 +1 @@
1
+ import o,{useCallback as r,useMemo as E}from"react";import y from"react-draggable";import{useLocalStorageState as L}from"ahooks";import k from"./useUpdateHeight.js";import N from"../assets/topToZero.svg.js";import Z from"../assets/bottomToZero.svg.js";const j=y,C=({containerRef:e,minTopHeight:p=0,minBottomHeight:u=0,defaultHeight:h=50,axis:a,localKey:b})=>{const s=b||"dynamicResizerHeights",{topHeight:i,position:l,bounds:c,topStyle:v,bottomStyle:H,updateELHeight:d,setTopHeightToZero:S,setBottomHeightToZero:f}=k(e,p,u,h,s),[P,g]=L(s),T=r(()=>{e.current&&e.current.classList.add("hide-scrollbar")},[e]),m=r((t,D)=>{t.stopPropagation(),d(D.y)},[d]),n=r(t=>{t.stopPropagation(),e.current&&e.current.classList.remove("hide-scrollbar"),g(i)},[e,g,i]);return{rendered:E(()=>{const t=o.createElement("div",{className:"divider"},o.createElement("img",{src:N,className:"divider-top",draggable:"false",onClick:S}),o.createElement("div",{className:"divider-icon",draggable:"false"}),o.createElement("img",{src:Z,className:"divider-bottom",draggable:"false",onClick:f}));return o.createElement(j,{axis:a,position:l,handle:".divider",onStart:T,onDrag:m,onStop:n,bounds:c},t)},[a,l,m,n,c]),topStyle:v,bottomStyle:H}};export{C as default};
@@ -0,0 +1 @@
1
+ import{useState as g,useEffect as y,useMemo as r,useCallback as k}from"react";import{useLocalStorageState as E}from"ahooks";const z=(o,n,m,v,f)=>{const[i,T]=g(0),[H,b]=g(0),[l,M]=g(0),[h,_]=g(0),[x,p]=E(f);y(()=>{Z();const t=x;let e=0;t!=null?e=isNaN(Number(t))?0:Number(t):e=i||v,u(e)},[]);const B=r(()=>({x:0,y:i}),[i]),L=r(()=>{var t;return{top:l,bottom:(((t=o.current)==null?void 0:t.offsetHeight)||0)-h}},[i,o]),S=r(()=>({height:i+"px"}),[i]),N=r(()=>({height:H+"px"}),[H]),Z=()=>{var t,e,s,c;if(o){let a=n,d=m;n>=(((t=o.current)==null?void 0:t.offsetHeight)||0)/2&&(a=(((e=o.current)==null?void 0:e.offsetHeight)||0)/2),m>=(((s=o.current)==null?void 0:s.offsetHeight)||0)/2&&(d=(((c=o.current)==null?void 0:c.offsetHeight)||0)/2),M(a||1e-5),_(d)}},u=k(t=>{var e;if(o){const s=((e=o==null?void 0:o.current)==null?void 0:e.offsetHeight)||0,c=s-h;t>=l&&t<=c&&(T(t),b(s-t))}},[o,l,h]);return{topHeight:i,bottomHeight:H,position:B,bounds:L,topStyle:S,bottomStyle:N,updateELHeight:u,setBottomHeightToZero:()=>{var t;if(o){const e=((t=o==null?void 0:o.current)==null?void 0:t.offsetHeight)||0;u(e-h||0),p(e-h||0)}},setTopHeightToZero:()=>{o&&(u(l||0),p(l||0))}}};export{z as default};
@@ -0,0 +1 @@
1
+ import"./DynamicResizer.js";export{default}from"./DynamicResizer.js";
@@ -1 +1 @@
1
- import{EPointCloudPattern as J}from"@labelbee/lb-utils";import Se,{useState as r,useRef as ct,useMemo as R,useCallback as a,useEffect as Q}from"react";import{EPointCloudBoxRenderTrigger as M,calcResetAreasAndBoxIds as ut}from"../../utils/ToolPointCloudBoxRenderHelper.js";import{ActionsHistory as be,EToolName as X,uuid as gt}from"@labelbee/lb-annotation";import{useDispatch as pt}from"../../store/ctx.js";import{ChangeSave as ft}from"../../store/annotation/actionCreators.js";import mt from"../../store/annotatedBox/index.js";import Le from"lodash";import{addMapIndirectWeakSetItem as xe}from"./utils/map.js";import ht from"./hooks/useTimeoutFunc.js";import It,{getEmptyUseWindowKeydownListener as vt}from"./hooks/useWindowKeydownListener.js";var Pt=Object.defineProperty,wt=Object.defineProperties,yt=Object.getOwnPropertyDescriptors,De=Object.getOwnPropertySymbols,Ct=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,Ae=(d,n,u)=>n in d?Pt(d,n,{enumerable:!0,configurable:!0,writable:!0,value:u}):d[n]=u,k=(d,n)=>{for(var u in n||(n={}))Ct.call(n,u)&&Ae(d,u,n[u]);if(De)for(var u of De(n))Rt.call(n,u)&&Ae(d,u,n[u]);return d},Be=(d,n)=>wt(d,yt(n)),St=(d,n,u)=>new Promise((S,x)=>{var D=p=>{try{m(u.next(p))}catch(b){x(b)}},E=p=>{try{m(u.throw(p))}catch(b){x(b)}},m=p=>p.done?S(p.value):Promise.resolve(p.value).then(D,E);m((u=u.apply(d,n)).next())});const F=d=>Le.pick(d,["id","attribute","width","height","x","y","imageName"]),_e=Se.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new be,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:X.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:J.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:d=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:d=>!1,removeRectBySpecifyId:(d,n,u)=>!1,removeRectByPointCloudBoxId:d=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:vt()}),bt=({children:d})=>{const[n,u]=r([]),[S,x]=r([]),[D,E]=r([]),[m,p]=r([]),[b,Ve]=r([]),[I,_]=r([]),[L,z]=r([]),[Y,Ne]=r(!0),[$,He]=r(2),[ee,Oe]=r(!0),[te,je]=r(1),[g,oe]=r(),[ne,ie]=r(),[se,re]=r(),[c,le]=r(),[ae,Me]=r(""),[V,ke]=r(X.Rect),N=ct(new be).current,[f,K]=r([]),[de,Fe]=r(""),[H,Ee]=r(J.Detection),[C,ce]=r(void 0),[T,ze]=r([]),[W,Ke]=r([]),[ue,Te]=r(!1),h=mt(),[ge,We]=r({}),Ge=pt(),Ze=e=>{const{imgNode:t,path:o}=e;o&&t&&We(i=>Be(k({},i),{[o]:{width:t.width,height:t.height}}))},G=R(()=>I.length===1?I[0]:"",[I]),pe=It(),O=a((e,t,o="extId")=>{const i=o||"id",s=new Set(t);return p(l=>{let w=!1;const v=l.filter(B=>{const y=B[i],P=s.has(y)?B.imageName!==e:!0;return P||(w=!0),P});return w?v:l}),!0},[]),fe=a(e=>{const t=n.map(o=>o.id);return O(e,t,"extId")},[n,O]),me=a(e=>{if(!e)return!1;const t=n.filter(o=>Array.isArray(o.rects)).map(o=>{const{id:i,attribute:s,trackID:l}=o,w=o.rects.find(v=>v.imageName===e);if(w){const v=Le.pick(w,["width","height","x","y","imageName"]);return Be(k({},v),{id:gt(),attribute:s,order:l,extId:i,lineDash:[]})}return null}).filter(o=>o!==null);return t.length?(p(o=>{const i=new Set(o.filter(l=>e===l.imageName).map(l=>l.extId)),s=t.filter(l=>i.has(l.extId)===!1);return s.length?[...o,...s]:o}),!0):!1},[n]),he=R(()=>n.filter(t=>Array.isArray(t.rects)&&t.rects.length>0).reduce((t,o)=>{var i;return(i=o.rects)==null||i.forEach(s=>{const{imageName:l}=s;if(!l){console.warn("Missing image name"),console.trace(s,o);return}xe(t,l,o.id,o)}),t},new Map),[n]),Ie=a(e=>{p(t=>e(t,F))},[F]),ve=R(()=>m.filter(e=>e.extId!==void 0&&e.id!==void 0).reduce((e,t)=>{const o=t.imageName;return o?(xe(e,o,t.extId,t),e):(console.warn("missing image name"),console.log(t,m),e)},new Map),[m]),{fn:Ue}=ht(e=>{_(t=>{const o=e,i=new Set(o);let s=!1;const l=t.filter(w=>{const v=i.has(w);return v||(s=!0),v});return s?l:t})},200),Pe=a(e=>{const t=e.map(o=>o.id);u(e),Ue(t)},[]),we=R(()=>n.find(e=>e.id===G),[n,G]),Z=R(()=>n.filter(e=>!f.includes(e.attribute)),[n,f]),U=R(()=>S.filter(e=>!f.includes(e.attribute)),[S,f]),q=R(()=>b.filter(e=>e.attribute&&!f.includes(e.attribute)),[b,f]),qe=a(e=>{const t=n.concat(e);return Pe(t),t},[n]),Je=a(e=>{const t=S.concat(e);return x(t),t},[S]),Qe=a(e=>{Ne(e!==!1)},[]),A=a(e=>{e===void 0&&_([]),typeof e=="string"&&_([e]),Array.isArray(e)&&_(Array.from(new Set(e)))},[]),Xe=a(e=>{I.includes(e)?A(I.filter(t=>t!==e)):A([...I,e])},[I]),Ye=a(e=>{const t=F(e);p(o=>[...o,t])},[m]),$e=a((e,t=!1)=>{const o=F(e);p(i=>i.map(s=>s.id===e.id?t?k(k({},s),o):o:s))},[m]),et=a(e=>{p(t=>t.filter(o=>!e.find(i=>i.id===o.id)))},[m]),tt=a(e=>{L.includes(e)?z([]):z([e])},[L]),ot=a(()=>{if(V===X.Rect){const e=n.map(t=>t.id);A(e),g==null||g.pointCloud2dOperation.setSelectedIDs(e)}},[V,n,g,g==null?void 0:g.pointCloud2dOperation]),nt=a(e=>{A(n.filter(t=>t.attribute===e).map(t=>t.id))},[n]),it=a(e=>{if(f.includes(e))K(f.filter(t=>t!==e));else{const t=f.concat(e);K(t)}},[f]),st=a((e=Z,t=D,o=U,i=q,s=T)=>{var l;c==null||c.clearAllBox(),c==null||c.clearAllSphere(),g==null||g.updatePolygonList(e,t),g==null||g.updatePointList(o),g==null||g.updateLineList(i),c==null||c.generateBoxes(e),c==null||c.generateSpheres(o),(l=C==null?void 0:C.store)==null||l.updateCurrentSegment(s),ye(M.Default,e)},[c,g,C,C==null?void 0:C.store]),rt=a(()=>{oe(void 0),ie(void 0),re(void 0),le(void 0)},[]),ye=a((e,t,o)=>St(void 0,null,function*(){var i,s,l;if(!c)return;const w=c.pointCloudObject;if(!w)return;let v=[],B=[];try{if(t&&N.record.length){const{record:y,recordIndex:P}=N;let Ce=P;P>0&&(e===M.SingleToggleValid||e===M.SingleRotate||e===M.Single&&t.length===((i=y[P])==null?void 0:i.pointCloudBoxList.length))&&(Ce=P-1);let dt=(s=y[Ce])==null?void 0:s.pointCloudBoxList;const Re=ut(e,t,dt);v=Re.modifiedBoxIds,B=Re.resetAreas}}catch(y){console.error("call calcResetAreasAndBoxIds error",y)}try{const y=yield c.getHighlightIndexByMappingImgList({mappingImgList:o!=null?o:W,points:w.geometry.attributes.position.array}),P=yield c==null?void 0:c.highlightOriginPointCloud(t,y,{modifiedBoxIds:v,resetAreas:B});return P&&((l=g==null?void 0:g.pointCloudInstance)==null||l.updateColor(P)),P}catch(y){console.error("call highlightOriginPointCloud error",y)}}),[c,c==null?void 0:c.pointCloudObject,N]),lt=a(e=>{H!==e&&(Ge(ft),Ee(e),e===J.Detection&&ce(void 0))},[H]),j=R(()=>({selectedID:G,pointCloudBoxList:n,pointCloudSphereList:S,displayPointCloudList:Z,displaySphereList:U,displayLineList:q,selectedIDs:I,setPointCloudResult:Pe,setSelectedIDs:A,addPointCloudBox:qe,addPointCloudSphere:Je,setPointCloudSphereList:x,valid:Y,selectedPointCloudBox:we,setPointCloudValid:Qe,addSelectedID:Xe,addHighlightID:tt,selectedAllBoxes:ot,topViewInstance:g,setTopViewInstance:oe,sideViewInstance:ne,setSideViewInstance:ie,backViewInstance:se,setBackViewInstance:re,mainViewInstance:c,setMainViewInstance:le,polygonList:D,setPolygonList:E,rectList:m,setRectList:p,addRectIn2DView:Ye,removeRectIn2DView:et,updateRectIn2DView:$e,lineList:b,setLineList:Ve,zoom:te,setZoom:je,history:N,toggleAttributesVisible:it,hideAttributes:f,setHideAttributes:K,reRender:st,attrPanelLayout:de,setAttrPanelLayout:Fe,syncAllViewPointCloudColor:ye,defaultAttribute:ae,setDefaultAttribute:Me,pointCloudPattern:V,setPointCloudPattern:ke,selectSpecAttr:nt,globalPattern:H,setGlobalPattern:lt,ptSegmentInstance:C,setPtSegmentInstance:ce,segmentation:T,setSegmentation:ze,clearAllDetectionInstance:rt,highlight2DDataList:W,setHighlight2DDataList:Ke,highlight2DLoading:ue,setHighlight2DLoading:Te,cuboidBoxIn2DView:ee,setCuboidBoxIn2DView:Oe,imageSizes:ge,cacheImageNodeSize:Ze,highlightIDs:L,setHighlightIDs:z,removeRectByPointCloudBoxId:fe,removeRectBySpecifyId:O,addRectFromPointCloudBoxByImageName:me,rectRotateSensitivity:$,setRectRotateSensitivity:He,imageNamePointCloudBoxMap:he,linkageImageNameRectMap:ve,updateRectListByReducer:Ie,windowKeydownListenerHook:pe}),[Y,we,Z,U,q,D,m,g,ne,se,c,te,de,ae,V,H,C,T,W,ue,ee,ge,L,fe,O,me,$,he,ve,Ie,pe]);Q(()=>{var e,t,o;(e=h==null?void 0:h.setPointCloudBoxList)==null||e.call(h,n),(t=h==null?void 0:h.setHighlightIDs)==null||t.call(h,L),(o=h==null?void 0:h.setSelectedIDs)==null||o.call(h,I)},[n,I,L]),Q(()=>{var e;(e=h==null?void 0:h.setPtCtx)==null||e.call(h,j)},[j]);const at=()=>{const e=n.filter(s=>f.includes(s.attribute)),{setSelectedIDs:t,reRender:o}=j,i=e.map(s=>s.id);i.length>0&&t(I.filter(s=>!i.includes(s))),o()};return Q(()=>{var e,t,o,i;at(),(t=(e=g==null?void 0:g.toolInstance)==null?void 0:e.setHiddenAttributes)==null||t.call(e,f),(i=(o=C==null?void 0:C.store)==null?void 0:o.setHiddenAttributes)==null||i.call(o,f)},[f]),Se.createElement(_e.Provider,{value:j},d)};export{_e as PointCloudContext,bt as PointCloudProvider};
1
+ import{EPointCloudPattern as J}from"@labelbee/lb-utils";import Se,{useState as r,useRef as ct,useMemo as R,useCallback as a,useEffect as Q}from"react";import{EPointCloudBoxRenderTrigger as k,calcResetAreasAndBoxIds as ut}from"../../utils/ToolPointCloudBoxRenderHelper.js";import{ActionsHistory as be,EToolName as X,uuid as gt}from"@labelbee/lb-annotation";import{useDispatch as pt}from"../../store/ctx.js";import{ChangeSave as ft}from"../../store/annotation/actionCreators.js";import mt from"../../store/annotatedBox/index.js";import Le from"lodash";import{addMapIndirectWeakSetItem as xe}from"./utils/map.js";import ht from"./hooks/useTimeoutFunc.js";import It,{getEmptyUseWindowKeydownListener as vt}from"./hooks/useWindowKeydownListener.js";var Pt=Object.defineProperty,wt=Object.defineProperties,yt=Object.getOwnPropertyDescriptors,De=Object.getOwnPropertySymbols,Ct=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,Ae=(d,n,u)=>n in d?Pt(d,n,{enumerable:!0,configurable:!0,writable:!0,value:u}):d[n]=u,F=(d,n)=>{for(var u in n||(n={}))Ct.call(n,u)&&Ae(d,u,n[u]);if(De)for(var u of De(n))Rt.call(n,u)&&Ae(d,u,n[u]);return d},Be=(d,n)=>wt(d,yt(n)),St=(d,n,u)=>new Promise((S,x)=>{var D=p=>{try{m(u.next(p))}catch(b){x(b)}},z=p=>{try{m(u.throw(p))}catch(b){x(b)}},m=p=>p.done?S(p.value):Promise.resolve(p.value).then(D,z);m((u=u.apply(d,n)).next())});const E=d=>Le.pick(d,["id","attribute","width","height","x","y","imageName"]),_e=Se.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new be,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:X.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:J.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:d=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:d=>!1,removeRectBySpecifyId:(d,n,u)=>!1,removeRectByPointCloudBoxId:d=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:vt()}),bt=({children:d})=>{const[n,u]=r([]),[S,x]=r([]),[D,z]=r([]),[m,p]=r([]),[b,Ve]=r([]),[I,_]=r([]),[L,K]=r([]),[Y,Ne]=r(!0),[$,He]=r(2),[ee,Oe]=r(!0),[te,je]=r(1),[g,oe]=r(),[ne,ie]=r(),[se,re]=r(),[c,le]=r(),[ae,Me]=r(""),[V,ke]=r(X.Rect),N=ct(new be).current,[f,T]=r([]),[de,Fe]=r(""),[H,Ee]=r(J.Detection),[C,ce]=r(void 0),[W,ze]=r([]),[O,Ke]=r([]),[ue,Te]=r(!1),h=mt(),[ge,We]=r({}),Ge=pt(),Ze=e=>{const{imgNode:t,path:o}=e;o&&t&&We(i=>Be(F({},i),{[o]:{width:t.width,height:t.height}}))},G=R(()=>I.length===1?I[0]:"",[I]),pe=It(),j=a((e,t,o="extId")=>{const i=o||"id",s=new Set(t);return p(l=>{let w=!1;const v=l.filter(B=>{const y=B[i],P=s.has(y)?B.imageName!==e:!0;return P||(w=!0),P});return w?v:l}),!0},[]),fe=a(e=>{const t=n.map(o=>o.id);return j(e,t,"extId")},[n,j]),me=a(e=>{if(!e)return!1;const t=n.filter(o=>Array.isArray(o.rects)).map(o=>{const{id:i,attribute:s,trackID:l}=o,w=o.rects.find(v=>v.imageName===e);if(w){const v=Le.pick(w,["width","height","x","y","imageName"]);return Be(F({},v),{id:gt(),attribute:s,order:l,extId:i,lineDash:[]})}return null}).filter(o=>o!==null);return t.length?(p(o=>{const i=new Set(o.filter(l=>e===l.imageName).map(l=>l.extId)),s=t.filter(l=>i.has(l.extId)===!1);return s.length?[...o,...s]:o}),!0):!1},[n]),he=R(()=>n.filter(t=>Array.isArray(t.rects)&&t.rects.length>0).reduce((t,o)=>{var i;return(i=o.rects)==null||i.forEach(s=>{const{imageName:l}=s;if(!l){console.warn("Missing image name"),console.trace(s,o);return}xe(t,l,o.id,o)}),t},new Map),[n]),Ie=a(e=>{p(t=>e(t,E))},[E]),ve=R(()=>m.filter(e=>e.extId!==void 0&&e.id!==void 0).reduce((e,t)=>{const o=t.imageName;return o?(xe(e,o,t.extId,t),e):(console.warn("missing image name"),console.log(t,m),e)},new Map),[m]),{fn:Ue}=ht(e=>{_(t=>{const o=e,i=new Set(o);let s=!1;const l=t.filter(w=>{const v=i.has(w);return v||(s=!0),v});return s?l:t})},200),Pe=a(e=>{const t=e.map(o=>o.id);u(e),Ue(t)},[]),we=R(()=>n.find(e=>e.id===G),[n,G]),Z=R(()=>n.filter(e=>!f.includes(e.attribute)),[n,f]),U=R(()=>S.filter(e=>!f.includes(e.attribute)),[S,f]),q=R(()=>b.filter(e=>e.attribute&&!f.includes(e.attribute)),[b,f]),qe=a(e=>{const t=n.concat(e);return Pe(t),t},[n]),Je=a(e=>{const t=S.concat(e);return x(t),t},[S]),Qe=a(e=>{Ne(e!==!1)},[]),A=a(e=>{e===void 0&&_([]),typeof e=="string"&&_([e]),Array.isArray(e)&&_(Array.from(new Set(e)))},[]),Xe=a(e=>{I.includes(e)?A(I.filter(t=>t!==e)):A([...I,e])},[I]),Ye=a(e=>{const t=E(e);p(o=>[...o,t])},[m]),$e=a((e,t=!1)=>{const o=E(e);p(i=>i.map(s=>s.id===e.id?t?F(F({},s),o):o:s))},[m]),et=a(e=>{p(t=>t.filter(o=>!e.find(i=>i.id===o.id)))},[m]),tt=a(e=>{L.includes(e)?K([]):K([e])},[L]),ot=a(()=>{if(V===X.Rect){const e=n.map(t=>t.id);A(e),g==null||g.pointCloud2dOperation.setSelectedIDs(e)}},[V,n,g,g==null?void 0:g.pointCloud2dOperation]),nt=a(e=>{A(n.filter(t=>t.attribute===e).map(t=>t.id))},[n]),it=a(e=>{if(f.includes(e))T(f.filter(t=>t!==e));else{const t=f.concat(e);T(t)}},[f]),st=a((e=Z,t=D,o=U,i=q,s=W)=>{var l;c==null||c.clearAllBox(),c==null||c.clearAllSphere(),g==null||g.updatePolygonList(e,t),g==null||g.updatePointList(o),g==null||g.updateLineList(i),c==null||c.generateBoxes(e),c==null||c.generateSpheres(o),(l=C==null?void 0:C.store)==null||l.updateCurrentSegment(s),ye(k.Default,e)},[c,g,C,C==null?void 0:C.store]),rt=a(()=>{oe(void 0),ie(void 0),re(void 0),le(void 0)},[]),ye=a((e,t,o)=>St(void 0,null,function*(){var i,s,l;if(!c)return;const w=c.pointCloudObject;if(!w)return;let v=[],B=[];try{if(t&&N.record.length){const{record:y,recordIndex:P}=N;let Ce=P;P>0&&(e===k.SingleToggleValid||e===k.SingleRotate||e===k.Single&&t.length===((i=y[P])==null?void 0:i.pointCloudBoxList.length))&&(Ce=P-1);let dt=(s=y[Ce])==null?void 0:s.pointCloudBoxList;const Re=ut(e,t,dt);v=Re.modifiedBoxIds,B=Re.resetAreas}}catch(y){console.error("call calcResetAreasAndBoxIds error",y)}try{const y=yield c.getHighlightIndexByMappingImgList({mappingImgList:o!=null?o:O,points:w.geometry.attributes.position.array}),P=yield c==null?void 0:c.highlightOriginPointCloud(t,y,{modifiedBoxIds:v,resetAreas:B});return P&&((l=g==null?void 0:g.pointCloudInstance)==null||l.updateColor(P)),P}catch(y){console.error("call highlightOriginPointCloud error",y)}}),[c,c==null?void 0:c.pointCloudObject,N,O]),lt=a(e=>{H!==e&&(Ge(ft),Ee(e),e===J.Detection&&ce(void 0))},[H]),M=R(()=>({selectedID:G,pointCloudBoxList:n,pointCloudSphereList:S,displayPointCloudList:Z,displaySphereList:U,displayLineList:q,selectedIDs:I,setPointCloudResult:Pe,setSelectedIDs:A,addPointCloudBox:qe,addPointCloudSphere:Je,setPointCloudSphereList:x,valid:Y,selectedPointCloudBox:we,setPointCloudValid:Qe,addSelectedID:Xe,addHighlightID:tt,selectedAllBoxes:ot,topViewInstance:g,setTopViewInstance:oe,sideViewInstance:ne,setSideViewInstance:ie,backViewInstance:se,setBackViewInstance:re,mainViewInstance:c,setMainViewInstance:le,polygonList:D,setPolygonList:z,rectList:m,setRectList:p,addRectIn2DView:Ye,removeRectIn2DView:et,updateRectIn2DView:$e,lineList:b,setLineList:Ve,zoom:te,setZoom:je,history:N,toggleAttributesVisible:it,hideAttributes:f,setHideAttributes:T,reRender:st,attrPanelLayout:de,setAttrPanelLayout:Fe,syncAllViewPointCloudColor:ye,defaultAttribute:ae,setDefaultAttribute:Me,pointCloudPattern:V,setPointCloudPattern:ke,selectSpecAttr:nt,globalPattern:H,setGlobalPattern:lt,ptSegmentInstance:C,setPtSegmentInstance:ce,segmentation:W,setSegmentation:ze,clearAllDetectionInstance:rt,highlight2DDataList:O,setHighlight2DDataList:Ke,highlight2DLoading:ue,setHighlight2DLoading:Te,cuboidBoxIn2DView:ee,setCuboidBoxIn2DView:Oe,imageSizes:ge,cacheImageNodeSize:Ze,highlightIDs:L,setHighlightIDs:K,removeRectByPointCloudBoxId:fe,removeRectBySpecifyId:j,addRectFromPointCloudBoxByImageName:me,rectRotateSensitivity:$,setRectRotateSensitivity:He,imageNamePointCloudBoxMap:he,linkageImageNameRectMap:ve,updateRectListByReducer:Ie,windowKeydownListenerHook:pe}),[Y,we,Z,U,q,D,m,g,ne,se,c,te,de,ae,V,H,C,W,O,ue,ee,ge,L,fe,j,me,$,he,ve,Ie,pe]);Q(()=>{var e,t,o;(e=h==null?void 0:h.setPointCloudBoxList)==null||e.call(h,n),(t=h==null?void 0:h.setHighlightIDs)==null||t.call(h,L),(o=h==null?void 0:h.setSelectedIDs)==null||o.call(h,I)},[n,I,L]),Q(()=>{var e;(e=h==null?void 0:h.setPtCtx)==null||e.call(h,M)},[M]);const at=()=>{const e=n.filter(s=>f.includes(s.attribute)),{setSelectedIDs:t,reRender:o}=M,i=e.map(s=>s.id);i.length>0&&t(I.filter(s=>!i.includes(s))),o()};return Q(()=>{var e,t,o,i;at(),(t=(e=g==null?void 0:g.toolInstance)==null?void 0:e.setHiddenAttributes)==null||t.call(e,f),(i=(o=C==null?void 0:C.store)==null?void 0:o.setHiddenAttributes)==null||i.call(o,f)},[f]),Se.createElement(_e.Provider,{value:M},d)};export{_e as PointCloudContext,bt as PointCloudProvider};
package/es/index.css CHANGED
@@ -63,6 +63,77 @@
63
63
  justify-content: space-between;
64
64
  margin-top: 16px;
65
65
  }
66
+ .dynamic-resizer-content {
67
+ width: 100%;
68
+ height: 100%;
69
+ flex-shrink: 0;
70
+ flex-grow: 0;
71
+ position: relative;
72
+ }
73
+
74
+ .divider {
75
+ height: 10px;
76
+ width: 100%;
77
+ position: absolute;
78
+ top: -5px;
79
+ left: 0;
80
+ cursor: row-resize;
81
+ user-select: none;
82
+ display: flex;
83
+ align-items: center;
84
+ flex-direction: column;
85
+ justify-content: center;
86
+ }
87
+
88
+ .divider:hover .divider-top, .divider:hover .divider-bottom {
89
+ display: block;
90
+ }
91
+
92
+ .divider-top,
93
+ .divider-bottom {
94
+ width: 20px;
95
+ height: 20px;
96
+ cursor: pointer;
97
+ display: none;
98
+ user-select: none;
99
+ }
100
+
101
+ .divider-icon {
102
+ width: 100%;
103
+ height: 20px;
104
+ position: relative;
105
+ }
106
+ .divider-icon::after {
107
+ content: "";
108
+ display: block;
109
+ position: absolute;
110
+ top: 50%;
111
+ left: 0;
112
+ right: 0;
113
+ width: 90%;
114
+ height: 1px;
115
+ background: #ccc;
116
+ margin: 0 auto;
117
+ }
118
+
119
+ .dynamic-resizer-top {
120
+ width: 100%;
121
+ overflow-y: auto;
122
+ }
123
+
124
+ .dynamic-resizer-bottom {
125
+ width: 100%;
126
+ overflow-y: auto;
127
+ }
128
+
129
+ .hide-scrollbar * {
130
+ scrollbar-width: none; /* Firefox */
131
+ -ms-overflow-style: none; /* IE and Edge */
132
+ }
133
+
134
+ .hide-scrollbar *::-webkit-scrollbar {
135
+ display: none; /* Chrome, Safari, Opera */
136
+ }
66
137
  .index-module_latexEditor__0fK8G {
67
138
  line-height: 32px;
68
139
  background-color: #ededed;
@@ -1 +1 @@
1
- import e,{useState as y,useContext as j,useEffect as D}from"react";import{EditFilled as ot}from"@ant-design/icons";import{ToolIcons as nt}from"../ToolIcons.js";import{EToolName as rt}from"../../../../data/enums/ToolType.js";import{cTool as lt}from"@labelbee/lb-annotation";import{PointCloudContext as h}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as I,Input as it,message as w}from"antd";import st from"../../../../utils/StepUtils.js";import{connect as at}from"react-redux";import{jsonParser as ct,classnames as ut}from"../../../../utils/index.js";import{useStatus as R}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as $}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as mt,useDispatch as dt}from"../../../../store/ctx.js";import pt from"./components/batchUpdateModal/index.js";import ft from"./components/annotatedBox/index.js";import gt from"./components/rectRotateSensitivitySlider/index.js";import vt from"./components/findTrackIDIndex/index.js";import{EPointCloudSegmentStatus as L,EPointCloudPattern as St}from"@labelbee/lb-utils";import bt from"../../../../components/attributeList/index.js";import{useAttribute as Ct}from"../../../../components/pointCloudView/hooks/useAttribute.js";import _t from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import Pt from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import xt from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import Et from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import yt from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import It from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as T}from"../index.js";import{SetTaskStepList as wt}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as Lt}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import Tt from"../../../../components/subAttributeList/index.js";var jt=Object.defineProperty,Dt=Object.defineProperties,ht=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,kt=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable,z=(o,t,n)=>t in o?jt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,A=(o,t)=>{for(var n in t||(t={}))kt.call(t,n)&&z(o,n,t[n]);if(U)for(var n of U(t))At.call(t,n)&&z(o,n,t[n]);return o},V=(o,t)=>Dt(o,ht(t));const Vt=()=>{const[o,t]=y(!1),n=j(h),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:r}=$(),[u,m]=y(""),{t:g}=k(),p=c==null?void 0:c.info.trackID,s=d=>!!a.find(b=>b.trackID===d&&b.id!==(c==null?void 0:c.info.id)),i=(d=!1)=>{const f=parseInt(u,10);if(d&&t(!1),isNaN(f)){w.error(g("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){w.error(g("NotAllowDecimalPointsInTrackID"));return}if(s(f)){w.error(g("DuplicateTrackIDsExist"));return}if(!(f>0)){w.error(g("PositiveIntegerCheck"));return}S(f)};D(()=>{t(!1)},[p]);const S=d=>{var f;const b=r({trackID:d});(f=n==null?void 0:n.topViewInstance)==null||f.updatePolygonList(b!=null?b:[])};return e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,g("CurrentBoxTrackIDs")),p&&e.createElement(pt,{id:p,updateCurrentPolygonList:d=>S(d)})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},o&&p?e.createElement(it,{defaultValue:p,onChange:d=>{m(d.target.value)},disabled:!p,size:"small",onBlur:()=>{i()},onPressEnter:()=>{i(!0)}}):e.createElement("span",null,p),e.createElement(ot,{style:{color:"#999",marginLeft:16,cursor:typeof p!="undefined"?"pointer":"not-allowed"},onClick:()=>{p&&t(!o)}})))},F=({segmentStatus:o,globalPattern:t})=>t===St.Segmentation&&![L.Edit,L.Ready].includes(o),M=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:r,enableColorPicker:u})=>{const[m,g]=y({segmentStatus:L.Ready}),{selectedBox:p}=$(),s=j(h),{ptSegmentInstance:i}=s,{t:S}=k(),{defaultAttribute:d}=Ct(),f=Lt(),{isPointCloudSegmentationPattern:b}=R(),H=dt(),J={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};D(()=>{if(!!i)return i.on("syncPointCloudStatus",g),()=>{i.unbind("syncPointCloudStatus",g)}},[i]);const X=(l,C)=>{var _,P,x,B,N;const E=(_=a==null?void 0:a.attributeList)==null?void 0:_.map(v=>v.value===l?V(A({},v),{color:C}):v),O=V(A({},a),{attributeList:E}),tt=JSON.stringify(O),et=c==null?void 0:c.map(v=>(v==null?void 0:v.step)===(r==null?void 0:r.step)?V(A({},v),{config:tt}):v);(P=s==null?void 0:s.topViewInstance)==null||P.updateAttributeList(E),(x=s==null?void 0:s.sideViewInstance)==null||x.updateAttributeList(E),(B=s==null?void 0:s.backViewInstance)==null||B.updateAttributeList(E),(N=s==null?void 0:s.mainViewInstance)==null||N.setConfig(O),H(wt({stepList:et}))},Y=l=>{f.updateViewsByDefaultSize&&f.updateViewsByDefaultSize(l)},q=l=>{F({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setDefaultAttribute(l)},G=(l,C)=>{F({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setSubAttribute(l,C)},K=o.map(l=>({label:l.key,value:l.value,color:l==null?void 0:l.color,limit:l==null?void 0:l.limit,isDefault:l==null?void 0:l.isDefault})),Q=p||m.cacheSegData&&m.segmentStatus===L.Edit,Z=b;return e.createElement("div",{style:{flex:1,overflowX:"hidden",overflowY:"auto"}},e.createElement("div",{style:J},S("Attribute")),e.createElement(bt,{list:K,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:l=>q(l),updateColorConfig:X,enableColorPicker:u,updateSize:Y,forbidShowLimitPopover:Z}),e.createElement(I,{style:{margin:0}}),Q&&e.createElement(Tt,{subAttributeList:t,setSubAttribute:G,getValue:l=>{var C,_,P,x;return((_=(C=s.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:_[l.value])||((x=(P=m.cacheSegData)==null?void 0:P.subAttribute)==null?void 0:x[l.value])}}))},Bt=[{toolName:"LassoSelector",commonSvg:_t,selectedSvg:Pt},{toolName:"RectSelector",commonSvg:yt,selectedSvg:It},{toolName:"CircleSelector",commonSvg:xt,selectedSvg:Et}],W=({toolInstance:o})=>{const{ptSegmentInstance:t}=j(h),[n,a]=y("LassoSelector"),{t:c}=k();return D(()=>{if(!t)return;const r=()=>{a("LassoSelector")},u=()=>{a("RectSelector")},m=()=>{a("CircleSelector")};return t.on("LassoSelector",r),t.on("RectSelector",u),t.on("CircleSelector",m),()=>{t.unbind("LassoSelector",r),t.unbind("RectSelector",u),t.unbind("CircleSelector",m)}},[t]),e.createElement("div",{className:`${T}__level`},Bt.map(r=>{const u=n===r.toolName;return e.createElement("span",{className:`${T}__toolOption`,key:r.toolName,onClick:()=>t==null?void 0:t.emit(r.toolName)},e.createElement("img",{className:`${T}__singleTool`,src:u?r==null?void 0:r.selectedSvg:r==null?void 0:r.commonSvg}),e.createElement("span",{className:ut({[`${T}__toolOption__selected`]:u})},c(r.toolName)))}))},Nt=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:r})=>{var u,m;const{updatePointCloudPattern:g,pointCloudPattern:p,isPointCloudSegmentationPattern:s}=R(),i=ct(o.config),S=(u=i==null?void 0:i.attributeList)!=null?u:[],d=(i==null?void 0:i.secondaryAttributeConfigurable)===!0?(m=i==null?void 0:i.inputList)!=null?m:[]:[];return s?e.createElement(e.Fragment,null,e.createElement(W,{toolInstance:t}),e.createElement(M,{toolInstance:t,attributeList:S,subAttributeList:d,config:i,stepList:c,stepInfo:o,enableColorPicker:r})):e.createElement(e.Fragment,null,e.createElement(nt,{toolName:lt.EPointCloudName.PointCloud,selectedToolName:p,onChange:f=>g==null?void 0:g(f)}),e.createElement(M,{toolInstance:t,attributeList:S,subAttributeList:d,config:i,stepList:c,stepInfo:o,enableColorPicker:r}),(i==null?void 0:i.trackConfigurable)===!0&&p===rt.Rect&&e.createElement("div",{style:{flexShrink:0,height:280,overflow:"auto"}},e.createElement(Vt,null),e.createElement(I,{style:{margin:0}}),e.createElement(ft,{imgList:n,imgIndex:a}),e.createElement(I,{style:{margin:0}}),e.createElement(vt,{imgList:n,imgIndex:a}),e.createElement(I,{style:{margin:0}}),e.createElement(gt,null)))},Ot=o=>{var t,n,a,c;const r=st.getCurrentStepInfo((t=o.annotation)==null?void 0:t.step,(n=o.annotation)==null?void 0:n.stepList),u=(a=o.annotation)==null?void 0:a.toolInstance,m=(c=o.annotation)==null?void 0:c.stepList;return{stepInfo:r,toolInstance:u,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:m}};var Rt=at(Ot,null,null,{context:mt})(Nt);export{W as PointCloudSegToolIcon,Rt as default};
1
+ import e,{useState as P,useContext as j,useEffect as I}from"react";import{EditFilled as ot}from"@ant-design/icons";import{ToolIcons as nt}from"../ToolIcons.js";import{EToolName as lt}from"../../../../data/enums/ToolType.js";import{cTool as rt}from"@labelbee/lb-annotation";import{PointCloudContext as h}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as w,Input as it,message as D}from"antd";import st from"../../../../utils/StepUtils.js";import{connect as at}from"react-redux";import{jsonParser as ct,classnames as ut}from"../../../../utils/index.js";import{useStatus as R}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as $}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as mt,useDispatch as dt}from"../../../../store/ctx.js";import pt from"./components/batchUpdateModal/index.js";import ft from"./components/annotatedBox/index.js";import vt from"./components/rectRotateSensitivitySlider/index.js";import gt from"./components/findTrackIDIndex/index.js";import{EPointCloudSegmentStatus as L,EPointCloudPattern as St}from"@labelbee/lb-utils";import bt from"../../../../components/attributeList/index.js";import{useAttribute as Ct}from"../../../../components/pointCloudView/hooks/useAttribute.js";import _t from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import yt from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import Et from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import xt from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import Pt from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import wt from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as T}from"../index.js";import{SetTaskStepList as Dt}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as Lt}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import Tt from"../../../../components/subAttributeList/index.js";import jt from"../../../../components/DynamicResizer/DynamicResizer.js";var It=Object.defineProperty,ht=Object.defineProperties,kt=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,Vt=Object.prototype.propertyIsEnumerable,U=(o,t,n)=>t in o?It(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,A=(o,t)=>{for(var n in t||(t={}))At.call(t,n)&&U(o,n,t[n]);if(z)for(var n of z(t))Vt.call(t,n)&&U(o,n,t[n]);return o},V=(o,t)=>ht(o,kt(t));const Bt=()=>{const[o,t]=P(!1),n=j(h),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:l}=$(),[u,m]=P(""),{t:v}=k(),p=c==null?void 0:c.info.trackID,s=d=>!!a.find(b=>b.trackID===d&&b.id!==(c==null?void 0:c.info.id)),i=(d=!1)=>{const f=parseInt(u,10);if(d&&t(!1),isNaN(f)){D.error(v("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){D.error(v("NotAllowDecimalPointsInTrackID"));return}if(s(f)){D.error(v("DuplicateTrackIDsExist"));return}if(!(f>0)){D.error(v("PositiveIntegerCheck"));return}S(f)};I(()=>{t(!1)},[p]);const S=d=>{var f;const b=l({trackID:d});(f=n==null?void 0:n.topViewInstance)==null||f.updatePolygonList(b!=null?b:[])};return e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,v("CurrentBoxTrackIDs")),p&&e.createElement(pt,{id:p,updateCurrentPolygonList:d=>S(d)})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},o&&p?e.createElement(it,{defaultValue:p,onChange:d=>{m(d.target.value)},disabled:!p,size:"small",onBlur:()=>{i()},onPressEnter:()=>{i(!0)}}):e.createElement("span",null,p),e.createElement(ot,{style:{color:"#999",marginLeft:16,cursor:typeof p!="undefined"?"pointer":"not-allowed"},onClick:()=>{p&&t(!o)}})))},F=({segmentStatus:o,globalPattern:t})=>t===St.Segmentation&&![L.Edit,L.Ready].includes(o),H=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:l,enableColorPicker:u})=>{const[m,v]=P({segmentStatus:L.Ready}),{selectedBox:p}=$(),s=j(h),{ptSegmentInstance:i}=s,{t:S}=k(),{defaultAttribute:d}=Ct(),f=Lt(),{isPointCloudSegmentationPattern:b}=R(),W=dt(),J={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};I(()=>{if(!!i)return i.on("syncPointCloudStatus",v),()=>{i.unbind("syncPointCloudStatus",v)}},[i]);const K=(r,C)=>{var _,y,E,B,N;const x=(_=a==null?void 0:a.attributeList)==null?void 0:_.map(g=>g.value===r?V(A({},g),{color:C}):g),O=V(A({},a),{attributeList:x}),tt=JSON.stringify(O),et=c==null?void 0:c.map(g=>(g==null?void 0:g.step)===(l==null?void 0:l.step)?V(A({},g),{config:tt}):g);(y=s==null?void 0:s.topViewInstance)==null||y.updateAttributeList(x),(E=s==null?void 0:s.sideViewInstance)==null||E.updateAttributeList(x),(B=s==null?void 0:s.backViewInstance)==null||B.updateAttributeList(x),(N=s==null?void 0:s.mainViewInstance)==null||N.setConfig(O),W(Dt({stepList:et}))},X=r=>{f.updateViewsByDefaultSize&&f.updateViewsByDefaultSize(r)},Y=r=>{F({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setDefaultAttribute(r)},q=(r,C)=>{F({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setSubAttribute(r,C)},G=o.map(r=>({label:r.key,value:r.value,color:r==null?void 0:r.color,limit:r==null?void 0:r.limit,isDefault:r==null?void 0:r.isDefault})),Q=p||m.cacheSegData&&m.segmentStatus===L.Edit,Z=b;return e.createElement("div",{style:{height:"100%",overflow:"auto",display:"flex",flexDirection:"column"}},e.createElement("div",{style:J},S("Attribute")),e.createElement("div",{style:{height:0,flex:1,overflowY:"auto",overflowX:"hidden"}},e.createElement(bt,{list:G,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:r=>Y(r),updateColorConfig:K,enableColorPicker:u,updateSize:X,forbidShowLimitPopover:Z}),e.createElement(w,{style:{margin:0}}),Q&&e.createElement(Tt,{subAttributeList:t,setSubAttribute:q,getValue:r=>{var C,_,y,E;return((_=(C=s.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:_[r.value])||((E=(y=m.cacheSegData)==null?void 0:y.subAttribute)==null?void 0:E[r.value])}})))},Nt=[{toolName:"LassoSelector",commonSvg:_t,selectedSvg:yt},{toolName:"RectSelector",commonSvg:Pt,selectedSvg:wt},{toolName:"CircleSelector",commonSvg:Et,selectedSvg:xt}],M=({toolInstance:o})=>{const{ptSegmentInstance:t}=j(h),[n,a]=P("LassoSelector"),{t:c}=k();return I(()=>{if(!t)return;const l=()=>{a("LassoSelector")},u=()=>{a("RectSelector")},m=()=>{a("CircleSelector")};return t.on("LassoSelector",l),t.on("RectSelector",u),t.on("CircleSelector",m),()=>{t.unbind("LassoSelector",l),t.unbind("RectSelector",u),t.unbind("CircleSelector",m)}},[t]),e.createElement("div",{className:`${T}__level`},Nt.map(l=>{const u=n===l.toolName;return e.createElement("span",{className:`${T}__toolOption`,key:l.toolName,onClick:()=>t==null?void 0:t.emit(l.toolName)},e.createElement("img",{className:`${T}__singleTool`,src:u?l==null?void 0:l.selectedSvg:l==null?void 0:l.commonSvg}),e.createElement("span",{className:ut({[`${T}__toolOption__selected`]:u})},c(l.toolName)))}))},Ot=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:l})=>{var u,m;const{updatePointCloudPattern:v,pointCloudPattern:p,isPointCloudSegmentationPattern:s}=R(),i=ct(o.config),S=(u=i==null?void 0:i.attributeList)!=null?u:[],d=(i==null?void 0:i.secondaryAttributeConfigurable)===!0?(m=i==null?void 0:i.inputList)!=null?m:[]:[];return s?e.createElement(e.Fragment,null,e.createElement(M,{toolInstance:t}),e.createElement(H,{toolInstance:t,attributeList:S,subAttributeList:d,config:i,stepList:c,stepInfo:o,enableColorPicker:l})):e.createElement(e.Fragment,null,e.createElement(nt,{toolName:rt.EPointCloudName.PointCloud,selectedToolName:p,onChange:f=>v==null?void 0:v(f)}),e.createElement("div",{style:{flex:1,overflow:"hidden"}},e.createElement(jt,{minTopHeight:42,defaultHeight:100,localKey:"id:"+(o==null?void 0:o.id)+"taskID:"+(o==null?void 0:o.taskID)+"step:"+(o==null?void 0:o.step)+"type:"+(o==null?void 0:o.type)},e.createElement(H,{toolInstance:t,attributeList:S,subAttributeList:d,config:i,stepList:c,stepInfo:o,enableColorPicker:l}),(i==null?void 0:i.trackConfigurable)===!0&&p===lt.Rect?e.createElement("div",{style:{height:"100%",overflow:"auto"}},e.createElement(Bt,null),e.createElement(w,{style:{margin:0}}),e.createElement(ft,{imgList:n,imgIndex:a}),e.createElement(w,{style:{margin:0}}),e.createElement(gt,{imgList:n,imgIndex:a}),e.createElement(w,{style:{margin:0}}),e.createElement(vt,null)):e.createElement("div",null))))},Rt=o=>{var t,n,a,c;const l=st.getCurrentStepInfo((t=o.annotation)==null?void 0:t.step,(n=o.annotation)==null?void 0:n.stepList),u=(a=o.annotation)==null?void 0:a.toolInstance,m=(c=o.annotation)==null?void 0:c.stepList;return{stepInfo:l,toolInstance:u,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:m}};var $t=at(Rt,null,null,{context:mt})(Ot);export{M as PointCloudSegToolIcon,$t as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.23.0-alpha.71",
3
+ "version": "1.23.0-alpha.73",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -57,6 +57,7 @@
57
57
  "postcss-url": "^10.1.3",
58
58
  "re-resizable": "^6.9.9",
59
59
  "react-colorful": "^5.6.1",
60
+ "react-draggable": "^4.4.6",
60
61
  "react-i18next": "^11.12.0",
61
62
  "react-markdown": "^8.0.7",
62
63
  "react-redux": "^7.2.3",