@labelbee/lb-components 1.8.0-alpha.7 → 1.8.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.
@@ -1 +1 @@
1
- "use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),annotation=require("../../hooks/annotation.js"),useStatus=require("./hooks/useStatus.js"),index=require("../../utils/index.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"),reactI18next=require("react-i18next"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(n,r,a)=>r in n?__defProp(n,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[r]=a,__spreadValues=(n,r)=>{for(var a in r||(r={}))__hasOwnProp.call(r,a)&&__defNormalProp(n,a,r[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(r))__propIsEnum.call(r,a)&&__defNormalProp(n,a,r[a]);return n},__spreadProps=(n,r)=>__defProps(n,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:n,config:r,checkMode:a,configString:m})=>{const o=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:k,selectNextBox:h,selectPrevBox:_,updateSelectedBox:P,deleteSelectedPointCloudBoxAndPolygon:B}=useSingleBox.useSingleBox(),{clearAllResult:p,updatePointCloudPattern:S}=useStatus.useStatus(),E=index.jsonParser(n.result),{copySelectedBoxes:I,pasteSelectedBoxes:V,copiedBoxes:A}=useBoxes.useBoxes({config:r}),{toolInstanceRef:i}=annotation.useCustomToolInstance({basicInfo:E}),{updateRotate:v}=useRotate.useRotate({currentData:n}),{updatePointCloudData:f,topViewSelectedChanged:q}=usePointCloudViews.usePointCloudViews(),{redo:y,undo:C,pushHistoryWithList:O,pushHistoryUnderUpdatePolygon:j}=useHistory.useHistory(),{syncThreeViewsAttribute:x}=useAttribute.useAttribute(),{syncAllViewsConfig:L,reRenderTopViewRange:R}=useConfig.useConfig(),{selectedPolygon:w}=usePolygon.usePolygon(),{t:b}=reactI18next.useTranslation(),T=(e,t)=>{var s;const{topViewInstance:u,mainViewInstance:l}=o;if(!u)return;const{pointCloud2dOperation:c}=u;switch(e){case"q":{v(2);break}case"e":v(-2);break;case"g":v(180);break;case"u":{const d=c.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;S(d);const N={[lbAnnotation.EToolName.Polygon]:b("PolygonPattern"),[lbAnnotation.EToolName.Rect]:b("RectPattern")};antd.message.success(b("ChangePatternMsg",{pattern:N[d]})),c.clearActiveStatus(),c.clearDrawingStatus()}break;case"+":l==null||l.updatePointSize(!0);break;case"-":l==null||l.updatePointSize(!1);break;case"v":o.setPointCloudValid(!o.valid);break;case"tab":if(t.shiftKey){_();break}h(),t.preventDefault();break;case"f":k();break;case"delete":B();break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const d=lbAnnotation.AttributeUtils.getAttributeByKeycode(t.keyCode,r.attributeList);d!==void 0&&i.current.setDefaultAttribute(d)}return}}},D=(e,t)=>{switch(e){case"c":I();break;case"v":V();break;case"a":o.selectedAllBoxes();break;case"z":{t.shiftKey?y():C();break}}},g=e=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(e)||a===!0)return;const t=e.key.toLocaleLowerCase();if(e.ctrlKey){D(t,e);return}T(t,e)};return React.useEffect(()=>{const{topViewInstance:e}=o;if(!!e)return window.addEventListener("keydown",g),()=>{window.removeEventListener("keydown",g)}},[o,A,r,o.pointCloudBoxList,o.polygonList]),React.useEffect(()=>{L(r)},[m]),React.useEffect(()=>{(r==null?void 0:r.radius)&&R(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{f==null||f()},[n,o.mainViewInstance]),React.useEffect(()=>{i.current.exportData=()=>[o.pointCloudBoxList,{valid:o.valid}],i.current.exportCustomData=()=>{var e;return{resultPolygon:(e=o.polygonList)!=null?e:[]}},i.current.setDefaultAttribute=e=>{x(e);const t=o.selectedPointCloudBox;if(t){t.attribute=e;const s=P(t);o.mainViewInstance&&q(t,s)}w&&j(__spreadProps(__spreadValues({},w),{attribute:e}))},i.current.setSubAttribute=(e,t)=>{var s;const u=o.selectedPointCloudBox;if(u){const l=(s=u==null?void 0:u.subAttribute)!=null?s:{};u.subAttribute=__spreadProps(__spreadValues({},l),{[e]:t}),P(u)}},i.current.clearResult=()=>{p==null||p()},i.current.redo=()=>{y()},i.current.undo=()=>{C()},i.current.setValid=e=>{i.current.valid=e,setTimeout(()=>{o.setPointCloudValid(e),e===!1&&p()})},i.current.setForbidOperation=e=>{var t,s;(s=(t=o.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null||s.setForbidOperation(e),e===!0&&o.setSelectedIDs(void 0)},i.current.setShowDefaultCursor=e=>{var t,s;(s=(t=o.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null||s.setShowDefaultCursor(e)}},[o.pointCloudBoxList,o.selectedID,o.valid,o.polygonList,o.mainViewInstance]),React.useEffect(()=>{i.current.history={pushHistory:e=>{O({pointCloudBoxList:e})},initRecord:()=>{}}},[]),React.useEffect(()=>{var e;const t=(e=o.topViewInstance)==null?void 0:e.pointCloud2dOperation;if(!t||a)return;const s=c=>{x(c)},u=c=>{antd.message.error(c)},l=c=>{antd.message.info(c)};return t.on("syncAttribute",s),t.on("messageError",u),t.on("messageInfo",l),()=>{t.unbind("syncAttribute",s),t.unbind("messageError",u),t.unbind("messageInfo",l)}},[o.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
1
+ "use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),annotation=require("../../hooks/annotation.js"),useStatus=require("./hooks/useStatus.js"),index=require("../../utils/index.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"),reactI18next=require("react-i18next"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,r,n)=>r in i?__defProp(i,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[r]=n,__spreadValues=(i,r)=>{for(var n in r||(r={}))__hasOwnProp.call(r,n)&&__defNormalProp(i,n,r[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(r))__propIsEnum.call(r,n)&&__defNormalProp(i,n,r[n]);return i},__spreadProps=(i,r)=>__defProps(i,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:i,config:r,checkMode:n,configString:m,imgIndex:k})=>{const o=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:h,selectNextBox:_,selectPrevBox:B,updateSelectedBox:P,deleteSelectedPointCloudBoxAndPolygon:S}=useSingleBox.useSingleBox(),{clearAllResult:p,updatePointCloudPattern:E}=useStatus.useStatus(),I=index.jsonParser(i.result),{copySelectedBoxes:V,pasteSelectedBoxes:A,copiedBoxes:q}=useBoxes.useBoxes({config:r}),{toolInstanceRef:a}=annotation.useCustomToolInstance({basicInfo:I}),{updateRotate:v}=useRotate.useRotate({currentData:i}),{updatePointCloudData:f,topViewSelectedChanged:O}=usePointCloudViews.usePointCloudViews(),{redo:y,undo:C,pushHistoryWithList:j,pushHistoryUnderUpdatePolygon:L}=useHistory.useHistory(),{syncThreeViewsAttribute:x}=useAttribute.useAttribute(),{syncAllViewsConfig:R,reRenderTopViewRange:T}=useConfig.useConfig(),{selectedPolygon:w}=usePolygon.usePolygon(),{t:b}=reactI18next.useTranslation(),D=(e,t)=>{var s;const{topViewInstance:u,mainViewInstance:l}=o;if(!u)return;const{pointCloud2dOperation:c}=u;switch(e){case"q":{v(2);break}case"e":v(-2);break;case"g":v(180);break;case"u":{const d=c.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;E(d);const K={[lbAnnotation.EToolName.Polygon]:b("PolygonPattern"),[lbAnnotation.EToolName.Rect]:b("RectPattern")};antd.message.success(b("ChangePatternMsg",{pattern:K[d]})),c.clearActiveStatus(),c.clearDrawingStatus()}break;case"+":l==null||l.updatePointSize(!0);break;case"-":l==null||l.updatePointSize(!1);break;case"v":o.setPointCloudValid(!o.valid);break;case"tab":if(t.shiftKey){B();break}_(),t.preventDefault();break;case"f":h();break;case"delete":S();break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const d=lbAnnotation.AttributeUtils.getAttributeByKeycode(t.keyCode,r.attributeList);d!==void 0&&a.current.setDefaultAttribute(d)}return}}},N=(e,t)=>{switch(e){case"c":V();break;case"v":A();break;case"a":o.selectedAllBoxes();break;case"z":{t.shiftKey?y():C();break}}},g=e=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(e)||n===!0)return;const t=e.key.toLocaleLowerCase();if(e.ctrlKey){N(t,e);return}D(t,e)};return React.useEffect(()=>{const{topViewInstance:e}=o;if(!!e)return window.addEventListener("keydown",g),()=>{window.removeEventListener("keydown",g)}},[o,q,r,o.pointCloudBoxList,o.polygonList]),React.useEffect(()=>{R(r)},[m]),React.useEffect(()=>{(r==null?void 0:r.radius)&&T(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{f==null||f()},[k,o.mainViewInstance]),React.useEffect(()=>{a.current.exportData=()=>[o.pointCloudBoxList,{valid:o.valid}],a.current.exportCustomData=()=>{var e;return{resultPolygon:(e=o.polygonList)!=null?e:[]}},a.current.setDefaultAttribute=e=>{x(e);const t=o.selectedPointCloudBox;if(t){t.attribute=e;const s=P(t);o.mainViewInstance&&O(t,s)}w&&L(__spreadProps(__spreadValues({},w),{attribute:e}))},a.current.setSubAttribute=(e,t)=>{var s;const u=o.selectedPointCloudBox;if(u){const l=(s=u==null?void 0:u.subAttribute)!=null?s:{};u.subAttribute=__spreadProps(__spreadValues({},l),{[e]:t}),P(u)}},a.current.clearResult=()=>{p==null||p()},a.current.redo=()=>{y()},a.current.undo=()=>{C()},a.current.setValid=e=>{a.current.valid=e,setTimeout(()=>{o.setPointCloudValid(e),e===!1&&p()})},a.current.setForbidOperation=e=>{var t,s;(s=(t=o.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null||s.setForbidOperation(e),e===!0&&o.setSelectedIDs(void 0)},a.current.setShowDefaultCursor=e=>{var t,s;(s=(t=o.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null||s.setShowDefaultCursor(e)}},[o.pointCloudBoxList,o.selectedID,o.valid,o.polygonList,o.mainViewInstance]),React.useEffect(()=>{a.current.history={pushHistory:e=>{j({pointCloudBoxList:e})},initRecord:()=>{}}},[]),React.useEffect(()=>{var e;const t=(e=o.topViewInstance)==null?void 0:e.pointCloud2dOperation;if(!t||n)return;const s=c=>{x(c)},u=c=>{antd.message.error(c)},l=c=>{antd.message.info(c)};return t.on("syncAttribute",s),t.on("messageError",u),t.on("messageInfo",l),()=>{t.unbind("syncAttribute",s),t.unbind("messageError",u),t.unbind("messageInfo",l)}},[o.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var StepUtils=require("../../utils/StepUtils.js"),index=require("../../utils/index.js");const a2MapStateToProps=n=>{var e,o,i;const{annotation:{imgList:r,imgIndex:s}}=n,a=(e=r[s])!=null?e:{},t=StepUtils.getCurrentStepInfo((o=n.annotation)==null?void 0:o.step,(i=n.annotation)==null?void 0:i.stepList);return{currentData:a,imgList:r,stepInfo:t,config:index.jsonParser(t==null?void 0:t.config),configString:t==null?void 0:t.config}};exports.a2MapStateToProps=a2MapStateToProps;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var StepUtils=require("../../utils/StepUtils.js"),index=require("../../utils/index.js");const a2MapStateToProps=n=>{var e,o,i;const{annotation:{imgList:r,imgIndex:s}}=n,a=(e=r[s])!=null?e:{},t=StepUtils.getCurrentStepInfo((o=n.annotation)==null?void 0:o.step,(i=n.annotation)==null?void 0:i.stepList);return{currentData:a,imgIndex:s,imgList:r,stepInfo:t,config:index.jsonParser(t==null?void 0:t.config),configString:t==null?void 0:t.config}};exports.a2MapStateToProps=a2MapStateToProps;
@@ -1,3 +1,3 @@
1
1
  import { IA2MapStateProps } from '@/store/annotation/map';
2
- declare const _default: import("react-redux").ConnectedComponent<({ currentData, config }: IA2MapStateProps) => JSX.Element, import("react-redux").Omit<IA2MapStateProps, "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
2
+ declare const _default: import("react-redux").ConnectedComponent<({ currentData, config }: IA2MapStateProps) => JSX.Element, import("react-redux").Omit<IA2MapStateProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
3
3
  export default _default;
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { IA2MapStateProps } from '@/store/annotation/map';
3
3
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IA2MapStateProps>, import("react-redux").Omit<IA2MapStateProps & {
4
4
  children?: React.ReactNode;
5
- }, "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
5
+ }, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
6
6
  export default _default;
@@ -2,5 +2,5 @@ import { IA2MapStateProps } from '@/store/annotation/map';
2
2
  interface IProps {
3
3
  checkMode?: boolean;
4
4
  }
5
- declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, checkMode }: IA2MapStateProps & IProps) => JSX.Element, import("react-redux").Omit<IA2MapStateProps & IProps, "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
5
+ declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, checkMode }: IA2MapStateProps & IProps) => JSX.Element, import("react-redux").Omit<IA2MapStateProps & IProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
6
6
  export default _default;
@@ -5,5 +5,5 @@ interface IProps extends IA2MapStateProps {
5
5
  }
6
6
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
7
7
  children?: React.ReactNode;
8
- }, "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
8
+ }, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
9
9
  export default _default;
@@ -5,5 +5,5 @@ interface IProps {
5
5
  }
6
6
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IA2MapStateProps & IProps>, import("react-redux").Omit<IA2MapStateProps & IProps & {
7
7
  children?: React.ReactNode;
8
- }, "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
8
+ }, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
9
9
  export default _default;
@@ -7,5 +7,5 @@ interface IProps extends IA2MapStateProps {
7
7
  }
8
8
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
9
9
  children?: React.ReactNode;
10
- }, "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
10
+ }, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
11
11
  export default _default;
@@ -16,10 +16,12 @@ export interface IA2MapStateProps extends IAnnotationStateProps {
16
16
  imgList: IFileItem[];
17
17
  stepInfo: IStepInfo;
18
18
  config: any;
19
+ imgIndex: number;
19
20
  configString: string;
20
21
  }
21
22
  export declare const a2MapStateToProps: (state: AppState) => {
22
23
  currentData: any;
24
+ imgIndex: any;
23
25
  imgList: any;
24
26
  stepInfo: IStepInfo;
25
27
  config: any;
@@ -1 +1 @@
1
- import{PointCloudContext as W}from"./PointCloudContext.js";import{useRotate as Y}from"./hooks/useRotate.js";import{useBoxes as $}from"./hooks/useBoxes.js";import{useSingleBox as J}from"./hooks/useSingleBox.js";import{useContext as Q,useEffect as d}from"react";import{CommonToolUtils as X,AttributeUtils as Z,EToolName as m,cTool as ee}from"@labelbee/lb-annotation";import{message as y}from"antd";import{connect as te}from"react-redux";import{a2MapStateToProps as oe}from"../../store/annotation/map.js";import{useCustomToolInstance as re}from"../../hooks/annotation.js";import{useStatus as se}from"./hooks/useStatus.js";import{jsonParser as ne}from"../../utils/index.js";import{usePointCloudViews as ie}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as ae}from"../../store/ctx.js";import{useHistory as le}from"./hooks/useHistory.js";import{useAttribute as ue}from"./hooks/useAttribute.js";import{useConfig as ce}from"./hooks/useConfig.js";import{usePolygon as de}from"./hooks/usePolygon.js";import{useTranslation as pe}from"react-i18next";var me=Object.defineProperty,fe=Object.defineProperties,be=Object.getOwnPropertyDescriptors,_=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable,B=(n,r,i)=>r in n?me(n,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[r]=i,S=(n,r)=>{for(var i in r||(r={}))Pe.call(r,i)&&B(n,i,r[i]);if(_)for(var i of _(r))ye.call(r,i)&&B(n,i,r[i]);return n},I=(n,r)=>fe(n,be(r));const{EPolygonPattern:ve}=ee,Ce=({currentData:n,config:r,checkMode:i,configString:V})=>{const o=Q(W),{changeSelectedBoxValid:O,selectNextBox:j,selectPrevBox:A,updateSelectedBox:v,deleteSelectedPointCloudBoxAndPolygon:L}=J(),{clearAllResult:f,updatePointCloudPattern:E}=se(),R=ne(n.result),{copySelectedBoxes:T,pasteSelectedBoxes:D,copiedBoxes:K}=$({config:r}),{toolInstanceRef:a}=re({basicInfo:R}),{updateRotate:b}=Y({currentData:n}),{updatePointCloudData:C,topViewSelectedChanged:N}=ie(),{redo:w,undo:x,pushHistoryWithList:H,pushHistoryUnderUpdatePolygon:U}=le(),{syncThreeViewsAttribute:g}=ue(),{syncAllViewsConfig:z,reRenderTopViewRange:F}=ce(),{selectedPolygon:k}=de(),{t:P}=pe(),q=(e,t)=>{var s;const{topViewInstance:l,mainViewInstance:u}=o;if(!l)return;const{pointCloud2dOperation:c}=l;switch(e){case"q":{b(2);break}case"e":b(-2);break;case"g":b(180);break;case"u":{const p=c.pattern===ve.Normal?m.Rect:m.Polygon;E(p);const M={[m.Polygon]:P("PolygonPattern"),[m.Rect]:P("RectPattern")};y.success(P("ChangePatternMsg",{pattern:M[p]})),c.clearActiveStatus(),c.clearDrawingStatus()}break;case"+":u==null||u.updatePointSize(!0);break;case"-":u==null||u.updatePointSize(!1);break;case"v":o.setPointCloudValid(!o.valid);break;case"tab":if(t.shiftKey){A();break}j(),t.preventDefault();break;case"f":O();break;case"delete":L();break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const p=Z.getAttributeByKeycode(t.keyCode,r.attributeList);p!==void 0&&a.current.setDefaultAttribute(p)}return}}},G=(e,t)=>{switch(e){case"c":T();break;case"v":D();break;case"a":o.selectedAllBoxes();break;case"z":{t.shiftKey?w():x();break}}},h=e=>{if(!X.hotkeyFilter(e)||i===!0)return;const t=e.key.toLocaleLowerCase();if(e.ctrlKey){G(t,e);return}q(t,e)};return d(()=>{const{topViewInstance:e}=o;if(!!e)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h)}},[o,K,r,o.pointCloudBoxList,o.polygonList]),d(()=>{z(r)},[V]),d(()=>{(r==null?void 0:r.radius)&&F(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),d(()=>{C==null||C()},[n,o.mainViewInstance]),d(()=>{a.current.exportData=()=>[o.pointCloudBoxList,{valid:o.valid}],a.current.exportCustomData=()=>{var e;return{resultPolygon:(e=o.polygonList)!=null?e:[]}},a.current.setDefaultAttribute=e=>{g(e);const t=o.selectedPointCloudBox;if(t){t.attribute=e;const s=v(t);o.mainViewInstance&&N(t,s)}k&&U(I(S({},k),{attribute:e}))},a.current.setSubAttribute=(e,t)=>{var s;const l=o.selectedPointCloudBox;if(l){const u=(s=l==null?void 0:l.subAttribute)!=null?s:{};l.subAttribute=I(S({},u),{[e]:t}),v(l)}},a.current.clearResult=()=>{f==null||f()},a.current.redo=()=>{w()},a.current.undo=()=>{x()},a.current.setValid=e=>{a.current.valid=e,setTimeout(()=>{o.setPointCloudValid(e),e===!1&&f()})},a.current.setForbidOperation=e=>{var t,s;(s=(t=o.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null||s.setForbidOperation(e),e===!0&&o.setSelectedIDs(void 0)},a.current.setShowDefaultCursor=e=>{var t,s;(s=(t=o.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null||s.setShowDefaultCursor(e)}},[o.pointCloudBoxList,o.selectedID,o.valid,o.polygonList,o.mainViewInstance]),d(()=>{a.current.history={pushHistory:e=>{H({pointCloudBoxList:e})},initRecord:()=>{}}},[]),d(()=>{var e;const t=(e=o.topViewInstance)==null?void 0:e.pointCloud2dOperation;if(!t||i)return;const s=c=>{g(c)},l=c=>{y.error(c)},u=c=>{y.info(c)};return t.on("syncAttribute",s),t.on("messageError",l),t.on("messageInfo",u),()=>{t.unbind("syncAttribute",s),t.unbind("messageError",l),t.unbind("messageInfo",u)}},[o.topViewInstance]),null};var we=te(oe,null,null,{context:ae})(Ce);export{we as default};
1
+ import{PointCloudContext as Y}from"./PointCloudContext.js";import{useRotate as $}from"./hooks/useRotate.js";import{useBoxes as J}from"./hooks/useBoxes.js";import{useSingleBox as Q}from"./hooks/useSingleBox.js";import{useContext as X,useEffect as d}from"react";import{CommonToolUtils as Z,AttributeUtils as ee,EToolName as m,cTool as te}from"@labelbee/lb-annotation";import{message as y}from"antd";import{connect as oe}from"react-redux";import{a2MapStateToProps as re}from"../../store/annotation/map.js";import{useCustomToolInstance as se}from"../../hooks/annotation.js";import{useStatus as ne}from"./hooks/useStatus.js";import{jsonParser as ie}from"../../utils/index.js";import{usePointCloudViews as ae}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as ue}from"../../store/ctx.js";import{useHistory as le}from"./hooks/useHistory.js";import{useAttribute as ce}from"./hooks/useAttribute.js";import{useConfig as de}from"./hooks/useConfig.js";import{usePolygon as pe}from"./hooks/usePolygon.js";import{useTranslation as me}from"react-i18next";var fe=Object.defineProperty,be=Object.defineProperties,Pe=Object.getOwnPropertyDescriptors,_=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,B=(a,r,n)=>r in a?fe(a,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[r]=n,S=(a,r)=>{for(var n in r||(r={}))ye.call(r,n)&&B(a,n,r[n]);if(_)for(var n of _(r))ve.call(r,n)&&B(a,n,r[n]);return a},I=(a,r)=>be(a,Pe(r));const{EPolygonPattern:Ce}=te,we=({currentData:a,config:r,checkMode:n,configString:V,imgIndex:O})=>{const o=X(Y),{changeSelectedBoxValid:j,selectNextBox:A,selectPrevBox:L,updateSelectedBox:v,deleteSelectedPointCloudBoxAndPolygon:D}=Q(),{clearAllResult:f,updatePointCloudPattern:E}=ne(),R=ie(a.result),{copySelectedBoxes:T,pasteSelectedBoxes:K,copiedBoxes:N}=J({config:r}),{toolInstanceRef:i}=se({basicInfo:R}),{updateRotate:b}=$({currentData:a}),{updatePointCloudData:C,topViewSelectedChanged:H}=ae(),{redo:w,undo:x,pushHistoryWithList:U,pushHistoryUnderUpdatePolygon:z}=le(),{syncThreeViewsAttribute:g}=ce(),{syncAllViewsConfig:F,reRenderTopViewRange:q}=de(),{selectedPolygon:k}=pe(),{t:P}=me(),G=(e,t)=>{var s;const{topViewInstance:u,mainViewInstance:l}=o;if(!u)return;const{pointCloud2dOperation:c}=u;switch(e){case"q":{b(2);break}case"e":b(-2);break;case"g":b(180);break;case"u":{const p=c.pattern===Ce.Normal?m.Rect:m.Polygon;E(p);const W={[m.Polygon]:P("PolygonPattern"),[m.Rect]:P("RectPattern")};y.success(P("ChangePatternMsg",{pattern:W[p]})),c.clearActiveStatus(),c.clearDrawingStatus()}break;case"+":l==null||l.updatePointSize(!0);break;case"-":l==null||l.updatePointSize(!1);break;case"v":o.setPointCloudValid(!o.valid);break;case"tab":if(t.shiftKey){L();break}A(),t.preventDefault();break;case"f":j();break;case"delete":D();break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const p=ee.getAttributeByKeycode(t.keyCode,r.attributeList);p!==void 0&&i.current.setDefaultAttribute(p)}return}}},M=(e,t)=>{switch(e){case"c":T();break;case"v":K();break;case"a":o.selectedAllBoxes();break;case"z":{t.shiftKey?w():x();break}}},h=e=>{if(!Z.hotkeyFilter(e)||n===!0)return;const t=e.key.toLocaleLowerCase();if(e.ctrlKey){M(t,e);return}G(t,e)};return d(()=>{const{topViewInstance:e}=o;if(!!e)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h)}},[o,N,r,o.pointCloudBoxList,o.polygonList]),d(()=>{F(r)},[V]),d(()=>{(r==null?void 0:r.radius)&&q(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),d(()=>{C==null||C()},[O,o.mainViewInstance]),d(()=>{i.current.exportData=()=>[o.pointCloudBoxList,{valid:o.valid}],i.current.exportCustomData=()=>{var e;return{resultPolygon:(e=o.polygonList)!=null?e:[]}},i.current.setDefaultAttribute=e=>{g(e);const t=o.selectedPointCloudBox;if(t){t.attribute=e;const s=v(t);o.mainViewInstance&&H(t,s)}k&&z(I(S({},k),{attribute:e}))},i.current.setSubAttribute=(e,t)=>{var s;const u=o.selectedPointCloudBox;if(u){const l=(s=u==null?void 0:u.subAttribute)!=null?s:{};u.subAttribute=I(S({},l),{[e]:t}),v(u)}},i.current.clearResult=()=>{f==null||f()},i.current.redo=()=>{w()},i.current.undo=()=>{x()},i.current.setValid=e=>{i.current.valid=e,setTimeout(()=>{o.setPointCloudValid(e),e===!1&&f()})},i.current.setForbidOperation=e=>{var t,s;(s=(t=o.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null||s.setForbidOperation(e),e===!0&&o.setSelectedIDs(void 0)},i.current.setShowDefaultCursor=e=>{var t,s;(s=(t=o.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null||s.setShowDefaultCursor(e)}},[o.pointCloudBoxList,o.selectedID,o.valid,o.polygonList,o.mainViewInstance]),d(()=>{i.current.history={pushHistory:e=>{U({pointCloudBoxList:e})},initRecord:()=>{}}},[]),d(()=>{var e;const t=(e=o.topViewInstance)==null?void 0:e.pointCloud2dOperation;if(!t||n)return;const s=c=>{g(c)},u=c=>{y.error(c)},l=c=>{y.info(c)};return t.on("syncAttribute",s),t.on("messageError",u),t.on("messageInfo",l),()=>{t.unbind("syncAttribute",s),t.unbind("messageError",u),t.unbind("messageInfo",l)}},[o.topViewInstance]),null};var xe=oe(re,null,null,{context:ue})(we);export{xe as default};
@@ -1 +1 @@
1
- {"version":3,"file":"PointCloudListener.js","sources":["../../../src/components/pointCloudView/PointCloudListener.tsx"],"sourcesContent":["import { PointCloudContext } from './PointCloudContext';\nimport { useRotate } from './hooks/useRotate';\nimport { useBoxes } from './hooks/useBoxes';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport React, { useContext, useEffect } from 'react';\nimport { cTool, AttributeUtils, CommonToolUtils, EToolName } from '@labelbee/lb-annotation';\nimport { message } from 'antd';\nimport { connect } from 'react-redux';\nimport { a2MapStateToProps, IA2MapStateProps } from '@/store/annotation/map';\nimport { useCustomToolInstance } from '@/hooks/annotation';\nimport { useStatus } from './hooks/useStatus';\nimport { jsonParser } from '@/utils';\nimport { usePointCloudViews } from './hooks/usePointCloudViews';\nimport { LabelBeeContext } from '@/store/ctx';\nimport { useHistory } from './hooks/useHistory';\nimport { useAttribute } from './hooks/useAttribute';\nimport { useConfig } from './hooks/useConfig';\nimport { usePolygon } from './hooks/usePolygon';\nimport { useTranslation } from 'react-i18next';\n\nconst { EPolygonPattern } = cTool;\n\ninterface IProps extends IA2MapStateProps {\n checkMode?: boolean;\n}\n\nconst PointCloudListener: React.FC<IProps> = ({ currentData, config, checkMode, configString }) => {\n const ptCtx = useContext(PointCloudContext);\n const {\n changeSelectedBoxValid,\n selectNextBox,\n selectPrevBox,\n updateSelectedBox,\n deleteSelectedPointCloudBoxAndPolygon,\n } = useSingleBox();\n const { clearAllResult, updatePointCloudPattern } = useStatus();\n const basicInfo = jsonParser(currentData.result);\n const { copySelectedBoxes, pasteSelectedBoxes, copiedBoxes } = useBoxes({ config });\n const { toolInstanceRef } = useCustomToolInstance({ basicInfo });\n const { updateRotate } = useRotate({ currentData });\n const { updatePointCloudData, topViewSelectedChanged } = usePointCloudViews();\n const { redo, undo, pushHistoryWithList, pushHistoryUnderUpdatePolygon } = useHistory();\n const { syncThreeViewsAttribute } = useAttribute();\n const { syncAllViewsConfig, reRenderTopViewRange } = useConfig();\n const { selectedPolygon } = usePolygon();\n const { t } = useTranslation();\n\n const keydownEvents = (lowerCaseKey: string, e: KeyboardEvent) => {\n const { topViewInstance, mainViewInstance } = ptCtx;\n if (!topViewInstance) {\n return;\n }\n\n const { pointCloud2dOperation: TopPointCloudPolygonOperation } = topViewInstance;\n\n switch (lowerCaseKey) {\n case 'q': {\n // Q - anticlockwise\n updateRotate(2);\n break;\n }\n\n case 'e':\n // E - closewise\n updateRotate(-2);\n\n break;\n\n case 'g':\n // G , overturn 180\n updateRotate(180);\n\n break;\n\n case 'u':\n {\n // U , change TopOpereation Pattern\n const newToolName =\n TopPointCloudPolygonOperation.pattern === EPolygonPattern.Normal\n ? EToolName.Rect\n : EToolName.Polygon;\n updatePointCloudPattern(newToolName);\n\n // Tips\n const POLYGON_PATTERN = {\n [EToolName.Polygon]: t('PolygonPattern'),\n [EToolName.Rect]: t('RectPattern'),\n };\n message.success(t('ChangePatternMsg', { pattern: POLYGON_PATTERN[newToolName] }));\n\n // Clear Status\n TopPointCloudPolygonOperation.clearActiveStatus();\n TopPointCloudPolygonOperation.clearDrawingStatus();\n }\n\n break;\n\n // +: Increase points size\n case '+':\n mainViewInstance?.updatePointSize(true);\n break;\n\n // -: Reduce points size\n case '-':\n mainViewInstance?.updatePointSize(false);\n break;\n\n case 'v':\n ptCtx.setPointCloudValid(!ptCtx.valid);\n break;\n\n case 'tab':\n if (e.shiftKey) {\n selectPrevBox();\n break;\n }\n selectNextBox();\n e.preventDefault();\n break;\n\n case 'f':\n changeSelectedBoxValid();\n break;\n\n case 'delete':\n deleteSelectedPointCloudBoxAndPolygon();\n break;\n\n default: {\n if (config.attributeList?.length > 0) {\n const keyCode2Attribute = AttributeUtils.getAttributeByKeycode(\n e.keyCode,\n config.attributeList,\n );\n\n if (keyCode2Attribute !== undefined) {\n toolInstanceRef.current.setDefaultAttribute(keyCode2Attribute);\n }\n }\n return;\n }\n }\n };\n\n const ctrlKeydownEvents = (lowerCaseKey: string, e: KeyboardEvent) => {\n switch (lowerCaseKey) {\n case 'c':\n copySelectedBoxes();\n break;\n case 'v':\n pasteSelectedBoxes();\n break;\n case 'a':\n ptCtx.selectedAllBoxes();\n break;\n case 'z': {\n if (e.shiftKey) {\n redo();\n } else {\n undo();\n }\n break;\n }\n\n default:\n break;\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (!CommonToolUtils.hotkeyFilter(e) || checkMode === true) {\n return;\n }\n\n const lowerCaseKey = e.key.toLocaleLowerCase();\n\n if (e.ctrlKey) {\n ctrlKeydownEvents(lowerCaseKey, e);\n return;\n }\n\n keydownEvents(lowerCaseKey, e);\n };\n\n useEffect(() => {\n const { topViewInstance } = ptCtx;\n if (!topViewInstance) {\n return;\n }\n\n window.addEventListener('keydown', onKeyDown);\n\n return () => {\n window.removeEventListener('keydown', onKeyDown);\n };\n }, [ptCtx, copiedBoxes, config, ptCtx.pointCloudBoxList, ptCtx.polygonList]);\n\n useEffect(() => {\n syncAllViewsConfig(config);\n }, [configString]);\n\n useEffect(() => {\n if (config?.radius) {\n reRenderTopViewRange(config?.radius);\n }\n }, [config?.radius]);\n\n // Page switch data initialization\n useEffect(() => {\n updatePointCloudData?.();\n }, [currentData, ptCtx.mainViewInstance]);\n\n // Update the listener of toolInstance.\n useEffect(() => {\n toolInstanceRef.current.exportData = () => {\n return [ptCtx.pointCloudBoxList, { valid: ptCtx.valid }];\n };\n\n toolInstanceRef.current.exportCustomData = () => {\n return {\n resultPolygon: ptCtx.polygonList ?? [],\n };\n };\n\n toolInstanceRef.current.setDefaultAttribute = (newAttribute: string) => {\n syncThreeViewsAttribute(newAttribute);\n const selectBox = ptCtx.selectedPointCloudBox;\n if (selectBox) {\n selectBox.attribute = newAttribute;\n\n const newPointCloudList = updateSelectedBox(selectBox);\n\n if (ptCtx.mainViewInstance) {\n // TODO: Poor performance.\n topViewSelectedChanged(selectBox, newPointCloudList);\n }\n }\n if (selectedPolygon) {\n pushHistoryUnderUpdatePolygon({ ...selectedPolygon, attribute: newAttribute });\n }\n };\n\n toolInstanceRef.current.setSubAttribute = (key: string, value: string) => {\n const selectBox = ptCtx.selectedPointCloudBox;\n if (selectBox) {\n const originSubAttribute = selectBox?.subAttribute ?? {};\n\n selectBox.subAttribute = {\n ...originSubAttribute,\n [key]: value,\n };\n\n updateSelectedBox(selectBox);\n }\n };\n toolInstanceRef.current.clearResult = () => {\n clearAllResult?.();\n };\n\n toolInstanceRef.current.redo = () => {\n redo();\n };\n\n toolInstanceRef.current.undo = () => {\n undo();\n };\n\n toolInstanceRef.current.setValid = (valid: boolean) => {\n toolInstanceRef.current.valid = valid;\n\n // Avoid triggering SetState operations in the reducer phase\n setTimeout(() => {\n ptCtx.setPointCloudValid(valid);\n\n if (valid === false) {\n clearAllResult();\n }\n });\n };\n\n /**\n * TopView forbid all operations.\n * @param forbidOperation\n */\n toolInstanceRef.current.setForbidOperation = (forbidOperation: boolean) => {\n ptCtx.topViewInstance?.pointCloud2dOperation?.setForbidOperation(forbidOperation);\n if (forbidOperation === true) {\n // Clear Selected Status.\n ptCtx.setSelectedIDs(undefined);\n }\n };\n\n toolInstanceRef.current.setShowDefaultCursor = (showDefaultCursor: boolean) => {\n ptCtx.topViewInstance?.pointCloud2dOperation?.setShowDefaultCursor(showDefaultCursor);\n };\n }, [\n ptCtx.pointCloudBoxList,\n ptCtx.selectedID,\n ptCtx.valid,\n ptCtx.polygonList,\n ptCtx.mainViewInstance,\n ]);\n\n useEffect(() => {\n toolInstanceRef.current.history = {\n // Origin Result\n pushHistory: (result: any[]) => {\n // Rewrite\n // TODO, The polygon is out of range.\n pushHistoryWithList({ pointCloudBoxList: result });\n },\n initRecord: () => {},\n };\n }, []);\n\n useEffect(() => {\n const toolInstance = ptCtx.topViewInstance?.pointCloud2dOperation;\n\n if (!toolInstance || checkMode) {\n return;\n }\n // TopViewOperation Emitter\n const syncAttribute = (newAttribute: string) => {\n syncThreeViewsAttribute(newAttribute);\n };\n\n const messageError = (error: string) => {\n message.error(error);\n };\n const messageInfo = (info: string) => {\n message.info(info);\n };\n\n toolInstance.on('syncAttribute', syncAttribute);\n toolInstance.on('messageError', messageError);\n toolInstance.on('messageInfo', messageInfo);\n\n return () => {\n toolInstance.unbind('syncAttribute', syncAttribute);\n toolInstance.unbind('messageError', messageError);\n toolInstance.unbind('messageInfo', messageInfo);\n };\n }, [ptCtx.topViewInstance]);\n\n return null;\n};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CAAA;AAAA,KAAA,CAAA;AAGf,IAAA,YAAA,CAAa,GAAG,eAAiB,EAAA,aAAA,CAAA,CAAA;AACjC,IAAA,YAAA,CAAa,GAAG,cAAgB,EAAA,YAAA,CAAA,CAAA;AAChC,IAAA,YAAA,CAAa,GAAG,aAAe,EAAA,WAAA,CAAA,CAAA;AAE/B,IAAA,OAAO,MAAM;AACX,MAAA,YAAA,CAAa,OAAO,eAAiB,EAAA,aAAA,CAAA,CAAA;AACrC,MAAA,YAAA,CAAa,OAAO,cAAgB,EAAA,YAAA,CAAA,CAAA;AACpC,MAAA,YAAA,CAAa,OAAO,aAAe,EAAA,WAAA,CAAA,CAAA;AAAA,KAAA,CAAA;AAAA,GAAA,EAEpC,CAAC,KAAM,CAAA,eAAA,CAAA,CAAA,CAAA;AAEV,EAAO,OAAA,IAAA,CAAA;AAAA,CAAA,CAAA;AAGT,2BAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAC/D,CAAA,CAAA,CAAA,kBAAA,CAAA;;;;"}
1
+ {"version":3,"file":"PointCloudListener.js","sources":["../../../src/components/pointCloudView/PointCloudListener.tsx"],"sourcesContent":["import { PointCloudContext } from './PointCloudContext';\nimport { useRotate } from './hooks/useRotate';\nimport { useBoxes } from './hooks/useBoxes';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport React, { useContext, useEffect } from 'react';\nimport { cTool, AttributeUtils, CommonToolUtils, EToolName } from '@labelbee/lb-annotation';\nimport { message } from 'antd';\nimport { connect } from 'react-redux';\nimport { a2MapStateToProps, IA2MapStateProps } from '@/store/annotation/map';\nimport { useCustomToolInstance } from '@/hooks/annotation';\nimport { useStatus } from './hooks/useStatus';\nimport { jsonParser } from '@/utils';\nimport { usePointCloudViews } from './hooks/usePointCloudViews';\nimport { LabelBeeContext } from '@/store/ctx';\nimport { useHistory } from './hooks/useHistory';\nimport { useAttribute } from './hooks/useAttribute';\nimport { useConfig } from './hooks/useConfig';\nimport { usePolygon } from './hooks/usePolygon';\nimport { useTranslation } from 'react-i18next';\n\nconst { EPolygonPattern } = cTool;\n\ninterface IProps extends IA2MapStateProps {\n checkMode?: boolean;\n}\n\nconst PointCloudListener: React.FC<IProps> = ({ currentData, config, checkMode, configString, imgIndex }) => {\n const ptCtx = useContext(PointCloudContext);\n const {\n changeSelectedBoxValid,\n selectNextBox,\n selectPrevBox,\n updateSelectedBox,\n deleteSelectedPointCloudBoxAndPolygon,\n } = useSingleBox();\n const { clearAllResult, updatePointCloudPattern } = useStatus();\n const basicInfo = jsonParser(currentData.result);\n const { copySelectedBoxes, pasteSelectedBoxes, copiedBoxes } = useBoxes({ config });\n const { toolInstanceRef } = useCustomToolInstance({ basicInfo });\n const { updateRotate } = useRotate({ currentData });\n const { updatePointCloudData, topViewSelectedChanged } = usePointCloudViews();\n const { redo, undo, pushHistoryWithList, pushHistoryUnderUpdatePolygon } = useHistory();\n const { syncThreeViewsAttribute } = useAttribute();\n const { syncAllViewsConfig, reRenderTopViewRange } = useConfig();\n const { selectedPolygon } = usePolygon();\n const { t } = useTranslation();\n\n const keydownEvents = (lowerCaseKey: string, e: KeyboardEvent) => {\n const { topViewInstance, mainViewInstance } = ptCtx;\n if (!topViewInstance) {\n return;\n }\n\n const { pointCloud2dOperation: TopPointCloudPolygonOperation } = topViewInstance;\n\n switch (lowerCaseKey) {\n case 'q': {\n // Q - anticlockwise\n updateRotate(2);\n break;\n }\n\n case 'e':\n // E - closewise\n updateRotate(-2);\n\n break;\n\n case 'g':\n // G , overturn 180\n updateRotate(180);\n\n break;\n\n case 'u':\n {\n // U , change TopOpereation Pattern\n const newToolName =\n TopPointCloudPolygonOperation.pattern === EPolygonPattern.Normal\n ? EToolName.Rect\n : EToolName.Polygon;\n updatePointCloudPattern(newToolName);\n\n // Tips\n const POLYGON_PATTERN = {\n [EToolName.Polygon]: t('PolygonPattern'),\n [EToolName.Rect]: t('RectPattern'),\n };\n message.success(t('ChangePatternMsg', { pattern: POLYGON_PATTERN[newToolName] }));\n\n // Clear Status\n TopPointCloudPolygonOperation.clearActiveStatus();\n TopPointCloudPolygonOperation.clearDrawingStatus();\n }\n\n break;\n\n // +: Increase points size\n case '+':\n mainViewInstance?.updatePointSize(true);\n break;\n\n // -: Reduce points size\n case '-':\n mainViewInstance?.updatePointSize(false);\n break;\n\n case 'v':\n ptCtx.setPointCloudValid(!ptCtx.valid);\n break;\n\n case 'tab':\n if (e.shiftKey) {\n selectPrevBox();\n break;\n }\n selectNextBox();\n e.preventDefault();\n break;\n\n case 'f':\n changeSelectedBoxValid();\n break;\n\n case 'delete':\n deleteSelectedPointCloudBoxAndPolygon();\n break;\n\n default: {\n if (config.attributeList?.length > 0) {\n const keyCode2Attribute = AttributeUtils.getAttributeByKeycode(\n e.keyCode,\n config.attributeList,\n );\n\n if (keyCode2Attribute !== undefined) {\n toolInstanceRef.current.setDefaultAttribute(keyCode2Attribute);\n }\n }\n return;\n }\n }\n };\n\n const ctrlKeydownEvents = (lowerCaseKey: string, e: KeyboardEvent) => {\n switch (lowerCaseKey) {\n case 'c':\n copySelectedBoxes();\n break;\n case 'v':\n pasteSelectedBoxes();\n break;\n case 'a':\n ptCtx.selectedAllBoxes();\n break;\n case 'z': {\n if (e.shiftKey) {\n redo();\n } else {\n undo();\n }\n break;\n }\n\n default:\n break;\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (!CommonToolUtils.hotkeyFilter(e) || checkMode === true) {\n return;\n }\n\n const lowerCaseKey = e.key.toLocaleLowerCase();\n\n if (e.ctrlKey) {\n ctrlKeydownEvents(lowerCaseKey, e);\n return;\n }\n\n keydownEvents(lowerCaseKey, e);\n };\n\n useEffect(() => {\n const { topViewInstance } = ptCtx;\n if (!topViewInstance) {\n return;\n }\n\n window.addEventListener('keydown', onKeyDown);\n\n return () => {\n window.removeEventListener('keydown', onKeyDown);\n };\n }, [ptCtx, copiedBoxes, config, ptCtx.pointCloudBoxList, ptCtx.polygonList]);\n\n useEffect(() => {\n syncAllViewsConfig(config);\n }, [configString]);\n\n useEffect(() => {\n if (config?.radius) {\n reRenderTopViewRange(config?.radius);\n }\n }, [config?.radius]);\n\n // Page switch data initialization\n useEffect(() => {\n updatePointCloudData?.();\n }, [imgIndex, ptCtx.mainViewInstance]);\n\n // Update the listener of toolInstance.\n useEffect(() => {\n toolInstanceRef.current.exportData = () => {\n return [ptCtx.pointCloudBoxList, { valid: ptCtx.valid }];\n };\n\n toolInstanceRef.current.exportCustomData = () => {\n return {\n resultPolygon: ptCtx.polygonList ?? [],\n };\n };\n\n toolInstanceRef.current.setDefaultAttribute = (newAttribute: string) => {\n syncThreeViewsAttribute(newAttribute);\n const selectBox = ptCtx.selectedPointCloudBox;\n if (selectBox) {\n selectBox.attribute = newAttribute;\n\n const newPointCloudList = updateSelectedBox(selectBox);\n\n if (ptCtx.mainViewInstance) {\n // TODO: Poor performance.\n topViewSelectedChanged(selectBox, newPointCloudList);\n }\n }\n if (selectedPolygon) {\n pushHistoryUnderUpdatePolygon({ ...selectedPolygon, attribute: newAttribute });\n }\n };\n\n toolInstanceRef.current.setSubAttribute = (key: string, value: string) => {\n const selectBox = ptCtx.selectedPointCloudBox;\n if (selectBox) {\n const originSubAttribute = selectBox?.subAttribute ?? {};\n\n selectBox.subAttribute = {\n ...originSubAttribute,\n [key]: value,\n };\n\n updateSelectedBox(selectBox);\n }\n };\n toolInstanceRef.current.clearResult = () => {\n clearAllResult?.();\n };\n\n toolInstanceRef.current.redo = () => {\n redo();\n };\n\n toolInstanceRef.current.undo = () => {\n undo();\n };\n\n toolInstanceRef.current.setValid = (valid: boolean) => {\n toolInstanceRef.current.valid = valid;\n\n // Avoid triggering SetState operations in the reducer phase\n setTimeout(() => {\n ptCtx.setPointCloudValid(valid);\n\n if (valid === false) {\n clearAllResult();\n }\n });\n };\n\n /**\n * TopView forbid all operations.\n * @param forbidOperation\n */\n toolInstanceRef.current.setForbidOperation = (forbidOperation: boolean) => {\n ptCtx.topViewInstance?.pointCloud2dOperation?.setForbidOperation(forbidOperation);\n if (forbidOperation === true) {\n // Clear Selected Status.\n ptCtx.setSelectedIDs(undefined);\n }\n };\n\n toolInstanceRef.current.setShowDefaultCursor = (showDefaultCursor: boolean) => {\n ptCtx.topViewInstance?.pointCloud2dOperation?.setShowDefaultCursor(showDefaultCursor);\n };\n }, [\n ptCtx.pointCloudBoxList,\n ptCtx.selectedID,\n ptCtx.valid,\n ptCtx.polygonList,\n ptCtx.mainViewInstance,\n ]);\n\n useEffect(() => {\n toolInstanceRef.current.history = {\n // Origin Result\n pushHistory: (result: any[]) => {\n // Rewrite\n // TODO, The polygon is out of range.\n pushHistoryWithList({ pointCloudBoxList: result });\n },\n initRecord: () => {},\n };\n }, []);\n\n useEffect(() => {\n const toolInstance = ptCtx.topViewInstance?.pointCloud2dOperation;\n\n if (!toolInstance || checkMode) {\n return;\n }\n // TopViewOperation Emitter\n const syncAttribute = (newAttribute: string) => {\n syncThreeViewsAttribute(newAttribute);\n };\n\n const messageError = (error: string) => {\n message.error(error);\n };\n const messageInfo = (info: string) => {\n message.info(info);\n };\n\n toolInstance.on('syncAttribute', syncAttribute);\n toolInstance.on('messageError', messageError);\n toolInstance.on('messageInfo', messageInfo);\n\n return () => {\n toolInstance.unbind('syncAttribute', syncAttribute);\n toolInstance.unbind('messageError', messageError);\n toolInstance.unbind('messageInfo', messageInfo);\n };\n }, [ptCtx.topViewInstance]);\n\n return null;\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(\n PointCloudListener,\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,CAAE,eAAoB,CAAA,GAAA,KAAA,CAAA;AAM5B,MAAM,qBAAuC,CAAC,CAAE,aAAa,MAAQ,EAAA,SAAA,EAAW,cAAc,QAAe,CAAA,KAAA;AAC3G,EAAA,MAAM,QAAQ,UAAW,CAAA,iBAAA,CAAA,CAAA;AACzB,EAAM,MAAA;AAAA,IACJ,sBAAA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A;AACpC,MAAA,YAAA,CAAa,OAAO,aAAe,EAAA,WAAA,CAAA,CAAA;AAAA,KAAA,CAAA;AAAA,GAAA,EAEpC,CAAC,KAAM,CAAA,eAAA,CAAA,CAAA,CAAA;AAEV,EAAO,OAAA,IAAA,CAAA;AAAA,CAAA,CAAA;AAGT,2BAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAC/D,CAAA,CAAA,CAAA,kBAAA,CAAA;;;;"}
@@ -1 +1 @@
1
- import a from"../../utils/StepUtils.js";import{jsonParser as p}from"../../utils/index.js";const c=t=>{var o,i,r;const{annotation:{imgList:s,imgIndex:l}}=t,e=(o=s[l])!=null?o:{},n=a.getCurrentStepInfo((i=t.annotation)==null?void 0:i.step,(r=t.annotation)==null?void 0:r.stepList);return{currentData:e,imgList:s,stepInfo:n,config:p(n==null?void 0:n.config),configString:n==null?void 0:n.config}};export{c as a2MapStateToProps};
1
+ import a from"../../utils/StepUtils.js";import{jsonParser as p}from"../../utils/index.js";const c=t=>{var o,i,r;const{annotation:{imgList:s,imgIndex:l}}=t,e=(o=s[l])!=null?o:{},n=a.getCurrentStepInfo((i=t.annotation)==null?void 0:i.step,(r=t.annotation)==null?void 0:r.stepList);return{currentData:e,imgIndex:l,imgList:s,stepInfo:n,config:p(n==null?void 0:n.config),configString:n==null?void 0:n.config}};export{c as a2MapStateToProps};
@@ -1 +1 @@
1
- {"version":3,"file":"map.js","sources":["../../../src/store/annotation/map.ts"],"sourcesContent":["/**\n * @file MapStateToProps set\n * @createdate 2022-07-19\n * @author Ron <ron.f.luo@gmail.com>\n */\nimport { AppState } from '../index';\nimport { IFileItem } from '@/types/data';\nimport StepUtils from '@/utils/StepUtils';\nimport { IStepInfo } from '@/types/step';\nimport { jsonParser } from '@/utils';\n\nexport const aMapStateToProps = (state: AppState) => {\n const {\n annotation: { imgList, imgIndex },\n } = state;\n const currentData = imgList[imgIndex] ?? {};\n\n return {\n currentData,\n };\n};\n\nexport interface IAnnotationStateProps {\n currentData: IFileItem;\n}\n\nexport interface IA2MapStateProps extends IAnnotationStateProps {\n imgList: IFileItem[];\n stepInfo: IStepInfo;\n config: any;\n configString: string; // Easy for users to listener.\n}\n\nexport const a2MapStateToProps = (state: AppState) => {\n const {\n annotation: { imgList, imgIndex },\n } = state;\n const currentData = imgList[imgIndex] ?? {};\n const stepInfo = StepUtils.getCurrentStepInfo(state.annotation?.step, state.annotation?.stepList);\n\n return {\n currentData,\n imgList,\n stepInfo,\n config: jsonParser(stepInfo?.config),\n configString: stepInfo?.config,\n };\n};\n"],"names":[],"mappings":";;;AAiCa,MAAA,iBAAA,GAAoB,CAAC,KAAoB,KAAA;AAjCtD,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAkCE,EAAM,MAAA;AAAA,IACJ,UAAA,EAAY,CAAE,OAAS,EAAA,QAAA,CAAA;AAAA,GACrB,GAAA,KAAA,CAAA;AACJ,EAAM,MAAA,WAAA,GAAc,CAAQ,EAAA,GAAA,OAAA,CAAA,QAAA,CAAA,KAAR,IAAqB,GAAA,EAAA,GAAA,EAAA,CAAA;AACzC,EAAM,MAAA,QAAA,GAAW,UAAU,kBAAmB,CAAA,CAAA,EAAA,GAAA,KAAA,CAAM,eAAN,IAAkB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,EAAM,CAAM,EAAA,GAAA,KAAA,CAAA,UAAA,KAAN,IAAkB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,QAAA,CAAA,CAAA;AAExF,EAAO,OAAA;AAAA,IACL,WAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,WAAW,QAAU,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,QAAA,CAAA,MAAA,CAAA;AAAA,IAC7B,cAAc,QAAU,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,QAAA,CAAA,MAAA;AAAA,GAAA,CAAA;AAAA;;;;"}
1
+ {"version":3,"file":"map.js","sources":["../../../src/store/annotation/map.ts"],"sourcesContent":["/**\n * @file MapStateToProps set\n * @createdate 2022-07-19\n * @author Ron <ron.f.luo@gmail.com>\n */\nimport { AppState } from '../index';\nimport { IFileItem } from '@/types/data';\nimport StepUtils from '@/utils/StepUtils';\nimport { IStepInfo } from '@/types/step';\nimport { jsonParser } from '@/utils';\n\nexport const aMapStateToProps = (state: AppState) => {\n const {\n annotation: { imgList, imgIndex },\n } = state;\n const currentData = imgList[imgIndex] ?? {};\n\n return {\n currentData,\n };\n};\n\nexport interface IAnnotationStateProps {\n currentData: IFileItem;\n}\n\nexport interface IA2MapStateProps extends IAnnotationStateProps {\n imgList: IFileItem[];\n stepInfo: IStepInfo;\n config: any;\n imgIndex: number;\n configString: string; // Easy for users to listener.\n}\n\nexport const a2MapStateToProps = (state: AppState) => {\n const {\n annotation: { imgList, imgIndex },\n } = state;\n const currentData = imgList[imgIndex] ?? {};\n const stepInfo = StepUtils.getCurrentStepInfo(state.annotation?.step, state.annotation?.stepList);\n\n return {\n currentData,\n imgIndex,\n imgList,\n stepInfo,\n config: jsonParser(stepInfo?.config),\n configString: stepInfo?.config,\n };\n};\n"],"names":[],"mappings":";;;AAkCa,MAAA,iBAAA,GAAoB,CAAC,KAAoB,KAAA;AAlCtD,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAmCE,EAAM,MAAA;AAAA,IACJ,UAAA,EAAY,CAAE,OAAS,EAAA,QAAA,CAAA;AAAA,GACrB,GAAA,KAAA,CAAA;AACJ,EAAM,MAAA,WAAA,GAAc,CAAQ,EAAA,GAAA,OAAA,CAAA,QAAA,CAAA,KAAR,IAAqB,GAAA,EAAA,GAAA,EAAA,CAAA;AACzC,EAAM,MAAA,QAAA,GAAW,UAAU,kBAAmB,CAAA,CAAA,EAAA,GAAA,KAAA,CAAM,eAAN,IAAkB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,EAAM,CAAM,EAAA,GAAA,KAAA,CAAA,UAAA,KAAN,IAAkB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,QAAA,CAAA,CAAA;AAExF,EAAO,OAAA;AAAA,IACL,WAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,WAAW,QAAU,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,QAAA,CAAA,MAAA,CAAA;AAAA,IAC7B,cAAc,QAAU,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,QAAA,CAAA,MAAA;AAAA,GAAA,CAAA;AAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.8.0-alpha.7",
3
+ "version": "1.8.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",
@@ -41,8 +41,8 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@ant-design/icons": "^4.6.2",
44
- "@labelbee/lb-annotation": "^1.12.0-alpha.7",
45
- "@labelbee/lb-utils": "^1.5.0-alpha.7",
44
+ "@labelbee/lb-annotation": "^1.12.0-alpha.8",
45
+ "@labelbee/lb-utils": "^1.5.0-alpha.8",
46
46
  "ahooks": "^3.4.0",
47
47
  "classnames": "^2.3.0",
48
48
  "lodash": "^4.17.21",
@@ -97,5 +97,5 @@
97
97
  "path": "node_modules/cz-conventional-changelog"
98
98
  }
99
99
  },
100
- "gitHead": "47a05462b795baaad6d5ec881545fe6499e63933"
100
+ "gitHead": "5b44e6b46d5a2550688e6d9daba52a82204ba9d0"
101
101
  }