@labelbee/lb-components 1.17.0-alpha.10 → 1.17.0-alpha.11

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"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),useAttribute=require("./hooks/useAttribute.js"),actionCreators=require("../../store/annotation/actionCreators.js");const PointCloudSegmentListener=({checkMode:m,currentData:l,imgIndex:v,highlightAttribute:a,config:C,toolInstanceRef:u})=>{const s=ctx.useDispatch(),{updateSegmentAttribute:S,updateSegmentSubAttribute:b}=useAttribute.useAttribute(),n=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:e,setSegmentation:d}=n;React.useEffect(()=>{var t;if(e&&l.url)return actionCreators.SetPointCloudLoading(s,!0),e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=l==null?void 0:l.url)!=null?t:"").then(()=>{var o,r;const i=lbUtils.PointCloudUtils.getSegmentFromResultList((o=l==null?void 0:l.result)!=null?o:"");(r=e==null?void 0:e.store)==null||r.updateCurrentSegment(i),actionCreators.SetPointCloudLoading(s,!1)}),e.on("syncSegmentData",d),()=>{e.unbind("syncSegmentData",d)}},[v,e]),React.useEffect(()=>{var t;(t=e==null?void 0:e.store)==null||t.highlightPointsByAttribute(a!=null?a:"")},[a,e]);const g=(t,o)=>{var r,i;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("RectSelector");break;case"k":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Add);break;case"i":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(i=(r=e.store)==null?void 0:r.cacheSegData)==null?void 0:i.id);break}},c=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||m===!0)return;const o=t.key.toLocaleLowerCase();g(o)};return React.useEffect(()=>(window.addEventListener("keydown",c),u.current.setDefaultAttribute=t=>{S(t),e==null||e.emit("updateDefaultAttribute",{newAttribute:t})},u.current.setSubAttribute=(t,o)=>{b(t,o)},()=>{window.removeEventListener("keydown",c)}),[e]),React.useEffect(()=>{u.current.clearResult=()=>{!n.ptSegmentInstance||(n.ptSegmentInstance.emit("clearStash"),n.ptSegmentInstance.emit("clearAllSegmentData"))}},[n.pointCloudBoxList,n.valid,n.polygonList,n.lineList,n.pointCloudSphereList,n.ptSegmentInstance]),null};var PointCloudSegmentListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSegmentListener);module.exports=PointCloudSegmentListener$1;
1
+ "use strict";var React=require("react"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),useAttribute=require("./hooks/useAttribute.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../utils/index.js");const PointCloudSegmentListener=({checkMode:v,currentData:l,imgIndex:S,highlightAttribute:a,config:p,toolInstanceRef:u,configString:s})=>{const d=ctx.useDispatch(),{updateSegmentAttribute:C,updateSegmentSubAttribute:b}=useAttribute.useAttribute(),n=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:e,setSegmentation:c}=n;React.useEffect(()=>{var t;if(e&&l.url)return actionCreators.SetPointCloudLoading(d,!0),e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=l==null?void 0:l.url)!=null?t:"").then(()=>{var o,r;const i=lbUtils.PointCloudUtils.getSegmentFromResultList((o=l==null?void 0:l.result)!=null?o:"");(r=e==null?void 0:e.store)==null||r.updateCurrentSegment(i),actionCreators.SetPointCloudLoading(d,!1)}),e.on("syncSegmentData",c),()=>{e.unbind("syncSegmentData",c)}},[S,e]),React.useEffect(()=>{var t;(t=e==null?void 0:e.store)==null||t.highlightPointsByAttribute(a!=null?a:"")},[a,e]),React.useEffect(()=>{e==null||e.setConfig(index.jsonParser(s))},[s]);const g=(t,o)=>{var r,i;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("RectSelector");break;case"k":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Add);break;case"i":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(i=(r=e.store)==null?void 0:r.cacheSegData)==null?void 0:i.id);break}},m=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||v===!0)return;const o=t.key.toLocaleLowerCase();g(o)};return React.useEffect(()=>(window.addEventListener("keydown",m),u.current.setDefaultAttribute=t=>{C(t),e==null||e.emit("updateDefaultAttribute",{newAttribute:t})},u.current.setSubAttribute=(t,o)=>{b(t,o)},()=>{window.removeEventListener("keydown",m)}),[e]),React.useEffect(()=>{u.current.clearResult=()=>{!n.ptSegmentInstance||(n.ptSegmentInstance.emit("clearStash"),n.ptSegmentInstance.emit("clearAllSegmentData"))}},[n.pointCloudBoxList,n.valid,n.polygonList,n.lineList,n.pointCloudSphereList,n.ptSegmentInstance]),null};var PointCloudSegmentListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSegmentListener);module.exports=PointCloudSegmentListener$1;
@@ -1 +1 @@
1
- import{useContext as k,useEffect as a}from"react";import{a2MapStateToProps as L}from"../../store/annotation/map.js";import{connect as y}from"react-redux";import{LabelBeeContext as w,useDispatch as x}from"../../store/ctx.js";import{PointCloudContext as P}from"./PointCloudContext.js";import{CommonToolUtils as h}from"@labelbee/lb-annotation";import{PointCloudUtils as A,EPointCloudSegmentMode as S}from"@labelbee/lb-utils";import{useAttribute as D}from"./hooks/useAttribute.js";import{SetPointCloudLoading as p}from"../../store/annotation/actionCreators.js";const j=({checkMode:v,currentData:l,imgIndex:g,highlightAttribute:s,config:_,toolInstanceRef:u})=>{const m=x(),{updateSegmentAttribute:b,updateSegmentSubAttribute:C}=D(),n=k(P),{ptSegmentInstance:e,setSegmentation:d}=n;a(()=>{var t;if(e&&l.url)return p(m,!0),e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=l==null?void 0:l.url)!=null?t:"").then(()=>{var o,i;const r=A.getSegmentFromResultList((o=l==null?void 0:l.result)!=null?o:"");(i=e==null?void 0:e.store)==null||i.updateCurrentSegment(r),p(m,!1)}),e.on("syncSegmentData",d),()=>{e.unbind("syncSegmentData",d)}},[g,e]),a(()=>{var t;(t=e==null?void 0:e.store)==null||t.highlightPointsByAttribute(s!=null?s:"")},[s,e]);const f=(t,o)=>{var i,r;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("RectSelector");break;case"k":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",S.Add);break;case"i":e==null||e.emit("setSegmentMode",S.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(r=(i=e.store)==null?void 0:i.cacheSegData)==null?void 0:r.id);break}},c=t=>{if(!h.hotkeyFilter(t)||v===!0)return;const o=t.key.toLocaleLowerCase();f(o)};return a(()=>(window.addEventListener("keydown",c),u.current.setDefaultAttribute=t=>{b(t),e==null||e.emit("updateDefaultAttribute",{newAttribute:t})},u.current.setSubAttribute=(t,o)=>{C(t,o)},()=>{window.removeEventListener("keydown",c)}),[e]),a(()=>{u.current.clearResult=()=>{!n.ptSegmentInstance||(n.ptSegmentInstance.emit("clearStash"),n.ptSegmentInstance.emit("clearAllSegmentData"))}},[n.pointCloudBoxList,n.valid,n.polygonList,n.lineList,n.pointCloudSphereList,n.ptSegmentInstance]),null};var E=y(L,null,null,{context:w})(j);export{E as default};
1
+ import{useContext as L,useEffect as r}from"react";import{a2MapStateToProps as x}from"../../store/annotation/map.js";import{connect as y}from"react-redux";import{LabelBeeContext as P,useDispatch as w}from"../../store/ctx.js";import{PointCloudContext as h}from"./PointCloudContext.js";import{CommonToolUtils as j}from"@labelbee/lb-annotation";import{PointCloudUtils as A,EPointCloudSegmentMode as S}from"@labelbee/lb-utils";import{useAttribute as D}from"./hooks/useAttribute.js";import{SetPointCloudLoading as v}from"../../store/annotation/actionCreators.js";import{jsonParser as E}from"../../utils/index.js";const _=({checkMode:b,currentData:l,imgIndex:g,highlightAttribute:a,config:B,toolInstanceRef:u,configString:m})=>{const d=w(),{updateSegmentAttribute:C,updateSegmentSubAttribute:f}=D(),o=L(h),{ptSegmentInstance:e,setSegmentation:c}=o;r(()=>{var t;if(e&&l.url)return v(d,!0),e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=l==null?void 0:l.url)!=null?t:"").then(()=>{var n,i;const s=A.getSegmentFromResultList((n=l==null?void 0:l.result)!=null?n:"");(i=e==null?void 0:e.store)==null||i.updateCurrentSegment(s),v(d,!1)}),e.on("syncSegmentData",c),()=>{e.unbind("syncSegmentData",c)}},[g,e]),r(()=>{var t;(t=e==null?void 0:e.store)==null||t.highlightPointsByAttribute(a!=null?a:"")},[a,e]),r(()=>{e==null||e.setConfig(E(m))},[m]);const k=(t,n)=>{var i,s;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("RectSelector");break;case"k":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",S.Add);break;case"i":e==null||e.emit("setSegmentMode",S.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(s=(i=e.store)==null?void 0:i.cacheSegData)==null?void 0:s.id);break}},p=t=>{if(!j.hotkeyFilter(t)||b===!0)return;const n=t.key.toLocaleLowerCase();k(n)};return r(()=>(window.addEventListener("keydown",p),u.current.setDefaultAttribute=t=>{C(t),e==null||e.emit("updateDefaultAttribute",{newAttribute:t})},u.current.setSubAttribute=(t,n)=>{f(t,n)},()=>{window.removeEventListener("keydown",p)}),[e]),r(()=>{u.current.clearResult=()=>{!o.ptSegmentInstance||(o.ptSegmentInstance.emit("clearStash"),o.ptSegmentInstance.emit("clearAllSegmentData"))}},[o.pointCloudBoxList,o.valid,o.polygonList,o.lineList,o.pointCloudSphereList,o.ptSegmentInstance]),null};var M=y(x,null,null,{context:P})(_);export{M as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.17.0-alpha.10",
3
+ "version": "1.17.0-alpha.11",
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.20.0-alpha.7",
46
+ "@labelbee/lb-annotation": "1.20.0-alpha.8",
47
47
  "@labelbee/lb-utils": "1.13.0-alpha.5",
48
48
  "@labelbee/wavesurfer": "1.0.0",
49
49
  "@types/react-dom": "^18.2.7",