@labelbee/lb-components 1.23.0-alpha.104 → 1.23.0-alpha.106

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