@labelbee/lb-components 1.23.0-alpha.112 → 1.23.0-alpha.114

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 +1 @@
1
- "use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),es=require("antd/es"),useRefCache=require("../../hooks/useRefCache.js"),index=require("../measureCanvas/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,a)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a,__spreadValues=(e,n)=>{for(var a in n||(n={}))__hasOwnProp.call(n,a)&&__defNormalProp(e,a,n[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(n))__propIsEnum.call(n,a)&&__defNormalProp(e,a,n[a]);return e},__async=(e,n,a)=>new Promise((m,d)=>{var c=l=>{try{f(a.next(l))}catch(v){d(v)}},s=l=>{try{f(a.throw(l))}catch(v){d(v)}},f=l=>l.done?m(l.value):Promise.resolve(l.value).then(c,s);f((a=a.apply(e,n)).next())});const DEFAULT_SIZE={width:455,height:100},sizeInitialized=e=>{if(!e)return DEFAULT_SIZE;if(e.width&&e.height)return e;const n=__spreadValues({},e);return n.width||(n.width=DEFAULT_SIZE.width),n.height||(n.height=DEFAULT_SIZE.height),n},AnnotationView=(e,n)=>{var a,m;const{src:d,fallbackSrc:c,annotations:s=[],style:f={stroke:"blue",thickness:3},zoomChange:l,backgroundStyle:v={},onChange:b,showLoading:P=!1,globalStyle:S,afterImgOnLoad:C,measureVisible:p}=e,g=sizeInitialized(e.size),[A,E]=React.useState(!1),w=React.useRef(null),r=React.useRef(),R=useRefCache(C),h=React.useRef([]),_=React.useRef(!0);React.useImperativeHandle(n,()=>{const t=r.current;return t?{zoomIn:()=>t.zoomChanged(!0),zoomOut:()=>t.zoomChanged(!1),initImgPos:()=>t.initImgPos(),toolInstance:t}:{}},[r.current]),React.useEffect(()=>(w.current&&(r.current=new lbAnnotation.ViewOperation({container:w.current,size:g,style:f,annotations:s,config:"{}",zoomInfo:e.zoomInfo,staticMode:e.staticMode}),r.current.init()),()=>{var t;(t=r.current)==null||t.destroy()}),[p]);const I=React.useCallback(t=>__async(void 0,null,function*(){var u,o;try{const i=yield lbAnnotation.ImgUtils.load(t);return(u=r.current)==null||u.setImgNode(i),(o=R.current)==null||o.call(R,i),null}catch(i){return console.error("Error loading image:",i),i}}),[]),z=React.useCallback(t=>__async(void 0,null,function*(){var u,o;if(E(!0),(u=r.current)==null||u.setLoading(!0),(yield I(t))&&c){const y=yield I(c);y&&console.error("Error loading fallback image:",y)}(o=r.current)==null||o.setLoading(!1),E(!1)}),[I,c]);React.useEffect(()=>{r.current&&z(d)},[d,p,c,z]),React.useEffect(()=>{if(_.current===!1){h.current.push(s);return}const t=()=>{_.current=!0,h.current=[]},u=()=>{var o;const i=h.current.length;if(i>0){const y=h.current[i-1];h.current=[],(o=r.current)==null||o.updateData(y).then(u).catch(t)}else _.current=!0};r.current&&(_.current=!1,r.current.updateData(s).then(u).catch(t))},[s]),React.useEffect(()=>{const t=r.current;(t==null?void 0:t.setSize)&&(t.setSize(g),t.initPosition())},[(a=e.size)==null?void 0:a.width,(m=e.size)==null?void 0:m.height]),React.useEffect(()=>{var t,u;return r.current&&((t=r.current)==null||t.on("onChange",(...o)=>{b==null||b.apply(null,o)}),(u=r.current)==null||u.on("renderZoom",o=>{l&&l(o)})),()=>{var o,i;(o=r.current)==null||o.unbindAll("onChange"),(i=r.current)==null||i.unbindAll("renderZoom")}},[l,b]);const L=React__default.default.createElement("div",{ref:w,style:__spreadValues(__spreadValues({position:"relative"},g),v)}),{imgNode:O,zoom:k,currentPos:j}=r.current||{};return React__default.default.createElement(es.Spin,{spinning:P||A,delay:300,style:S},p&&O?React__default.default.createElement(index,{size:g,imgNode:O,zoom:k,currentPos:j}):L)};var AnnotationView$1=React__default.default.forwardRef(AnnotationView);module.exports=AnnotationView$1;
1
+ "use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),es=require("antd/es"),useRefCache=require("../../hooks/useRefCache.js"),index=require("../measureCanvas/index.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,o)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,__spreadValues=(e,r)=>{for(var o in r||(r={}))__hasOwnProp.call(r,o)&&__defNormalProp(e,o,r[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(r))__propIsEnum.call(r,o)&&__defNormalProp(e,o,r[o]);return e},__async=(e,r,o)=>new Promise((g,d)=>{var c=l=>{try{f(o.next(l))}catch(v){d(v)}},s=l=>{try{f(o.throw(l))}catch(v){d(v)}},f=l=>l.done?g(l.value):Promise.resolve(l.value).then(c,s);f((o=o.apply(e,r)).next())});const DEFAULT_SIZE={width:455,height:100},sizeInitialized=e=>{if(!e)return DEFAULT_SIZE;if(e.width&&e.height)return e;const r=__spreadValues({},e);return r.width||(r.width=DEFAULT_SIZE.width),r.height||(r.height=DEFAULT_SIZE.height),r},AnnotationView=(e,r)=>{var o,g;const{src:d,fallbackSrc:c,annotations:s=[],style:f={stroke:"blue",thickness:3},zoomChange:l,backgroundStyle:v={},onChange:C,showLoading:x=!1,globalStyle:L,afterImgOnLoad:k,measureVisible:y,onRightClick:m,pointCloudBoxList:E=[],hiddenText:P=!1}=e,_=sizeInitialized(e.size),[A,R]=React.useState(!1),w=React.useRef(null),t=React.useRef(),z=useRefCache(k),h=React.useRef([]),b=React.useRef(!0);React.useContext(PointCloudContext.PointCloudContext),React.useImperativeHandle(r,()=>{const n=t.current;return n?{zoomIn:()=>n.zoomChanged(!0),zoomOut:()=>n.zoomChanged(!1),initImgPos:()=>n.initImgPos(),toolInstance:n}:{}},[t.current]),React.useEffect(()=>(w.current&&(t.current=new lbAnnotation.ViewOperation({container:w.current,size:_,style:f,annotations:s,config:"{}",zoomInfo:e.zoomInfo,staticMode:e.staticMode}),t.current.init(),m&&t.current.on("onRightClick",m)),()=>{var n,i;m&&((n=t.current)==null||n.unbind("onRightClick",m)),(i=t.current)==null||i.destroy()}),[y]);const I=React.useCallback(n=>__async(void 0,null,function*(){var i,a;try{const u=yield lbAnnotation.ImgUtils.load(n);return(i=t.current)==null||i.setImgNode(u),(a=z.current)==null||a.call(z,u),null}catch(u){return console.error("Error loading image:",u),u}}),[]),O=React.useCallback(n=>__async(void 0,null,function*(){var i,a;if(R(!0),(i=t.current)==null||i.setLoading(!0),(yield I(n))&&c){const p=yield I(c);p&&console.error("Error loading fallback image:",p)}(a=t.current)==null||a.setLoading(!1),R(!1)}),[I,c]);React.useEffect(()=>{t.current&&O(d)},[d,y,c,O]),React.useEffect(()=>{(t==null?void 0:t.current)&&t.current.setPointCloudBoxList(E)},[E]),React.useEffect(()=>{var n;(t==null?void 0:t.current)&&((n=t.current)==null||n.setHiddenText(P))},[P]),React.useEffect(()=>{if(b.current===!1){h.current.push(s);return}const n=()=>{b.current=!0,h.current=[]},i=()=>{var a;const u=h.current.length;if(u>0){const p=h.current[u-1];h.current=[],(a=t.current)==null||a.updateData(p).then(i).catch(n)}else b.current=!0};t.current&&(b.current=!1,t.current.updateData(s).then(i).catch(n))},[s]),React.useEffect(()=>{const n=t.current;(n==null?void 0:n.setSize)&&(n.setSize(_),n.initPosition())},[(o=e.size)==null?void 0:o.width,(g=e.size)==null?void 0:g.height]),React.useEffect(()=>{var n,i;return t.current&&((n=t.current)==null||n.on("onChange",(...a)=>{C==null||C.apply(null,a)}),(i=t.current)==null||i.on("renderZoom",a=>{l&&l(a)})),()=>{var a,u;(a=t.current)==null||a.unbindAll("onChange"),(u=t.current)==null||u.unbindAll("renderZoom")}},[l,C]);const j=React__default.default.createElement("div",{ref:w,style:__spreadValues(__spreadValues({position:"relative"},_),v)}),{imgNode:S,zoom:q,currentPos:V}=t.current||{};return React__default.default.createElement(es.Spin,{spinning:x||A,delay:300,style:L},y&&S?React__default.default.createElement(index,{size:_,imgNode:S,zoom:q,currentPos:V}):j)};var AnnotationView$1=React__default.default.forwardRef(AnnotationView);module.exports=AnnotationView$1;
@@ -1 +1 @@
1
- "use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation"),util=require("./util.js"),useUpdateRectList=require("./useUpdateRectList.js"),useToolStyle=require("../../hooks/useToolStyle.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}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=(l,i,c)=>i in l?__defProp(l,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):l[i]=c,__spreadValues=(l,i)=>{for(var c in i||(i={}))__hasOwnProp.call(i,c)&&__defNormalProp(l,c,i[c]);if(__getOwnPropSymbols)for(var c of __getOwnPropSymbols(i))__propIsEnum.call(i,c)&&__defNormalProp(l,c,i[c]);return l},__spreadProps=(l,i)=>__defProps(l,__getOwnPropDescs(i)),__async=(l,i,c)=>new Promise((s,v)=>{var m=a=>{try{g(c.next(a))}catch(p){v(p)}},y=a=>{try{g(c.throw(a))}catch(p){v(p)}},g=a=>a.done?s(a.value):Promise.resolve(a.value).then(m,y);g((c=c.apply(l,i)).next())});const PointCloud2DRectOperationView=l=>{var i,c;const{mappingData:s,size:v,config:m,checkMode:y,afterImgOnLoad:g,shouldExcludePointCloudBoxListUpdate:a}=l,p=(i=s==null?void 0:s.url)!=null?i:"",D=(c=s==null?void 0:s.fallbackUrl)!=null?c:"",{pointCloudBoxList:P,setPointCloudResult:x,defaultAttribute:C,rectList:S,addRectIn2DView:A,updateRectIn2DView:F,removeRectIn2DView:M,updateRectListByReducer:T,selectedIDs:I,setSelectedIDs:j}=React.useContext(PointCloudContext.PointCloudContext),{value:E}=useToolStyle.useToolStyleContext(),z=ahooks.useLatest(I),{update2DViewRect:J,remove2DViewRect:$}=usePointCloudViews.usePointCloudViews(),L=React__default.default.useRef(null),o=React.useRef(null),q=ahooks.useMemoizedFn(J),b=ahooks.useMemoizedFn($),h=React.useRef(null),[G,N]=React.useState(!0),O=React.useMemo(()=>S==null?void 0:S.filter(e=>e.imageName===(s==null?void 0:s.path)),[s==null?void 0:s.path,S]),w=ahooks.useLatest(s==null?void 0:s.path),V=React.useCallback(e=>__async(void 0,null,function*(){try{const n=z.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(n.length){const r=new Set(n),u=t.filter(d=>r.has(d.id)).map(d=>d.id);j(u)}return t}catch(n){}}),[j]),B=e=>{const{boxID:n}=e;if(!a&&n){V(()=>{const t=q==null?void 0:q(e);return t?(h.current=t,x(t),t):null});return}F(e,!0)},U=e=>{w.current&&A(__spreadProps(__spreadValues({},e),{imageName:w.current}))},k=e=>{if(e.length===0)return;if(!a){const t=e.find(r=>r.boxID);if(t){V(()=>{const r=b==null?void 0:b(t);return r?(h.current=r,x(r),R(),r):null});return}}const n=e.find(t=>t.extId);n&&V(()=>{const{imageName:t,extId:r}=n,u=b==null?void 0:b({boxID:r,imageName:t});return u?(h.current=u,x(u),u):null}),M(e)},H=ahooks.useMemoizedFn(()=>{let e=[];return P.forEach(n=>{const{rects:t=[],id:r,attribute:u,trackID:d}=n,f=t.find(K=>K.imageName===w.current),_=r+"_"+w.current;f&&(e=[...e,__spreadProps(__spreadValues({},f),{boxID:r,id:_,attribute:u,order:d})])}),e}),R=useUpdateRectList.useUpdateRectList(()=>{var e,n,t;const r=a?[]:H(),u=(e=o.current)==null?void 0:e.selectedRectID,d=I.slice(0),f=util.selectSpecifiedRectsFromTopViewSelectedIds(d,r,O);(n=o.current)==null||n.setResult(f),u&&((t=o.current)==null||t.setSelectedRectID(u))});return React.useEffect(()=>{if(L.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:L.current,size:v,config:__spreadProps(__spreadValues({},m),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:y});return o.current=e,o.current.init(),o.current.on("updateDragResult",B),o.current.on("afterAddingDrawingRect",U),o.current.on("deleteSelectedRects",k),()=>{var n,t,r,u;(n=o.current)==null||n.unbind("updateDragResult",B),(t=o.current)==null||t.unbind("afterAddingDrawingRect",U),(r=o.current)==null||r.unbind("deleteSelectedRects",k),(u=o.current)==null||u.destroy()}}},[]),React.useEffect(()=>{const e=t=>__async(void 0,null,function*(){try{return yield lbAnnotation.ImgUtils.load(t)}catch(r){return console.error("Error loading image:",r),null}}),n=()=>__async(void 0,null,function*(){var t;N(!0);let r=yield e(p);!r&&D&&(r=yield e(D)),r&&((t=o.current)==null||t.setImgNode(r),g(r)),N(!1)});o.current&&(p||D)&&n()},[p,D]),React.useEffect(()=>{var e;(e=o.current)==null||e.setSize(v)},[v]),React.useEffect(()=>{P!==h.current&&R()},[P]),React.useEffect(()=>{var e,n;const t=O.find(r=>r.id===o.current.selectedRectID);(n=(e=o.current)==null?void 0:e.setDefaultAttribute)==null||n.call(e,C),t&&T(r=>{var u;const d=[];let f=null;return r.forEach(_=>{_.id!==o.current.selectedRectID?d.push(_):f=_}),t.extId===void 0&&(f=(u=o.current)==null?void 0:u.selectedRect),[...d,__spreadProps(__spreadValues({},f||{}),{attribute:C})]}),R()},[C]),React.useEffect(()=>{R()},[O]),React.useEffect(()=>{R()},[a]),React.useEffect(()=>{var e,n,t,r;const u=(n=(e=o.current)==null?void 0:e.config)!=null?n:{},d=__spreadProps(__spreadValues({},u),{attributeList:(t=m.attributeList)!=null?t:[]});(r=o.current)==null||r.setConfig(JSON.stringify(d))},[m.attributeList]),React.useEffect(()=>{var e;(e=o.current)==null||e.setEnableAddRect(I.length===0),R()},[I]),React.useEffect(()=>{const{hiddenText:e}=E||{};if(e===void 0)return;const n=o.current;if(!n)return;const t=__spreadValues(__spreadValues({},n.style),E);n.setStyle(t)},[E]),React__default.default.createElement(es.Spin,{spinning:G},React__default.default.createElement("div",{ref:L,style:__spreadValues({position:"relative"},v)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$1;
1
+ "use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation"),util=require("./util.js"),useUpdateRectList=require("./useUpdateRectList.js"),useToolStyle=require("../../hooks/useToolStyle.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}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=(l,i,c)=>i in l?__defProp(l,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):l[i]=c,__spreadValues=(l,i)=>{for(var c in i||(i={}))__hasOwnProp.call(i,c)&&__defNormalProp(l,c,i[c]);if(__getOwnPropSymbols)for(var c of __getOwnPropSymbols(i))__propIsEnum.call(i,c)&&__defNormalProp(l,c,i[c]);return l},__spreadProps=(l,i)=>__defProps(l,__getOwnPropDescs(i)),__async=(l,i,c)=>new Promise((a,v)=>{var g=d=>{try{m(c.next(d))}catch(p){v(p)}},y=d=>{try{m(c.throw(d))}catch(p){v(p)}},m=d=>d.done?a(d.value):Promise.resolve(d.value).then(g,y);m((c=c.apply(l,i)).next())});const PointCloud2DRectOperationView=l=>{var i,c;const{mappingData:a,size:v,config:g,checkMode:y,afterImgOnLoad:m,shouldExcludePointCloudBoxListUpdate:d}=l,p=(i=a==null?void 0:a.url)!=null?i:"",h=(c=a==null?void 0:a.fallbackUrl)!=null?c:"",{pointCloudBoxList:C,setPointCloudResult:P,defaultAttribute:x,rectList:S,addRectIn2DView:F,updateRectIn2DView:M,removeRectIn2DView:T,updateRectListByReducer:z,selectedIDs:D,setSelectedIDs:E}=React.useContext(PointCloudContext.PointCloudContext),{value:L}=useToolStyle.useToolStyleContext(),J=ahooks.useLatest(D),{update2DViewRect:$,remove2DViewRect:G}=usePointCloudViews.usePointCloudViews(),O=React__default.default.useRef(null),o=React.useRef(null),q=ahooks.useMemoizedFn($),I=ahooks.useMemoizedFn(G),b=React.useRef(null),[H,k]=React.useState(!0),V=React.useMemo(()=>S==null?void 0:S.filter(e=>e.imageName===(a==null?void 0:a.path)),[a==null?void 0:a.path,S]),w=ahooks.useLatest(a==null?void 0:a.path),j=React.useCallback(e=>__async(void 0,null,function*(){try{const r=J.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(r.length){const n=new Set(r),u=t.filter(s=>n.has(s.id)).map(s=>s.id);E(u)}return t}catch(r){}}),[E]),N=e=>{const{boxID:r}=e;if(!d&&r){j(()=>{const t=q==null?void 0:q(e);return t?(b.current=t,P(t),t):null});return}M(e,!0)},B=e=>{w.current&&F(__spreadProps(__spreadValues({},e),{imageName:w.current}))},U=e=>{if(e.length===0)return;if(!d){const t=e.find(n=>n.boxID);if(t){j(()=>{const n=I==null?void 0:I(t);return n?(b.current=n,P(n),R(),n):null});return}}const r=e.find(t=>t.extId);r&&j(()=>{const{imageName:t,extId:n}=r,u=I==null?void 0:I({boxID:n,imageName:t});return u?(b.current=u,P(u),u):null}),T(e)},K=ahooks.useMemoizedFn(()=>{let e=[];return C.forEach(r=>{const{rects:t=[],id:n,attribute:u,trackID:s}=r,f=t.find(Q=>Q.imageName===w.current),_=n+"_"+w.current;f&&(e=[...e,__spreadProps(__spreadValues({},f),{boxID:n,id:_,attribute:u,order:s})])}),e}),R=useUpdateRectList.useUpdateRectList(()=>{var e,r,t;const n=d?[]:K(),u=(e=o.current)==null?void 0:e.selectedRectID,s=D.slice(0),f=util.selectSpecifiedRectsFromTopViewSelectedIds(s,n,V);(r=o.current)==null||r.setResult(f),u&&((t=o.current)==null||t.setSelectedRectID(u))}),A=({targetId:e})=>E(e);return React.useEffect(()=>{if(O.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:O.current,size:v,config:__spreadProps(__spreadValues({},g),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:y});return o.current=e,o.current.init(),o.current.on("updateDragResult",N),o.current.on("afterAddingDrawingRect",B),o.current.on("deleteSelectedRects",U),o.current.on("onRightClick",A),()=>{var r,t,n,u,s;(r=o.current)==null||r.unbind("updateDragResult",N),(t=o.current)==null||t.unbind("afterAddingDrawingRect",B),(n=o.current)==null||n.unbind("deleteSelectedRects",U),(u=o.current)==null||u.unbind("onRightClick",A),(s=o.current)==null||s.destroy()}}},[]),React.useEffect(()=>{const e=t=>__async(void 0,null,function*(){try{return yield lbAnnotation.ImgUtils.load(t)}catch(n){return console.error("Error loading image:",n),null}}),r=()=>__async(void 0,null,function*(){var t;k(!0);let n=yield e(p);!n&&h&&(n=yield e(h)),n&&((t=o.current)==null||t.setImgNode(n),m(n)),k(!1)});o.current&&(p||h)&&r()},[p,h]),React.useEffect(()=>{var e;(e=o.current)==null||e.setSize(v)},[v]),React.useEffect(()=>{C!==b.current&&R()},[C]),React.useEffect(()=>{var e,r;const t=V.find(n=>n.id===o.current.selectedRectID);(r=(e=o.current)==null?void 0:e.setDefaultAttribute)==null||r.call(e,x),t&&z(n=>{var u;const s=[];let f=null;return n.forEach(_=>{_.id!==o.current.selectedRectID?s.push(_):f=_}),t.extId===void 0&&(f=(u=o.current)==null?void 0:u.selectedRect),[...s,__spreadProps(__spreadValues({},f||{}),{attribute:x})]}),R()},[x]),React.useEffect(()=>{R()},[V]),React.useEffect(()=>{R()},[d]),React.useEffect(()=>{var e,r,t,n;const u=(r=(e=o.current)==null?void 0:e.config)!=null?r:{},s=__spreadProps(__spreadValues({},u),{attributeList:(t=g.attributeList)!=null?t:[]});(n=o.current)==null||n.setConfig(JSON.stringify(s))},[g.attributeList]),React.useEffect(()=>{var e;(e=o.current)==null||e.setEnableAddRect(D.length===0),R()},[D]),React.useEffect(()=>{const{hiddenText:e}=L||{};if(e===void 0)return;const r=o.current;if(!r)return;const t=__spreadValues(__spreadValues({},r.style),L);r.setStyle(t)},[L]),React__default.default.createElement(es.Spin,{spinning:H},React__default.default.createElement("div",{ref:O,style:__spreadValues({position:"relative"},v)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$1;
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),React=require("react"),index=require("../AnnotationView/index.js"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),useHighlight=require("./hooks/useHighlight.js"),index$2=require("./components/HighlightVisible/index.js"),PointCloudContext=require("./PointCloudContext.js"),useDataLinkSwitch=require("./hooks/useDataLinkSwitch.js"),index$1=require("../pointCloud2DRectOperationView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,u,i)=>new Promise((s,a)=>{var f=t=>{try{o(i.next(t))}catch(n){a(n)}},c=t=>{try{o(i.throw(t))}catch(n){a(n)}},o=t=>t.done?s(t.value):Promise.resolve(t.value).then(f,c);o((i=i.apply(e,u)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:u,currentData:i,showEnlarge:s,checkMode:a=!1,measureVisible:f})=>{var c,o;const t=React.useRef(null),n=React.useRef(),{selectedBox:d}=useSingleBox.useSingleBox(),m=useSize(t),{url:p,fallbackUrl:x,calib:v,path:j}=e,{toggle2dVisible:q,isHighlightVisible:P}=useHighlight.useHighlight({currentData:i}),[_,b]=React.useState(!1),{highlight2DLoading:B,setHighlight2DLoading:k,cuboidBoxIn2DView:h,cacheImageNodeSize:V}=React.useContext(PointCloudContext.PointCloudContext),z=!e,I=React.useMemo(()=>({zIndex:s?-1:101,is2DView:!h,imageName:e.path}),[s,h,e.path]),{rendered:R,isLinking:H}=useDataLinkSwitch(I),C=l=>{g(),V({path:j,imgNode:l})},g=React.useCallback(()=>{var l,L;const y=(l=n.current)==null?void 0:l.toolInstance;if(u(""),!d||!y)return;const r=e.annotations.find(E=>E.annotation.id===d.info.id);let S="";r&&((L=r==null?void 0:r.annotation.pointList)==null?void 0:L.length)>0&&(y.focusPositionByPointList(r==null?void 0:r.annotation.pointList),S=d.info.id,u(S))},[d,n.current,e.annotations]);React.useEffect(()=>{g()},[g]);const O=()=>__async(void 0,null,function*(){b(!0),k(!0);try{yield q(p,x!=null?x:"",v)}catch(l){console.error("highlightOnClick error:",l)}finally{b(!1),k(!1)}});return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:t},h?React__default.default.createElement(index,{src:(c=e==null?void 0:e.url)!=null?c:"",fallbackSrc:(o=e==null?void 0:e.fallbackUrl)!=null?o:"",annotations:e.annotations,size:m,ref:n,globalStyle:{display:z?"none":"block"},afterImgOnLoad:C,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:f}):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{shouldExcludePointCloudBoxListUpdate:!H,mappingData:e,size:m,checkMode:a,afterImgOnLoad:C}),!a&&R),v&&React__default.default.createElement(index$2,{visible:P(p),onClick:O,loading:_,disabled:B,style:{position:"absolute",right:16,top:16,zIndex:s?-1:101}}))};module.exports=PointCloud2DSingleView;
1
+ "use strict";var dom=require("../../utils/dom.js"),React=require("react"),index=require("../AnnotationView/index.js"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),useHighlight=require("./hooks/useHighlight.js"),index$2=require("./components/HighlightVisible/index.js"),PointCloudContext=require("./PointCloudContext.js"),useDataLinkSwitch=require("./hooks/useDataLinkSwitch.js"),index$1=require("../pointCloud2DRectOperationView/index.js"),useToolStyle=require("../../hooks/useToolStyle.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,u,i)=>new Promise((s,a)=>{var h=t=>{try{l(i.next(t))}catch(o){a(o)}},c=t=>{try{l(i.throw(t))}catch(o){a(o)}},l=t=>t.done?s(t.value):Promise.resolve(t.value).then(h,c);l((i=i.apply(e,u)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:u,currentData:i,showEnlarge:s,checkMode:a=!1,measureVisible:h})=>{var c,l;const t=React.useRef(null),o=React.useRef(),{selectedBox:d}=useSingleBox.useSingleBox(),x=useSize(t),{url:m,fallbackUrl:p,calib:v,path:j}=e,{toggle2dVisible:q,isHighlightVisible:P}=useHighlight.useHighlight({currentData:i}),[B,k]=React.useState(!1),{highlight2DLoading:_,setHighlight2DLoading:C,cuboidBoxIn2DView:f,cacheImageNodeSize:I,setSelectedIDs:R,pointCloudBoxList:V}=React.useContext(PointCloudContext.PointCloudContext),{value:z}=useToolStyle.useToolStyleContext(),{hiddenText:H}=z||{},O=!e,E=React.useMemo(()=>({zIndex:s?-1:101,is2DView:!f,imageName:e.path}),[s,f,e.path]),{rendered:N,isLinking:T}=useDataLinkSwitch(E),S=n=>{g(),I({path:j,imgNode:n})},g=React.useCallback(()=>{var n,b;const y=(n=o.current)==null?void 0:n.toolInstance;if(u(""),!d||!y)return;const r=e.annotations.find($=>$.annotation.id===d.info.id);let L="";r&&((b=r==null?void 0:r.annotation.pointList)==null?void 0:b.length)>0&&(y.focusPositionByPointList(r==null?void 0:r.annotation.pointList),L=d.info.id,u(L))},[d,o.current,e.annotations]);React.useEffect(()=>{g()},[g]);const U=()=>__async(void 0,null,function*(){k(!0),C(!0);try{yield q(m,p!=null?p:"",v)}catch(n){console.error("highlightOnClick error:",n)}finally{k(!1),C(!1)}});return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:t},f?React__default.default.createElement(index,{src:(c=e==null?void 0:e.url)!=null?c:"",fallbackSrc:(l=e==null?void 0:e.fallbackUrl)!=null?l:"",annotations:e.annotations,size:x,ref:o,globalStyle:{display:O?"none":"block"},afterImgOnLoad:S,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:h,onRightClick:({targetId:n})=>R(n),pointCloudBoxList:V,hiddenText:H}):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{shouldExcludePointCloudBoxListUpdate:!T,mappingData:e,size:x,checkMode:a,afterImgOnLoad:S}),!a&&N),v&&React__default.default.createElement(index$2,{visible:P(m),onClick:U,loading:B,disabled:_,style:{position:"absolute",right:16,top:16,zIndex:s?-1:101}}))};module.exports=PointCloud2DSingleView;
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index$1=require("./components/PointCloudSizeSlider/index.js"),index$2=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var classNames__default=_interopDefaultLegacy(classNames),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,a,i)=>a in t?__defProp(t,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[a]=i,__spreadValues=(t,a)=>{for(var i in a||(a={}))__hasOwnProp.call(a,i)&&__defNormalProp(t,i,a[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(a))__propIsEnum.call(a,i)&&__defNormalProp(t,i,a[i]);return t},__spreadProps=(t,a)=>__defProps(t,__getOwnPropDescs(a));const EKeyCode=lbAnnotation.cKeyCode.default,pointCloudID="LABELBEE-POINTCLOUD",PointCloud3DContext=React__default.default.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),PointCloudViewIcon=({perspectiveView:t})=>{const{isActive:a,setTarget3DView:i}=React.useContext(PointCloud3DContext),c=n=>classNames__default.default({[dom.getClassName("point-cloud-3d-view",n)]:!0,active:a});return React__default.default.createElement("span",{onClick:()=>{i(lbUtils.EPerspectiveView[t])},className:c(t.toLocaleLowerCase())})},PointCloud3DSideBar=({isEnlarge:t})=>{const{reset3DView:a,followTopView:i}=React.useContext(PointCloud3DContext),{t:c}=reactI18next.useTranslation(),n=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Top"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Front"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Left"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Back"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Right"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"LFT"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"RBT"})),p=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(antd.Tooltip,{title:c("CameraFollowTopView")},React__default.default.createElement("span",{onClick:()=>{i()},className:dom.getClassName("point-cloud-3d-view","followTop")})),React__default.default.createElement("span",{onClick:()=>{a()},className:dom.getClassName("point-cloud-3d-view","reset")}));return t?React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebarZoom")},p,n):React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebar")},n,p)},PointCloud3D=({currentData:t,config:a,highlightAttribute:i})=>{var c;const n=React.useContext(PointCloudContext.PointCloudContext),[p,h]=React.useState(!0),[d,C]=React.useState(!1),m=React.useRef(null),{initPointCloud3d:P}=usePointCloudViews.usePointCloudViews(),v=useSize(m),{t:g}=reactI18next.useTranslation();React.useEffect(()=>{!n.mainViewInstance||P==null||P(v)},[v]);const{selectedBox:u}=useSingleBox.useSingleBox(),{selectedSphere:w}=useSphere.useSphere(),V=e=>{var o,l;const r=u==null?void 0:u.info;if(r){const s=__spreadValues({},r.center);s.x=s.x-.01,s.z=1e3;const f=e===lbUtils.EPerspectiveView.Top;(o=n.mainViewInstance)==null||o.updateCameraByBox(r,e,f?s:void 0)}w&&((l=n.mainViewInstance)==null||l.updateCameraBySphere(w,e))},I=()=>{var e;(e=n.mainViewInstance)==null||e.resetCamera()},b=()=>{var e,o;const l=(e=n.topViewInstance)==null?void 0:e.pointCloudInstance.camera;l&&((o=n.mainViewInstance)==null||o.applyCameraTarget(l))};React.useEffect(()=>{if(m.current&&(t==null?void 0:t.url)){let e=n.mainViewInstance;!e&&v.width&&(e=new lbAnnotation.PointCloud({container:m.current,isOrthographicCamera:!0,orthographicParams:lbUtils.PointCloudUtils.getDefaultOrthographicParams(v),config:a}),n.setMainViewInstance(e))}},[v,t]),React.useEffect(()=>{var e;if(m.current&&(t==null?void 0:t.url)&&t.result&&n.mainViewInstance){let o=n.mainViewInstance;const l=lbUtils.PointCloudUtils.getBoxParamsFromResultList(t.result);l.forEach(s=>{var f;const E=(f=lbUtils.toolStyleConverter.getColorFromConfig({attribute:s.attribute},__spreadProps(__spreadValues({},a),{attributeConfigurable:!0}),{}))==null?void 0:f.hex;o==null||o.addBoxToSense(s,E)}),o.render(),n.setPointCloudResult(l);const r=lbUtils.PointCloudUtils.getRectParamsFromResultList(t.result);n.setRectList(r),n.setPointCloudValid((e=index.jsonParser(t.result))==null?void 0:e.valid)}},[t,n.mainViewInstance]),React.useEffect(()=>{var e,o,l,r,s;if(((e=u==null?void 0:u.info)==null?void 0:e.id)!==void 0){V(lbUtils.EPerspectiveView.Top);const E=(r=(l=(o=n.topViewInstance)==null?void 0:o.pointCloudInstance)==null?void 0:l.camera.zoom)!=null?r:1;(s=n.mainViewInstance)==null||s.updateCameraZoom(E)}},[(c=u==null?void 0:u.info)==null?void 0:c.id]),React.useEffect(()=>{var e,o,l,r;if(w){V(lbUtils.EPerspectiveView.Top);const s=(l=(o=(e=n.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:o.camera.zoom)!=null?l:1;(r=n.mainViewInstance)==null||r.updateCameraZoom(s)}},[w]),React.useEffect(()=>(window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x)}),[]);const x=e=>{if(e.keyCode===EKeyCode.Esc){C(!1);return}},_=React.useMemo(()=>({reset3DView:I,setTarget3DView:V,isActive:!!u,followTopView:b}),[u,n.mainViewInstance]);React.useEffect(()=>{var e,o,l;const r=n.pointCloudBoxList.filter(s=>s.attribute===i);(r==null?void 0:r.length)>0&&((e=n.mainViewInstance)==null||e.clearHighlightBoxes(),(o=n.mainViewInstance)==null||o.highlightBoxes(r)),r.length===0&&((l=n.mainViewInstance)==null||l.clearHighlightBoxesAndRender())},[i,n.mainViewInstance]);const S=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{onChange:e=>{var o;(o=n.mainViewInstance)==null||o.updatePointSize({customSize:e})}}),React__default.default.createElement("span",{style:{marginRight:8}},g("ShowArrows")),React__default.default.createElement(antd.Switch,{size:"small",checked:p,onChange:e=>{var o;h(e),(o=n.mainViewInstance)==null||o.setShowDirection(e)}}),d&&React__default.default.createElement(PointCloud3DContext.Provider,{value:_},React__default.default.createElement(PointCloud3DSideBar,{isEnlarge:d})));return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-3d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:d}),title:d?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{C(!1)}}),g("3DView")):React__default.default.createElement(index$2,{title:g("3DView"),onClick:()=>{C(!0)}}),toolbar:S},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-content")},!d&&React__default.default.createElement(PointCloud3DContext.Provider,{value:_},React__default.default.createElement(PointCloud3DSideBar,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-view"),id:pointCloudID,ref:m})))};var PointCloud3DView=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud3D);module.exports=PointCloud3DView;
1
+ "use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index$1=require("./components/PointCloudSizeSlider/index.js"),index$2=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),useToolStyle=require("../../hooks/useToolStyle.js");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var classNames__default=_interopDefaultLegacy(classNames),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=(n,a,i)=>a in n?__defProp(n,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[a]=i,__spreadValues=(n,a)=>{for(var i in a||(a={}))__hasOwnProp.call(a,i)&&__defNormalProp(n,i,a[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(a))__propIsEnum.call(a,i)&&__defNormalProp(n,i,a[i]);return n},__spreadProps=(n,a)=>__defProps(n,__getOwnPropDescs(a));const EKeyCode=lbAnnotation.cKeyCode.default,pointCloudID="LABELBEE-POINTCLOUD",PointCloud3DContext=React__default.default.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),PointCloudViewIcon=({perspectiveView:n})=>{const{isActive:a,setTarget3DView:i}=React.useContext(PointCloud3DContext),c=t=>classNames__default.default({[dom.getClassName("point-cloud-3d-view",t)]:!0,active:a});return React__default.default.createElement("span",{onClick:()=>{i(lbUtils.EPerspectiveView[n])},className:c(n.toLocaleLowerCase())})},PointCloud3DSideBar=({isEnlarge:n})=>{const{reset3DView:a,followTopView:i}=React.useContext(PointCloud3DContext),{t:c}=reactI18next.useTranslation(),t=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Top"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Front"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Left"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Back"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Right"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"LFT"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"RBT"})),p=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(antd.Tooltip,{title:c("CameraFollowTopView")},React__default.default.createElement("span",{onClick:()=>{i()},className:dom.getClassName("point-cloud-3d-view","followTop")})),React__default.default.createElement("span",{onClick:()=>{a()},className:dom.getClassName("point-cloud-3d-view","reset")}));return n?React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebarZoom")},p,t):React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebar")},t,p)},PointCloud3D=({currentData:n,config:a,highlightAttribute:i})=>{var c;const t=React.useContext(PointCloudContext.PointCloudContext),[p,T]=React.useState(!0),[m,C]=React.useState(!1),f=React.useRef(null),{initPointCloud3d:P}=usePointCloudViews.usePointCloudViews(),v=useSize(f),{t:V}=reactI18next.useTranslation(),{value:x}=useToolStyle.useToolStyleContext(),{hiddenText:_}=x||{};React.useEffect(()=>{let e=t.mainViewInstance;e&&e.updateHiddenTextAndRender(_,t.pointCloudBoxList)},[x]),React.useEffect(()=>{!t.mainViewInstance||P==null||P(v)},[v]);const{selectedBox:u}=useSingleBox.useSingleBox(),{selectedSphere:w}=useSphere.useSphere(),[y,h]=React.useState(!0),g=e=>{var o,l;const r=u==null?void 0:u.info;if(r){const s=__spreadValues({},r.center);s.x=s.x-.01,s.z=1e3;const d=e===lbUtils.EPerspectiveView.Top;(o=t.mainViewInstance)==null||o.updateCameraByBox(r,e,d?s:void 0)}w&&((l=t.mainViewInstance)==null||l.updateCameraBySphere(w,e))},b=()=>{var e;(e=t.mainViewInstance)==null||e.resetCamera()},N=()=>{var e,o;const l=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance.camera;l&&((o=t.mainViewInstance)==null||o.applyCameraTarget(l))};React.useEffect(()=>{if(f.current&&(n==null?void 0:n.url)){let e=t.mainViewInstance;!e&&v.width&&(e=new lbAnnotation.PointCloud({container:f.current,isOrthographicCamera:!0,orthographicParams:lbUtils.PointCloudUtils.getDefaultOrthographicParams(v),config:a,hiddenText:_}),e.setHandlerPipe({setSelectedIDs:t.setSelectedIDs,setNeedUpdateCenter:h}),t.setMainViewInstance(e))}},[v,n]),React.useEffect(()=>{var e;if(f.current&&(n==null?void 0:n.url)&&n.result&&t.mainViewInstance){let o=t.mainViewInstance;const l=lbUtils.PointCloudUtils.getBoxParamsFromResultList(n.result);l.forEach(s=>{var d;const E=(d=lbUtils.toolStyleConverter.getColorFromConfig({attribute:s.attribute},__spreadProps(__spreadValues({},a),{attributeConfigurable:!0}),{}))==null?void 0:d.hex;o==null||o.addBoxToSense(s,E)}),o.render(),t.setPointCloudResult(l);const r=lbUtils.PointCloudUtils.getRectParamsFromResultList(n.result);t.setRectList(r),t.setPointCloudValid((e=index.jsonParser(n.result))==null?void 0:e.valid)}},[n,t.mainViewInstance]),React.useEffect(()=>{var e,o,l,r,s;const d=(e=u==null?void 0:u.info)==null?void 0:e.id;if(!y){h(!0);return}if(d!==void 0){g(lbUtils.EPerspectiveView.Top);const E=(r=(l=(o=t.topViewInstance)==null?void 0:o.pointCloudInstance)==null?void 0:l.camera.zoom)!=null?r:1;(s=t.mainViewInstance)==null||s.updateCameraZoom(E)}},[(c=u==null?void 0:u.info)==null?void 0:c.id]),React.useEffect(()=>{var e,o,l,r;if(w){g(lbUtils.EPerspectiveView.Top);const s=(l=(o=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:o.camera.zoom)!=null?l:1;(r=t.mainViewInstance)==null||r.updateCameraZoom(s)}},[w]),React.useEffect(()=>(window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I)}),[]);const I=e=>{if(e.keyCode===EKeyCode.Esc){C(!1);return}},S=React.useMemo(()=>({reset3DView:b,setTarget3DView:g,isActive:!!u,followTopView:N}),[u,t.mainViewInstance]);React.useEffect(()=>{var e,o,l;const r=t.pointCloudBoxList.filter(s=>s.attribute===i);(r==null?void 0:r.length)>0&&((e=t.mainViewInstance)==null||e.clearHighlightBoxes(),(o=t.mainViewInstance)==null||o.highlightBoxes(r)),r.length===0&&((l=t.mainViewInstance)==null||l.clearHighlightBoxesAndRender())},[i,t.mainViewInstance]);const B=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{onChange:e=>{var o;(o=t.mainViewInstance)==null||o.updatePointSize({customSize:e})}}),React__default.default.createElement("span",{style:{marginRight:8}},V("ShowArrows")),React__default.default.createElement(antd.Switch,{size:"small",checked:p,onChange:e=>{var o;T(e),(o=t.mainViewInstance)==null||o.setShowDirection(e)}}),m&&React__default.default.createElement(PointCloud3DContext.Provider,{value:S},React__default.default.createElement(PointCloud3DSideBar,{isEnlarge:m})));return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-3d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:m}),title:m?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{C(!1)}}),V("3DView")):React__default.default.createElement(index$2,{title:V("3DView"),onClick:()=>{C(!0)}}),toolbar:B},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-content")},!m&&React__default.default.createElement(PointCloud3DContext.Provider,{value:S},React__default.default.createElement(PointCloud3DSideBar,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-view"),id:pointCloudID,ref:f})))};var PointCloud3DView=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud3D);module.exports=PointCloud3DView;
@@ -1 +1 @@
1
- "use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),useStatus=require("./hooks/useStatus.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),reactI18next=require("react-i18next"),actionCreators=require("../../store/annotation/actionCreators.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,r,l)=>r in i?__defProp(i,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[r]=l,__spreadValues=(i,r)=>{for(var l in r||(r={}))__hasOwnProp.call(r,l)&&__defNormalProp(i,l,r[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(r))__propIsEnum.call(r,l)&&__defNormalProp(i,l,r[l]);return i},__spreadProps=(i,r)=>__defProps(i,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:i,config:r,checkMode:l,configString:V,imgIndex:f,toolInstanceRef:u,setResourceLoading:E})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:L,selectNextBox:B,selectPrevBox:q,updateSelectedBox:C,deleteSelectedPointCloudBoxAndPolygon:O}=useSingleBox.useSingleBox(),{selectedSphere:P,updatePointCloudSphere:A}=useSphere.useSphere(),{clearAllResult:y,updatePointCloudPattern:j}=useStatus.useStatus(),{copySelectedBoxes:I,pasteSelectedBoxes:T,copiedBoxes:$}=useBoxes.useBoxes({config:r,currentData:i}),{updateRotate:g}=useRotate.useRotate({currentData:i}),{updateRotateEdge:D}=useRotateEdge.useRotateEdge({currentData:i}),{updatePointCloudData:v,topViewSelectedChanged:h}=usePointCloudViews.usePointCloudViews({setResourceLoading:E}),{redo:m,undo:S,pushHistoryWithList:N,pushHistoryUnderUpdatePolygon:R,pushHistoryUnderUpdateLine:H}=useHistory.useHistory(),K=ctx.useDispatch(),{syncThreeViewsAttribute:x}=useAttribute.useAttribute(),{syncAllViewsConfig:U,reRenderTopViewRange:z}=useConfig.useConfig(),{selectedPolygon:k}=usePolygon.usePolygon(),{selectedLine:_}=useLine.useLine(),{t:w}=reactI18next.useTranslation(),F=ahooks.useLatest(i),b=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},G=(t,o)=>{var s,a;const{topViewInstance:c,mainViewInstance:n}=e;if(!c)return;const{pointCloud2dOperation:d}=c;switch(t){case"q":{g(e.rectRotateSensitivity);break}case"e":g(-Number(e.rectRotateSensitivity));break;case"g":D(-90);break;case"u":{const p=d.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;j(p);const Y={[lbAnnotation.EToolName.Polygon]:w("PolygonPattern"),[lbAnnotation.EToolName.Rect]:w("RectPattern")};antd.message.success(w("ChangePatternMsg",{pattern:Y[p]})),d.clearActiveStatus(),d.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){q();break}B(),o.preventDefault();break;case"f":L();break;case"arrowup":b({y:-1});break;case"arrowdown":b({y:1});break;case"arrowleft":b({x:-1});break;case"arrowright":b({x:1});break;case"delete":O(F.current);break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const p=lbAnnotation.AttributeUtils.getAttributeByKeycode(o.keyCode,r.attributeList);p!==void 0&&((a=u.current)==null||a.setDefaultAttribute(p))}return}}},M=(t,o)=>{switch(t){case"c":I();break;case"v":T();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?m():S();break}}},W=ahooks.useLatest(t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||l===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){M(o,t);return}G(o,t)});return React.useEffect(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(c=>W.current(c))},[e,e.topViewInstance,e.windowKeydownListenerHook]),React.useEffect(()=>{U(r)},[V]),React.useEffect(()=>{(r==null?void 0:r.radius)&&z(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{v==null||v()},[f,e.mainViewInstance]),React.useEffect(()=>{e.setHideAttributes([])},[f]),React.useEffect(()=>{u.current.setDefaultAttribute=t=>{var o,s,a,c;x(t);const n=e.selectedPointCloudBox;if(n){n.attribute=t;const d=K(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[n],stepConfig:r,action:"viewUpdateBox"}));n.valid=d[0].valid;const p=C(n);(a=(s=(o=e==null?void 0:e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:s.setPolygonValidAndRender)==null||a.call(s,n.id,!0,n.valid),e.mainViewInstance&&h({newSelectedBox:n,newPointCloudList:p})}if(k&&R(__spreadProps(__spreadValues({},k),{attribute:t})),_&&H(__spreadProps(__spreadValues({},_),{attribute:t})),P){const d=A(__spreadProps(__spreadValues({},P),{attribute:t}));e.mainViewInstance&&((c=e.mainViewInstance)==null||c.generateSpheres(d),h({newSelectedSphere:P,newSphereList:d}))}},u.current.setSubAttribute=(t,o)=>{var s;const a=e.selectedPointCloudBox;if(a){const c=(s=a==null?void 0:a.subAttribute)!=null?s:{};a.subAttribute=__spreadProps(__spreadValues({},c),{[t]:o}),C(a)}},u.current.clearResult=()=>{y==null||y()},u.current.redo=()=>{m()},u.current.undo=()=>{S()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&y()})},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(()=>{v==null||v(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),React.useEffect(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),React.useEffect(()=>{u.current.history={pushHistory:t=>{N({pointCloudBoxList:t})},initRecord:()=>{}}},[]),React.useEffect(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||l)return;const s=n=>{x(n)},a=n=>{antd.message.error(n)},c=n=>{antd.message.info(n)};return o.on("syncAttribute",s),o.on("messageError",a),o.on("messageInfo",c),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",a),o.unbind("messageInfo",c)}},[e.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
1
+ "use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),useStatus=require("./hooks/useStatus.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),reactI18next=require("react-i18next"),actionCreators=require("../../store/annotation/actionCreators.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,r,l)=>r in i?__defProp(i,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[r]=l,__spreadValues=(i,r)=>{for(var l in r||(r={}))__hasOwnProp.call(r,l)&&__defNormalProp(i,l,r[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(r))__propIsEnum.call(r,l)&&__defNormalProp(i,l,r[l]);return i},__spreadProps=(i,r)=>__defProps(i,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:i,config:r,checkMode:l,configString:_,imgIndex:f,toolInstanceRef:u,setResourceLoading:B})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:E,selectNextBox:L,selectPrevBox:q,updateSelectedBox:C,deleteSelectedPointCloudBoxAndPolygon:I}=useSingleBox.useSingleBox(),{selectedSphere:b,updatePointCloudSphere:O}=useSphere.useSphere(),{clearAllResult:w,updatePointCloudPattern:A}=useStatus.useStatus(),{copySelectedBoxes:j,pasteSelectedBoxes:T,copiedBoxes:$}=useBoxes.useBoxes({config:r,currentData:i}),{updateRotate:g}=useRotate.useRotate({currentData:i}),{updateRotateEdge:D}=useRotateEdge.useRotateEdge({currentData:i}),{updatePointCloudData:v,topViewSelectedChanged:m}=usePointCloudViews.usePointCloudViews({setResourceLoading:B}),{redo:h,undo:x,pushHistoryWithList:N,pushHistoryUnderUpdatePolygon:R,pushHistoryUnderUpdateLine:H}=useHistory.useHistory(),K=ctx.useDispatch(),{syncThreeViewsAttribute:S}=useAttribute.useAttribute(),{syncAllViewsConfig:U,reRenderTopViewRange:z}=useConfig.useConfig(),{selectedPolygon:k}=usePolygon.usePolygon(),{selectedLine:V}=useLine.useLine(),{t:y}=reactI18next.useTranslation(),F=ahooks.useLatest(i),P=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},G=(t,o)=>{var s,a;const{topViewInstance:c,mainViewInstance:n}=e;if(!c)return;const{pointCloud2dOperation:d}=c;switch(t){case"q":{g(e.rectRotateSensitivity);break}case"e":g(-Number(e.rectRotateSensitivity));break;case"g":D(-90);break;case"u":{const p=d.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;A(p);const Y={[lbAnnotation.EToolName.Polygon]:y("PolygonPattern"),[lbAnnotation.EToolName.Rect]:y("RectPattern")};antd.message.success(y("ChangePatternMsg",{pattern:Y[p]})),d.clearActiveStatus(),d.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){q();break}L(),o.preventDefault();break;case"f":E();break;case"arrowup":P({y:-1});break;case"arrowdown":P({y:1});break;case"arrowleft":P({x:-1});break;case"arrowright":P({x:1});break;case"delete":I(F.current);break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const p=lbAnnotation.AttributeUtils.getAttributeByKeycode(o.keyCode,r.attributeList);p!==void 0&&((a=u.current)==null||a.setDefaultAttribute(p))}return}}},M=(t,o)=>{switch(t){case"c":j();break;case"v":T();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?h():x();break}}},W=ahooks.useLatest(t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||l===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){M(o,t);return}G(o,t)});return React.useEffect(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(c=>W.current(c))},[e,e.topViewInstance,e.windowKeydownListenerHook]),React.useEffect(()=>{U(r)},[_]),React.useEffect(()=>{(r==null?void 0:r.radius)&&z(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{v==null||v()},[f,e.mainViewInstance]),React.useEffect(()=>{e.setHideAttributes([])},[f]),React.useEffect(()=>{u.current.setDefaultAttribute=t=>{var o,s,a,c;S(t);const n=e.selectedPointCloudBox;if(n){n.attribute=t;const d=K(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[n],stepConfig:r,action:"viewUpdateBox"}));n.valid=d[0].valid;const p=C(n);(a=(s=(o=e==null?void 0:e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:s.setPolygonValidAndRender)==null||a.call(s,n.id,!0,n.valid),e.mainViewInstance&&(m({newSelectedBox:n,newPointCloudList:p}),e.mainViewInstance.generateBoxes(p))}if(k&&R(__spreadProps(__spreadValues({},k),{attribute:t})),V&&H(__spreadProps(__spreadValues({},V),{attribute:t})),b){const d=O(__spreadProps(__spreadValues({},b),{attribute:t}));e.mainViewInstance&&((c=e.mainViewInstance)==null||c.generateSpheres(d),m({newSelectedSphere:b,newSphereList:d}))}},u.current.setSubAttribute=(t,o)=>{var s;const a=e.selectedPointCloudBox;if(a){const c=(s=a==null?void 0:a.subAttribute)!=null?s:{};a.subAttribute=__spreadProps(__spreadValues({},c),{[t]:o}),C(a),e.mainViewInstance&&e.selectedPointCloudBox&&e.mainViewInstance.generateBox(e.selectedPointCloudBox)}},u.current.clearResult=()=>{w==null||w()},u.current.redo=()=>{h()},u.current.undo=()=>{x()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&w()})},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(()=>{v==null||v(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),React.useEffect(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),React.useEffect(()=>{u.current.history={pushHistory:t=>{N({pointCloudBoxList:t})},initRecord:()=>{}}},[]),React.useEffect(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||l)return;const s=n=>{S(n)},a=n=>{antd.message.error(n)},c=n=>{antd.message.info(n)};return o.on("syncAttribute",s),o.on("messageError",a),o.on("messageInfo",c),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",a),o.unbind("messageInfo",c)}},[e.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
@@ -3,6 +3,7 @@
3
3
  * @author laoluo
4
4
  */
5
5
  import React from 'react';
6
+ import { IPointCloudBoxList } from '@labelbee/lb-utils';
6
7
  export type TAfterImgOnLoad = (img: HTMLImageElement) => void;
7
8
  interface IProps {
8
9
  src: string;
@@ -30,6 +31,12 @@ interface IProps {
30
31
  };
31
32
  staticMode?: boolean;
32
33
  measureVisible?: boolean;
34
+ onRightClick?: (e: {
35
+ event: MouseEvent;
36
+ targetId: string;
37
+ }) => void;
38
+ pointCloudBoxList?: IPointCloudBoxList;
39
+ hiddenText?: boolean;
33
40
  }
34
41
  declare const _default: React.ForwardRefExoticComponent<IProps & React.RefAttributes<unknown>>;
35
42
  export default _default;
@@ -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$5=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"),index$4=require("./components/firstFrameDataSwitch/index.js"),lbUtils=require("@labelbee/lb-utils"),index$6=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$8=require("../index.js"),actionCreators=require("../../../../store/annotation/actionCreators.js"),usePointCloudViews=require("../../../../components/pointCloudView/hooks/usePointCloudViews.js"),index$7=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(g=>g.trackID===d&&g.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}S(v)};React.useEffect(()=>{t(!1)},[m]);const S=d=>{var v;const g=o({trackID:d});(v=n==null?void 0:n.topViewInstance)==null||v.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,p("CurrentBoxTrackIDs")),m&&React__default.default.createElement(index$5,{id:m,updateCurrentPolygonList:d=>S(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:S}=reactI18next.useTranslation(),{defaultAttribute:d}=useAttribute.useAttribute(),v=usePointCloudViews.usePointCloudViews(),{isPointCloudSegmentationPattern:g}=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}))},q=l=>{v.updateViewsByDefaultSize&&v.updateViewsByDefaultSize(l)},I=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=g;return React__default.default.createElement("div",{style:{height:"100%",overflow:"auto",display:"flex",flexDirection:"column"}},React__default.default.createElement("div",{style:w},S("Attribute")),React__default.default.createElement("div",{style:{height:0,flex:1,overflowY:"auto",overflowX:"hidden"}},React__default.default.createElement(index$6.default,{list:h,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:l=>I(l),updateColorConfig:j,enableColorPicker:u,updateSize:q,forbidShowLimitPopover:V}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),k&&React__default.default.createElement(index$7,{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$8.sidebarCls}__level`},renderSegmentTools.map(o=>{const u=n===o.toolName;return React__default.default.createElement("span",{className:`${index$8.sidebarCls}__toolOption`,key:o.toolName,onClick:()=>t==null?void 0:t.emit(o.toolName)},React__default.default.createElement("img",{className:`${index$8.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$8.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),S=(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:S,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:400,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:S,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),e.loadPreStep>0&&React__default.default.createElement(index$4,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;
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$5=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"),index$4=require("./components/firstFrameDataSwitch/index.js"),lbUtils=require("@labelbee/lb-utils"),index$6=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$8=require("../index.js"),actionCreators=require("../../../../store/annotation/actionCreators.js"),usePointCloudViews=require("../../../../components/pointCloudView/hooks/usePointCloudViews.js"),index$7=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,r=d=>!!i.find(g=>g.trackID===d&&g.id!==(s==null?void 0:s.info.id)),a=(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(r(v)){antd.message.error(p("DuplicateTrackIDsExist"));return}if(!(v>0)){antd.message.error(p("PositiveIntegerCheck"));return}S(v)};React.useEffect(()=>{t(!1)},[m]);const S=d=>{var v;const g=o({trackID:d});(v=n==null?void 0:n.topViewInstance)==null||v.updatePolygonList(g!=null?g:[]),n.mainViewInstance&&n.selectedPointCloudBox&&(n==null||n.mainViewInstance.generateBox(n==null?void 0:n.selectedPointCloudBox))};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$5,{id:m,updateCurrentPolygonList:d=>S(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:()=>{a()},onPressEnter:()=>{a(!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(),r=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:a}=r,{t:S}=reactI18next.useTranslation(),{defaultAttribute:d}=useAttribute.useAttribute(),v=usePointCloudViews.usePointCloudViews(),{isPointCloudSegmentationPattern:g}=useStatus.useStatus(),D=ctx.useDispatch(),T={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};React.useEffect(()=>{if(!!a)return a.on("syncPointCloudStatus",p),()=>{a.unbind("syncPointCloudStatus",p)}},[a]);const j=(l,C)=>{var b,x,P,E,y;const _=(b=i==null?void 0:i.attributeList)==null?void 0:b.map(f=>f.value===l?__spreadProps(__spreadValues({},f),{color:C}):f),w=__spreadProps(__spreadValues({},i),{attributeList:_}),B=JSON.stringify(w),A=s==null?void 0:s.map(f=>(f==null?void 0:f.step)===(o==null?void 0:o.step)?__spreadProps(__spreadValues({},f),{config:B}):f);(x=r==null?void 0:r.topViewInstance)==null||x.updateAttributeList(_),(P=r==null?void 0:r.sideViewInstance)==null||P.updateAttributeList(_),(E=r==null?void 0:r.backViewInstance)==null||E.updateAttributeList(_),(y=r==null?void 0:r.mainViewInstance)==null||y.setConfig(w),D(actionCreators.SetTaskStepList({stepList:A}))},I=l=>{v.updateViewsByDefaultSize&&v.updateViewsByDefaultSize(l)},q=l=>{isAllowUpdateInSegment({globalPattern:r.globalPattern,segmentStatus:c.segmentStatus})||n.setDefaultAttribute(l)},L=(l,C)=>{isAllowUpdateInSegment({globalPattern:r.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})),V=m||c.cacheSegData&&c.segmentStatus===lbUtils.EPointCloudSegmentStatus.Edit,k=g;return React__default.default.createElement("div",{style:{height:"100%",overflow:"auto",display:"flex",flexDirection:"column"}},React__default.default.createElement("div",{style:T},S("Attribute")),React__default.default.createElement("div",{style:{height:0,flex:1,overflowY:"auto",overflowX:"hidden"}},React__default.default.createElement(index$6.default,{list:h,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:l=>q(l),updateColorConfig:j,enableColorPicker:u,updateSize:I,forbidShowLimitPopover:k}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),V&&React__default.default.createElement(index$7,{subAttributeList:t,setSubAttribute:L,getValue:l=>{var C,b,x,P;return((b=(C=r.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:b[l.value])||((P=(x=c.cacheSegData)==null?void 0:x.subAttribute)==null?void 0:P[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$8.sidebarCls}__level`},renderSegmentTools.map(o=>{const u=n===o.toolName;return React__default.default.createElement("span",{className:`${index$8.sidebarCls}__toolOption`,key:o.toolName,onClick:()=>t==null?void 0:t.emit(o.toolName)},React__default.default.createElement("img",{className:`${index$8.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$8.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:r}=useStatus.useStatus(),a=index.jsonParser(e.config),S=(u=a==null?void 0:a.attributeList)!=null?u:[],d=(a==null?void 0:a.secondaryAttributeConfigurable)===!0?(c=a==null?void 0:a.inputList)!=null?c:[]:[];return r?React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegToolIcon,{toolInstance:t}),React__default.default.createElement(AttributeUpdater,{toolInstance:t,attributeList:S,subAttributeList:d,config:a,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:400,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:S,subAttributeList:d,config:a,stepList:s,stepInfo:e,enableColorPicker:o}),(a==null?void 0:a.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),e.loadPreStep>0&&React__default.default.createElement(index$4,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;
@@ -1 +1 @@
1
- import w,{useState as T,useRef as b,useImperativeHandle as $,useEffect as v,useCallback as k}from"react";import{ViewOperation as q,ImgUtils as B}from"@labelbee/lb-annotation";import{Spin as G}from"antd/es";import J from"../../hooks/useRefCache.js";import K from"../measureCanvas/index.js";var Q=Object.defineProperty,V=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,j=(t,n,o)=>n in t?Q(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,S=(t,n)=>{for(var o in n||(n={}))W.call(n,o)&&j(t,o,n[o]);if(V)for(var o of V(n))X.call(n,o)&&j(t,o,n[o]);return t},D=(t,n,o)=>new Promise((g,d)=>{var c=l=>{try{f(o.next(l))}catch(m){d(m)}},s=l=>{try{f(o.throw(l))}catch(m){d(m)}},f=l=>l.done?g(l.value):Promise.resolve(l.value).then(c,s);f((o=o.apply(t,n)).next())});const C={width:455,height:100},Y=t=>{if(!t)return C;if(t.width&&t.height)return t;const n=S({},t);return n.width||(n.width=C.width),n.height||(n.height=C.height),n},ee=(t,n)=>{var o,g;const{src:d,fallbackSrc:c,annotations:s=[],style:f={stroke:"blue",thickness:3},zoomChange:l,backgroundStyle:m={},onChange:I,showLoading:N=!1,globalStyle:M,afterImgOnLoad:U,measureVisible:z}=t,_=Y(t.size),[Z,E]=T(!1),O=b(null),r=b(),R=J(U),h=b([]),p=b(!0);$(n,()=>{const e=r.current;return e?{zoomIn:()=>e.zoomChanged(!0),zoomOut:()=>e.zoomChanged(!1),initImgPos:()=>e.initImgPos(),toolInstance:e}:{}},[r.current]),v(()=>(O.current&&(r.current=new q({container:O.current,size:_,style:f,annotations:s,config:"{}",zoomInfo:t.zoomInfo,staticMode:t.staticMode}),r.current.init()),()=>{var e;(e=r.current)==null||e.destroy()}),[z]);const P=k(e=>D(void 0,null,function*(){var u,a;try{const i=yield B.load(e);return(u=r.current)==null||u.setImgNode(i),(a=R.current)==null||a.call(R,i),null}catch(i){return console.error("Error loading image:",i),i}}),[]),A=k(e=>D(void 0,null,function*(){var u,a;if(E(!0),(u=r.current)==null||u.setLoading(!0),(yield P(e))&&c){const y=yield P(c);y&&console.error("Error loading fallback image:",y)}(a=r.current)==null||a.setLoading(!1),E(!1)}),[P,c]);v(()=>{r.current&&A(d)},[d,z,c,A]),v(()=>{if(p.current===!1){h.current.push(s);return}const e=()=>{p.current=!0,h.current=[]},u=()=>{var a;const i=h.current.length;if(i>0){const y=h.current[i-1];h.current=[],(a=r.current)==null||a.updateData(y).then(u).catch(e)}else p.current=!0};r.current&&(p.current=!1,r.current.updateData(s).then(u).catch(e))},[s]),v(()=>{const e=r.current;(e==null?void 0:e.setSize)&&(e.setSize(_),e.initPosition())},[(o=t.size)==null?void 0:o.width,(g=t.size)==null?void 0:g.height]),v(()=>{var e,u;return r.current&&((e=r.current)==null||e.on("onChange",(...a)=>{I==null||I.apply(null,a)}),(u=r.current)==null||u.on("renderZoom",a=>{l&&l(a)})),()=>{var a,i;(a=r.current)==null||a.unbindAll("onChange"),(i=r.current)==null||i.unbindAll("renderZoom")}},[l,I]);const x=w.createElement("div",{ref:O,style:S(S({position:"relative"},_),m)}),{imgNode:L,zoom:F,currentPos:H}=r.current||{};return w.createElement(G,{spinning:N||Z,delay:300,style:M},z&&L?w.createElement(K,{size:_,imgNode:L,zoom:F,currentPos:H}):x)};var te=w.forwardRef(ee);export{te as default};
1
+ import w,{useState as q,useRef as y,useContext as G,useImperativeHandle as J,useEffect as c,useCallback as j}from"react";import{ViewOperation as K,ImgUtils as Q}from"@labelbee/lb-annotation";import{Spin as W}from"antd/es";import X from"../../hooks/useRefCache.js";import Y from"../measureCanvas/index.js";import{PointCloudContext as ee}from"../pointCloudView/PointCloudContext.js";var te=Object.defineProperty,D=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,N=(n,r,o)=>r in n?te(n,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[r]=o,R=(n,r)=>{for(var o in r||(r={}))ne.call(r,o)&&N(n,o,r[o]);if(D)for(var o of D(r))re.call(r,o)&&N(n,o,r[o]);return n},M=(n,r,o)=>new Promise((g,f)=>{var s=u=>{try{m(o.next(u))}catch(h){f(h)}},d=u=>{try{m(o.throw(u))}catch(h){f(h)}},m=u=>u.done?g(u.value):Promise.resolve(u.value).then(s,d);m((o=o.apply(n,r)).next())});const S={width:455,height:100},oe=n=>{if(!n)return S;if(n.width&&n.height)return n;const r=R({},n);return r.width||(r.width=S.width),r.height||(r.height=S.height),r},ie=(n,r)=>{var o,g;const{src:f,fallbackSrc:s,annotations:d=[],style:m={stroke:"blue",thickness:3},zoomChange:u,backgroundStyle:h={},onChange:I,showLoading:T=!1,globalStyle:U,afterImgOnLoad:Z,measureVisible:P,onRightClick:_,pointCloudBoxList:E=[],hiddenText:L=!1}=n,p=oe(n.size),[B,k]=q(!1),z=y(null),e=y(),x=X(Z),v=y([]),C=y(!0);G(ee),J(r,()=>{const t=e.current;return t?{zoomIn:()=>t.zoomChanged(!0),zoomOut:()=>t.zoomChanged(!1),initImgPos:()=>t.initImgPos(),toolInstance:t}:{}},[e.current]),c(()=>(z.current&&(e.current=new K({container:z.current,size:p,style:m,annotations:d,config:"{}",zoomInfo:n.zoomInfo,staticMode:n.staticMode}),e.current.init(),_&&e.current.on("onRightClick",_)),()=>{var t,a;_&&((t=e.current)==null||t.unbind("onRightClick",_)),(a=e.current)==null||a.destroy()}),[P]);const O=j(t=>M(void 0,null,function*(){var a,i;try{const l=yield Q.load(t);return(a=e.current)==null||a.setImgNode(l),(i=x.current)==null||i.call(x,l),null}catch(l){return console.error("Error loading image:",l),l}}),[]),A=j(t=>M(void 0,null,function*(){var a,i;if(k(!0),(a=e.current)==null||a.setLoading(!0),(yield O(t))&&s){const b=yield O(s);b&&console.error("Error loading fallback image:",b)}(i=e.current)==null||i.setLoading(!1),k(!1)}),[O,s]);c(()=>{e.current&&A(f)},[f,P,s,A]),c(()=>{(e==null?void 0:e.current)&&e.current.setPointCloudBoxList(E)},[E]),c(()=>{var t;(e==null?void 0:e.current)&&((t=e.current)==null||t.setHiddenText(L))},[L]),c(()=>{if(C.current===!1){v.current.push(d);return}const t=()=>{C.current=!0,v.current=[]},a=()=>{var i;const l=v.current.length;if(l>0){const b=v.current[l-1];v.current=[],(i=e.current)==null||i.updateData(b).then(a).catch(t)}else C.current=!0};e.current&&(C.current=!1,e.current.updateData(d).then(a).catch(t))},[d]),c(()=>{const t=e.current;(t==null?void 0:t.setSize)&&(t.setSize(p),t.initPosition())},[(o=n.size)==null?void 0:o.width,(g=n.size)==null?void 0:g.height]),c(()=>{var t,a;return e.current&&((t=e.current)==null||t.on("onChange",(...i)=>{I==null||I.apply(null,i)}),(a=e.current)==null||a.on("renderZoom",i=>{u&&u(i)})),()=>{var i,l;(i=e.current)==null||i.unbindAll("onChange"),(l=e.current)==null||l.unbindAll("renderZoom")}},[u,I]);const H=w.createElement("div",{ref:z,style:R(R({position:"relative"},p),h)}),{imgNode:V,zoom:F,currentPos:$}=e.current||{};return w.createElement(W,{spinning:T||B,delay:300,style:U},P&&V?w.createElement(Y,{size:p,imgNode:V,zoom:F,currentPos:$}):H)};var ae=w.forwardRef(ie);export{ae as default};
@@ -1 +1 @@
1
- import{useLatest as q,useMemoizedFn as U}from"ahooks";import{Spin as le}from"antd/es";import k,{useContext as ie,useRef as G,useState as ce,useMemo as ue,useCallback as se,useEffect as f}from"react";import{connect as ae}from"react-redux";import{usePointCloudViews as de}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as fe}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as pe}from"../../store/annotation/map.js";import{LabelBeeContext as me}from"../../store/ctx.js";import{PointCloud2DRectOperation as ve,ImgUtils as ge}from"@labelbee/lb-annotation";import{selectSpecifiedRectsFromTopViewSelectedIds as Re}from"./util.js";import{useUpdateRectList as _e}from"./useUpdateRectList.js";import{useToolStyleContext as De}from"../../hooks/useToolStyle.js";var Ie=Object.defineProperty,he=Object.defineProperties,be=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable,K=(u,i,c)=>i in u?Ie(u,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):u[i]=c,m=(u,i)=>{for(var c in i||(i={}))we.call(i,c)&&K(u,c,i[c]);if(H)for(var c of H(i))ye.call(i,c)&&K(u,c,i[c]);return u},h=(u,i)=>he(u,be(i)),A=(u,i,c)=>new Promise((s,v)=>{var _=a=>{try{D(c.next(a))}catch(g){v(g)}},S=a=>{try{D(c.throw(a))}catch(g){v(g)}},D=a=>a.done?s(a.value):Promise.resolve(a.value).then(_,S);D((c=c.apply(u,i)).next())});const Pe=u=>{var i,c;const{mappingData:s,size:v,config:_,checkMode:S,afterImgOnLoad:D,shouldExcludePointCloudBoxListUpdate:a}=u,g=(i=s==null?void 0:s.url)!=null?i:"",b=(c=s==null?void 0:s.fallbackUrl)!=null?c:"",{pointCloudBoxList:C,setPointCloudResult:O,defaultAttribute:L,rectList:V,addRectIn2DView:Q,updateRectIn2DView:W,removeRectIn2DView:X,updateRectListByReducer:Y,selectedIDs:w,setSelectedIDs:T}=ie(fe),{value:j}=De(),Z=q(w),{update2DViewRect:ee,remove2DViewRect:te}=de(),E=k.useRef(null),o=G(null),F=U(ee),y=U(te),P=G(null),[ne,M]=ce(!0),N=ue(()=>V==null?void 0:V.filter(e=>e.imageName===(s==null?void 0:s.path)),[s==null?void 0:s.path,V]),x=q(s==null?void 0:s.path),B=se(e=>A(void 0,null,function*(){try{const r=Z.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(r.length){const n=new Set(r),l=t.filter(d=>n.has(d.id)).map(d=>d.id);T(l)}return t}catch(r){}}),[T]),z=e=>{const{boxID:r}=e;if(!a&&r){B(()=>{const t=F==null?void 0:F(e);return t?(P.current=t,O(t),t):null});return}W(e,!0)},J=e=>{x.current&&Q(h(m({},e),{imageName:x.current}))},$=e=>{if(e.length===0)return;if(!a){const t=e.find(n=>n.boxID);if(t){B(()=>{const n=y==null?void 0:y(t);return n?(P.current=n,O(n),R(),n):null});return}}const r=e.find(t=>t.extId);r&&B(()=>{const{imageName:t,extId:n}=r,l=y==null?void 0:y({boxID:n,imageName:t});return l?(P.current=l,O(l),l):null}),X(e)},re=U(()=>{let e=[];return C.forEach(r=>{const{rects:t=[],id:n,attribute:l,trackID:d}=r,p=t.find(oe=>oe.imageName===x.current),I=n+"_"+x.current;p&&(e=[...e,h(m({},p),{boxID:n,id:I,attribute:l,order:d})])}),e}),R=_e(()=>{var e,r,t;const n=a?[]:re(),l=(e=o.current)==null?void 0:e.selectedRectID,d=w.slice(0),p=Re(d,n,N);(r=o.current)==null||r.setResult(p),l&&((t=o.current)==null||t.setSelectedRectID(l))});return f(()=>{if(E.current){const e=new ve({container:E.current,size:v,config:h(m({},_),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:S});return o.current=e,o.current.init(),o.current.on("updateDragResult",z),o.current.on("afterAddingDrawingRect",J),o.current.on("deleteSelectedRects",$),()=>{var r,t,n,l;(r=o.current)==null||r.unbind("updateDragResult",z),(t=o.current)==null||t.unbind("afterAddingDrawingRect",J),(n=o.current)==null||n.unbind("deleteSelectedRects",$),(l=o.current)==null||l.destroy()}}},[]),f(()=>{const e=t=>A(void 0,null,function*(){try{return yield ge.load(t)}catch(n){return console.error("Error loading image:",n),null}}),r=()=>A(void 0,null,function*(){var t;M(!0);let n=yield e(g);!n&&b&&(n=yield e(b)),n&&((t=o.current)==null||t.setImgNode(n),D(n)),M(!1)});o.current&&(g||b)&&r()},[g,b]),f(()=>{var e;(e=o.current)==null||e.setSize(v)},[v]),f(()=>{C!==P.current&&R()},[C]),f(()=>{var e,r;const t=N.find(n=>n.id===o.current.selectedRectID);(r=(e=o.current)==null?void 0:e.setDefaultAttribute)==null||r.call(e,L),t&&Y(n=>{var l;const d=[];let p=null;return n.forEach(I=>{I.id!==o.current.selectedRectID?d.push(I):p=I}),t.extId===void 0&&(p=(l=o.current)==null?void 0:l.selectedRect),[...d,h(m({},p||{}),{attribute:L})]}),R()},[L]),f(()=>{R()},[N]),f(()=>{R()},[a]),f(()=>{var e,r,t,n;const l=(r=(e=o.current)==null?void 0:e.config)!=null?r:{},d=h(m({},l),{attributeList:(t=_.attributeList)!=null?t:[]});(n=o.current)==null||n.setConfig(JSON.stringify(d))},[_.attributeList]),f(()=>{var e;(e=o.current)==null||e.setEnableAddRect(w.length===0),R()},[w]),f(()=>{const{hiddenText:e}=j||{};if(e===void 0)return;const r=o.current;if(!r)return;const t=m(m({},r.style),j);r.setStyle(t)},[j]),k.createElement(le,{spinning:ne},k.createElement("div",{ref:E,style:m({position:"relative"},v)}))};var xe=ae(pe,null,null,{context:me})(Pe);export{xe as default};
1
+ import{useLatest as G,useMemoizedFn as U}from"ahooks";import{Spin as ie}from"antd/es";import A,{useContext as ce,useRef as H,useState as ue,useMemo as se,useCallback as ae,useEffect as f}from"react";import{connect as de}from"react-redux";import{usePointCloudViews as fe}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as pe}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as me}from"../../store/annotation/map.js";import{LabelBeeContext as ve}from"../../store/ctx.js";import{PointCloud2DRectOperation as ge,ImgUtils as Re}from"@labelbee/lb-annotation";import{selectSpecifiedRectsFromTopViewSelectedIds as _e}from"./util.js";import{useUpdateRectList as he}from"./useUpdateRectList.js";import{useToolStyleContext as De}from"../../hooks/useToolStyle.js";var Ie=Object.defineProperty,be=Object.defineProperties,we=Object.getOwnPropertyDescriptors,K=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,Q=(s,i,c)=>i in s?Ie(s,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):s[i]=c,m=(s,i)=>{for(var c in i||(i={}))ye.call(i,c)&&Q(s,c,i[c]);if(K)for(var c of K(i))Pe.call(i,c)&&Q(s,c,i[c]);return s},I=(s,i)=>be(s,we(i)),T=(s,i,c)=>new Promise((a,v)=>{var _=d=>{try{h(c.next(d))}catch(g){v(g)}},x=d=>{try{h(c.throw(d))}catch(g){v(g)}},h=d=>d.done?a(d.value):Promise.resolve(d.value).then(_,x);h((c=c.apply(s,i)).next())});const Ce=s=>{var i,c;const{mappingData:a,size:v,config:_,checkMode:x,afterImgOnLoad:h,shouldExcludePointCloudBoxListUpdate:d}=s,g=(i=a==null?void 0:a.url)!=null?i:"",b=(c=a==null?void 0:a.fallbackUrl)!=null?c:"",{pointCloudBoxList:S,setPointCloudResult:O,defaultAttribute:L,rectList:V,addRectIn2DView:W,updateRectIn2DView:X,removeRectIn2DView:Y,updateRectListByReducer:Z,selectedIDs:w,setSelectedIDs:j}=ce(pe),{value:E}=De(),ee=G(w),{update2DViewRect:te,remove2DViewRect:ne}=fe(),N=A.useRef(null),o=H(null),F=U(te),y=U(ne),P=H(null),[re,M]=ue(!0),k=se(()=>V==null?void 0:V.filter(e=>e.imageName===(a==null?void 0:a.path)),[a==null?void 0:a.path,V]),C=G(a==null?void 0:a.path),B=ae(e=>T(void 0,null,function*(){try{const r=ee.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(r.length){const n=new Set(r),l=t.filter(u=>n.has(u.id)).map(u=>u.id);j(l)}return t}catch(r){}}),[j]),z=e=>{const{boxID:r}=e;if(!d&&r){B(()=>{const t=F==null?void 0:F(e);return t?(P.current=t,O(t),t):null});return}X(e,!0)},J=e=>{C.current&&W(I(m({},e),{imageName:C.current}))},$=e=>{if(e.length===0)return;if(!d){const t=e.find(n=>n.boxID);if(t){B(()=>{const n=y==null?void 0:y(t);return n?(P.current=n,O(n),R(),n):null});return}}const r=e.find(t=>t.extId);r&&B(()=>{const{imageName:t,extId:n}=r,l=y==null?void 0:y({boxID:n,imageName:t});return l?(P.current=l,O(l),l):null}),Y(e)},oe=U(()=>{let e=[];return S.forEach(r=>{const{rects:t=[],id:n,attribute:l,trackID:u}=r,p=t.find(le=>le.imageName===C.current),D=n+"_"+C.current;p&&(e=[...e,I(m({},p),{boxID:n,id:D,attribute:l,order:u})])}),e}),R=he(()=>{var e,r,t;const n=d?[]:oe(),l=(e=o.current)==null?void 0:e.selectedRectID,u=w.slice(0),p=_e(u,n,k);(r=o.current)==null||r.setResult(p),l&&((t=o.current)==null||t.setSelectedRectID(l))}),q=({targetId:e})=>j(e);return f(()=>{if(N.current){const e=new ge({container:N.current,size:v,config:I(m({},_),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:x});return o.current=e,o.current.init(),o.current.on("updateDragResult",z),o.current.on("afterAddingDrawingRect",J),o.current.on("deleteSelectedRects",$),o.current.on("onRightClick",q),()=>{var r,t,n,l,u;(r=o.current)==null||r.unbind("updateDragResult",z),(t=o.current)==null||t.unbind("afterAddingDrawingRect",J),(n=o.current)==null||n.unbind("deleteSelectedRects",$),(l=o.current)==null||l.unbind("onRightClick",q),(u=o.current)==null||u.destroy()}}},[]),f(()=>{const e=t=>T(void 0,null,function*(){try{return yield Re.load(t)}catch(n){return console.error("Error loading image:",n),null}}),r=()=>T(void 0,null,function*(){var t;M(!0);let n=yield e(g);!n&&b&&(n=yield e(b)),n&&((t=o.current)==null||t.setImgNode(n),h(n)),M(!1)});o.current&&(g||b)&&r()},[g,b]),f(()=>{var e;(e=o.current)==null||e.setSize(v)},[v]),f(()=>{S!==P.current&&R()},[S]),f(()=>{var e,r;const t=k.find(n=>n.id===o.current.selectedRectID);(r=(e=o.current)==null?void 0:e.setDefaultAttribute)==null||r.call(e,L),t&&Z(n=>{var l;const u=[];let p=null;return n.forEach(D=>{D.id!==o.current.selectedRectID?u.push(D):p=D}),t.extId===void 0&&(p=(l=o.current)==null?void 0:l.selectedRect),[...u,I(m({},p||{}),{attribute:L})]}),R()},[L]),f(()=>{R()},[k]),f(()=>{R()},[d]),f(()=>{var e,r,t,n;const l=(r=(e=o.current)==null?void 0:e.config)!=null?r:{},u=I(m({},l),{attributeList:(t=_.attributeList)!=null?t:[]});(n=o.current)==null||n.setConfig(JSON.stringify(u))},[_.attributeList]),f(()=>{var e;(e=o.current)==null||e.setEnableAddRect(w.length===0),R()},[w]),f(()=>{const{hiddenText:e}=E||{};if(e===void 0)return;const r=o.current;if(!r)return;const t=m(m({},r.style),E);r.setStyle(t)},[E]),A.createElement(ie,{spinning:re},A.createElement("div",{ref:N,style:m({position:"relative"},v)}))};var xe=de(me,null,null,{context:ve})(Ce);export{xe as default};
@@ -1 +1 @@
1
- import{getClassName as F}from"../../utils/dom.js";import s,{useRef as j,useState as T,useContext as q,useMemo as w,useCallback as D,useEffect as G}from"react";import J from"../AnnotationView/index.js";import K from"../../hooks/useSize.js";import{useSingleBox as M}from"./hooks/useSingleBox.js";import{useHighlight as Q}from"./hooks/useHighlight.js";import W from"./components/HighlightVisible/index.js";import{PointCloudContext as X}from"./PointCloudContext.js";import Y from"./hooks/useDataLinkSwitch.js";import Z from"../pointCloud2DRectOperationView/index.js";var $=(t,u,i)=>new Promise((a,r)=>{var f=o=>{try{e(i.next(o))}catch(n){r(n)}},d=o=>{try{e(i.throw(o))}catch(n){r(n)}},e=o=>o.done?a(o.value):Promise.resolve(o.value).then(f,d);e((i=i.apply(t,u)).next())});const tt=({view2dData:t,setSelectedID:u,currentData:i,showEnlarge:a,checkMode:r=!1,measureVisible:f})=>{var d,e;const o=j(null),n=j(),{selectedBox:m}=M(),p=K(o),{url:b,fallbackUrl:k,calib:x,path:_}=t,{toggle2dVisible:v,isHighlightVisible:z}=Q({currentData:i}),[B,C]=T(!1),{highlight2DLoading:I,setHighlight2DLoading:L,cuboidBoxIn2DView:h,cacheImageNodeSize:O}=q(X),H=!t,R=w(()=>({zIndex:a?-1:101,is2DView:!h,imageName:t.path}),[a,h,t.path]),{rendered:E,isLinking:N}=Y(R),S=l=>{g(),O({path:_,imgNode:l})},g=D(()=>{var l,y;const V=(l=n.current)==null?void 0:l.toolInstance;if(u(""),!m||!V)return;const c=t.annotations.find(A=>A.annotation.id===m.info.id);let P="";c&&((y=c==null?void 0:c.annotation.pointList)==null?void 0:y.length)>0&&(V.focusPositionByPointList(c==null?void 0:c.annotation.pointList),P=m.info.id,u(P))},[m,n.current,t.annotations]);G(()=>{g()},[g]);const U=()=>$(void 0,null,function*(){C(!0),L(!0);try{yield v(b,k!=null?k:"",x)}catch(l){console.error("highlightOnClick error:",l)}finally{C(!1),L(!1)}});return s.createElement("div",{className:F("point-cloud-2d-image"),ref:o},h?s.createElement(J,{src:(d=t==null?void 0:t.url)!=null?d:"",fallbackSrc:(e=t==null?void 0:t.fallbackUrl)!=null?e:"",annotations:t.annotations,size:p,ref:n,globalStyle:{display:H?"none":"block"},afterImgOnLoad:S,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:f}):s.createElement(s.Fragment,null,s.createElement(Z,{shouldExcludePointCloudBoxListUpdate:!N,mappingData:t,size:p,checkMode:r,afterImgOnLoad:S}),!r&&E),x&&s.createElement(W,{visible:z(b),onClick:U,loading:B,disabled:I,style:{position:"absolute",right:16,top:16,zIndex:a?-1:101}}))};export{tt as default};
1
+ import{getClassName as w}from"../../utils/dom.js";import s,{useRef as P,useState as G,useContext as J,useMemo as K,useCallback as M,useEffect as Q}from"react";import W from"../AnnotationView/index.js";import X from"../../hooks/useSize.js";import{useSingleBox as Y}from"./hooks/useSingleBox.js";import{useHighlight as Z}from"./hooks/useHighlight.js";import $ from"./components/HighlightVisible/index.js";import{PointCloudContext as oo}from"./PointCloudContext.js";import to from"./hooks/useDataLinkSwitch.js";import eo from"../pointCloud2DRectOperationView/index.js";import{useToolStyleContext as no}from"../../hooks/useToolStyle.js";var io=(o,u,i)=>new Promise((a,r)=>{var h=t=>{try{l(i.next(t))}catch(n){r(n)}},d=t=>{try{l(i.throw(t))}catch(n){r(n)}},l=t=>t.done?a(t.value):Promise.resolve(t.value).then(h,d);l((i=i.apply(o,u)).next())});const lo=({view2dData:o,setSelectedID:u,currentData:i,showEnlarge:a,checkMode:r=!1,measureVisible:h})=>{var d,l;const t=P(null),n=P(),{selectedBox:m}=Y(),p=X(t),{url:x,fallbackUrl:k,calib:C,path:v}=o,{toggle2dVisible:B,isHighlightVisible:I}=Z({currentData:i}),[_,b]=G(!1),{highlight2DLoading:z,setHighlight2DLoading:S,cuboidBoxIn2DView:f,cacheImageNodeSize:O,setSelectedIDs:R,pointCloudBoxList:H}=J(oo),{value:E}=no(),{hiddenText:N}=E||{},T=!o,U=K(()=>({zIndex:a?-1:101,is2DView:!f,imageName:o.path}),[a,f,o.path]),{rendered:A,isLinking:D}=to(U),L=e=>{g(),O({path:v,imgNode:e})},g=M(()=>{var e,y;const V=(e=n.current)==null?void 0:e.toolInstance;if(u(""),!m||!V)return;const c=o.annotations.find(q=>q.annotation.id===m.info.id);let j="";c&&((y=c==null?void 0:c.annotation.pointList)==null?void 0:y.length)>0&&(V.focusPositionByPointList(c==null?void 0:c.annotation.pointList),j=m.info.id,u(j))},[m,n.current,o.annotations]);Q(()=>{g()},[g]);const F=()=>io(void 0,null,function*(){b(!0),S(!0);try{yield B(x,k!=null?k:"",C)}catch(e){console.error("highlightOnClick error:",e)}finally{b(!1),S(!1)}});return s.createElement("div",{className:w("point-cloud-2d-image"),ref:t},f?s.createElement(W,{src:(d=o==null?void 0:o.url)!=null?d:"",fallbackSrc:(l=o==null?void 0:o.fallbackUrl)!=null?l:"",annotations:o.annotations,size:p,ref:n,globalStyle:{display:T?"none":"block"},afterImgOnLoad:L,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:h,onRightClick:({targetId:e})=>R(e),pointCloudBoxList:H,hiddenText:N}):s.createElement(s.Fragment,null,s.createElement(eo,{shouldExcludePointCloudBoxListUpdate:!D,mappingData:o,size:p,checkMode:r,afterImgOnLoad:L}),!r&&A),C&&s.createElement($,{visible:I(x),onClick:F,loading:_,disabled:z,style:{position:"absolute",right:16,top:16,zIndex:a?-1:101}}))};export{lo as default};
@@ -1 +1 @@
1
- import{getClassName as m}from"../../utils/dom.js";import{cKeyCode as Z,PointCloud as H}from"@labelbee/lb-annotation";import{PointCloudUtils as S,toolStyleConverter as U,EPerspectiveView as E}from"@labelbee/lb-utils";import j from"classnames";import e,{useContext as T,useState as O,useRef as q,useEffect as u,useMemo as G}from"react";import{PointCloudContainer as J}from"./PointCloudLayout.js";import{PointCloudContext as Q}from"./PointCloudContext.js";import{a2MapStateToProps as W}from"../../store/annotation/map.js";import{connect as X}from"react-redux";import{jsonParser as Y}from"../../utils/index.js";import{useSingleBox as $}from"./hooks/useSingleBox.js";import{useSphere as ee}from"./hooks/useSphere.js";import{Switch as te,Tooltip as oe}from"antd";import ne from"../../hooks/useSize.js";import{usePointCloudViews as ie}from"./hooks/usePointCloudViews.js";import{useTranslation as z}from"react-i18next";import{LabelBeeContext as re}from"../../store/ctx.js";import le from"./components/PointCloudSizeSlider/index.js";import ae from"./components/TitleButton/index.js";import{LeftOutlined as se}from"@ant-design/icons";var ce=Object.defineProperty,me=Object.defineProperties,de=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,ue=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,N=(n,r,l)=>r in n?ce(n,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[r]=l,k=(n,r)=>{for(var l in r||(r={}))ue.call(r,l)&&N(n,l,r[l]);if(D)for(var l of D(r))pe.call(r,l)&&N(n,l,r[l]);return n},ve=(n,r)=>me(n,de(r));const we=Z.default,fe="LABELBEE-POINTCLOUD",_=e.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),p=({perspectiveView:n})=>{const{isActive:r,setTarget3DView:l}=T(_),v=o=>j({[m("point-cloud-3d-view",o)]:!0,active:r});return e.createElement("span",{onClick:()=>{l(E[n])},className:v(n.toLocaleLowerCase())})},R=({isEnlarge:n})=>{const{reset3DView:r,followTopView:l}=T(_),{t:v}=z(),o=e.createElement(e.Fragment,null,e.createElement(p,{perspectiveView:"Top"}),e.createElement(p,{perspectiveView:"Front"}),e.createElement(p,{perspectiveView:"Left"}),e.createElement(p,{perspectiveView:"Back"}),e.createElement(p,{perspectiveView:"Right"}),e.createElement(p,{perspectiveView:"LFT"}),e.createElement(p,{perspectiveView:"RBT"})),g=e.createElement(e.Fragment,null,e.createElement(oe,{title:v("CameraFollowTopView")},e.createElement("span",{onClick:()=>{l()},className:m("point-cloud-3d-view","followTop")})),e.createElement("span",{onClick:()=>{r()},className:m("point-cloud-3d-view","reset")}));return n?e.createElement("div",{className:m("point-cloud-3d-sidebarZoom")},g,o):e.createElement("div",{className:m("point-cloud-3d-sidebar")},o,g)},Ce=({currentData:n,config:r,highlightAttribute:l})=>{var v;const o=T(Q),[g,F]=O(!0),[w,h]=O(!1),f=q(null),{initPointCloud3d:y}=ie(),C=ne(f),{t:I}=z();u(()=>{!o.mainViewInstance||y==null||y(C)},[C]);const{selectedBox:d}=$(),{selectedSphere:P}=ee(),x=t=>{var i,a;const s=d==null?void 0:d.info;if(s){const c=k({},s.center);c.x=c.x-.01,c.z=1e3;const V=t===E.Top;(i=o.mainViewInstance)==null||i.updateCameraByBox(s,t,V?c:void 0)}P&&((a=o.mainViewInstance)==null||a.updateCameraBySphere(P,t))},A=()=>{var t;(t=o.mainViewInstance)==null||t.resetCamera()},K=()=>{var t,i;const a=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance.camera;a&&((i=o.mainViewInstance)==null||i.applyCameraTarget(a))};u(()=>{if(f.current&&(n==null?void 0:n.url)){let t=o.mainViewInstance;!t&&C.width&&(t=new H({container:f.current,isOrthographicCamera:!0,orthographicParams:S.getDefaultOrthographicParams(C),config:r}),o.setMainViewInstance(t))}},[C,n]),u(()=>{var t;if(f.current&&(n==null?void 0:n.url)&&n.result&&o.mainViewInstance){let i=o.mainViewInstance;const a=S.getBoxParamsFromResultList(n.result);a.forEach(c=>{var V;const b=(V=U.getColorFromConfig({attribute:c.attribute},ve(k({},r),{attributeConfigurable:!0}),{}))==null?void 0:V.hex;i==null||i.addBoxToSense(c,b)}),i.render(),o.setPointCloudResult(a);const s=S.getRectParamsFromResultList(n.result);o.setRectList(s),o.setPointCloudValid((t=Y(n.result))==null?void 0:t.valid)}},[n,o.mainViewInstance]),u(()=>{var t,i,a,s,c;if(((t=d==null?void 0:d.info)==null?void 0:t.id)!==void 0){x(E.Top);const b=(s=(a=(i=o.topViewInstance)==null?void 0:i.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?s:1;(c=o.mainViewInstance)==null||c.updateCameraZoom(b)}},[(v=d==null?void 0:d.info)==null?void 0:v.id]),u(()=>{var t,i,a,s;if(P){x(E.Top);const c=(a=(i=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?a:1;(s=o.mainViewInstance)==null||s.updateCameraZoom(c)}},[P]),u(()=>(window.addEventListener("keydown",B),()=>{window.removeEventListener("keydown",B)}),[]);const B=t=>{if(t.keyCode===we.Esc){h(!1);return}},L=G(()=>({reset3DView:A,setTarget3DView:x,isActive:!!d,followTopView:K}),[d,o.mainViewInstance]);u(()=>{var t,i,a;const s=o.pointCloudBoxList.filter(c=>c.attribute===l);(s==null?void 0:s.length)>0&&((t=o.mainViewInstance)==null||t.clearHighlightBoxes(),(i=o.mainViewInstance)==null||i.highlightBoxes(s)),s.length===0&&((a=o.mainViewInstance)==null||a.clearHighlightBoxesAndRender())},[l,o.mainViewInstance]);const M=e.createElement(e.Fragment,null,e.createElement(le,{onChange:t=>{var i;(i=o.mainViewInstance)==null||i.updatePointSize({customSize:t})}}),e.createElement("span",{style:{marginRight:8}},I("ShowArrows")),e.createElement(te,{size:"small",checked:g,onChange:t=>{var i;F(t),(i=o.mainViewInstance)==null||i.setShowDirection(t)}}),w&&e.createElement(_.Provider,{value:L},e.createElement(R,{isEnlarge:w})));return e.createElement(J,{className:j({[m("point-cloud-3d-container")]:!0,[m("point-cloud-container","zoom")]:w}),title:w?e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement(se,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{h(!1)}}),I("3DView")):e.createElement(ae,{title:I("3DView"),onClick:()=>{h(!0)}}),toolbar:M},e.createElement("div",{className:m("point-cloud-3d-content")},!w&&e.createElement(_.Provider,{value:L},e.createElement(R,null)),e.createElement("div",{className:m("point-cloud-3d-view"),id:fe,ref:f})))};var Ve=X(W,null,null,{context:re})(Ce);export{Ve as default};
1
+ import{getClassName as d}from"../../utils/dom.js";import{cKeyCode as G,PointCloud as J}from"@labelbee/lb-annotation";import{PointCloudUtils as T,toolStyleConverter as Q,EPerspectiveView as E}from"@labelbee/lb-utils";import N from"classnames";import o,{useContext as b,useState as y,useRef as W,useEffect as u,useMemo as X}from"react";import{PointCloudContainer as Y}from"./PointCloudLayout.js";import{PointCloudContext as $}from"./PointCloudContext.js";import{a2MapStateToProps as ee}from"../../store/annotation/map.js";import{connect as te}from"react-redux";import{jsonParser as oe}from"../../utils/index.js";import{useSingleBox as ne}from"./hooks/useSingleBox.js";import{useSphere as ie}from"./hooks/useSphere.js";import{Switch as le,Tooltip as re}from"antd";import ae from"../../hooks/useSize.js";import{usePointCloudViews as se}from"./hooks/usePointCloudViews.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as ce}from"../../store/ctx.js";import de from"./components/PointCloudSizeSlider/index.js";import me from"./components/TitleButton/index.js";import{LeftOutlined as ue}from"@ant-design/icons";import{useToolStyleContext as pe}from"../../hooks/useToolStyle.js";var ve=Object.defineProperty,we=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,F=(n,l,r)=>l in n?ve(n,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[l]=r,A=(n,l)=>{for(var r in l||(l={}))Ce.call(l,r)&&F(n,r,l[r]);if(R)for(var r of R(l))Ve.call(l,r)&&F(n,r,l[r]);return n},Pe=(n,l)=>we(n,fe(l));const ge=G.default,Ee="LABELBEE-POINTCLOUD",_=o.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),p=({perspectiveView:n})=>{const{isActive:l,setTarget3DView:r}=b(_),v=t=>N({[d("point-cloud-3d-view",t)]:!0,active:l});return o.createElement("span",{onClick:()=>{r(E[n])},className:v(n.toLocaleLowerCase())})},H=({isEnlarge:n})=>{const{reset3DView:l,followTopView:r}=b(_),{t:v}=k(),t=o.createElement(o.Fragment,null,o.createElement(p,{perspectiveView:"Top"}),o.createElement(p,{perspectiveView:"Front"}),o.createElement(p,{perspectiveView:"Left"}),o.createElement(p,{perspectiveView:"Back"}),o.createElement(p,{perspectiveView:"Right"}),o.createElement(p,{perspectiveView:"LFT"}),o.createElement(p,{perspectiveView:"RBT"})),P=o.createElement(o.Fragment,null,o.createElement(re,{title:v("CameraFollowTopView")},o.createElement("span",{onClick:()=>{r()},className:d("point-cloud-3d-view","followTop")})),o.createElement("span",{onClick:()=>{l()},className:d("point-cloud-3d-view","reset")}));return n?o.createElement("div",{className:d("point-cloud-3d-sidebarZoom")},P,t):o.createElement("div",{className:d("point-cloud-3d-sidebar")},t,P)},_e=({currentData:n,config:l,highlightAttribute:r})=>{var v;const t=b($),[P,U]=y(!0),[f,h]=y(!1),C=W(null),{initPointCloud3d:B}=se(),V=ae(C),{t:x}=k(),{value:L}=pe(),{hiddenText:j}=L||{};u(()=>{let e=t.mainViewInstance;e&&e.updateHiddenTextAndRender(j,t.pointCloudBoxList)},[L]),u(()=>{!t.mainViewInstance||B==null||B(V)},[V]);const{selectedBox:m}=ne(),{selectedSphere:g}=ie(),[K,O]=y(!0),I=e=>{var i,a;const s=m==null?void 0:m.info;if(s){const c=A({},s.center);c.x=c.x-.01,c.z=1e3;const w=e===E.Top;(i=t.mainViewInstance)==null||i.updateCameraByBox(s,e,w?c:void 0)}g&&((a=t.mainViewInstance)==null||a.updateCameraBySphere(g,e))},M=()=>{var e;(e=t.mainViewInstance)==null||e.resetCamera()},Z=()=>{var e,i;const a=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance.camera;a&&((i=t.mainViewInstance)==null||i.applyCameraTarget(a))};u(()=>{if(C.current&&(n==null?void 0:n.url)){let e=t.mainViewInstance;!e&&V.width&&(e=new J({container:C.current,isOrthographicCamera:!0,orthographicParams:T.getDefaultOrthographicParams(V),config:l,hiddenText:j}),e.setHandlerPipe({setSelectedIDs:t.setSelectedIDs,setNeedUpdateCenter:O}),t.setMainViewInstance(e))}},[V,n]),u(()=>{var e;if(C.current&&(n==null?void 0:n.url)&&n.result&&t.mainViewInstance){let i=t.mainViewInstance;const a=T.getBoxParamsFromResultList(n.result);a.forEach(c=>{var w;const S=(w=Q.getColorFromConfig({attribute:c.attribute},Pe(A({},l),{attributeConfigurable:!0}),{}))==null?void 0:w.hex;i==null||i.addBoxToSense(c,S)}),i.render(),t.setPointCloudResult(a);const s=T.getRectParamsFromResultList(n.result);t.setRectList(s),t.setPointCloudValid((e=oe(n.result))==null?void 0:e.valid)}},[n,t.mainViewInstance]),u(()=>{var e,i,a,s,c;const w=(e=m==null?void 0:m.info)==null?void 0:e.id;if(!K){O(!0);return}if(w!==void 0){I(E.Top);const S=(s=(a=(i=t.topViewInstance)==null?void 0:i.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?s:1;(c=t.mainViewInstance)==null||c.updateCameraZoom(S)}},[(v=m==null?void 0:m.info)==null?void 0:v.id]),u(()=>{var e,i,a,s;if(g){I(E.Top);const c=(a=(i=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?a:1;(s=t.mainViewInstance)==null||s.updateCameraZoom(c)}},[g]),u(()=>(window.addEventListener("keydown",D),()=>{window.removeEventListener("keydown",D)}),[]);const D=e=>{if(e.keyCode===ge.Esc){h(!1);return}},z=X(()=>({reset3DView:M,setTarget3DView:I,isActive:!!m,followTopView:Z}),[m,t.mainViewInstance]);u(()=>{var e,i,a;const s=t.pointCloudBoxList.filter(c=>c.attribute===r);(s==null?void 0:s.length)>0&&((e=t.mainViewInstance)==null||e.clearHighlightBoxes(),(i=t.mainViewInstance)==null||i.highlightBoxes(s)),s.length===0&&((a=t.mainViewInstance)==null||a.clearHighlightBoxesAndRender())},[r,t.mainViewInstance]);const q=o.createElement(o.Fragment,null,o.createElement(de,{onChange:e=>{var i;(i=t.mainViewInstance)==null||i.updatePointSize({customSize:e})}}),o.createElement("span",{style:{marginRight:8}},x("ShowArrows")),o.createElement(le,{size:"small",checked:P,onChange:e=>{var i;U(e),(i=t.mainViewInstance)==null||i.setShowDirection(e)}}),f&&o.createElement(_.Provider,{value:z},o.createElement(H,{isEnlarge:f})));return o.createElement(Y,{className:N({[d("point-cloud-3d-container")]:!0,[d("point-cloud-container","zoom")]:f}),title:f?o.createElement("div",{style:{display:"flex",alignItems:"center"}},o.createElement(ue,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{h(!1)}}),x("3DView")):o.createElement(me,{title:x("3DView"),onClick:()=>{h(!0)}}),toolbar:q},o.createElement("div",{className:d("point-cloud-3d-content")},!f&&o.createElement(_.Provider,{value:z},o.createElement(H,null)),o.createElement("div",{className:d("point-cloud-3d-view"),id:Ee,ref:C})))};var he=te(ee,null,null,{context:ce})(_e);export{he as default};
@@ -1 +1 @@
1
- import{PointCloudContext as re}from"./PointCloudContext.js";import{useRotate as se}from"./hooks/useRotate.js";import{useRotateEdge as ne}from"./hooks/useRotateEdge.js";import{useBoxes as ie}from"./hooks/useBoxes.js";import{useSingleBox as ae}from"./hooks/useSingleBox.js";import{useSphere as ue}from"./hooks/useSphere.js";import{useContext as le,useEffect as d}from"react";import{CommonToolUtils as ce,EPointCloudName as de,AttributeUtils as pe,EToolName as f,cTool as me}from"@labelbee/lb-annotation";import{message as g}from"antd";import{connect as ve}from"react-redux";import{a2MapStateToProps as be}from"../../store/annotation/map.js";import{useStatus as fe}from"./hooks/useStatus.js";import{usePointCloudViews as Pe}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as ye,useDispatch as we}from"../../store/ctx.js";import{useHistory as Ce}from"./hooks/useHistory.js";import{useAttribute as he}from"./hooks/useAttribute.js";import{useConfig as ge}from"./hooks/useConfig.js";import{usePolygon as Se}from"./hooks/usePolygon.js";import{useLine as ke}from"./hooks/useLine.js";import{useTranslation as xe}from"react-i18next";import{PreDataProcess as _e}from"../../store/annotation/actionCreators.js";import{useLatest as A}from"ahooks";var Ve=Object.defineProperty,Le=Object.defineProperties,Be=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,E=(a,r,l)=>r in a?Ve(a,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[r]=l,P=(a,r)=>{for(var l in r||(r={}))Oe.call(r,l)&&E(a,l,r[l]);if(I)for(var l of I(r))je.call(r,l)&&E(a,l,r[l]);return a},y=(a,r)=>Le(a,Be(r));const{EPolygonPattern:Ae}=me,Ie=({currentData:a,config:r,checkMode:l,configString:D,imgIndex:S,toolInstanceRef:u,setResourceLoading:T})=>{const e=le(re),{changeSelectedBoxValid:H,selectNextBox:K,selectPrevBox:N,updateSelectedBox:k,deleteSelectedPointCloudBoxAndPolygon:R}=ae(),{selectedSphere:w,updatePointCloudSphere:U}=ue(),{clearAllResult:C,updatePointCloudPattern:z}=fe(),{copySelectedBoxes:F,pasteSelectedBoxes:q,copiedBoxes:De}=ie({config:r,currentData:a}),{updateRotate:x}=se({currentData:a}),{updateRotateEdge:G}=ne({currentData:a}),{updatePointCloudData:v,topViewSelectedChanged:_}=Pe({setResourceLoading:T}),{redo:V,undo:L,pushHistoryWithList:M,pushHistoryUnderUpdatePolygon:W,pushHistoryUnderUpdateLine:Y}=Ce(),$=we(),{syncThreeViewsAttribute:B}=he(),{syncAllViewsConfig:J,reRenderTopViewRange:Q}=ge(),{selectedPolygon:O}=Se(),{selectedLine:j}=ke(),{t:h}=xe(),X=A(a),b=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},Z=(t,o)=>{var s,i;const{topViewInstance:c,mainViewInstance:n}=e;if(!c)return;const{pointCloud2dOperation:p}=c;switch(t){case"q":{x(e.rectRotateSensitivity);break}case"e":x(-Number(e.rectRotateSensitivity));break;case"g":G(-90);break;case"u":{const m=p.pattern===Ae.Normal?f.Rect:f.Polygon;z(m);const oe={[f.Polygon]:h("PolygonPattern"),[f.Rect]:h("RectPattern")};g.success(h("ChangePatternMsg",{pattern:oe[m]})),p.clearActiveStatus(),p.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){N();break}K(),o.preventDefault();break;case"f":H();break;case"arrowup":b({y:-1});break;case"arrowdown":b({y:1});break;case"arrowleft":b({x:-1});break;case"arrowright":b({x:1});break;case"delete":R(X.current);break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const m=pe.getAttributeByKeycode(o.keyCode,r.attributeList);m!==void 0&&((i=u.current)==null||i.setDefaultAttribute(m))}return}}},ee=(t,o)=>{switch(t){case"c":F();break;case"v":q();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?V():L();break}}},te=A(t=>{if(!ce.hotkeyFilter(t)||l===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){ee(o,t);return}Z(o,t)});return d(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(c=>te.current(c))},[e,e.topViewInstance,e.windowKeydownListenerHook]),d(()=>{J(r)},[D]),d(()=>{(r==null?void 0:r.radius)&&Q(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),d(()=>{v==null||v()},[S,e.mainViewInstance]),d(()=>{e.setHideAttributes([])},[S]),d(()=>{u.current.setDefaultAttribute=t=>{var o,s,i,c;B(t);const n=e.selectedPointCloudBox;if(n){n.attribute=t;const p=$(_e({tool:de.PointCloud,dataList:[n],stepConfig:r,action:"viewUpdateBox"}));n.valid=p[0].valid;const m=k(n);(i=(s=(o=e==null?void 0:e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:s.setPolygonValidAndRender)==null||i.call(s,n.id,!0,n.valid),e.mainViewInstance&&_({newSelectedBox:n,newPointCloudList:m})}if(O&&W(y(P({},O),{attribute:t})),j&&Y(y(P({},j),{attribute:t})),w){const p=U(y(P({},w),{attribute:t}));e.mainViewInstance&&((c=e.mainViewInstance)==null||c.generateSpheres(p),_({newSelectedSphere:w,newSphereList:p}))}},u.current.setSubAttribute=(t,o)=>{var s;const i=e.selectedPointCloudBox;if(i){const c=(s=i==null?void 0:i.subAttribute)!=null?s:{};i.subAttribute=y(P({},c),{[t]:o}),k(i)}},u.current.clearResult=()=>{C==null||C()},u.current.redo=()=>{V()},u.current.undo=()=>{L()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&C()})},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(()=>{v==null||v(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),d(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),d(()=>{u.current.history={pushHistory:t=>{M({pointCloudBoxList:t})},initRecord:()=>{}}},[]),d(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||l)return;const s=n=>{B(n)},i=n=>{g.error(n)},c=n=>{g.info(n)};return o.on("syncAttribute",s),o.on("messageError",i),o.on("messageInfo",c),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",i),o.unbind("messageInfo",c)}},[e.topViewInstance]),null};var Ee=ve(be,null,null,{context:ye})(Ie);export{Ee as default};
1
+ import{PointCloudContext as ne}from"./PointCloudContext.js";import{useRotate as re}from"./hooks/useRotate.js";import{useRotateEdge as se}from"./hooks/useRotateEdge.js";import{useBoxes as ie}from"./hooks/useBoxes.js";import{useSingleBox as ae}from"./hooks/useSingleBox.js";import{useSphere as ue}from"./hooks/useSphere.js";import{useContext as le,useEffect as d}from"react";import{CommonToolUtils as ce,EPointCloudName as de,AttributeUtils as pe,EToolName as P,cTool as me}from"@labelbee/lb-annotation";import{message as h}from"antd";import{connect as ve}from"react-redux";import{a2MapStateToProps as be}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,useDispatch as ye}from"../../store/ctx.js";import{useHistory as Ce}from"./hooks/useHistory.js";import{useAttribute as ge}from"./hooks/useAttribute.js";import{useConfig as he}from"./hooks/useConfig.js";import{usePolygon as Se}from"./hooks/usePolygon.js";import{useLine as xe}from"./hooks/useLine.js";import{useTranslation as ke}from"react-i18next";import{PreDataProcess as _e}from"../../store/annotation/actionCreators.js";import{useLatest as j}from"ahooks";var Ve=Object.defineProperty,Be=Object.defineProperties,Le=Object.getOwnPropertyDescriptors,A=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,E=(a,n,l)=>n in a?Ve(a,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[n]=l,f=(a,n)=>{for(var l in n||(n={}))Ie.call(n,l)&&E(a,l,n[l]);if(A)for(var l of A(n))Oe.call(n,l)&&E(a,l,n[l]);return a},w=(a,n)=>Be(a,Le(n));const{EPolygonPattern:je}=me,Ae=({currentData:a,config:n,checkMode:l,configString:D,imgIndex:S,toolInstanceRef:u,setResourceLoading:T})=>{const e=le(ne),{changeSelectedBoxValid:H,selectNextBox:K,selectPrevBox:N,updateSelectedBox:x,deleteSelectedPointCloudBoxAndPolygon:R}=ae(),{selectedSphere:y,updatePointCloudSphere:U}=ue(),{clearAllResult:C,updatePointCloudPattern:z}=Pe(),{copySelectedBoxes:F,pasteSelectedBoxes:q,copiedBoxes:De}=ie({config:n,currentData:a}),{updateRotate:k}=re({currentData:a}),{updateRotateEdge:G}=se({currentData:a}),{updatePointCloudData:v,topViewSelectedChanged:_}=fe({setResourceLoading:T}),{redo:V,undo:B,pushHistoryWithList:M,pushHistoryUnderUpdatePolygon:W,pushHistoryUnderUpdateLine:Y}=Ce(),$=ye(),{syncThreeViewsAttribute:L}=ge(),{syncAllViewsConfig:J,reRenderTopViewRange:Q}=he(),{selectedPolygon:I}=Se(),{selectedLine:O}=xe(),{t:g}=ke(),X=j(a),b=t=>{var o;const{topViewInstance:r}=e;!r||(o=r.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},Z=(t,o)=>{var r,i;const{topViewInstance:c,mainViewInstance:s}=e;if(!c)return;const{pointCloud2dOperation:p}=c;switch(t){case"q":{k(e.rectRotateSensitivity);break}case"e":k(-Number(e.rectRotateSensitivity));break;case"g":G(-90);break;case"u":{const m=p.pattern===je.Normal?P.Rect:P.Polygon;z(m);const oe={[P.Polygon]:g("PolygonPattern"),[P.Rect]:g("RectPattern")};h.success(g("ChangePatternMsg",{pattern:oe[m]})),p.clearActiveStatus(),p.clearDrawingStatus()}break;case"+":s==null||s.updatePointSize({zoomIn:!0});break;case"-":s==null||s.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){N();break}K(),o.preventDefault();break;case"f":H();break;case"arrowup":b({y:-1});break;case"arrowdown":b({y:1});break;case"arrowleft":b({x:-1});break;case"arrowright":b({x:1});break;case"delete":R(X.current);break;default:{if(((r=n.attributeList)==null?void 0:r.length)>0){const m=pe.getAttributeByKeycode(o.keyCode,n.attributeList);m!==void 0&&((i=u.current)==null||i.setDefaultAttribute(m))}return}}},ee=(t,o)=>{switch(t){case"c":F();break;case"v":q();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?V():B();break}}},te=j(t=>{if(!ce.hotkeyFilter(t)||l===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){ee(o,t);return}Z(o,t)});return d(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(c=>te.current(c))},[e,e.topViewInstance,e.windowKeydownListenerHook]),d(()=>{J(n)},[D]),d(()=>{(n==null?void 0:n.radius)&&Q(n==null?void 0:n.radius)},[n==null?void 0:n.radius]),d(()=>{v==null||v()},[S,e.mainViewInstance]),d(()=>{e.setHideAttributes([])},[S]),d(()=>{u.current.setDefaultAttribute=t=>{var o,r,i,c;L(t);const s=e.selectedPointCloudBox;if(s){s.attribute=t;const p=$(_e({tool:de.PointCloud,dataList:[s],stepConfig:n,action:"viewUpdateBox"}));s.valid=p[0].valid;const m=x(s);(i=(r=(o=e==null?void 0:e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:r.setPolygonValidAndRender)==null||i.call(r,s.id,!0,s.valid),e.mainViewInstance&&(_({newSelectedBox:s,newPointCloudList:m}),e.mainViewInstance.generateBoxes(m))}if(I&&W(w(f({},I),{attribute:t})),O&&Y(w(f({},O),{attribute:t})),y){const p=U(w(f({},y),{attribute:t}));e.mainViewInstance&&((c=e.mainViewInstance)==null||c.generateSpheres(p),_({newSelectedSphere:y,newSphereList:p}))}},u.current.setSubAttribute=(t,o)=>{var r;const i=e.selectedPointCloudBox;if(i){const c=(r=i==null?void 0:i.subAttribute)!=null?r:{};i.subAttribute=w(f({},c),{[t]:o}),x(i),e.mainViewInstance&&e.selectedPointCloudBox&&e.mainViewInstance.generateBox(e.selectedPointCloudBox)}},u.current.clearResult=()=>{C==null||C()},u.current.redo=()=>{V()},u.current.undo=()=>{B()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&C()})},u.current.setForbidOperation=t=>{var o,r;(r=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||r.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},u.current.setShowDefaultCursor=t=>{var o,r;(r=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||r.setShowDefaultCursor(t)},u.current.asyncData=t=>{setTimeout(()=>{v==null||v(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),d(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),d(()=>{u.current.history={pushHistory:t=>{M({pointCloudBoxList:t})},initRecord:()=>{}}},[]),d(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||l)return;const r=s=>{L(s)},i=s=>{h.error(s)},c=s=>{h.info(s)};return o.on("syncAttribute",r),o.on("messageError",i),o.on("messageInfo",c),()=>{o.unbind("syncAttribute",r),o.unbind("messageError",i),o.unbind("messageInfo",c)}},[e.topViewInstance]),null};var Ee=ve(be,null,null,{context:we})(Ae);export{Ee as default};
@@ -1 +1 @@
1
- import e,{useState as P,useContext as L,useEffect as T}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 I}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 St from"./components/firstFrameDataSwitch/index.js";import{EPointCloudSegmentStatus as h,EPointCloudPattern as bt}from"@labelbee/lb-utils";import Ct from"../../../../components/attributeList/index.js";import{useAttribute as _t}from"../../../../components/pointCloudView/hooks/useAttribute.js";import yt from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import Et from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import xt from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import Pt from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import wt from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import Dt from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as j}from"../index.js";import{SetTaskStepList as ht}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as jt}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import Lt from"../../../../components/subAttributeList/index.js";import Tt from"../../../../components/DynamicResizer/DynamicResizer.js";var It=Object.defineProperty,kt=Object.defineProperties,At=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,Vt=Object.prototype.hasOwnProperty,Bt=Object.prototype.propertyIsEnumerable,F=(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={}))Vt.call(t,n)&&F(o,n,t[n]);if(z)for(var n of z(t))Bt.call(t,n)&&F(o,n,t[n]);return o},V=(o,t)=>kt(o,At(t));const Nt=()=>{const[o,t]=P(!1),n=L(I),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:r}=$(),[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)};T(()=>{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,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)}})))},U=({segmentStatus:o,globalPattern:t})=>t===bt.Segmentation&&![h.Edit,h.Ready].includes(o),H=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:r,enableColorPicker:u})=>{const[m,v]=P({segmentStatus:h.Ready}),{selectedBox:p}=$(),s=L(I),{ptSegmentInstance:i}=s,{t:S}=k(),{defaultAttribute:d}=_t(),f=jt(),{isPointCloudSegmentationPattern:b}=R(),W=dt(),J={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};T(()=>{if(!!i)return i.on("syncPointCloudStatus",v),()=>{i.unbind("syncPointCloudStatus",v)}},[i]);const K=(l,C)=>{var _,y,E,B,N;const x=(_=a==null?void 0:a.attributeList)==null?void 0:_.map(g=>g.value===l?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)===(r==null?void 0:r.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(ht({stepList:et}))},X=l=>{f.updateViewsByDefaultSize&&f.updateViewsByDefaultSize(l)},Y=l=>{U({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setDefaultAttribute(l)},q=(l,C)=>{U({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setSubAttribute(l,C)},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===h.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(Ct,{list:G,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:l=>Y(l),updateColorConfig:K,enableColorPicker:u,updateSize:X,forbidShowLimitPopover:Z}),e.createElement(w,{style:{margin:0}}),Q&&e.createElement(Lt,{subAttributeList:t,setSubAttribute:q,getValue:l=>{var C,_,y,E;return((_=(C=s.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:_[l.value])||((E=(y=m.cacheSegData)==null?void 0:y.subAttribute)==null?void 0:E[l.value])}})))},Ot=[{toolName:"LassoSelector",commonSvg:yt,selectedSvg:Et},{toolName:"RectSelector",commonSvg:wt,selectedSvg:Dt},{toolName:"CircleSelector",commonSvg:xt,selectedSvg:Pt}],M=({toolInstance:o})=>{const{ptSegmentInstance:t}=L(I),[n,a]=P("LassoSelector"),{t:c}=k();return T(()=>{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:`${j}__level`},Ot.map(r=>{const u=n===r.toolName;return e.createElement("span",{className:`${j}__toolOption`,key:r.toolName,onClick:()=>t==null?void 0:t.emit(r.toolName)},e.createElement("img",{className:`${j}__singleTool`,src:u?r==null?void 0:r.selectedSvg:r==null?void 0:r.commonSvg}),e.createElement("span",{className:ut({[`${j}__toolOption__selected`]:u})},c(r.toolName)))}))},Rt=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:r})=>{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:r})):e.createElement(e.Fragment,null,e.createElement(nt,{toolName:lt.EPointCloudName.PointCloud,selectedToolName:p,onChange:f=>v==null?void 0:v(f)}),e.createElement("div",{style:{flex:1,overflow:"hidden"}},e.createElement(Tt,{minTopHeight:42,defaultHeight:400,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:r}),(i==null?void 0:i.trackConfigurable)===!0&&p===rt.Rect?e.createElement("div",{style:{height:"100%",overflow:"auto"}},e.createElement(Nt,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),o.loadPreStep>0&&e.createElement(St,null)):e.createElement("div",null))))},$t=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 zt=at($t,null,null,{context:mt})(Rt);export{M as PointCloudSegToolIcon,zt as default};
1
+ import e,{useState as E,useContext as I,useEffect as L}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 it}from"@labelbee/lb-annotation";import{PointCloudContext as T}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as w,Input as rt,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 St from"./components/firstFrameDataSwitch/index.js";import{EPointCloudSegmentStatus as h,EPointCloudPattern as bt}from"@labelbee/lb-utils";import Ct from"../../../../components/attributeList/index.js";import{useAttribute as xt}from"../../../../components/pointCloudView/hooks/useAttribute.js";import Pt from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import _t from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import yt from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import Et from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import wt from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import Dt from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as j}from"../index.js";import{SetTaskStepList as ht}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as jt}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import It from"../../../../components/subAttributeList/index.js";import Lt from"../../../../components/DynamicResizer/DynamicResizer.js";var Tt=Object.defineProperty,kt=Object.defineProperties,Bt=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,Vt=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable,F=(o,t,n)=>t in o?Tt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,B=(o,t)=>{for(var n in t||(t={}))Vt.call(t,n)&&F(o,n,t[n]);if(z)for(var n of z(t))At.call(t,n)&&F(o,n,t[n]);return o},V=(o,t)=>kt(o,Bt(t));const Nt=()=>{const[o,t]=E(!1),n=I(T),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:l}=$(),[u,m]=E(""),{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)),r=(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)};L(()=>{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:[]),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,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(rt,{defaultValue:p,onChange:d=>{m(d.target.value)},disabled:!p,size:"small",onBlur:()=>{r()},onPressEnter:()=>{r(!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)}})))},U=({segmentStatus:o,globalPattern:t})=>t===bt.Segmentation&&![h.Edit,h.Ready].includes(o),H=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:l,enableColorPicker:u})=>{const[m,v]=E({segmentStatus:h.Ready}),{selectedBox:p}=$(),s=I(T),{ptSegmentInstance:r}=s,{t:S}=k(),{defaultAttribute:d}=xt(),f=jt(),{isPointCloudSegmentationPattern:b}=R(),W=dt(),J={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};L(()=>{if(!!r)return r.on("syncPointCloudStatus",v),()=>{r.unbind("syncPointCloudStatus",v)}},[r]);const K=(i,C)=>{var x,P,_,A,N;const y=(x=a==null?void 0:a.attributeList)==null?void 0:x.map(g=>g.value===i?V(B({},g),{color:C}):g),O=V(B({},a),{attributeList:y}),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(B({},g),{config:tt}):g);(P=s==null?void 0:s.topViewInstance)==null||P.updateAttributeList(y),(_=s==null?void 0:s.sideViewInstance)==null||_.updateAttributeList(y),(A=s==null?void 0:s.backViewInstance)==null||A.updateAttributeList(y),(N=s==null?void 0:s.mainViewInstance)==null||N.setConfig(O),W(ht({stepList:et}))},X=i=>{f.updateViewsByDefaultSize&&f.updateViewsByDefaultSize(i)},Y=i=>{U({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setDefaultAttribute(i)},q=(i,C)=>{U({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setSubAttribute(i,C)},G=o.map(i=>({label:i.key,value:i.value,color:i==null?void 0:i.color,limit:i==null?void 0:i.limit,isDefault:i==null?void 0:i.isDefault})),Q=p||m.cacheSegData&&m.segmentStatus===h.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(Ct,{list:G,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:i=>Y(i),updateColorConfig:K,enableColorPicker:u,updateSize:X,forbidShowLimitPopover:Z}),e.createElement(w,{style:{margin:0}}),Q&&e.createElement(It,{subAttributeList:t,setSubAttribute:q,getValue:i=>{var C,x,P,_;return((x=(C=s.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:x[i.value])||((_=(P=m.cacheSegData)==null?void 0:P.subAttribute)==null?void 0:_[i.value])}})))},Ot=[{toolName:"LassoSelector",commonSvg:Pt,selectedSvg:_t},{toolName:"RectSelector",commonSvg:wt,selectedSvg:Dt},{toolName:"CircleSelector",commonSvg:yt,selectedSvg:Et}],M=({toolInstance:o})=>{const{ptSegmentInstance:t}=I(T),[n,a]=E("LassoSelector"),{t:c}=k();return L(()=>{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:`${j}__level`},Ot.map(l=>{const u=n===l.toolName;return e.createElement("span",{className:`${j}__toolOption`,key:l.toolName,onClick:()=>t==null?void 0:t.emit(l.toolName)},e.createElement("img",{className:`${j}__singleTool`,src:u?l==null?void 0:l.selectedSvg:l==null?void 0:l.commonSvg}),e.createElement("span",{className:ut({[`${j}__toolOption__selected`]:u})},c(l.toolName)))}))},Rt=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:l})=>{var u,m;const{updatePointCloudPattern:v,pointCloudPattern:p,isPointCloudSegmentationPattern:s}=R(),r=ct(o.config),S=(u=r==null?void 0:r.attributeList)!=null?u:[],d=(r==null?void 0:r.secondaryAttributeConfigurable)===!0?(m=r==null?void 0:r.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:r,stepList:c,stepInfo:o,enableColorPicker:l})):e.createElement(e.Fragment,null,e.createElement(nt,{toolName:it.EPointCloudName.PointCloud,selectedToolName:p,onChange:f=>v==null?void 0:v(f)}),e.createElement("div",{style:{flex:1,overflow:"hidden"}},e.createElement(Lt,{minTopHeight:42,defaultHeight:400,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:r,stepList:c,stepInfo:o,enableColorPicker:l}),(r==null?void 0:r.trackConfigurable)===!0&&p===lt.Rect?e.createElement("div",{style:{height:"100%",overflow:"auto"}},e.createElement(Nt,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),o.loadPreStep>0&&e.createElement(St,null)):e.createElement("div",null))))},$t=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 zt=at($t,null,null,{context:mt})(Rt);export{M as PointCloudSegToolIcon,zt as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.23.0-alpha.112",
3
+ "version": "1.23.0-alpha.114",
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.27.0-alpha.53",
46
+ "@labelbee/lb-annotation": "1.27.0-alpha.55",
47
47
  "@labelbee/lb-utils": "1.19.0-alpha.22",
48
48
  "@labelbee/wavesurfer": "1.1.0-alpha.1",
49
49
  "@types/react-dom": "^18.2.7",