@labelbee/lb-components 1.24.0-alpha.30 → 1.24.0-alpha.31

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.
@@ -1,2 +1,2 @@
1
- function i(o,a){var r=atob(o);if(a){for(var e=new Uint8Array(r.length),n=0,t=r.length;n<t;++n)e[n]=r.charCodeAt(n);return String.fromCharCode.apply(null,new Uint16Array(e.buffer))}return r}function l(o,a,r){var e=a===void 0?null:a,n=r===void 0?!1:r,t=i(o,n),u=t.indexOf(`
2
- `,10)+1,c=t.substring(u)+(e?"//# sourceMappingURL="+e:""),f=new Blob([c],{type:"application/javascript"});return URL.createObjectURL(f)}function v(o,a,r){var e;return function(t){return e=e||l(o,a,r),new Worker(e,t)}}export{v as createBase64WorkerFactory};
1
+ function i(o,t){var e=atob(o);if(t){for(var r=new Uint8Array(e.length),n=0,a=e.length;n<a;++n)r[n]=e.charCodeAt(n);return new TextDecoder("utf-16le").decode(new Uint16Array(r.buffer))}return e}function u(o,t,e){var r=t===void 0?null:t,n=e===void 0?!1:e,a=i(o,n),c=a.indexOf(`
2
+ `,10)+1,d=a.substring(c)+(r?"//# sourceMappingURL="+r:""),f=new Blob([d],{type:"application/javascript"});return URL.createObjectURL(f)}function v(o,t,e){var r;return function(a){return r=r||u(o,t,e),new Worker(r,a)}}export{v as createBase64WorkerFactory,u as createURL};
@@ -1 +1 @@
1
- import{createBase64WorkerFactory as l}from"./_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js";var Z=l("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7dmFyIGU9T2JqZWN0LmRlZmluZVByb3BlcnR5LHQ9T2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyxuPU9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHksbz1PYmplY3QucHJvdG90eXBlLnByb3BlcnR5SXNFbnVtZXJhYmxlLGE9KHQsbixvKT0+biBpbiB0P2UodCxuLHtlbnVtZXJhYmxlOiEwLGNvbmZpZ3VyYWJsZTohMCx3cml0YWJsZTohMCx2YWx1ZTpvfSk6dFtuXT1vLHI9KGUscik9Pntmb3IodmFyIHMgaW4gcnx8KHI9e30pKW4uY2FsbChyLHMpJiZhKGUscyxyW3NdKTtpZih0KWZvcih2YXIgcyBvZiB0KHIpKW8uY2FsbChyLHMpJiZhKGUscyxyW3NdKTtyZXR1cm4gZX07b25tZXNzYWdlPWZ1bmN0aW9uKGUpe2NvbnN0e2NhY2hlTWFwOnQsaW5kZXhlczpuLGRlZmF1bHRSR0JBOm99PWUuZGF0YSxhPW4ubGVuZ3RoLHM9W107Zm9yKGxldCBlPTA7ZTxhO2UrPTEpe2NvbnN0IG89dFtuW2VdXTtvJiZzLnB1c2gocih7fSxvKSl9cG9zdE1lc3NhZ2Uoe2Fubm90YXRpb25zOlt7dHlwZToicGl4ZWxQb2ludHMiLGFubm90YXRpb246cyxkZWZhdWx0UkdCQTpvfV19KX19KCk7Cgo=",null,!1);export{Z as default};
1
+ import{createBase64WorkerFactory as l}from"./_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js";var Z=l("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7dmFyIGM9T2JqZWN0LmRlZmluZVByb3BlcnR5LG89T2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyxsPU9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHksZj1PYmplY3QucHJvdG90eXBlLnByb3BlcnR5SXNFbnVtZXJhYmxlLGE9KHIsZSx0KT0+ZSBpbiByP2MocixlLHtlbnVtZXJhYmxlOiEwLGNvbmZpZ3VyYWJsZTohMCx3cml0YWJsZTohMCx2YWx1ZTp0fSk6cltlXT10LHU9KHIsZSk9Pntmb3IodmFyIHQgaW4gZXx8KGU9e30pKWwuY2FsbChlLHQpJiZhKHIsdCxlW3RdKTtpZihvKWZvcih2YXIgdCBvZiBvKGUpKWYuY2FsbChlLHQpJiZhKHIsdCxlW3RdKTtyZXR1cm4gcn07b25tZXNzYWdlPWZ1bmN0aW9uKGUpe2NvbnN0e2NhY2hlTWFwOnQsaW5kZXhlczpzLGRlZmF1bHRSR0JBOl99PWUuZGF0YSxkPXMubGVuZ3RoLHA9W107Zm9yKGxldCBuPTA7bjxkO249bisxKXtjb25zdCBpPXRbc1tuXV07aSYmcC5wdXNoKHUoe30saSkpfXBvc3RNZXNzYWdlKHthbm5vdGF0aW9uczpbe3R5cGU6InBpeGVsUG9pbnRzIixhbm5vdGF0aW9uOnAsZGVmYXVsdFJHQkE6X31dfSl9fSkoKTsKCg==",null,!1);export{Z as default};
@@ -1 +1 @@
1
- import{useLatest as oe,useMemoizedFn as q,useDebounceEffect as he}from"ahooks";import{Spin as De}from"antd/es";import Z,{useContext as _e,useRef as J,useState as O,useMemo as be,useCallback as Ce,useEffect as p}from"react";import{connect as we}from"react-redux";import{usePointCloudViews as ye}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as xe}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as Pe}from"../../store/annotation/map.js";import{LabelBeeContext as Se}from"../../store/ctx.js";import{PointCloud2DRectOperation as Le,ImgUtils as Oe}from"@labelbee/lb-annotation";import{ImgPosUtils as Ve}from"@labelbee/lb-utils";import{selectSpecifiedRectsFromTopViewSelectedIds as Ee}from"./util.js";import{useUpdateRectList as je}from"./useUpdateRectList.js";import Be from"lodash";import{useToolStyleContext as Ne}from"../../hooks/useToolStyle.js";import ke from"../../store/toolConfig/index.js";var Ue=Object.defineProperty,Ae=Object.defineProperties,ze=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertySymbols,Me=Object.prototype.hasOwnProperty,Te=Object.prototype.propertyIsEnumerable,ce=(a,l,s)=>l in a?Ue(a,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[l]=s,v=(a,l)=>{for(var s in l||(l={}))Me.call(l,s)&&ce(a,s,l[s]);if(ie)for(var s of ie(l))Te.call(l,s)&&ce(a,s,l[s]);return a},C=(a,l)=>Ae(a,ze(l)),$=(a,l,s)=>new Promise((f,g)=>{var _=u=>{try{b(s.next(u))}catch(R){g(R)}},V=u=>{try{b(s.throw(u))}catch(R){g(R)}},b=u=>u.done?f(u.value):Promise.resolve(u.value).then(_,V);b((s=s.apply(a,l)).next())});const Fe=a=>{var l,s;const{mappingData:f,size:g,config:_,checkMode:V,afterImgOnLoad:b,shouldExcludePointCloudBoxListUpdate:u}=a,{selectBoxVisibleSwitch:R}=ke(),E=(l=f==null?void 0:f.url)!=null?l:"",w=(s=f==null?void 0:f.fallbackUrl)!=null?s:"",{pointCloudBoxList:j,setPointCloudResult:B,defaultAttribute:N,rectList:k,addRectIn2DView:le,updateRectIn2DView:se,removeRectIn2DView:ue,updateRectListByReducer:de,selectedIDs:m,setSelectedIDs:U,selectedID:y}=_e(xe),{value:A}=Ne(),ae=oe(m),{update2DViewRect:fe,remove2DViewRect:pe}=ye(),z=Z.useRef(null),n=J(null),G=q(fe),x=q(pe),P=J(null),[me,K]=O(!0),[Q,W]=O(""),[ve,M]=O(!1),[ge,S]=O(!0),I=be(()=>k==null?void 0:k.filter(e=>e.imageName===(f==null?void 0:f.path)),[f==null?void 0:f.path,k]),X=J(I),L=oe(f==null?void 0:f.path),T=Ce(e=>$(void 0,null,function*(){try{const o=ae.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(o.length){const r=new Set(o),i=t.filter(c=>r.has(c.id)).map(c=>c.id);U(i)}return t}catch(o){}}),[U]),Y=e=>{const{boxID:o}=e;if(S(!1),!u&&o){T(()=>{const t=G==null?void 0:G(e);return t?(P.current=t,B(t),t):null});return}se(e,!0)},ee=e=>{L.current&&le(C(v({},e),{imageName:L.current}))},te=e=>{if(e.length===0)return;if(!u){const t=e.find(r=>r.boxID);if(t){T(()=>{const r=x==null?void 0:x(t);return r?(P.current=r,B(r),h(),r):null});return}}const o=e.find(t=>t.extId);o&&T(()=>{const{imageName:t,extId:r}=o,i=x==null?void 0:x({boxID:r,imageName:t});return i?(P.current=i,B(i),i):null}),ue(e)},Re=q(()=>{let e=[];return j.forEach(o=>{const{rects:t=[],id:r,attribute:i,trackID:c}=o,d=t.find(F=>F.imageName===L.current),D=r+"_"+L.current;d&&(e=[...e,C(v({},d),{boxID:r,id:D,attribute:i,order:c})])}),e}),h=je(()=>{var e,o,t,r,i;const c=u?[]:Re(),d=(e=n.current)==null?void 0:e.selectedRectID,D=m.slice(0),F=R?Ee(D,c,I):[...c,...I];let ne=[];!R&&(m==null?void 0:m.length)&&(ne=c.filter(H=>d?m.includes(H.boxID)&&!d.includes(H.boxID):m.includes(H.boxID))),(o=n.current)==null||o.setHighLightRectList(ne),(t=n.current)==null||t.setResult(F),Q?((r=n.current)==null||r.setSelectedRectID(Q),W("")):ve&&d&&((i=n.current)==null||i.setSelectedRectID(d),M(!1))}),re=({targetId:e,id:o})=>{S(!1),requestAnimationFrame(()=>{Ie(e),W(o)})},Ie=e=>{(Array.isArray(m)?m:[]).includes(e)||U(e)};return p(()=>{if(z.current){const e=new Le({container:z.current,size:g,config:C(v({},_),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:V});return n.current=e,n.current.init(),n.current.on("updateDragResult",Y),n.current.on("afterAddingDrawingRect",ee),n.current.on("deleteSelectedRects",te),n.current.on("onRightClick",re),()=>{var o,t,r,i,c;(o=n.current)==null||o.unbind("updateDragResult",Y),(t=n.current)==null||t.unbind("afterAddingDrawingRect",ee),(r=n.current)==null||r.unbind("deleteSelectedRects",te),(i=n.current)==null||i.unbind("onRightClick",re),(c=n.current)==null||c.destroy()}}},[]),p(()=>{const e=t=>$(void 0,null,function*(){try{return yield Oe.load(t)}catch(r){return console.error("Error loading image:",r),null}}),o=()=>$(void 0,null,function*(){var t;K(!0);let r=yield e(E);!r&&w&&(r=yield e(w)),r&&((t=n.current)==null||t.setImgNode(r),b(r)),K(!1)});n.current&&(E||w)&&o()},[E,w]),p(()=>{var e;(e=n.current)==null||e.setSize(g)},[g]),p(()=>{j!==P.current&&h()},[j]),p(()=>{var e,o;const t=I.find(r=>r.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,N),t&&de(r=>{var i;const c=[];let d=null;return r.forEach(D=>{D.id!==n.current.selectedRectID?c.push(D):d=D}),t.extId===void 0&&(d=(i=n.current)==null?void 0:i.selectedRect),[...c,C(v({},d||{}),{attribute:N})]}),M(!0),h()},[N]),p(()=>{const e=X.current;Be.isEqual(e,I)||(M(!0),h(),X.current=I)},[I]),p(()=>{h()},[u]),p(()=>{var e,o,t,r;const i=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},c=C(v({},i),{attributeList:(t=_.attributeList)!=null?t:[]});(r=n.current)==null||r.setConfig(JSON.stringify(c))},[_.attributeList]),p(()=>{var e;(e=n.current)==null||e.setEnableAddRect(m.length===0),h()},[m]),he(()=>{if(!y||!ge){S(!0),u&&(n.current.setHoverRectID(""),n.current.render());return}const{rectList:e,size:o,zoom:t,imgNode:r}=n.current,i=e.find(d=>d.boxID===y||d.extId===y),c=Ve.getBasicRecPos(r,i,o,.5);if(!c){S(!0);return}u&&n.current.setHoverRectID(i.id),n.current.setCurrentPos(c.currentPos),n.current.setZoom(c.innerZoom),n.current.renderBasicCanvas(),n.current.render()},[y],{wait:200}),p(()=>{const{hiddenText:e}=A||{};if(e===void 0)return;const o=n.current;if(!o)return;const t=v(v({},o.style),A);o.setStyle(t)},[A]),p(()=>{h()},[R]),Z.createElement(De,{spinning:me},Z.createElement("div",{ref:z,style:v({position:"relative"},g)}))};var He=we(Pe,null,null,{context:Se})(Fe);export{He as default};
1
+ import{useLatest as ce,useMemoizedFn as Z,useDebounceEffect as _e}from"ahooks";import{Spin as be}from"antd/es";import q,{useContext as Ce,useRef as J,useState as O,useMemo as we,useCallback as ye,useEffect as p}from"react";import{connect as xe}from"react-redux";import{usePointCloudViews as Pe}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as Se}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as Le}from"../../store/annotation/map.js";import{LabelBeeContext as Oe}from"../../store/ctx.js";import{PointCloud2DRectOperation as Ve,ImgUtils as Ee}from"@labelbee/lb-annotation";import{ImgPosUtils as je}from"@labelbee/lb-utils";import{selectSpecifiedRectsFromTopViewSelectedIds as Be}from"./util.js";import{useUpdateRectList as Ne}from"./useUpdateRectList.js";import ke from"lodash";import{useToolStyleContext as Ue}from"../../hooks/useToolStyle.js";import Ae from"../../store/toolConfig/index.js";var Te=Object.defineProperty,ze=Object.defineProperties,Me=Object.getOwnPropertyDescriptors,le=Object.getOwnPropertySymbols,Fe=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,se=(a,l,s)=>l in a?Te(a,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[l]=s,v=(a,l)=>{for(var s in l||(l={}))Fe.call(l,s)&&se(a,s,l[s]);if(le)for(var s of le(l))He.call(l,s)&&se(a,s,l[s]);return a},C=(a,l)=>ze(a,Me(l)),$=(a,l,s)=>new Promise((f,g)=>{var _=u=>{try{b(s.next(u))}catch(R){g(R)}},V=u=>{try{b(s.throw(u))}catch(R){g(R)}},b=u=>u.done?f(u.value):Promise.resolve(u.value).then(_,V);b((s=s.apply(a,l)).next())});const Ze=a=>{var l,s;const{mappingData:f,size:g,config:_,checkMode:V,afterImgOnLoad:b,shouldExcludePointCloudBoxListUpdate:u}=a,{selectBoxVisibleSwitch:R,attrChangeTrigger:G}=Ae(),E=(l=f==null?void 0:f.url)!=null?l:"",w=(s=f==null?void 0:f.fallbackUrl)!=null?s:"",{pointCloudBoxList:j,setPointCloudResult:B,defaultAttribute:N,rectList:k,addRectIn2DView:ue,updateRectIn2DView:de,removeRectIn2DView:ae,updateRectListByReducer:fe,selectedIDs:m,setSelectedIDs:U,selectedID:y}=Ce(Se),{value:A}=Ue(),pe=ce(m),{update2DViewRect:me,remove2DViewRect:ve}=Pe(),T=q.useRef(null),n=J(null),K=Z(me),x=Z(ve),P=J(null),[ge,Q]=O(!0),[W,X]=O(""),[Re,z]=O(!1),[Ie,S]=O(!0),I=we(()=>k==null?void 0:k.filter(e=>e.imageName===(f==null?void 0:f.path)),[f==null?void 0:f.path,k]),Y=J(I),L=ce(f==null?void 0:f.path),M=ye(e=>$(void 0,null,function*(){try{const o=pe.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(o.length){const r=new Set(o),i=t.filter(c=>r.has(c.id)).map(c=>c.id);U(i)}return t}catch(o){}}),[U]),ee=e=>{const{boxID:o}=e;if(S(!1),!u&&o){M(()=>{const t=K==null?void 0:K(e);return t?(P.current=t,B(t),t):null});return}de(e,!0)},te=e=>{L.current&&ue(C(v({},e),{imageName:L.current}))},re=e=>{if(e.length===0)return;if(!u){const t=e.find(r=>r.boxID);if(t){M(()=>{const r=x==null?void 0:x(t);return r?(P.current=r,B(r),h(),r):null});return}}const o=e.find(t=>t.extId);o&&M(()=>{const{imageName:t,extId:r}=o,i=x==null?void 0:x({boxID:r,imageName:t});return i?(P.current=i,B(i),i):null}),ae(e)},he=Z(()=>{let e=[];return j.forEach(o=>{const{rects:t=[],id:r,attribute:i,trackID:c}=o,d=t.find(F=>F.imageName===L.current),D=r+"_"+L.current;d&&(e=[...e,C(v({},d),{boxID:r,id:D,attribute:i,order:c})])}),e}),h=Ne(()=>{var e,o,t,r,i;const c=u?[]:he(),d=(e=n.current)==null?void 0:e.selectedRectID,D=m.slice(0),F=R?Be(D,c,I):[...c,...I];let ie=[];!R&&(m==null?void 0:m.length)&&(ie=c.filter(H=>d?m.includes(H.boxID)&&!d.includes(H.boxID):m.includes(H.boxID))),(o=n.current)==null||o.setHighLightRectList(ie),(t=n.current)==null||t.setResult(F),W?((r=n.current)==null||r.setSelectedRectID(W),X("")):Re&&d&&((i=n.current)==null||i.setSelectedRectID(d),z(!1))}),ne=({targetId:e,id:o})=>{S(!1),De(e),X(o)},De=e=>{(Array.isArray(m)?m:[]).includes(e)||U(e)},oe=()=>{var e,o;const t=I.find(r=>r.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,N),t&&fe(r=>{var i;const c=[];let d=null;return r.forEach(D=>{D.id!==n.current.selectedRectID?c.push(D):d=D}),t.extId===void 0&&(d=(i=n.current)==null?void 0:i.selectedRect),[...c,C(v({},d||{}),{attribute:N})]}),z(!0),h()};return p(()=>{if(T.current){const e=new Ve({container:T.current,size:g,config:C(v({},_),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:V});return n.current=e,n.current.init(),n.current.on("updateDragResult",ee),n.current.on("afterAddingDrawingRect",te),n.current.on("deleteSelectedRects",re),n.current.on("onRightClick",ne),()=>{var o,t,r,i,c;(o=n.current)==null||o.unbind("updateDragResult",ee),(t=n.current)==null||t.unbind("afterAddingDrawingRect",te),(r=n.current)==null||r.unbind("deleteSelectedRects",re),(i=n.current)==null||i.unbind("onRightClick",ne),(c=n.current)==null||c.destroy()}}},[]),p(()=>{const e=t=>$(void 0,null,function*(){try{return yield Ee.load(t)}catch(r){return console.error("Error loading image:",r),null}}),o=()=>$(void 0,null,function*(){var t;Q(!0);let r=yield e(E);!r&&w&&(r=yield e(w)),r&&((t=n.current)==null||t.setImgNode(r),b(r)),Q(!1)});n.current&&(E||w)&&o()},[E,w]),p(()=>{var e;(e=n.current)==null||e.setSize(g)},[g]),p(()=>{j!==P.current&&h()},[j]),p(()=>{oe()},[N]),p(()=>{G&&oe()},[G]),p(()=>{const e=Y.current;ke.isEqual(e,I)||(z(!0),h(),Y.current=I)},[I]),p(()=>{h()},[u]),p(()=>{var e,o,t,r;const i=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},c=C(v({},i),{attributeList:(t=_.attributeList)!=null?t:[]});(r=n.current)==null||r.setConfig(JSON.stringify(c))},[_.attributeList]),p(()=>{var e;(e=n.current)==null||e.setEnableAddRect(m.length===0),h()},[m]),_e(()=>{if(!y||!Ie){S(!0),u&&(n.current.setHoverRectID(""),n.current.render());return}const{rectList:e,size:o,zoom:t,imgNode:r}=n.current,i=e.find(d=>d.boxID===y||d.extId===y),c=je.getBasicRecPos(r,i,o,.5);if(!c){S(!0);return}u&&n.current.setHoverRectID(i.id),n.current.setCurrentPos(c.currentPos),n.current.setZoom(c.innerZoom),n.current.renderBasicCanvas(),n.current.render()},[y],{wait:200}),p(()=>{const{hiddenText:e}=A||{};if(e===void 0)return;const o=n.current;if(!o)return;const t=v(v({},o.style),A);o.setStyle(t)},[A]),p(()=>{h()},[R]),q.createElement(be,{spinning:ge},q.createElement("div",{ref:T,style:v({position:"relative"},g)}))};var qe=xe(Le,null,null,{context:Oe})(Ze);export{qe as default};
@@ -1 +1 @@
1
- import{PointCloudContext as oe}from"./PointCloudContext.js";import{useRotate as re}from"./hooks/useRotate.js";import{useRotateEdge as se}from"./hooks/useRotateEdge.js";import{useBoxes as ne}from"./hooks/useBoxes.js";import{useSingleBox as ie}from"./hooks/useSingleBox.js";import{useSphere as ae}from"./hooks/useSphere.js";import{useContext as ue,useEffect as c}from"react";import{CommonToolUtils as le,EToolName as P,cTool as ce}from"@labelbee/lb-annotation";import{Modal as de,message as y}from"antd";import{connect as pe}from"react-redux";import{a2MapStateToProps as me}from"../../store/annotation/map.js";import{useStatus as Pe}from"./hooks/useStatus.js";import{usePointCloudViews as fe}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as we}from"../../store/ctx.js";import{useHistory as be}from"./hooks/useHistory.js";import{useAttribute as ve}from"./hooks/useAttribute.js";import{useConfig as ye}from"./hooks/useConfig.js";import{usePolygon as he}from"./hooks/usePolygon.js";import{useLine as Ce}from"./hooks/useLine.js";import{useUpdatePointCloudColor as ge}from"./hooks/useUpdatePointCloudColor.js";import{useTranslation as Se}from"react-i18next";import{useLatest as I}from"ahooks";var ke=Object.defineProperty,xe=Object.defineProperties,Ve=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable,j=(i,r,a)=>r in i?ke(i,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[r]=a,f=(i,r)=>{for(var a in r||(r={}))_e.call(r,a)&&j(i,a,r[a]);if(O)for(var a of O(r))Be.call(r,a)&&j(i,a,r[a]);return i},w=(i,r)=>xe(i,Ve(r));const{EPolygonPattern:Ie}=ce,Oe=({currentData:i,config:r,checkMode:a,configString:L,imgIndex:h,toolInstanceRef:u,setResourceLoading:C,isBatchSetValid:A})=>{const e=ue(oe),{changeSelectedBoxValid:E,selectNextBox:T,selectPrevBox:D,updateSelectedBox:H,deleteSelectedPointCloudBoxAndPolygon:K}=ie(),{selectedSphere:b,updatePointCloudSphere:N}=ae(),{clearAllResult:g,updatePointCloudPattern:U}=Pe(),{copySelectedBoxes:z,pasteSelectedBoxes:R,copiedBoxes:Le}=ne({config:r,currentData:i}),{updateRotate:S}=re({currentData:i}),{updateRotateEdge:F}=se({currentData:i}),{updatePointCloudData:p,topViewSelectedChanged:M}=fe({setResourceLoading:C}),{redo:k,undo:x,pushHistoryWithList:q,pushHistoryUnderUpdatePolygon:G,pushHistoryUnderUpdateLine:W}=be(),{syncThreeViewsAttribute:V}=ve(),{syncAllViewsConfig:Y,reRenderTopViewRange:$}=ye(),{selectedPolygon:_}=he(),{selectedLine:B}=Ce(),{t:v}=Se(),{updatePointCloudColor:J}=ge(C,r),Q=I(i),m=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},X=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:l}=s;switch(t){case"q":{S(e.rectRotateSensitivity);break}case"e":S(-Number(e.rectRotateSensitivity));break;case"g":F(-90);break;case"u":{const d=l.pattern===Ie.Normal?P.Rect:P.Polygon;U(d);const te={[P.Polygon]:v("PolygonPattern"),[P.Rect]:v("RectPattern")};y.success(v("ChangePatternMsg",{pattern:te[d]})),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":A?(de.destroyAll(),e.setBatchSetValidModal(!e.visibleBatchSetValid)):e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){D();break}T(),o.preventDefault();break;case"f":E();break;case"arrowup":m({y:-1});break;case"arrowdown":m({y:1});break;case"arrowleft":m({x:-1});break;case"arrowright":m({x:1});break;case"delete":K(Q.current);break}},Z=(t,o)=>{switch(t){case"c":z();break;case"v":R();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?k():x();break}}},ee=I(t=>{if(!le.hotkeyFilter(t)||a===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){Z(o,t);return}X(o,t)});return c(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>ee.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),c(()=>{Y(r)},[L]),c(()=>{(r==null?void 0:r.radius)&&$(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),c(()=>{p==null||p()},[h,e.mainViewInstance]),c(()=>{e.setHideAttributes([])},[h]),c(()=>{u.current.setDefaultAttribute=t=>{var o;if(V(t),J(t),_&&G(w(f({},_),{attribute:t})),B&&W(w(f({},B),{attribute:t})),b){const s=N(w(f({},b),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),M({newSelectedSphere:b,newSphereList:s}))}},u.current.setSubAttribute=(t,o)=>{var s;const n=e.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=w(f({},l),{[t]:o}),H(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},u.current.clearResult=()=>{g==null||g()},u.current.redo=()=>{k()},u.current.undo=()=>{x()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t)})},u.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},u.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},u.current.asyncData=t=>{setTimeout(()=>{p==null||p(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),c(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),c(()=>{u.current.history={pushHistory:t=>{q({pointCloudBoxList:t})},initRecord:()=>{}}},[]),c(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||a)return;const s=d=>{V(d)},n=d=>{y.error(d)},l=d=>{y.info(d)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[e.topViewInstance]),null};var je=pe(me,null,null,{context:we})(Oe);export{je as default};
1
+ import{PointCloudContext as oe}from"./PointCloudContext.js";import{useRotate as re}from"./hooks/useRotate.js";import{useRotateEdge as se}from"./hooks/useRotateEdge.js";import{useBoxes as ne}from"./hooks/useBoxes.js";import{useSingleBox as ie}from"./hooks/useSingleBox.js";import{useSphere as ae}from"./hooks/useSphere.js";import{useContext as ue,useEffect as c}from"react";import{CommonToolUtils as le,EToolName as P,cTool as ce}from"@labelbee/lb-annotation";import{Modal as de,message as y}from"antd";import{connect as pe}from"react-redux";import{a2MapStateToProps as me}from"../../store/annotation/map.js";import{useStatus as Pe}from"./hooks/useStatus.js";import{usePointCloudViews as we}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as fe}from"../../store/ctx.js";import{useHistory as ve}from"./hooks/useHistory.js";import{useAttribute as be}from"./hooks/useAttribute.js";import{useConfig as ye}from"./hooks/useConfig.js";import{usePolygon as ge}from"./hooks/usePolygon.js";import{useLine as he}from"./hooks/useLine.js";import{useUpdatePointCloudColor as Ce}from"./hooks/useUpdatePointCloudColor.js";import{useTranslation as Se}from"react-i18next";import{useLatest as B}from"ahooks";var ke=Object.defineProperty,Ve=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable,j=(i,r,u)=>r in i?ke(i,r,{enumerable:!0,configurable:!0,writable:!0,value:u}):i[r]=u,w=(i,r)=>{for(var u in r||(r={}))_e.call(r,u)&&j(i,u,r[u]);if(O)for(var u of O(r))Ie.call(r,u)&&j(i,u,r[u]);return i},f=(i,r)=>Ve(i,xe(r));const{EPolygonPattern:Be}=ce,Oe=({currentData:i,config:r,checkMode:u,configString:L,imgIndex:g,toolInstanceRef:a,setResourceLoading:h,isBatchSetValid:A})=>{const e=ue(oe),{changeSelectedBoxValid:T,selectNextBox:E,selectPrevBox:D,updateSelectedBox:H,deleteSelectedPointCloudBoxAndPolygon:K}=ie(),{selectedSphere:v,updatePointCloudSphere:N}=ae(),{clearAllResult:C,updatePointCloudPattern:U}=Pe(),{copySelectedBoxes:z,pasteSelectedBoxes:R,copiedBoxes:Le}=ne({config:r,currentData:i}),{updateRotate:S}=re({currentData:i}),{updateRotateEdge:F}=se({currentData:i}),{updatePointCloudData:p,topViewSelectedChanged:M}=we({setResourceLoading:h}),{redo:k,undo:V,pushHistoryWithList:q,pushHistoryUnderUpdatePolygon:G,pushHistoryUnderUpdateLine:W}=ve(),{syncThreeViewsAttribute:x}=be(),{syncAllViewsConfig:Y,reRenderTopViewRange:$}=ye(),{selectedPolygon:_}=ge(),{selectedLine:I}=he(),{t:b}=Se(),{updatePointCloudColor:J}=Ce(h,r),Q=B(i),m=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},X=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:l}=s;switch(t){case"q":{S(e.rectRotateSensitivity);break}case"e":S(-Number(e.rectRotateSensitivity));break;case"g":F(-90);break;case"u":{const d=l.pattern===Be.Normal?P.Rect:P.Polygon;U(d);const te={[P.Polygon]:b("PolygonPattern"),[P.Rect]:b("RectPattern")};y.success(b("ChangePatternMsg",{pattern:te[d]})),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":A?(de.destroyAll(),e.setBatchSetValidModal(!e.visibleBatchSetValid)):e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){D();break}E(),o.preventDefault();break;case"f":T();break;case"arrowup":m({y:-1});break;case"arrowdown":m({y:1});break;case"arrowleft":m({x:-1});break;case"arrowright":m({x:1});break;case"delete":K(Q.current);break}},Z=(t,o)=>{switch(t){case"c":z();break;case"v":R();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?k():V();break}}},ee=B(t=>{if(!le.hotkeyFilter(t)||u===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){Z(o,t);return}X(o,t)});return c(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>ee.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),c(()=>{Y(r)},[L]),c(()=>{(r==null?void 0:r.radius)&&$(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),c(()=>{p==null||p()},[g,e.mainViewInstance]),c(()=>{e.setHideAttributes([])},[g]),c(()=>{a.current.setAttrChangeTrigger=t=>{var o;(o=e.topViewInstance)==null||o.toolInstance.setAttrChangeTrigger(t)},a.current.setDefaultAttribute=t=>{var o;if(x(t),J(t),_&&G(f(w({},_),{attribute:t})),I&&W(f(w({},I),{attribute:t})),v){const s=N(f(w({},v),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),M({newSelectedSphere:v,newSphereList:s}))}},a.current.setSubAttribute=(t,o)=>{var s;const n=e.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=f(w({},l),{[t]:o}),H(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},a.current.clearResult=()=>{C==null||C()},a.current.redo=()=>{k()},a.current.undo=()=>{V()},a.current.setValid=t=>{a.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t)})},a.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},a.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},a.current.asyncData=t=>{setTimeout(()=>{p==null||p(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),c(()=>{a.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},a.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),c(()=>{a.current.history={pushHistory:t=>{q({pointCloudBoxList:t})},initRecord:()=>{}}},[]),c(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||u)return;const s=d=>{x(d)},n=d=>{y.error(d)},l=d=>{y.info(d)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[e.topViewInstance]),null};var je=pe(me,null,null,{context:fe})(Oe);export{je as default};
@@ -1 +1 @@
1
- const o=(e,l)=>({selectBoxVisibleSwitch:!1,setSelectBoxVisibleSwitch:t=>e(()=>({selectBoxVisibleSwitch:t}))});export{o as default};
1
+ const i=(t,o)=>({selectBoxVisibleSwitch:!1,setSelectBoxVisibleSwitch:e=>t(()=>({selectBoxVisibleSwitch:e})),attrChangeTrigger:0,setAttrChangeTrigger:e=>t(()=>({attrChangeTrigger:e}))});export{i as default};
@@ -1 +1 @@
1
- import e,{useState as w,useContext as T,useMemo as ot,useEffect as L}from"react";import{EditFilled as nt}from"@ant-design/icons";import{ToolIcons as it}from"../ToolIcons.js";import{EToolName as lt}from"../../../../data/enums/ToolType.js";import{cTool as rt}from"@labelbee/lb-annotation";import{PointCloudContext as B}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as D,Input as st,message as h}from"antd";import at from"../../../../utils/StepUtils.js";import{connect as ct}from"react-redux";import{jsonParser as ut,classnames as mt}from"../../../../utils/index.js";import{useStatus as $}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as z}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as dt,useDispatch as pt}from"../../../../store/ctx.js";import ft from"./components/batchUpdateModal/index.js";import vt from"./components/annotatedBox/index.js";import gt from"./components/rectRotateSensitivitySlider/index.js";import St from"./components/findTrackIDIndex/index.js";import bt from"./components/firstFrameDataSwitch/index.js";import Ct from"./components/selectBoxVisibleSwitch/index.js";import{EPointCloudSegmentStatus as j,EPointCloudPattern as xt}from"@labelbee/lb-utils";import Et from"../../../../components/attributeList/index.js";import{useAttribute as Pt}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 wt from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import Dt from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import ht from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import jt from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as I}from"../index.js";import{SetTaskStepList as It}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as Tt}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import Lt from"../../../../components/subAttributeList/index.js";import Bt from"../../../../components/DynamicResizer/DynamicResizer.js";import{isNumber as kt}from"lodash";var Vt=Object.defineProperty,At=Object.defineProperties,Nt=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,Ot=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,U=(o,t,n)=>t in o?Vt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,V=(o,t)=>{for(var n in t||(t={}))Ot.call(t,n)&&U(o,n,t[n]);if(F)for(var n of F(t))Rt.call(t,n)&&U(o,n,t[n]);return o},A=(o,t)=>At(o,Nt(t));const $t=()=>{const[o,t]=w(!1),n=T(B),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:i}=z(),[u,m]=w(""),{t:f}=k(),p=c==null?void 0:c.info.trackID,r=ot(()=>kt(p)&&p>=0,[p]),s=d=>!!a.find(C=>C.trackID===d&&C.id!==(c==null?void 0:c.info.id)),b=(d=!1)=>{const v=parseInt(u,10);if(d&&t(!1),isNaN(v)){h.error(f("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){h.error(f("NotAllowDecimalPointsInTrackID"));return}if(s(v)){h.error(f("DuplicateTrackIDsExist"));return}if(!(v>0)){h.error(f("PositiveIntegerCheck"));return}g(v)};L(()=>{t(!1)},[p]);const g=d=>{var v;const C=i({trackID:d});(v=n==null?void 0:n.topViewInstance)==null||v.updatePolygonList(C!=null?C:[]),n.mainViewInstance&&n.selectedPointCloudBox&&(n==null||n.mainViewInstance.generateBox(n==null?void 0:n.selectedPointCloudBox))};return e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,f("CurrentBoxTrackIDs")),r&&e.createElement(ft,{id:p,updateCurrentPolygonList:d=>g(d)})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},o&&r?e.createElement(st,{defaultValue:p,onChange:d=>{m(d.target.value)},disabled:!r,size:"small",onBlur:()=>{b()},onPressEnter:()=>{b(!0)}}):e.createElement("span",null,p),e.createElement(nt,{style:{color:"#999",marginLeft:16,cursor:typeof p!="undefined"?"pointer":"not-allowed"},onClick:()=>{r&&t(!o)}})))},H=({segmentStatus:o,globalPattern:t})=>t===xt.Segmentation&&![j.Edit,j.Ready].includes(o),M=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:i,enableColorPicker:u})=>{const[m,f]=w({segmentStatus:j.Ready}),{selectedBox:p}=z(),r=T(B),{ptSegmentInstance:s}=r,{t:b}=k(),{defaultAttribute:g}=Pt(),d=Tt(),{isPointCloudSegmentationPattern:v}=$(),C=pt(),J={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};L(()=>{if(!!s)return s.on("syncPointCloudStatus",f),()=>{s.unbind("syncPointCloudStatus",f)}},[s]);const K=(l,x)=>{var E,P,_,N,O;const y=(E=a==null?void 0:a.attributeList)==null?void 0:E.map(S=>S.value===l?A(V({},S),{color:x}):S),R=A(V({},a),{attributeList:y}),tt=JSON.stringify(R),et=c==null?void 0:c.map(S=>(S==null?void 0:S.step)===(i==null?void 0:i.step)?A(V({},S),{config:tt}):S);(P=r==null?void 0:r.topViewInstance)==null||P.updateAttributeList(y),(_=r==null?void 0:r.sideViewInstance)==null||_.updateAttributeList(y),(N=r==null?void 0:r.backViewInstance)==null||N.updateAttributeList(y),(O=r==null?void 0:r.mainViewInstance)==null||O.setConfig(R),C(It({stepList:et}))},X=l=>{d.updateViewsByDefaultSize&&d.updateViewsByDefaultSize(l)},Y=l=>{H({globalPattern:r.globalPattern,segmentStatus:m.segmentStatus})||n.setDefaultAttribute(l)},q=(l,x)=>{H({globalPattern:r.globalPattern,segmentStatus:m.segmentStatus})||n.setSubAttribute(l,x)},G=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===j.Edit,Z=v;return e.createElement("div",{style:{height:"100%",overflow:"auto",display:"flex",flexDirection:"column"}},e.createElement("div",{style:J},b("Attribute")),e.createElement("div",{style:{height:0,flex:1,overflowY:"auto",overflowX:"hidden"}},e.createElement(Et,{list:G,forbidDefault:!0,selectedAttribute:g!=null?g:"",attributeChanged:l=>Y(l),updateColorConfig:K,enableColorPicker:u,updateSize:X,forbidShowLimitPopover:Z}),e.createElement(D,{style:{margin:0}}),Q&&e.createElement(Lt,{subAttributeList:t,setSubAttribute:q,getValue:l=>{var x,E,P,_;return((E=(x=r.selectedPointCloudBox)==null?void 0:x.subAttribute)==null?void 0:E[l.value])||((_=(P=m.cacheSegData)==null?void 0:P.subAttribute)==null?void 0:_[l.value])}})))},zt=[{toolName:"LassoSelector",commonSvg:_t,selectedSvg:yt},{toolName:"RectSelector",commonSvg:ht,selectedSvg:jt},{toolName:"CircleSelector",commonSvg:wt,selectedSvg:Dt}],W=({toolInstance:o})=>{const{ptSegmentInstance:t}=T(B),[n,a]=w("LassoSelector"),{t:c}=k();return L(()=>{if(!t)return;const i=()=>{a("LassoSelector")},u=()=>{a("RectSelector")},m=()=>{a("CircleSelector")};return t.on("LassoSelector",i),t.on("RectSelector",u),t.on("CircleSelector",m),()=>{t.unbind("LassoSelector",i),t.unbind("RectSelector",u),t.unbind("CircleSelector",m)}},[t]),e.createElement("div",{className:`${I}__level`},zt.map(i=>{const u=n===i.toolName;return e.createElement("span",{className:`${I}__toolOption`,key:i.toolName,onClick:()=>t==null?void 0:t.emit(i.toolName)},e.createElement("img",{className:`${I}__singleTool`,src:u?i==null?void 0:i.selectedSvg:i==null?void 0:i.commonSvg}),e.createElement("span",{className:mt({[`${I}__toolOption__selected`]:u})},c(i.toolName)))}))},Ft=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:i})=>{var u,m;const{updatePointCloudPattern:f,pointCloudPattern:p,isPointCloudSegmentationPattern:r}=$(),s=ut(o.config),b=(u=s==null?void 0:s.attributeList)!=null?u:[],g=(s==null?void 0:s.secondaryAttributeConfigurable)===!0?(m=s==null?void 0:s.inputList)!=null?m:[]:[];return r?e.createElement(e.Fragment,null,e.createElement(W,{toolInstance:t}),e.createElement(M,{toolInstance:t,attributeList:b,subAttributeList:g,config:s,stepList:c,stepInfo:o,enableColorPicker:i})):e.createElement(e.Fragment,null,e.createElement(it,{toolName:rt.EPointCloudName.PointCloud,selectedToolName:p,onChange:d=>f==null?void 0:f(d)}),e.createElement("div",{style:{flex:1,overflow:"hidden"}},e.createElement(Bt,{minTopHeight:42,defaultHeight:400,localKey:"settingid:"+(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(M,{toolInstance:t,attributeList:b,subAttributeList:g,config:s,stepList:c,stepInfo:o,enableColorPicker:i}),(s==null?void 0:s.trackConfigurable)===!0&&p===lt.Rect?e.createElement("div",{style:{height:"100%",overflow:"auto"}},e.createElement($t,null),e.createElement(D,{style:{margin:0}}),e.createElement(vt,{imgList:n,imgIndex:a}),e.createElement(D,{style:{margin:0}}),e.createElement(St,{imgList:n,imgIndex:a}),e.createElement(D,{style:{margin:0}}),e.createElement(gt,null),o.loadPreStep>0&&e.createElement(bt,null),e.createElement(Ct,null)):e.createElement("div",null))))},Ut=o=>{var t,n,a,c;const i=at.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:i,toolInstance:u,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:m}};var Ht=ct(Ut,null,null,{context:dt})(Ft);export{W as PointCloudSegToolIcon,Ht as default};
1
+ import e,{useState as w,useContext as I,useMemo as rt,useEffect as L}from"react";import{EditFilled as it}from"@ant-design/icons";import{ToolIcons as lt}from"../ToolIcons.js";import{EToolName as st}from"../../../../data/enums/ToolType.js";import{cTool as at}from"@labelbee/lb-annotation";import{PointCloudContext as B}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as h,Input as ct,message as T}from"antd";import ut from"../../../../utils/StepUtils.js";import{connect as mt}from"react-redux";import{jsonParser as dt,classnames as pt}from"../../../../utils/index.js";import{useStatus as $}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as z}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as gt,useDispatch as ft}from"../../../../store/ctx.js";import vt from"./components/batchUpdateModal/index.js";import St from"./components/annotatedBox/index.js";import bt from"./components/rectRotateSensitivitySlider/index.js";import Ct from"./components/findTrackIDIndex/index.js";import xt from"./components/firstFrameDataSwitch/index.js";import Et from"./components/selectBoxVisibleSwitch/index.js";import{EPointCloudSegmentStatus as D,EPointCloudPattern as Pt}from"@labelbee/lb-utils";import _t from"../../../../components/attributeList/index.js";import{useAttribute as yt}from"../../../../components/pointCloudView/hooks/useAttribute.js";import wt from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import ht from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import Tt from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import Dt from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import jt from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import It from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as j}from"../index.js";import{SetTaskStepList as Lt}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as Bt}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import kt from"../../../../components/subAttributeList/index.js";import At from"../../../../components/DynamicResizer/DynamicResizer.js";import{isNumber as Vt}from"lodash";import Nt from"../../../../store/toolConfig/index.js";var Ot=Object.defineProperty,Rt=Object.defineProperties,$t=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,zt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,U=(o,t,n)=>t in o?Ot(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,A=(o,t)=>{for(var n in t||(t={}))zt.call(t,n)&&U(o,n,t[n]);if(F)for(var n of F(t))Ft.call(t,n)&&U(o,n,t[n]);return o},V=(o,t)=>Rt(o,$t(t));const Ut=()=>{const[o,t]=w(!1),n=I(B),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:i}=z(),[u,m]=w(""),{t:g}=k(),p=c==null?void 0:c.info.trackID,l=rt(()=>Vt(p)&&p>=0,[p]),s=d=>!!a.find(x=>x.trackID===d&&x.id!==(c==null?void 0:c.info.id)),C=(d=!1)=>{const f=parseInt(u,10);if(d&&t(!1),isNaN(f)){T.error(g("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){T.error(g("NotAllowDecimalPointsInTrackID"));return}if(s(f)){T.error(g("DuplicateTrackIDsExist"));return}if(!(f>0)){T.error(g("PositiveIntegerCheck"));return}v(f)};L(()=>{t(!1)},[p]);const v=d=>{var f;const x=i({trackID:d});(f=n==null?void 0:n.topViewInstance)==null||f.updatePolygonList(x!=null?x:[]),n.mainViewInstance&&n.selectedPointCloudBox&&(n==null||n.mainViewInstance.generateBox(n==null?void 0:n.selectedPointCloudBox))};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")),l&&e.createElement(vt,{id:p,updateCurrentPolygonList:d=>v(d)})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},o&&l?e.createElement(ct,{defaultValue:p,onChange:d=>{m(d.target.value)},disabled:!l,size:"small",onBlur:()=>{C()},onPressEnter:()=>{C(!0)}}):e.createElement("span",null,p),e.createElement(it,{style:{color:"#999",marginLeft:16,cursor:typeof p!="undefined"?"pointer":"not-allowed"},onClick:()=>{l&&t(!o)}})))},H=({segmentStatus:o,globalPattern:t})=>t===Pt.Segmentation&&![D.Edit,D.Ready].includes(o),M=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:i,enableColorPicker:u})=>{const[m,g]=w({segmentStatus:D.Ready}),{selectedBox:p}=z(),l=I(B),{ptSegmentInstance:s}=l,{t:C}=k(),{defaultAttribute:v}=yt(),d=Bt(),{isPointCloudSegmentationPattern:f}=$(),x=ft(),{attrChangeTrigger:J,setAttrChangeTrigger:K}=Nt(),X={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};L(()=>{if(!!s)return s.on("syncPointCloudStatus",g),()=>{s.unbind("syncPointCloudStatus",g)}},[s]);const Y=(r,S)=>{var E,P,_,N,O;const y=(E=a==null?void 0:a.attributeList)==null?void 0:E.map(b=>b.value===r?V(A({},b),{color:S}):b),R=V(A({},a),{attributeList:y}),ot=JSON.stringify(R),nt=c==null?void 0:c.map(b=>(b==null?void 0:b.step)===(i==null?void 0:i.step)?V(A({},b),{config:ot}):b);(P=l==null?void 0:l.topViewInstance)==null||P.updateAttributeList(y),(_=l==null?void 0:l.sideViewInstance)==null||_.updateAttributeList(y),(N=l==null?void 0:l.backViewInstance)==null||N.updateAttributeList(y),(O=l==null?void 0:l.mainViewInstance)==null||O.setConfig(R),x(Lt({stepList:nt}))},q=r=>{d.updateViewsByDefaultSize&&d.updateViewsByDefaultSize(r)},G=r=>{if(H({globalPattern:l.globalPattern,segmentStatus:m.segmentStatus}))return;const S=r===v?J+1:0;K(S),n.setAttrChangeTrigger(S),n.setDefaultAttribute(r)},Q=(r,S)=>{H({globalPattern:l.globalPattern,segmentStatus:m.segmentStatus})||n.setSubAttribute(r,S)},Z=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})),tt=p||m.cacheSegData&&m.segmentStatus===D.Edit,et=f;return e.createElement("div",{style:{height:"100%",overflow:"auto",display:"flex",flexDirection:"column"}},e.createElement("div",{style:X},C("Attribute")),e.createElement("div",{style:{height:0,flex:1,overflowY:"auto",overflowX:"hidden"}},e.createElement(_t,{list:Z,forbidDefault:!0,selectedAttribute:v!=null?v:"",attributeChanged:r=>G(r),updateColorConfig:Y,enableColorPicker:u,updateSize:q,forbidShowLimitPopover:et}),e.createElement(h,{style:{margin:0}}),tt&&e.createElement(kt,{subAttributeList:t,setSubAttribute:Q,getValue:r=>{var S,E,P,_;return((E=(S=l.selectedPointCloudBox)==null?void 0:S.subAttribute)==null?void 0:E[r.value])||((_=(P=m.cacheSegData)==null?void 0:P.subAttribute)==null?void 0:_[r.value])}})))},Ht=[{toolName:"LassoSelector",commonSvg:wt,selectedSvg:ht},{toolName:"RectSelector",commonSvg:jt,selectedSvg:It},{toolName:"CircleSelector",commonSvg:Tt,selectedSvg:Dt}],W=({toolInstance:o})=>{const{ptSegmentInstance:t}=I(B),[n,a]=w("LassoSelector"),{t:c}=k();return L(()=>{if(!t)return;const i=()=>{a("LassoSelector")},u=()=>{a("RectSelector")},m=()=>{a("CircleSelector")};return t.on("LassoSelector",i),t.on("RectSelector",u),t.on("CircleSelector",m),()=>{t.unbind("LassoSelector",i),t.unbind("RectSelector",u),t.unbind("CircleSelector",m)}},[t]),e.createElement("div",{className:`${j}__level`},Ht.map(i=>{const u=n===i.toolName;return e.createElement("span",{className:`${j}__toolOption`,key:i.toolName,onClick:()=>t==null?void 0:t.emit(i.toolName)},e.createElement("img",{className:`${j}__singleTool`,src:u?i==null?void 0:i.selectedSvg:i==null?void 0:i.commonSvg}),e.createElement("span",{className:pt({[`${j}__toolOption__selected`]:u})},c(i.toolName)))}))},Mt=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:i})=>{var u,m;const{updatePointCloudPattern:g,pointCloudPattern:p,isPointCloudSegmentationPattern:l}=$(),s=dt(o.config),C=(u=s==null?void 0:s.attributeList)!=null?u:[],v=(s==null?void 0:s.secondaryAttributeConfigurable)===!0?(m=s==null?void 0:s.inputList)!=null?m:[]:[];return l?e.createElement(e.Fragment,null,e.createElement(W,{toolInstance:t}),e.createElement(M,{toolInstance:t,attributeList:C,subAttributeList:v,config:s,stepList:c,stepInfo:o,enableColorPicker:i})):e.createElement(e.Fragment,null,e.createElement(lt,{toolName:at.EPointCloudName.PointCloud,selectedToolName:p,onChange:d=>g==null?void 0:g(d)}),e.createElement("div",{style:{flex:1,overflow:"hidden"}},e.createElement(At,{minTopHeight:42,defaultHeight:400,localKey:"settingid:"+(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(M,{toolInstance:t,attributeList:C,subAttributeList:v,config:s,stepList:c,stepInfo:o,enableColorPicker:i}),(s==null?void 0:s.trackConfigurable)===!0&&p===st.Rect?e.createElement("div",{style:{height:"100%",overflow:"auto"}},e.createElement(Ut,null),e.createElement(h,{style:{margin:0}}),e.createElement(St,{imgList:n,imgIndex:a}),e.createElement(h,{style:{margin:0}}),e.createElement(Ct,{imgList:n,imgIndex:a}),e.createElement(h,{style:{margin:0}}),e.createElement(bt,null),o.loadPreStep>0&&e.createElement(xt,null),e.createElement(Et,null)):e.createElement("div",null))))},Wt=o=>{var t,n,a,c;const i=ut.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:i,toolInstance:u,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:m}};var Jt=mt(Wt,null,null,{context:gt})(Mt);export{W as PointCloudSegToolIcon,Jt as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.24.0-alpha.30",
3
+ "version": "1.24.0-alpha.31",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "^4.6.2",
46
- "@labelbee/lb-annotation": "1.28.0-alpha.17",
46
+ "@labelbee/lb-annotation": "1.28.0-alpha.18",
47
47
  "@labelbee/lb-utils": "1.20.0-alpha.3",
48
48
  "@labelbee/wavesurfer": "1.1.0",
49
49
  "@types/react-dom": "18.3.1",