@labelbee/lb-components 1.23.0-alpha.136 → 1.23.0-alpha.138
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/AnnotationView/hooks/useFilterAnnotations.js +1 -0
- package/dist/components/AnnotationView/index.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
- package/dist/types/components/AnnotationView/hooks/useFilterAnnotations.d.ts +2 -0
- package/dist/types/components/AnnotationView/index.d.ts +2 -0
- package/es/_virtual/2DViewWorker.js +1 -1
- package/es/components/AnnotationView/hooks/useFilterAnnotations.js +1 -0
- package/es/components/AnnotationView/index.js +1 -1
- package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var React=require("react");const useFilterAnnotations=(t=[],r,n)=>React.useMemo(()=>n&&(r==null?void 0:r.length)?t.filter(u=>r.includes(u.annotation.id)):t,[t,r,n]);module.exports=useFilterAnnotations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),es=require("antd/es"),useRefCache=require("../../hooks/useRefCache.js"),index=require("../measureCanvas/index.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,o)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,__spreadValues=(e,r)=>{for(var o in r||(r={}))__hasOwnProp.call(r,o)&&__defNormalProp(e,o,r[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(r))__propIsEnum.call(r,o)&&__defNormalProp(e,o,r[o]);return e},__async=(e,r,o)=>new Promise((
|
|
1
|
+
"use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),es=require("antd/es"),useRefCache=require("../../hooks/useRefCache.js"),index$1=require("../measureCanvas/index.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),useFilterAnnotations=require("./hooks/useFilterAnnotations.js"),index=require("../../store/toolConfig/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,o)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,__spreadValues=(e,r)=>{for(var o in r||(r={}))__hasOwnProp.call(r,o)&&__defNormalProp(e,o,r[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(r))__propIsEnum.call(r,o)&&__defNormalProp(e,o,r[o]);return e},__async=(e,r,o)=>new Promise((h,s)=>{var c=u=>{try{d(o.next(u))}catch(f){s(f)}},p=u=>{try{d(o.throw(u))}catch(f){s(f)}},d=u=>u.done?h(u.value):Promise.resolve(u.value).then(c,p);d((o=o.apply(e,r)).next())});const DEFAULT_SIZE={width:455,height:100},sizeInitialized=e=>{if(!e)return DEFAULT_SIZE;if(e.width&&e.height)return e;const r=__spreadValues({},e);return r.width||(r.width=DEFAULT_SIZE.width),r.height||(r.height=DEFAULT_SIZE.height),r},AnnotationView=(e,r)=>{var o,h;const{src:s,fallbackSrc:c,annotations:p=[],style:d={stroke:"blue",thickness:3},zoomChange:u,backgroundStyle:f={},onChange:y,showLoading:A=!1,globalStyle:k,afterImgOnLoad:L,measureVisible:w,onRightClick:g,pointCloudBoxList:P=[],hiddenText:R=!1,renderToolName:j}=e,m=sizeInitialized(e.size),[q,x]=React.useState(!1),I=React.useRef(null),t=React.useRef(),S=useRefCache(L),v=React.useRef([]),_=React.useRef(!0),{selectedIDs:V}=React.useContext(PointCloudContext.PointCloudContext),{selectBoxVisibleSwitch:D}=index(),b=useFilterAnnotations(p,V,D);React.useImperativeHandle(r,()=>{const n=t.current;return n?{zoomIn:()=>n.zoomChanged(!0),zoomOut:()=>n.zoomChanged(!1),initImgPos:()=>n.initImgPos(),toolInstance:n}:{}},[t.current]),React.useEffect(()=>(I.current&&(t.current=new lbAnnotation.ViewOperation({container:I.current,size:m,style:d,annotations:b,config:"{}",zoomInfo:e.zoomInfo,staticMode:e.staticMode,renderToolName:j}),t.current.init(),g&&t.current.on("onRightClick",g)),()=>{var n,a;g&&((n=t.current)==null||n.unbind("onRightClick",g)),(a=t.current)==null||a.destroy()}),[w]);const E=React.useCallback(n=>__async(void 0,null,function*(){var a,i;try{const l=yield lbAnnotation.ImgUtils.load(n);return(a=t.current)==null||a.setImgNode(l),(i=S.current)==null||i.call(S,l),null}catch(l){return console.error("Error loading image:",l),l}}),[]),z=React.useCallback(n=>__async(void 0,null,function*(){var a,i;if(x(!0),(a=t.current)==null||a.setLoading(!0),(yield E(n))&&c){const C=yield E(c);C&&console.error("Error loading fallback image:",C)}(i=t.current)==null||i.setLoading(!1),x(!1)}),[E,c]);React.useEffect(()=>{t.current&&z(s)},[s,w,c,z]),React.useEffect(()=>{(t==null?void 0:t.current)&&t.current.setPointCloudBoxList(P)},[P]),React.useEffect(()=>{var n;(t==null?void 0:t.current)&&((n=t.current)==null||n.setHiddenText(R))},[R]),React.useEffect(()=>{if(_.current===!1){v.current.push(b);return}const n=()=>{_.current=!0,v.current=[]},a=()=>{var i;const l=v.current.length;if(l>0){const C=v.current[l-1];v.current=[],(i=t.current)==null||i.updateData(C).then(a).catch(n)}else _.current=!0};t.current&&(_.current=!1,t.current.updateData(b).then(a).catch(n))},[b]),React.useEffect(()=>{const n=t.current;(n==null?void 0:n.setSize)&&(n.setSize(m),n.initPosition())},[(o=e.size)==null?void 0:o.width,(h=e.size)==null?void 0:h.height]),React.useEffect(()=>{var n,a;return t.current&&((n=t.current)==null||n.on("onChange",(...i)=>{y==null||y.apply(null,i)}),(a=t.current)==null||a.on("renderZoom",i=>{u&&u(i)})),()=>{var i,l;(i=t.current)==null||i.unbindAll("onChange"),(l=t.current)==null||l.unbindAll("renderZoom")}},[u,y]);const N=React__default.default.createElement("div",{ref:I,style:__spreadValues(__spreadValues({position:"relative"},m),f)}),{imgNode:O,zoom:T,currentPos:B}=t.current||{};return React__default.default.createElement(es.Spin,{spinning:A||q,delay:300,style:k},w&&O?React__default.default.createElement(index$1,{size:m,imgNode:O,zoom:T,currentPos:B}):N)};var AnnotationView$1=React__default.default.forwardRef(AnnotationView);module.exports=AnnotationView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),index=require("../AnnotationView/index.js"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),useHighlight=require("./hooks/useHighlight.js"),index$2=require("./components/HighlightVisible/index.js"),PointCloudContext=require("./PointCloudContext.js"),useDataLinkSwitch=require("./hooks/useDataLinkSwitch.js"),index$1=require("../pointCloud2DRectOperationView/index.js"),useToolStyle=require("../../hooks/useToolStyle.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,u,i)=>new Promise((s,a)=>{var h=t=>{try{l(i.next(t))}catch(o){a(o)}},c=t=>{try{l(i.throw(t))}catch(o){a(o)}},l=t=>t.done?s(t.value):Promise.resolve(t.value).then(h,c);l((i=i.apply(e,u)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:u,currentData:i,showEnlarge:s,checkMode:a=!1,measureVisible:h})=>{var c,l;const t=React.useRef(null),o=React.useRef(),{selectedBox:d}=useSingleBox.useSingleBox(),
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),index=require("../AnnotationView/index.js"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHighlight=require("./hooks/useHighlight.js"),index$2=require("./components/HighlightVisible/index.js"),PointCloudContext=require("./PointCloudContext.js"),useDataLinkSwitch=require("./hooks/useDataLinkSwitch.js"),index$1=require("../pointCloud2DRectOperationView/index.js"),useToolStyle=require("../../hooks/useToolStyle.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,u,i)=>new Promise((s,a)=>{var h=t=>{try{l(i.next(t))}catch(o){a(o)}},c=t=>{try{l(i.throw(t))}catch(o){a(o)}},l=t=>t.done?s(t.value):Promise.resolve(t.value).then(h,c);l((i=i.apply(e,u)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:u,currentData:i,showEnlarge:s,checkMode:a=!1,measureVisible:h})=>{var c,l;const t=React.useRef(null),o=React.useRef(),{selectedBox:d}=useSingleBox.useSingleBox(),m=useSize(t),{url:x,fallbackUrl:p,calib:b,path:q}=e,{toggle2dVisible:P,isHighlightVisible:j}=useHighlight.useHighlight({currentData:i}),[B,v]=React.useState(!1),{highlight2DLoading:_,setHighlight2DLoading:C,cuboidBoxIn2DView:f,cacheImageNodeSize:I,setSelectedIDs:R,pointCloudBoxList:V}=React.useContext(PointCloudContext.PointCloudContext),{value:z}=useToolStyle.useToolStyleContext(),{hiddenText:N}=z||{},E=!e,H=React.useMemo(()=>({zIndex:s?-1:101,is2DView:!f,imageName:e.path}),[s,f,e.path]),{rendered:O,isLinking:T}=useDataLinkSwitch(H),k=n=>{g(),I({path:q,imgNode:n})},g=React.useCallback(()=>{var n,S;const y=(n=o.current)==null?void 0:n.toolInstance;if(u(""),!d||!y)return;const r=e.annotations.find(A=>A.annotation.id===d.info.id);let L="";r&&((S=r==null?void 0:r.annotation.pointList)==null?void 0:S.length)>0&&(y.focusPositionByPointList(r==null?void 0:r.annotation.pointList),L=d.info.id,u(L))},[d,o.current,e.annotations]);React.useEffect(()=>{g()},[g]);const U=()=>__async(void 0,null,function*(){v(!0),C(!0);try{yield P(x,p!=null?p:"",b)}catch(n){console.error("highlightOnClick error:",n)}finally{v(!1),C(!1)}});return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:t},f?React__default.default.createElement(index,{src:(c=e==null?void 0:e.url)!=null?c:"",fallbackSrc:(l=e==null?void 0:e.fallbackUrl)!=null?l:"",annotations:e.annotations,size:m,ref:o,globalStyle:{display:E?"none":"block"},afterImgOnLoad:k,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:h,onRightClick:({targetId:n})=>R(n),pointCloudBoxList:V,hiddenText:N,renderToolName:lbAnnotation.EPointCloudName.PointCloud}):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{shouldExcludePointCloudBoxListUpdate:!T,mappingData:e,size:m,checkMode:a,afterImgOnLoad:k}),!a&&O),b&&React__default.default.createElement(index$2,{visible:j(x),onClick:U,loading:B,disabled:_,style:{position:"absolute",right:16,top:16,zIndex:s?-1:101}}))};module.exports=PointCloud2DSingleView;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @author laoluo
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import { EPointCloudName } from '@labelbee/lb-annotation';
|
|
6
7
|
import { IPointCloudBoxList } from '@labelbee/lb-utils';
|
|
7
8
|
export type TAfterImgOnLoad = (img: HTMLImageElement) => void;
|
|
8
9
|
interface IProps {
|
|
@@ -37,6 +38,7 @@ interface IProps {
|
|
|
37
38
|
}) => void;
|
|
38
39
|
pointCloudBoxList?: IPointCloudBoxList;
|
|
39
40
|
hiddenText?: boolean;
|
|
41
|
+
renderToolName?: EPointCloudName.PointCloud | undefined;
|
|
40
42
|
}
|
|
41
43
|
declare const _default: React.ForwardRefExoticComponent<IProps & React.RefAttributes<unknown>>;
|
|
42
44
|
export default _default;
|