@labelbee/lb-components 1.24.0-alpha.7 → 1.24.0-alpha.8
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.
- package/dist/_virtual/2DViewWorker.js +1 -1
- package/dist/components/attributeList/index.js +1 -1
- package/dist/components/pointCloudView/PointCloudListener.js +1 -1
- package/es/_virtual/2DViewWorker.js +1 -1
- package/es/components/attributeList/index.js +1 -1
- package/es/components/pointCloudView/PointCloudListener.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import B from"../../assets/attributeIcon/icon_eyeLock_a.svg.js";import F from"../../assets/attributeIcon/icon_eyeLock_h.svg.js";import{COLORS_ARRAY as b,NULL_COLOR as G}from"../../data/Style.js";import{ColorTag as H}from"../colorTag/index.js";import{Radio as y}from"antd/es";import n,{useState as C,useEffect as M}from"react";import{Popover as W,message as Y}from"antd";import $ from"../colorPalette/index.js";import{CloseOutlined as q}from"@ant-design/icons";import{useTranslation as J}from"react-i18next";import Q from"./components/limitPopover/index.js";import X from"lodash";import{CommonToolUtils as Z,MathUtils as s}from"@labelbee/lb-annotation";import{useDebounceFn as E}from"ahooks";const R=[G].concat(b),p=n.forwardRef((e,_)=>{const w=n.useRef(),{t:g}=J(),A=e.list||[],[D,m]=C(!1),[P,T]=C(void 0),[c,I]=C([]);let d=[...R];e.forbidDefault===!0&&(d=d.slice(1));let k="sensebee-radio-group";e.noHeightLimit&&(k="sensebee-radio-group-no-limit-height");const O=t=>{var l,u;if(!Z.hotkeyFilter(t)||(e==null?void 0:e.forbidColor))return;let o=t.keyCode;e.forbidDefault===!0&&(o=o-1);let i;if(s.isInRange(t.keyCode,[48,57])&&(i=e.list[o-48]),s.isInRange(t.keyCode,[96,105])&&(i=e.list[o-96]),t.shiftKey&&i){if(!(e==null?void 0:e.attributeLockChange))return;f(t,i),t.preventDefault();return}(s.isInRange(t.keyCode,[48,57])||s.isInRange(t.keyCode,[96,105]))&&((u=e==null?void 0:e.attributeChanged)==null||u.call(e,(l=i==null?void 0:i.value)!=null?l:""))},{run:L}=E(O,{wait:200});M(()=>(window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)));const S=(t,l)=>{e.updateColorConfig&&e.updateColorConfig(t,l)},j=(t,l)=>{if(t.shiftKey&&(e==null?void 0:e.attributeLockChange)){f(t,l);return}e.attributeChanged(t.target.value)},{run:N}=E(j,{wait:100}),f=(t,l)=>{var u;if(e==null?void 0:e.forbidColor)return;const o=c.includes(l.value);let i=X.cloneDeep(c);o?i=i.filter(a=>a!==l.value):i.push(l.value),I(i),(u=e==null?void 0:e.attributeLockChange)==null||u.call(e,i),o||Y.success(g("AttributeLockNotify",{label:l.label})),t.preventDefault()};return n.createElement("div",{className:k,style:e.style},n.createElement(y.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,ref:_},A.map((t,l)=>{var u,o,i;let a=(u=e==null?void 0:e.num)!=null?u:l;const z=(t==null?void 0:t.value)===(e==null?void 0:e.selectedAttribute);e.forbidDefault===!0&&typeof a=="number"&&a++,typeof a=="number"&&a<=9&&a>=0||(a="-");let v=l>8&&!e.forbidDefault?b[(l-1)%b.length]:d[l%d.length];(t==null?void 0:t.color)&&(v=t.color);const{defaultSize:U,logicalCondition:h,sizeRange:V}=((o=t==null?void 0:t.limit)==null?void 0:o.sizeLimit)||{},x=((i=t==null?void 0:t.limit)==null?void 0:i.positionLimit)||U||V||(h==null?void 0:h.length)>0,K=z&&x&&e.forbidShowLimitPopover!==!0;return n.createElement(y,{value:t.value,ref:w,key:t.label+l,onClick:r=>N(r,t)},n.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&n.createElement(W,{content:n.createElement($,{defaultColor:v,setColor:r=>S(t.value,r)}),title:n.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},n.createElement("span",null,g("Palette")),n.createElement(q,{onClick:()=>m(!1)})),visible:D&&P===l,onVisibleChange:r=>{!r||m(r)}},n.createElement(H,{color:v,style:{cursor:"pointer",marginRight:"8px"},onClick:()=>{(e==null?void 0:e.enableColorPicker)&&(T(l),m(!0))}})),t.label),!(e==null?void 0:e.forbidColor)&&(e==null?void 0:e.attributeLockChange)&&n.createElement("img",{onClick:r=>f(r,t),src:c.includes(t.value)?B:F,style:{display:c.includes(t.value)?"inline-block":""},className:"sensebee-radio-icon"}),K&&n.createElement(Q,{limit:t.limit,updateSize:e==null?void 0:e.updateSize}),n.createElement("span",{className:"sensebee-radio-num"},a))})))});export{R as ATTRIBUTE_COLORS,p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PointCloudContext as
|
|
1
|
+
import{PointCloudContext as te}from"./PointCloudContext.js";import{useRotate as oe}from"./hooks/useRotate.js";import{useRotateEdge as re}from"./hooks/useRotateEdge.js";import{useBoxes as se}from"./hooks/useBoxes.js";import{useSingleBox as ne}from"./hooks/useSingleBox.js";import{useSphere as ie}from"./hooks/useSphere.js";import{useContext as ae,useEffect as c}from"react";import{CommonToolUtils as ue,EToolName as P,cTool as le}from"@labelbee/lb-annotation";import{message as C}from"antd";import{connect as ce}from"react-redux";import{a2MapStateToProps as de}from"../../store/annotation/map.js";import{useStatus as pe}from"./hooks/useStatus.js";import{usePointCloudViews as me}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as Pe}from"../../store/ctx.js";import{useHistory as fe}from"./hooks/useHistory.js";import{useAttribute as we}from"./hooks/useAttribute.js";import{useConfig as be}from"./hooks/useConfig.js";import{usePolygon as ye}from"./hooks/usePolygon.js";import{useLine as ve}from"./hooks/useLine.js";import{useUpdatePointCloudColor as Ce}from"./hooks/useUpdatePointCloudColor.js";import{useTranslation as he}from"react-i18next";import{useLatest as B}from"ahooks";var ge=Object.defineProperty,Se=Object.defineProperties,ke=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,j=(i,r,a)=>r in i?ge(i,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[r]=a,f=(i,r)=>{for(var a in r||(r={}))xe.call(r,a)&&j(i,a,r[a]);if(O)for(var a of O(r))Ve.call(r,a)&&j(i,a,r[a]);return i},w=(i,r)=>Se(i,ke(r));const{EPolygonPattern:_e}=le,Ie=({currentData:i,config:r,checkMode:a,configString:L,imgIndex:h,toolInstanceRef:u,setResourceLoading:g})=>{const e=ae(te),{changeSelectedBoxValid:E,selectNextBox:A,selectPrevBox:T,updateSelectedBox:D,deleteSelectedPointCloudBoxAndPolygon:H}=ne(),{selectedSphere:b,updatePointCloudSphere:K}=ie(),{clearAllResult:y,updatePointCloudPattern:N}=pe(),{copySelectedBoxes:U,pasteSelectedBoxes:z,copiedBoxes:Oe}=se({config:r,currentData:i}),{updateRotate:S}=oe({currentData:i}),{updateRotateEdge:R}=re({currentData:i}),{updatePointCloudData:p,topViewSelectedChanged:F}=me({setResourceLoading:g}),{redo:k,undo:x,pushHistoryWithList:q,pushHistoryUnderUpdatePolygon:G,pushHistoryUnderUpdateLine:M}=fe(),{syncThreeViewsAttribute:V}=we(),{syncAllViewsConfig:W,reRenderTopViewRange:Y}=be(),{selectedPolygon:_}=ye(),{selectedLine:I}=ve(),{t:v}=he(),{updatePointCloudColor:$}=Ce(g,r),J=B(i),m=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},Q=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:l}=s;switch(t){case"q":{S(e.rectRotateSensitivity);break}case"e":S(-Number(e.rectRotateSensitivity));break;case"g":R(-90);break;case"u":{const d=l.pattern===_e.Normal?P.Rect:P.Polygon;N(d);const ee={[P.Polygon]:v("PolygonPattern"),[P.Rect]:v("RectPattern")};C.success(v("ChangePatternMsg",{pattern:ee[d]})),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){T();break}A(),o.preventDefault();break;case"f":E();break;case"arrowup":m({y:-1});break;case"arrowdown":m({y:1});break;case"arrowleft":m({x:-1});break;case"arrowright":m({x:1});break;case"delete":H(J.current);break}},X=(t,o)=>{switch(t){case"c":U();break;case"v":z();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?k():x();break}}},Z=B(t=>{if(!ue.hotkeyFilter(t)||a===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){X(o,t);return}Q(o,t)});return c(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>Z.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),c(()=>{W(r)},[L]),c(()=>{(r==null?void 0:r.radius)&&Y(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),c(()=>{p==null||p()},[h,e.mainViewInstance]),c(()=>{e.setHideAttributes([])},[h]),c(()=>{u.current.setDefaultAttribute=t=>{var o;if(V(t),$(t),_&&G(w(f({},_),{attribute:t})),I&&M(w(f({},I),{attribute:t})),b){const s=K(w(f({},b),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),F({newSelectedSphere:b,newSphereList:s}))}},u.current.setSubAttribute=(t,o)=>{var s;const n=e.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=w(f({},l),{[t]:o}),D(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},u.current.clearResult=()=>{y==null||y()},u.current.redo=()=>{k()},u.current.undo=()=>{x()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&y()})},u.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},u.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},u.current.asyncData=t=>{setTimeout(()=>{p==null||p(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),c(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),c(()=>{u.current.history={pushHistory:t=>{q({pointCloudBoxList:t})},initRecord:()=>{}}},[]),c(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||a)return;const s=d=>{V(d)},n=d=>{C.error(d)},l=d=>{C.info(d)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[e.topViewInstance]),null};var Be=ce(de,null,null,{context:Pe})(Ie);export{Be as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.24.0-alpha.
|
|
3
|
+
"version": "1.24.0-alpha.8",
|
|
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.28.0-alpha.
|
|
46
|
+
"@labelbee/lb-annotation": "1.28.0-alpha.4",
|
|
47
47
|
"@labelbee/lb-utils": "1.19.0",
|
|
48
48
|
"@labelbee/wavesurfer": "1.1.0",
|
|
49
49
|
"@types/react-dom": "^18.2.7",
|