@labelbee/lb-components 1.23.0-alpha.75 → 1.23.0-alpha.76
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 dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js"),_2DViewWorker=require("../../_virtual/2DViewWorker.js"),ahooks=require("ahooks");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:g,data:
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js"),_2DViewWorker=require("../../_virtual/2DViewWorker.js"),ahooks=require("ahooks");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:g,data:o,setIsEnlarge:u,setCurIndex:s,curIndex:c=0,index:f,annotations2d:d})=>g?React__default.default.createElement(index,{title:o==null?void 0:o.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{u(!1),s(void 0)}}),React__default.default.createElement("span",null,o==null?void 0:o.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},c+1,"/",d==null?void 0:d.length)):React__default.default.createElement(index,{title:o==null?void 0:o.calName,onClick:()=>{u(!0),s(f)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:g,thumbnailWidth:o,isEnlargeTopView:u,highlightAttribute:s,loadPCDFileLoading:c,checkMode:f,measureVisible:d})=>{var x;const[a,w]=React.useState([]),{topViewInstance:L,displayPointCloudList:C,polygonList:y,imageSizes:_,selectedIDs:h,windowKeydownListenerHook:v}=React.useContext(PointCloudContext.PointCloudContext),[q,F]=React.useState(""),[m,P]=React.useState(!1),[i,p]=React.useState(void 0),E=React.useCallback(t=>{P(t),lbAnnotation.EventBus.emit("2d-image:enlarge",t)},[]),r=React.useRef();React.useEffect(()=>{var t;if(!c&&L&&(e==null?void 0:e.mappingImgList)&&((t=e==null?void 0:e.mappingImgList)==null?void 0:t.length)>0)return r.current&&r.current.terminate(),r.current=new _2DViewWorker,r.current.onmessage=n=>{var l;const N=n.data;w(N),(l=r.current)==null||l.terminate()},r.current.postMessage({currentData:e,displayPointCloudList:C,selectedID:q,highlightAttribute:s,imageSizes:_,config:g,polygonList:y,selectedIDs:h}),()=>{var n;(n=r.current)==null||n.terminate()}},[C,e==null?void 0:e.mappingImgList,q,s,c,y,_,h]);const I=ahooks.useLatest(t=>{if(!m)return;const n=()=>{t.stopImmediatePropagation()};switch(t.keyCode){case EKeyCode.Esc:{E(!1);break}case EKeyCode.Left:{k();break}case EKeyCode.Right:{b();break}}n()}),k=()=>{i===void 0||!m||Number(i)>0&&p(i-1)},b=()=>{i===void 0||!m||Number(i)<(a==null?void 0:a.length)-1&&p(i+1)};React.useEffect(()=>{const t=l=>I.current(l);return v.preappendEventListener(t)},[v,v.preappendEventListener]);const j=!e||!(e==null?void 0:e.mappingImgList)||!(((x=e==null?void 0:e.mappingImgList)==null?void 0:x.length)>0),S=React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},React__default.default.createElement("img",{src:icon_left_squareOutlined,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>k()}),React__default.default.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("img",{src:icon_right_squareOutlined,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>b()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{E(!1),p(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(a==null?void 0:a.length)>0?React__default.default.createElement(React__default.default.Fragment,null,a.map((t,n)=>{const l=m&&n===i;return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-2d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:l}),title:React__default.default.createElement(ContainerTitle,{showEnlarge:l,isEnlargeTopView:u,data:t,setIsEnlarge:E,setCurIndex:p,curIndex:i,index:n,annotations2d:a}),titleOnSurface:!l,style:{display:j?"none":"flex",width:l?"100%":o},key:n,toolbar:S},(t==null?void 0:t.annotations)&&(t==null?void 0:t.url)&&React__default.default.createElement(PointCloud2DSingleView,{key:t.url,currentData:e,view2dData:t,setSelectedID:F,showEnlarge:l,checkMode:f,measureVisible:d}))})):null};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as _}from"../../utils/dom.js";import t,{useState as
|
|
1
|
+
import{getClassName as _}from"../../utils/dom.js";import t,{useState as f,useContext as z,useCallback as $,useRef as q,useEffect as j}from"react";import{PointCloudContainer as D}from"./PointCloudLayout.js";import{PointCloudContext as M}from"./PointCloudContext.js";import{connect as W}from"react-redux";import{cKeyCode as H,EventBus as G}from"@labelbee/lb-annotation";import{LabelBeeContext as J}from"../../store/ctx.js";import{a2MapStateToProps as Q}from"../../store/annotation/map.js";import U from"./PointCloud2DSingleView.js";import S from"./components/TitleButton/index.js";import{LeftOutlined as X}from"@ant-design/icons";import Y from"classnames";import Z from"../../assets/annotation/common/icon_esc.svg.js";import ee from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import te from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";import ne from"../../_virtual/2DViewWorker.js";import{useLatest as oe}from"ahooks";const C=H.default,ie=({showEnlarge:n,isEnlargeTopView:v,data:l,setIsEnlarge:c,setCurIndex:m,curIndex:u=0,index:E,annotations2d:p})=>v?t.createElement(S,{title:l==null?void 0:l.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):n?t.createElement("div",{style:{display:"flex",alignItems:"center"}},t.createElement(X,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{c(!1),m(void 0)}}),t.createElement("span",null,l==null?void 0:l.calName),t.createElement("span",{style:{marginLeft:"8px"}},u+1,"/",p==null?void 0:p.length)):t.createElement(S,{title:l==null?void 0:l.calName,onClick:()=>{c(!0),m(E)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),le=({currentData:n,config:v,thumbnailWidth:l,isEnlargeTopView:c,highlightAttribute:m,loadPCDFileLoading:u,checkMode:E,measureVisible:p})=>{var h;const[a,N]=f([]),{topViewInstance:R,displayPointCloudList:k,polygonList:w,imageSizes:F,selectedIDs:b,windowKeydownListenerHook:x}=z(M),[L,A]=f(""),[d,V]=f(!1),[r,g]=f(void 0),y=$(e=>{V(e),G.emit("2d-image:enlarge",e)},[]),s=q();j(()=>{var e;if(!u&&R&&(n==null?void 0:n.mappingImgList)&&((e=n==null?void 0:n.mappingImgList)==null?void 0:e.length)>0)return s.current&&s.current.terminate(),s.current=new ne,s.current.onmessage=o=>{var i;const O=o.data;N(O),(i=s.current)==null||i.terminate()},s.current.postMessage({currentData:n,displayPointCloudList:k,selectedID:L,highlightAttribute:m,imageSizes:F,config:v,polygonList:w,selectedIDs:b}),()=>{var o;(o=s.current)==null||o.terminate()}},[k,n==null?void 0:n.mappingImgList,L,m,u,w,F,b]);const T=oe(e=>{if(!d)return;const o=()=>{e.stopImmediatePropagation()};switch(e.keyCode){case C.Esc:{y(!1);break}case C.Left:{I();break}case C.Right:{P();break}}o()}),I=()=>{r===void 0||!d||Number(r)>0&&g(r-1)},P=()=>{r===void 0||!d||Number(r)<(a==null?void 0:a.length)-1&&g(r+1)};j(()=>{const e=i=>T.current(i);return x.preappendEventListener(e)},[x,x.preappendEventListener]);const B=!n||!(n==null?void 0:n.mappingImgList)||!(((h=n==null?void 0:n.mappingImgList)==null?void 0:h.length)>0),K=t.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},t.createElement("img",{src:ee,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>I()}),t.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),t.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),t.createElement("img",{src:te,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>P()}),t.createElement("img",{src:Z,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{y(!1),g(void 0)}}),t.createElement("span",null,"\u952E\u9000\u51FA"));return(a==null?void 0:a.length)>0?t.createElement(t.Fragment,null,a.map((e,o)=>{const i=d&&o===r;return t.createElement(D,{className:Y({[_("point-cloud-2d-container")]:!0,[_("point-cloud-container","zoom")]:i}),title:t.createElement(ie,{showEnlarge:i,isEnlargeTopView:c,data:e,setIsEnlarge:y,setCurIndex:g,curIndex:r,index:o,annotations2d:a}),titleOnSurface:!i,style:{display:B?"none":"flex",width:i?"100%":l},key:o,toolbar:K},(e==null?void 0:e.annotations)&&(e==null?void 0:e.url)&&t.createElement(U,{key:e.url,currentData:n,view2dData:e,setSelectedID:A,showEnlarge:i,checkMode:E,measureVisible:p}))})):null};var re=W(Q,null,null,{context:J})(le);export{re as default};
|