@labelbee/lb-components 1.23.0-alpha.105 → 1.23.0-alpha.107

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";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),antd=require("antd"),usePointCloudViews=require("./usePointCloudViews.js"),PointCloudContext=require("../PointCloudContext.js"),reactI18next=require("react-i18next"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),AnnotationDataUtils=require("../../../utils/AnnotationDataUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),index=require("../../../utils/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,o)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,__spreadValues=(t,e)=>{for(var o in e||(e={}))__hasOwnProp.call(e,o)&&__defNormalProp(t,o,e[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(e))__propIsEnum.call(e,o)&&__defNormalProp(t,o,e[o]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const updateBoxRects=(t,e=[],o=[])=>{const{rects:a=[]}=t,s=a.map(r=>{var u;return __spreadProps(__spreadValues({},r),{imageName:(u=AnnotationDataUtils.getNextPath({prePath:r.imageName,preMappingImgList:o,nextMappingImgList:e}))!=null?u:""})}).filter(r=>r.imageName!=="");return __spreadProps(__spreadValues({},t),{rects:s})},updateCopiedBoxesId=(t,e)=>{const o=Math.max(...t.map(s=>s.trackID||0),0),a=.2;return e.map((s,r)=>__spreadProps(__spreadValues({},s),{id:lbAnnotation.uuid(),uuid:lbAnnotation.uuid(),center:{x:s.center.x-a*5,y:s.center.y+a,z:s.center.z},trackID:o+r+1}))},useBoxes=({config:t,currentData:e})=>{const{selectedIDs:o,pointCloudBoxList:a,displayPointCloudList:s,setPointCloudResult:r,syncAllViewPointCloudColor:u,imageSizes:f}=React.useContext(PointCloudContext.PointCloudContext),[c,d]=React.useState({copiedBoxes:[],copiedMappingImgList:[]}),{copiedBoxes:l}=c,{pointCloudBoxListUpdated:x}=usePointCloudViews.usePointCloudViews(),{t:g,i18n:P}=reactI18next.useTranslation(),{pushHistoryWithList:y}=useHistory.useHistory(),m=React.useMemo(()=>s.filter(n=>o.includes(n.id)),[o,s]),I=React.useCallback(()=>{var n;if(m.length>0){const p=(n=e==null?void 0:e.mappingImgList)!=null?n:[];d({copiedBoxes:___default.default.cloneDeep(m),copiedMappingImgList:p})}else d({copiedBoxes:[],copiedMappingImgList:[]}),antd.message.error(g("CopyEmptyInPointCloud"));antd.message.success(g("CopySuccess"))},[o,s,P.language,e]),B=React.useCallback(()=>{var n,p;if(l.length===0){antd.message.error(g("PasteEmptyInPointCloud"));return}const v=(n=e==null?void 0:e.mappingImgList)!=null?n:[],L=(p=c==null?void 0:c.copiedMappingImgList)!=null?p:[],O=l.map(i=>updateBoxRects(i,v,L)),b=updateCopiedBoxesId(s,O),j=i=>{r(i),x==null||x(i),d({copiedBoxes:[],copiedMappingImgList:[]}),y({pointCloudBoxList:i}),u(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiPaste,i)},C=[...s,...b];C.forEach(i=>index.generatePointCloudBoxRects({pointCloudBox:i,mappingImgList:v,imageSizes:f})),j(C)},[l,s,P.language,e]);return{copySelectedBoxes:I,pasteSelectedBoxes:B,copiedBoxes:l,selectedBoxes:m}};exports.useBoxes=useBoxes;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),antd=require("antd"),usePointCloudViews=require("./usePointCloudViews.js"),PointCloudContext=require("../PointCloudContext.js"),reactI18next=require("react-i18next"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),AnnotationDataUtils=require("../../../utils/AnnotationDataUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),index=require("../../../utils/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,o)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,__spreadValues=(t,e)=>{for(var o in e||(e={}))__hasOwnProp.call(e,o)&&__defNormalProp(t,o,e[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(e))__propIsEnum.call(e,o)&&__defNormalProp(t,o,e[o]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const updateBoxRects=(t,e=[],o=[])=>{const{rects:p=[]}=t,s=p.map(n=>{var u;return __spreadProps(__spreadValues({},n),{imageName:(u=AnnotationDataUtils.getNextPath({prePath:n.imageName,preMappingImgList:o,nextMappingImgList:e}))!=null?u:""})}).filter(n=>n.imageName!=="");return __spreadProps(__spreadValues({},t),{rects:s})},updateCopiedBoxesId=(t,e)=>{const o=Math.max(...t.map(s=>s.trackID||0),0),p=.2;return e.map((s,n)=>{const{width:u,height:C,center:c,rotation:i}=s,{x:l,y:f,z:d}=c,g=u*p,x=C*p,m=g*Math.cos(i)-x*Math.sin(i),v=g*Math.sin(i)+x*Math.cos(i),y=l-Math.abs(m),r=f-Math.abs(v);return __spreadProps(__spreadValues({},s),{id:lbAnnotation.uuid(),uuid:lbAnnotation.uuid(),center:{x:y,y:r,z:d},trackID:o+n+1})})},useBoxes=({config:t,currentData:e})=>{const{selectedIDs:o,pointCloudBoxList:p,displayPointCloudList:s,setPointCloudResult:n,syncAllViewPointCloudColor:u,imageSizes:C}=React.useContext(PointCloudContext.PointCloudContext),[c,i]=React.useState({copiedBoxes:[],copiedMappingImgList:[]}),{copiedBoxes:l}=c,{pointCloudBoxListUpdated:f}=usePointCloudViews.usePointCloudViews(),{t:d,i18n:g}=reactI18next.useTranslation(),{pushHistoryWithList:x}=useHistory.useHistory(),m=React.useMemo(()=>s.filter(r=>o.includes(r.id)),[o,s]),v=React.useCallback(()=>{var r;if(m.length>0){const P=(r=e==null?void 0:e.mappingImgList)!=null?r:[];i({copiedBoxes:___default.default.cloneDeep(m),copiedMappingImgList:P})}else i({copiedBoxes:[],copiedMappingImgList:[]}),antd.message.error(d("CopyEmptyInPointCloud"));antd.message.success(d("CopySuccess"))},[o,s,g.language,e]),y=React.useCallback(()=>{var r,P;if(l.length===0){antd.message.error(d("PasteEmptyInPointCloud"));return}const I=(r=e==null?void 0:e.mappingImgList)!=null?r:[],B=(P=c==null?void 0:c.copiedMappingImgList)!=null?P:[],M=l.map(a=>updateBoxRects(a,I,B)),h=updateCopiedBoxesId(s,M),O=a=>{n(a),f==null||f(a),i({copiedBoxes:[],copiedMappingImgList:[]}),x({pointCloudBoxList:a}),u(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiPaste,a)};h.forEach(a=>index.generatePointCloudBoxRects({pointCloudBox:a,mappingImgList:I,imageSizes:C}));const b=[...s,...h];O(b)},[l,s,g.language,e]);return{copySelectedBoxes:v,pasteSelectedBoxes:y,copiedBoxes:l,selectedBoxes:m}};exports.useBoxes=useBoxes;