@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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var icon_eyeLock_a=require("../../assets/attributeIcon/icon_eyeLock_a.svg.js"),icon_eyeLock_h=require("../../assets/attributeIcon/icon_eyeLock_h.svg.js"),Style=require("../../data/Style.js"),index$1=require("../colorTag/index.js"),es=require("antd/es"),React=require("react"),antd=require("antd"),index=require("../colorPalette/index.js"),icons=require("@ant-design/icons"),reactI18next=require("react-i18next"),index$2=require("./components/limitPopover/index.js"),_=require("lodash"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);const ATTRIBUTE_COLORS=[Style.NULL_COLOR].concat(Style.COLORS_ARRAY),AttributeList=React__default.default.forwardRef((e,g)=>{const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var icon_eyeLock_a=require("../../assets/attributeIcon/icon_eyeLock_a.svg.js"),icon_eyeLock_h=require("../../assets/attributeIcon/icon_eyeLock_h.svg.js"),Style=require("../../data/Style.js"),index$1=require("../colorTag/index.js"),es=require("antd/es"),React=require("react"),antd=require("antd"),index=require("../colorPalette/index.js"),icons=require("@ant-design/icons"),reactI18next=require("react-i18next"),index$2=require("./components/limitPopover/index.js"),_=require("lodash"),lbAnnotation=require("@labelbee/lb-annotation"),ahooks=require("ahooks");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);const ATTRIBUTE_COLORS=[Style.NULL_COLOR].concat(Style.COLORS_ARRAY),AttributeList=React__default.default.forwardRef((e,g)=>{const k=React__default.default.useRef(),{t:v}=reactI18next.useTranslation(),L=e.list||[],[h,c]=React.useState(!1),[y,R]=React.useState(void 0),[r,E]=React.useState([]);let d=[...ATTRIBUTE_COLORS];e.forbidDefault===!0&&(d=d.slice(1));let b="sensebee-radio-group";e.noHeightLimit&&(b="sensebee-radio-group-no-limit-height");const A=t=>{var l,o;if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||(e==null?void 0:e.forbidColor))return;let a=t.keyCode;e.forbidDefault===!0&&(a=a-1);let i;if(lbAnnotation.MathUtils.isInRange(t.keyCode,[48,57])&&(i=e.list[a-48]),lbAnnotation.MathUtils.isInRange(t.keyCode,[96,105])&&(i=e.list[a-96]),t.shiftKey&&i){if(!(e==null?void 0:e.attributeLockChange))return;s(t,i),t.preventDefault();return}(lbAnnotation.MathUtils.isInRange(t.keyCode,[48,57])||lbAnnotation.MathUtils.isInRange(t.keyCode,[96,105]))&&((o=e==null?void 0:e.attributeChanged)==null||o.call(e,(l=i==null?void 0:i.value)!=null?l:""))},{run:C}=ahooks.useDebounceFn(A,{wait:200});React.useEffect(()=>(window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)));const O=(t,l)=>{e.updateColorConfig&&e.updateColorConfig(t,l)},w=(t,l)=>{if(t.shiftKey&&(e==null?void 0:e.attributeLockChange)){s(t,l);return}e.attributeChanged(t.target.value)},{run:S}=ahooks.useDebounceFn(w,{wait:100}),s=(t,l)=>{var o;if(e==null?void 0:e.forbidColor)return;const a=r.includes(l.value);let i=___default.default.cloneDeep(r);a?i=i.filter(n=>n!==l.value):i.push(l.value),E(i),(o=e==null?void 0:e.attributeLockChange)==null||o.call(e,i),a||antd.message.success(v("AttributeLockNotify",{label:l.label})),t.preventDefault()};return React__default.default.createElement("div",{className:b,style:e.style},React__default.default.createElement(es.Radio.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,ref:g},L.map((t,l)=>{var o,a,i;let n=(o=e==null?void 0:e.num)!=null?o:l;const q=(t==null?void 0:t.value)===(e==null?void 0:e.selectedAttribute);e.forbidDefault===!0&&typeof n=="number"&&n++,typeof n=="number"&&n<=9&&n>=0||(n="-");let f=l>8&&!e.forbidDefault?Style.COLORS_ARRAY[(l-1)%Style.COLORS_ARRAY.length]:d[l%d.length];(t==null?void 0:t.color)&&(f=t.color);const{defaultSize:D,logicalCondition:m,sizeRange:T}=((a=t==null?void 0:t.limit)==null?void 0:a.sizeLimit)||{},I=((i=t==null?void 0:t.limit)==null?void 0:i.positionLimit)||D||T||(m==null?void 0:m.length)>0,j=q&&I&&e.forbidShowLimitPopover!==!0;return React__default.default.createElement(es.Radio,{value:t.value,ref:k,key:t.label+l,onClick:u=>S(u,t)},React__default.default.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&React__default.default.createElement(antd.Popover,{content:React__default.default.createElement(index,{defaultColor:f,setColor:u=>O(t.value,u)}),title:React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},React__default.default.createElement("span",null,v("Palette")),React__default.default.createElement(icons.CloseOutlined,{onClick:()=>c(!1)})),visible:h&&y===l,onVisibleChange:u=>{!u||c(u)}},React__default.default.createElement(index$1.ColorTag,{color:f,style:{cursor:"pointer",marginRight:"8px"},onClick:()=>{(e==null?void 0:e.enableColorPicker)&&(R(l),c(!0))}})),t.label),!(e==null?void 0:e.forbidColor)&&(e==null?void 0:e.attributeLockChange)&&React__default.default.createElement("img",{onClick:u=>s(u,t),src:r.includes(t.value)?icon_eyeLock_a:icon_eyeLock_h,style:{display:r.includes(t.value)?"inline-block":""},className:"sensebee-radio-icon"}),j&&React__default.default.createElement(index$2,{limit:t.limit,updateSize:e==null?void 0:e.updateSize}),React__default.default.createElement("span",{className:"sensebee-radio-num"},n))})))});exports.ATTRIBUTE_COLORS=ATTRIBUTE_COLORS,exports.default=AttributeList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),useStatus=require("./hooks/useStatus.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),useUpdatePointCloudColor=require("./hooks/useUpdatePointCloudColor.js"),reactI18next=require("react-i18next"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(
|
|
1
|
+
"use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),useStatus=require("./hooks/useStatus.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),useUpdatePointCloudColor=require("./hooks/useUpdatePointCloudColor.js"),reactI18next=require("react-i18next"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(a,r,i)=>r in a?__defProp(a,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[r]=i,__spreadValues=(a,r)=>{for(var i in r||(r={}))__hasOwnProp.call(r,i)&&__defNormalProp(a,i,r[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(r))__propIsEnum.call(r,i)&&__defNormalProp(a,i,r[i]);return a},__spreadProps=(a,r)=>__defProps(a,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:a,config:r,checkMode:i,configString:x,imgIndex:b,toolInstanceRef:u,setResourceLoading:y})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:k,selectNextBox:V,selectPrevBox:_,updateSelectedBox:E,deleteSelectedPointCloudBoxAndPolygon:I}=useSingleBox.useSingleBox(),{selectedSphere:v,updatePointCloudSphere:q}=useSphere.useSphere(),{clearAllResult:P,updatePointCloudPattern:B}=useStatus.useStatus(),{copySelectedBoxes:L,pasteSelectedBoxes:O,copiedBoxes:W}=useBoxes.useBoxes({config:r,currentData:a}),{updateRotate:C}=useRotate.useRotate({currentData:a}),{updateRotateEdge:j}=useRotateEdge.useRotateEdge({currentData:a}),{updatePointCloudData:d,topViewSelectedChanged:T}=usePointCloudViews.usePointCloudViews({setResourceLoading:y}),{redo:f,undo:g,pushHistoryWithList:A,pushHistoryUnderUpdatePolygon:D,pushHistoryUnderUpdateLine:H}=useHistory.useHistory(),{syncThreeViewsAttribute:m}=useAttribute.useAttribute(),{syncAllViewsConfig:N,reRenderTopViewRange:R}=useConfig.useConfig(),{selectedPolygon:h}=usePolygon.usePolygon(),{selectedLine:S}=useLine.useLine(),{t:w}=reactI18next.useTranslation(),{updatePointCloudColor:K}=useUpdatePointCloudColor.useUpdatePointCloudColor(y,r),U=ahooks.useLatest(a),p=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},z=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:l}=s;switch(t){case"q":{C(e.rectRotateSensitivity);break}case"e":C(-Number(e.rectRotateSensitivity));break;case"g":j(-90);break;case"u":{const c=l.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;B(c);const M={[lbAnnotation.EToolName.Polygon]:w("PolygonPattern"),[lbAnnotation.EToolName.Rect]:w("RectPattern")};antd.message.success(w("ChangePatternMsg",{pattern:M[c]})),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){_();break}V(),o.preventDefault();break;case"f":k();break;case"arrowup":p({y:-1});break;case"arrowdown":p({y:1});break;case"arrowleft":p({x:-1});break;case"arrowright":p({x:1});break;case"delete":I(U.current);break}},F=(t,o)=>{switch(t){case"c":L();break;case"v":O();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?f():g();break}}},G=ahooks.useLatest(t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||i===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){F(o,t);return}z(o,t)});return React.useEffect(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>G.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),React.useEffect(()=>{N(r)},[x]),React.useEffect(()=>{(r==null?void 0:r.radius)&&R(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{d==null||d()},[b,e.mainViewInstance]),React.useEffect(()=>{e.setHideAttributes([])},[b]),React.useEffect(()=>{u.current.setDefaultAttribute=t=>{var o;if(m(t),K(t),h&&D(__spreadProps(__spreadValues({},h),{attribute:t})),S&&H(__spreadProps(__spreadValues({},S),{attribute:t})),v){const s=q(__spreadProps(__spreadValues({},v),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),T({newSelectedSphere:v,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=__spreadProps(__spreadValues({},l),{[t]:o}),E(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},u.current.clearResult=()=>{P==null||P()},u.current.redo=()=>{f()},u.current.undo=()=>{g()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&P()})},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(()=>{d==null||d(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),React.useEffect(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),React.useEffect(()=>{u.current.history={pushHistory:t=>{A({pointCloudBoxList:t})},initRecord:()=>{}}},[]),React.useEffect(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||i)return;const s=c=>{m(c)},n=c=>{antd.message.error(c)},l=c=>{antd.message.info(c)};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 PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
|