@labelbee/lb-components 1.23.0-alpha.108 → 1.23.0-alpha.109

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:f=[]}=t,s=f.map(n=>{var c;return __spreadProps(__spreadValues({},n),{imageName:(c=AnnotationDataUtils.getNextPath({prePath:n.imageName,preMappingImgList:o,nextMappingImgList:e}))!=null?c:""})}).filter(n=>n.imageName!=="");return __spreadProps(__spreadValues({},t),{rects:s})},updateCopiedBoxesId=(t,e)=>{const o=new Set(t.map(n=>n.trackID||0));let f=Math.max(...o,0);const s=.2;return e.map((n,c)=>{const{width:y,height:p,center:d,rotation:r,trackID:g=0}=n,{x:m,y:P,z:I}=d,l=y*s,C=p*s,h=l*Math.cos(r)-C*Math.sin(r),i=l*Math.sin(r)+C*Math.cos(r),u=m-Math.abs(h),v=P-Math.abs(i);let x=g;return o.has(g)&&(x=++f),o.add(x),__spreadProps(__spreadValues({},n),{id:lbAnnotation.uuid(),uuid:lbAnnotation.uuid(),center:{x:u,y:v,z:I},trackID:x})})},useBoxes=({config:t,currentData:e})=>{const{selectedIDs:o,pointCloudBoxList:f,displayPointCloudList:s,setPointCloudResult:n,syncAllViewPointCloudColor:c,imageSizes:y}=React.useContext(PointCloudContext.PointCloudContext),[p,d]=React.useState({copiedBoxes:[],copiedMappingImgList:[]}),{copiedBoxes:r}=p,{pointCloudBoxListUpdated:g}=usePointCloudViews.usePointCloudViews(),{t:m,i18n:P}=reactI18next.useTranslation(),{pushHistoryWithList:I}=useHistory.useHistory(),l=React.useMemo(()=>s.filter(i=>o.includes(i.id)),[o,s]),C=React.useCallback(()=>{var i;if(l.length>0){const u=(i=e==null?void 0:e.mappingImgList)!=null?i:[];d({copiedBoxes:___default.default.cloneDeep(l),copiedMappingImgList:u})}else d({copiedBoxes:[],copiedMappingImgList:[]}),antd.message.error(m("CopyEmptyInPointCloud"));antd.message.success(m("CopySuccess"))},[o,s,P.language,e]),h=React.useCallback(()=>{var i,u;if(r.length===0){antd.message.error(m("PasteEmptyInPointCloud"));return}const v=(i=e==null?void 0:e.mappingImgList)!=null?i:[],x=(u=p==null?void 0:p.copiedMappingImgList)!=null?u:[],M=r.map(a=>updateBoxRects(a,v,x)),B=updateCopiedBoxesId(s,M),w=a=>{n(a),g==null||g(a),d({copiedBoxes:[],copiedMappingImgList:[]}),I({pointCloudBoxList:a}),c(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiPaste,a)};B.forEach(a=>index.generatePointCloudBoxRects({pointCloudBox:a,mappingImgList:v,imageSizes:y}));const O=[...s,...B];w(O)},[r,s,P.language,e]);return{copySelectedBoxes:C,pasteSelectedBoxes:h,copiedBoxes:r,selectedBoxes:l}};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:l=[]}=t,s=l.map(n=>{var d;return __spreadProps(__spreadValues({},n),{imageName:(d=AnnotationDataUtils.getNextPath({prePath:n.imageName,preMappingImgList:o,nextMappingImgList:e}))!=null?d:""})}).filter(n=>n.imageName!=="");return __spreadProps(__spreadValues({},t),{rects:s})},updateCopiedBoxesId=(t,e)=>{const o=new Set(t.map(n=>n.trackID||0));let l=Math.max(...o,0);const s=.2;return e.map((n,d)=>{const{width:y,height:g,center:m,rotation:r,trackID:x=0}=n,{x:f,y:P,z:I}=m,u=y*s,C=g*s,h=u*Math.cos(r)-C*Math.sin(r),i=u*Math.sin(r)+C*Math.cos(r),c=f-Math.abs(h),v=P-Math.abs(i);let p=x;return o.has(x)?p=++l:l=Math.max(l,p),o.add(p),__spreadProps(__spreadValues({},n),{id:lbAnnotation.uuid(),uuid:lbAnnotation.uuid(),center:{x:c,y:v,z:I},trackID:p})})},useBoxes=({config:t,currentData:e})=>{const{selectedIDs:o,pointCloudBoxList:l,displayPointCloudList:s,setPointCloudResult:n,syncAllViewPointCloudColor:d,imageSizes:y}=React.useContext(PointCloudContext.PointCloudContext),[g,m]=React.useState({copiedBoxes:[],copiedMappingImgList:[]}),{copiedBoxes:r}=g,{pointCloudBoxListUpdated:x}=usePointCloudViews.usePointCloudViews(),{t:f,i18n:P}=reactI18next.useTranslation(),{pushHistoryWithList:I}=useHistory.useHistory(),u=React.useMemo(()=>s.filter(i=>o.includes(i.id)),[o,s]),C=React.useCallback(()=>{var i;if(u.length>0){const c=(i=e==null?void 0:e.mappingImgList)!=null?i:[];m({copiedBoxes:___default.default.cloneDeep(u),copiedMappingImgList:c})}else m({copiedBoxes:[],copiedMappingImgList:[]}),antd.message.error(f("CopyEmptyInPointCloud"));antd.message.success(f("CopySuccess"))},[o,s,P.language,e]),h=React.useCallback(()=>{var i,c;if(r.length===0){antd.message.error(f("PasteEmptyInPointCloud"));return}const v=(i=e==null?void 0:e.mappingImgList)!=null?i:[],p=(c=g==null?void 0:g.copiedMappingImgList)!=null?c:[],M=r.map(a=>updateBoxRects(a,v,p)),B=updateCopiedBoxesId(s,M),w=a=>{n(a),x==null||x(a),m({copiedBoxes:[],copiedMappingImgList:[]}),I({pointCloudBoxList:a}),d(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiPaste,a)};B.forEach(a=>index.generatePointCloudBoxRects({pointCloudBox:a,mappingImgList:v,imageSizes:y}));const O=[...s,...B];w(O)},[r,s,P.language,e]);return{copySelectedBoxes:C,pasteSelectedBoxes:h,copiedBoxes:r,selectedBoxes:u}};exports.useBoxes=useBoxes;
@@ -1 +1 @@
1
- import{useContext as E,useState as T,useMemo as k,useCallback as O}from"react";import N from"lodash";import{message as v}from"antd";import{usePointCloudViews as H}from"./usePointCloudViews.js";import{PointCloudContext as V}from"../PointCloudContext.js";import{useTranslation as A}from"react-i18next";import{EPointCloudBoxRenderTrigger as U}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import z from"../../../utils/AnnotationDataUtils.js";import{uuid as L}from"@labelbee/lb-annotation";import{useHistory as X}from"./useHistory.js";import{generatePointCloudBoxRects as Y}from"../../../utils/index.js";var W=Object.defineProperty,q=Object.defineProperties,F=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,j=(o,t,e)=>t in o?W(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,B=(o,t)=>{for(var e in t||(t={}))G.call(t,e)&&j(o,e,t[e]);if(b)for(var e of b(t))J.call(t,e)&&j(o,e,t[e]);return o},M=(o,t)=>q(o,F(t));const K=(o,t=[],e=[])=>{const{rects:x=[]}=o,s=x.map(i=>{var l;return M(B({},i),{imageName:(l=z.getNextPath({prePath:i.imageName,preMappingImgList:e,nextMappingImgList:t}))!=null?l:""})}).filter(i=>i.imageName!=="");return M(B({},o),{rects:s})},Q=(o,t)=>{const e=new Set(o.map(i=>i.trackID||0));let x=Math.max(...e,0);const s=.2;return t.map((i,l)=>{const{width:_,height:d,center:u,rotation:n,trackID:m=0}=i,{x:g,y:P,z:h}=u,p=_*s,C=d*s,y=p*Math.cos(n)-C*Math.sin(n),r=p*Math.sin(n)+C*Math.cos(n),c=g-Math.abs(y),I=P-Math.abs(r);let f=m;return e.has(m)&&(f=++x),e.add(f),M(B({},i),{id:L(),uuid:L(),center:{x:c,y:I,z:h},trackID:f})})},Z=({config:o,currentData:t})=>{const{selectedIDs:e,pointCloudBoxList:x,displayPointCloudList:s,setPointCloudResult:i,syncAllViewPointCloudColor:l,imageSizes:_}=E(V),[d,u]=T({copiedBoxes:[],copiedMappingImgList:[]}),{copiedBoxes:n}=d,{pointCloudBoxListUpdated:m}=H(),{t:g,i18n:P}=A(),{pushHistoryWithList:h}=X(),p=k(()=>s.filter(r=>e.includes(r.id)),[e,s]),C=O(()=>{var r;if(p.length>0){const c=(r=t==null?void 0:t.mappingImgList)!=null?r:[];u({copiedBoxes:N.cloneDeep(p),copiedMappingImgList:c})}else u({copiedBoxes:[],copiedMappingImgList:[]}),v.error(g("CopyEmptyInPointCloud"));v.success(g("CopySuccess"))},[e,s,P.language,t]),y=O(()=>{var r,c;if(n.length===0){v.error(g("PasteEmptyInPointCloud"));return}const I=(r=t==null?void 0:t.mappingImgList)!=null?r:[],f=(c=d==null?void 0:d.copiedMappingImgList)!=null?c:[],R=n.map(a=>K(a,I,f)),w=Q(s,R),S=a=>{i(a),m==null||m(a),u({copiedBoxes:[],copiedMappingImgList:[]}),h({pointCloudBoxList:a}),l(U.MultiPaste,a)};w.forEach(a=>Y({pointCloudBox:a,mappingImgList:I,imageSizes:_}));const D=[...s,...w];S(D)},[n,s,P.language,t]);return{copySelectedBoxes:C,pasteSelectedBoxes:y,copiedBoxes:n,selectedBoxes:p}};export{Z as useBoxes};
1
+ import{useContext as E,useState as T,useMemo as k,useCallback as O}from"react";import N from"lodash";import{message as v}from"antd";import{usePointCloudViews as H}from"./usePointCloudViews.js";import{PointCloudContext as V}from"../PointCloudContext.js";import{useTranslation as A}from"react-i18next";import{EPointCloudBoxRenderTrigger as U}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import z from"../../../utils/AnnotationDataUtils.js";import{uuid as L}from"@labelbee/lb-annotation";import{useHistory as X}from"./useHistory.js";import{generatePointCloudBoxRects as Y}from"../../../utils/index.js";var W=Object.defineProperty,q=Object.defineProperties,F=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,j=(o,t,e)=>t in o?W(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,M=(o,t)=>{for(var e in t||(t={}))G.call(t,e)&&j(o,e,t[e]);if(b)for(var e of b(t))J.call(t,e)&&j(o,e,t[e]);return o},B=(o,t)=>q(o,F(t));const K=(o,t=[],e=[])=>{const{rects:p=[]}=o,s=p.map(i=>{var m;return B(M({},i),{imageName:(m=z.getNextPath({prePath:i.imageName,preMappingImgList:e,nextMappingImgList:t}))!=null?m:""})}).filter(i=>i.imageName!=="");return B(M({},o),{rects:s})},Q=(o,t)=>{const e=new Set(o.map(i=>i.trackID||0));let p=Math.max(...e,0);const s=.2;return t.map((i,m)=>{const{width:_,height:u,center:g,rotation:n,trackID:f=0}=i,{x,y:P,z:h}=g,c=_*s,C=u*s,y=c*Math.cos(n)-C*Math.sin(n),r=c*Math.sin(n)+C*Math.cos(n),l=x-Math.abs(y),I=P-Math.abs(r);let d=f;return e.has(f)?d=++p:p=Math.max(p,d),e.add(d),B(M({},i),{id:L(),uuid:L(),center:{x:l,y:I,z:h},trackID:d})})},Z=({config:o,currentData:t})=>{const{selectedIDs:e,pointCloudBoxList:p,displayPointCloudList:s,setPointCloudResult:i,syncAllViewPointCloudColor:m,imageSizes:_}=E(V),[u,g]=T({copiedBoxes:[],copiedMappingImgList:[]}),{copiedBoxes:n}=u,{pointCloudBoxListUpdated:f}=H(),{t:x,i18n:P}=A(),{pushHistoryWithList:h}=X(),c=k(()=>s.filter(r=>e.includes(r.id)),[e,s]),C=O(()=>{var r;if(c.length>0){const l=(r=t==null?void 0:t.mappingImgList)!=null?r:[];g({copiedBoxes:N.cloneDeep(c),copiedMappingImgList:l})}else g({copiedBoxes:[],copiedMappingImgList:[]}),v.error(x("CopyEmptyInPointCloud"));v.success(x("CopySuccess"))},[e,s,P.language,t]),y=O(()=>{var r,l;if(n.length===0){v.error(x("PasteEmptyInPointCloud"));return}const I=(r=t==null?void 0:t.mappingImgList)!=null?r:[],d=(l=u==null?void 0:u.copiedMappingImgList)!=null?l:[],R=n.map(a=>K(a,I,d)),w=Q(s,R),S=a=>{i(a),f==null||f(a),g({copiedBoxes:[],copiedMappingImgList:[]}),h({pointCloudBoxList:a}),m(U.MultiPaste,a)};w.forEach(a=>Y({pointCloudBox:a,mappingImgList:I,imageSizes:_}));const D=[...s,...w];S(D)},[n,s,P.language,t]);return{copySelectedBoxes:C,pasteSelectedBoxes:y,copiedBoxes:n,selectedBoxes:c}};export{Z as useBoxes};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.23.0-alpha.108",
3
+ "version": "1.23.0-alpha.109",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",