@labelbee/lb-components 1.10.0-alpha.17 → 1.10.0-alpha.19
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"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(d){return d&&typeof d=="object"&&"default"in d?d:{default:d}}var React__default=_interopDefaultLegacy(React);const PointCloudContext=React__default.default.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{}}),PointCloudProvider=({children:d})=>{const[l,h]=React.useState([]),[c,m]=React.useState([]),[C,T]=React.useState([]),[S,j]=React.useState([]),[u,L]=React.useState([]),[w,_]=React.useState(!0),[I,k]=React.useState(1),[o,q]=React.useState(),[V,z]=React.useState(),[g,F]=React.useState(),[n,Z]=React.useState(),[x,G]=React.useState(""),[v,J]=React.useState(lbAnnotation.EToolName.Rect),K=React.useRef(new lbAnnotation.ActionsHistory).current,[i,b]=React.useState([]),[B,Q]=React.useState(""),R=React.useMemo(()=>u.length===1?u[0]:"",[u]),D=React.useMemo(()=>{const r=l.find(t=>t.id===R),y=t=>{const e=l.concat(t);return h(e),e},A=t=>{const e=c.concat(t);return m(e),e},f=t=>{_(t!==!1)},s=t=>{t===void 0&&L([]),typeof t=="string"&&L([t]),Array.isArray(t)&&L(Array.from(new Set(t)))},W=t=>{u.includes(t)?s(u.filter(e=>e!==t)):s([...u,t])},X=()=>{if(v===lbAnnotation.EToolName.Rect){const t=l.map(e=>e.id);s(t),o==null||o.pointCloud2dOperation.setSelectedIDs(t)}},Y=t=>{s(l.filter(e=>e.attribute===t).map(e=>e.id))},E=l.filter(t=>!i.includes(t.attribute)),H=c.filter(t=>!i.includes(t.attribute)),O=S.filter(t=>t.attribute&&!i.includes(t.attribute)),$=t=>{if(i.includes(t))b(i.filter(e=>e!==t));else{const e=i.concat(t);b(e)}},tt=(t=E,e=C,P=H,p=O)=>{l.forEach(a=>{n==null||n.removeObjectByName(a.id)}),c.forEach(a=>{n==null||n.removeObjectByName(a.id)}),o==null||o.updatePolygonList(t,e),o==null||o.updatePointList(P),o==null||o.updateLineList(p),n==null||n.generateBoxes(t),n==null||n.generateSpheres(P),M(t)},M=t=>{const e=n==null?void 0:n.highlightOriginPointCloud(t);return new Promise(P=>{e==null||e.then(p=>{[o].forEach(a=>{var N;p&&((N=a==null?void 0:a.pointCloudInstance)==null||N.updateColor(p),P({color:p}))})})})};return{selectedID:R,pointCloudBoxList:l,pointCloudSphereList:c,displayPointCloudList:E,displaySphereList:H,displayLineList:O,selectedIDs:u,setPointCloudResult:h,setSelectedIDs:s,addPointCloudBox:y,addPointCloudSphere:A,setPointCloudSphereList:m,valid:w,selectedPointCloudBox:r,setPointCloudValid:f,addSelectedID:W,selectedAllBoxes:X,topViewInstance:o,setTopViewInstance:q,sideViewInstance:V,setSideViewInstance:z,backViewInstance:g,setBackViewInstance:F,mainViewInstance:n,setMainViewInstance:Z,polygonList:C,setPolygonList:T,lineList:S,setLineList:j,zoom:I,setZoom:k,history:K,toggleAttributesVisible:$,hideAttributes:i,setHideAttributes:b,reRender:tt,attrPanelLayout:B,setAttrPanelLayout:Q,syncAllViewPointCloudColor:M,defaultAttribute:x,setDefaultAttribute:G,pointCloudPattern:v,setPointCloudPattern:J,selectSpecAttr:Y}},[w,u,l,c,C,S,o,V,g,n,I,i,B,x,v]),U=()=>{const r=l.filter(s=>i.includes(s.attribute)),{setSelectedIDs:y,reRender:A}=D,f=r.map(s=>s.id);f.length>0&&y(u.filter(s=>!f.includes(s))),A()};return React.useEffect(()=>{var r;U(),(r=o==null?void 0:o.pointCloud2dOperation)==null||r.setHiddenAttributes(i)},[i]),React__default.default.createElement(PointCloudContext.Provider,{value:D},d)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import T,{useState as o,useRef as dt,useMemo as j,useEffect as rt}from"react";import{ActionsHistory as z,EToolName as h}from"@labelbee/lb-annotation";const F=T.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new z,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:h.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{}}),ct=({children:Z})=>{const[d,m]=o([]),[a,w]=o([]),[P,q]=o([]),[L,G]=o([]),[r,b]=o([]),[I,J]=o(!0),[V,K]=o(1),[n,Q]=o(),[g,U]=o(),[x,W]=o(),[i,X]=o(),[B,Y]=o(""),[v,$]=o(h.Rect),_=dt(new z).current,[s,A]=o([]),[R,tt]=o(""),D=j(()=>r.length===1?r[0]:"",[r]),E=j(()=>{const c=d.find(t=>t.id===D),S=t=>{const e=d.concat(t);return m(e),e},y=t=>{const e=a.concat(t);return w(e),e},f=t=>{J(t!==!1)},l=t=>{t===void 0&&b([]),typeof t=="string"&&b([t]),Array.isArray(t)&&b(Array.from(new Set(t)))},ot=t=>{r.includes(t)?l(r.filter(e=>e!==t)):l([...r,t])},nt=()=>{if(v===h.Rect){const t=d.map(e=>e.id);l(t),n==null||n.pointCloud2dOperation.setSelectedIDs(t)}},it=t=>{l(d.filter(e=>e.attribute===t).map(e=>e.id))},H=d.filter(t=>!s.includes(t.attribute)),O=a.filter(t=>!s.includes(t.attribute)),k=L.filter(t=>t.attribute&&!s.includes(t.attribute)),st=t=>{if(s.includes(t))A(s.filter(e=>e!==t));else{const e=s.concat(t);A(e)}},lt=(t=H,e=P,C=O,p=k)=>{d.forEach(u=>{i==null||i.removeObjectByName(u.id)}),a.forEach(u=>{i==null||i.removeObjectByName(u.id)}),n==null||n.updatePolygonList(t,e),n==null||n.updatePointList(C),n==null||n.updateLineList(p),i==null||i.generateBoxes(t),i==null||i.generateSpheres(C),M(t)},M=t=>{const e=i==null?void 0:i.highlightOriginPointCloud(t);return new Promise(C=>{e==null||e.then(p=>{[n].forEach(u=>{var N;p&&((N=u==null?void 0:u.pointCloudInstance)==null||N.updateColor(p),C({color:p}))})})})};return{selectedID:D,pointCloudBoxList:d,pointCloudSphereList:a,displayPointCloudList:H,displaySphereList:O,displayLineList:k,selectedIDs:r,setPointCloudResult:m,setSelectedIDs:l,addPointCloudBox:S,addPointCloudSphere:y,setPointCloudSphereList:w,valid:I,selectedPointCloudBox:c,setPointCloudValid:f,addSelectedID:ot,selectedAllBoxes:nt,topViewInstance:n,setTopViewInstance:Q,sideViewInstance:g,setSideViewInstance:U,backViewInstance:x,setBackViewInstance:W,mainViewInstance:i,setMainViewInstance:X,polygonList:P,setPolygonList:q,lineList:L,setLineList:G,zoom:V,setZoom:K,history:_,toggleAttributesVisible:st,hideAttributes:s,setHideAttributes:A,reRender:lt,attrPanelLayout:R,setAttrPanelLayout:tt,syncAllViewPointCloudColor:M,defaultAttribute:B,setDefaultAttribute:Y,pointCloudPattern:v,setPointCloudPattern:$,selectSpecAttr:it}},[I,r,d,a,P,L,n,g,x,i,V,s,R,B,v]),et=()=>{const c=d.filter(l=>s.includes(l.attribute)),{setSelectedIDs:S,reRender:y}=E,f=c.map(l=>l.id);f.length>0&&S(r.filter(l=>!f.includes(l))),y()};return rt(()=>{var c;et(),(c=n==null?void 0:n.pointCloud2dOperation)==null||c.setHiddenAttributes(s)},[s]),T.createElement(F.Provider,{value:E},Z)};export{F as PointCloudContext,ct as PointCloudProvider};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.10.0-alpha.
|
|
3
|
+
"version": "1.10.0-alpha.19",
|
|
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.14.0-alpha.
|
|
46
|
+
"@labelbee/lb-annotation": "1.14.0-alpha.18",
|
|
47
47
|
"@labelbee/lb-utils": "1.7.0-alpha.9",
|
|
48
48
|
"ahooks": "^3.4.0",
|
|
49
49
|
"classnames": "^2.3.0",
|