@labelbee/lb-components 1.23.0-alpha.12 → 1.23.0-alpha.121
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/App.js +1 -1
- package/dist/_virtual/2DViewWorker.js +1 -0
- package/dist/_virtual/highlightSegmentWorker.js +1 -1
- package/dist/assets/annotation/icon_link.svg.js +1 -0
- package/dist/assets/annotation/icon_unlink.svg.js +1 -0
- package/dist/assets/annotation/pointCloudTool/Image2DBoxScale.svg.js +1 -0
- package/dist/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
- package/dist/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
- package/dist/assets/annotation/pointCloudTool/rotate90_black.svg.js +1 -0
- package/dist/assets/icons/ad33251.svg +26 -0
- package/dist/components/AnnotationView/index.js +1 -1
- package/dist/components/DynamicResizer/DynamicResizer.js +1 -0
- package/dist/components/DynamicResizer/assets/bottomToZero.svg.js +1 -0
- package/dist/components/DynamicResizer/assets/divider.svg.js +1 -0
- package/dist/components/DynamicResizer/assets/topToZero.svg.js +1 -0
- package/dist/components/DynamicResizer/hooks/useDrag.js +1 -0
- package/dist/components/DynamicResizer/hooks/useUpdateHeight.js +1 -0
- package/dist/components/DynamicResizer/index.js +1 -0
- package/dist/components/LLMToolView/index.js +1 -1
- package/dist/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/dist/components/LLMToolView/questionView/components/imgView/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/dist/components/LLMToolView/sidebar/index.js +1 -1
- package/dist/components/LLMToolView/utils/data.js +1 -1
- package/dist/components/audioAnnotate/audioContext/index.js +1 -1
- package/dist/components/audioAnnotate/audioSide/clipSidebar/index.js +2 -1
- package/dist/components/audioAnnotate/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -1
- package/dist/components/audioAnnotate/utils/dataTransform.js +1 -0
- package/dist/components/audioPlayer/clipRegion/index.js +1 -1
- package/dist/components/audioPlayer/index.js +1 -1
- package/dist/components/audioPlayer/useAudioCombine/index.js +3 -2
- package/dist/components/audioPlayer/useAudioScroll/index.js +1 -1
- package/dist/components/audioPlayer/useAudioSegment/index.js +1 -1
- package/dist/components/audioPlayer/zoomSlider/index.js +1 -1
- package/dist/components/longText/index.js +1 -1
- package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
- package/dist/components/pointCloud2DRectOperationView/useUpdateRectList.js +1 -0
- package/dist/components/pointCloud2DRectOperationView/util.js +1 -0
- package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
- package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudBackView.js +1 -1
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/PointCloudInfos.js +1 -1
- package/dist/components/pointCloudView/PointCloudLayout.js +1 -1
- package/dist/components/pointCloudView/PointCloudListener.js +1 -1
- package/dist/components/pointCloudView/PointCloudSegment2DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudSegmentListener.js +1 -1
- package/dist/components/pointCloudView/PointCloudSideView.js +1 -1
- package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
- package/dist/components/pointCloudView/components/HighlightVisible/index.js +1 -1
- package/dist/components/pointCloudView/hooks/useBoxes.js +1 -1
- package/dist/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
- package/dist/components/pointCloudView/hooks/useHighlight.js +1 -1
- package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/components/pointCloudView/hooks/usePolygon.js +1 -1
- package/dist/components/pointCloudView/hooks/useRotate.js +1 -1
- package/dist/components/pointCloudView/hooks/useRotateEdge.js +1 -0
- package/dist/components/pointCloudView/hooks/useSingleBox.js +1 -1
- package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
- package/dist/components/pointCloudView/hooks/useTimeoutFunc.js +1 -0
- package/dist/components/pointCloudView/hooks/useWindowKeydownListener.js +1 -0
- package/dist/components/pointCloudView/index.js +1 -1
- package/dist/components/pointCloudView/utils/event-polyfill.js +1 -0
- package/dist/components/pointCloudView/utils/map.js +1 -0
- package/dist/components/predictTracking/predictTrackingIcon/index.js +1 -1
- package/dist/components/predictTracking/previewResult/index.js +1 -1
- package/dist/components/subAttributeList/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/index.js +1 -1
- package/dist/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
- package/dist/hooks/useToolStyle.js +1 -0
- package/dist/index.css +161 -12
- package/dist/index.js +1 -1
- package/dist/store/Actions.js +1 -1
- package/dist/store/annotatedBox/index.js +1 -1
- package/dist/store/annotation/actionCreators.js +1 -1
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/store/toolConfig/baseToolConfig.js +1 -0
- package/dist/store/toolConfig/index.js +1 -0
- package/dist/store/toolConfig/pointCloudToolConfig.js +1 -0
- package/dist/types/App.d.ts +6 -1
- package/dist/types/components/AnnotationView/index.d.ts +8 -0
- package/dist/types/components/DynamicResizer/DynamicResizer.d.ts +5 -0
- package/dist/types/components/DynamicResizer/hooks/useDrag.d.ts +12 -0
- package/dist/types/components/DynamicResizer/hooks/useUpdateHeight.d.ts +23 -0
- package/dist/types/components/DynamicResizer/index.d.ts +2 -0
- package/dist/types/components/DynamicResizer/types/interface.d.ts +17 -0
- package/dist/types/components/LLMToolView/utils/data.d.ts +1 -1
- package/dist/types/components/audioAnnotate/audioContext/index.d.ts +10 -2
- package/dist/types/components/audioAnnotate/textInput/index.d.ts +1 -0
- package/dist/types/components/audioAnnotate/utils/dataTransform.d.ts +9 -0
- package/dist/types/components/audioPlayer/clipRegion/index.d.ts +1 -0
- package/dist/types/components/audioPlayer/index.d.ts +28 -21
- package/dist/types/components/audioPlayer/zoomSlider/index.d.ts +1 -0
- package/dist/types/components/longText/index.d.ts +1 -0
- package/dist/types/components/pointCloud2DRectOperationView/index.d.ts +1 -0
- package/dist/types/components/pointCloud2DRectOperationView/useUpdateRectList.d.ts +2 -0
- package/dist/types/components/pointCloud2DRectOperationView/util.d.ts +8 -0
- package/dist/types/components/pointCloudView/2DViewWorker.d.ts +1 -0
- package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +2 -1
- package/dist/types/components/pointCloudView/PointCloudContext.d.ts +28 -4
- package/dist/types/components/pointCloudView/PointCloudLayout.d.ts +1 -0
- package/dist/types/components/pointCloudView/PointCloudListener.d.ts +1 -0
- package/dist/types/components/pointCloudView/components/HighlightVisible/index.d.ts +2 -1
- package/dist/types/components/pointCloudView/hooks/useBoxes.d.ts +5 -3
- package/dist/types/components/pointCloudView/hooks/useDataLinkSwitch.d.ts +19 -0
- package/dist/types/components/pointCloudView/hooks/useHighlight.d.ts +1 -1
- package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +13 -1
- package/dist/types/components/pointCloudView/hooks/useRotateEdge.d.ts +9 -0
- package/dist/types/components/pointCloudView/hooks/useSingleBox.d.ts +3 -2
- package/dist/types/components/pointCloudView/hooks/useTimeoutFunc.d.ts +6 -0
- package/dist/types/components/pointCloudView/hooks/useWindowKeydownListener.d.ts +16 -0
- package/dist/types/components/pointCloudView/index.d.ts +1 -0
- package/dist/types/components/pointCloudView/utils/event-polyfill.d.ts +8 -0
- package/dist/types/components/pointCloudView/utils/map.d.ts +11 -0
- package/dist/types/components/subAttributeList/index.d.ts +10 -0
- package/dist/types/components/videoAnnotate/index.d.ts +2 -1
- package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +2 -1
- package/dist/types/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.d.ts +1 -1
- package/dist/types/hooks/useToolStyle.d.ts +30 -0
- package/dist/types/index.d.ts +8 -2
- package/dist/types/store/Actions.d.ts +1 -0
- package/dist/types/store/annotatedBox/index.d.ts +2 -0
- package/dist/types/store/annotation/actionCreators.d.ts +4 -3
- package/dist/types/store/annotation/reducer.d.ts +1 -0
- package/dist/types/store/annotation/types.d.ts +9 -2
- package/dist/types/store/toolConfig/baseToolConfig.d.ts +4 -0
- package/dist/types/store/toolConfig/index.d.ts +3 -0
- package/dist/types/store/toolConfig/pointCloudToolConfig.d.ts +4 -0
- package/dist/types/store/toolConfig/types.d.ts +10 -0
- package/dist/types/utils/AnnotationDataUtils.d.ts +58 -1
- package/dist/types/utils/ToolPointCloudBoxRenderHelper.d.ts +23 -0
- package/dist/types/utils/index.d.ts +31 -1
- package/dist/types/views/MainView/sidebar/GeneralOperation/ActionsConfirm.d.ts +1 -0
- package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.d.ts +3 -0
- package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.d.ts +3 -0
- package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.d.ts +3 -0
- package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +1 -1
- package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.d.ts +9 -0
- package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.d.ts +3 -0
- package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/index.d.ts +1 -0
- package/dist/types/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.d.ts +10 -2
- package/dist/types/views/MainView/toolFooter/index.d.ts +1 -1
- package/dist/types/views/MainView/toolHeader/StepSwitch/index.d.ts +1 -1
- package/dist/types/views/MainView/toolHeader/index.d.ts +1 -1
- package/dist/utils/AnnotationDataUtils.js +1 -1
- package/dist/utils/ToolPointCloudBoxRenderHelper.js +1 -0
- package/dist/utils/index.js +1 -1
- package/dist/views/MainView/index.js +1 -1
- package/dist/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.js +1 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.module.scss.js +1 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js +1 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.module.scss.js +1 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.js +1 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.module.scss.js +1 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/TagSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
- package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
- package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.js +1 -0
- package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
- package/dist/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
- package/dist/views/MainView/toolFooter/index.js +1 -1
- package/dist/views/MainView/toolHeader/index.js +1 -1
- package/es/App.js +1 -1
- package/es/_virtual/2DViewWorker.js +1 -0
- package/es/_virtual/highlightSegmentWorker.js +1 -1
- package/es/assets/annotation/icon_link.svg.js +1 -0
- package/es/assets/annotation/icon_unlink.svg.js +1 -0
- package/es/assets/annotation/pointCloudTool/Image2DBoxScale.svg.js +1 -0
- package/es/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
- package/es/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
- package/es/assets/annotation/pointCloudTool/rotate90_black.svg.js +1 -0
- package/es/components/AnnotationView/index.js +1 -1
- package/es/components/DynamicResizer/DynamicResizer.js +1 -0
- package/es/components/DynamicResizer/assets/bottomToZero.svg.js +1 -0
- package/es/components/DynamicResizer/assets/divider.svg.js +1 -0
- package/es/components/DynamicResizer/assets/topToZero.svg.js +1 -0
- package/es/components/DynamicResizer/hooks/useDrag.js +1 -0
- package/es/components/DynamicResizer/hooks/useUpdateHeight.js +1 -0
- package/es/components/DynamicResizer/index.js +1 -0
- package/es/components/LLMToolView/index.js +1 -1
- package/es/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/es/components/LLMToolView/questionView/components/imgView/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
- package/es/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
- package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/es/components/LLMToolView/sidebar/index.js +1 -1
- package/es/components/LLMToolView/utils/data.js +1 -1
- package/es/components/audioAnnotate/audioContext/index.js +1 -1
- package/es/components/audioAnnotate/audioSide/clipSidebar/index.js +2 -1
- package/es/components/audioAnnotate/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -1
- package/es/components/audioAnnotate/utils/dataTransform.js +1 -0
- package/es/components/audioPlayer/clipRegion/index.js +1 -1
- package/es/components/audioPlayer/index.js +1 -1
- package/es/components/audioPlayer/useAudioCombine/index.js +3 -2
- package/es/components/audioPlayer/useAudioScroll/index.js +1 -1
- package/es/components/audioPlayer/useAudioSegment/index.js +1 -1
- package/es/components/audioPlayer/zoomSlider/index.js +1 -1
- package/es/components/longText/index.js +1 -1
- package/es/components/pointCloud2DRectOperationView/index.js +1 -1
- package/es/components/pointCloud2DRectOperationView/useUpdateRectList.js +1 -0
- package/es/components/pointCloud2DRectOperationView/util.js +1 -0
- package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
- package/es/components/pointCloudView/PointCloud2DView.js +1 -1
- package/es/components/pointCloudView/PointCloud3DView.js +1 -1
- package/es/components/pointCloudView/PointCloudBackView.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/PointCloudInfos.js +1 -1
- package/es/components/pointCloudView/PointCloudLayout.js +1 -1
- package/es/components/pointCloudView/PointCloudListener.js +1 -1
- package/es/components/pointCloudView/PointCloudSegment2DView.js +1 -1
- package/es/components/pointCloudView/PointCloudSegmentListener.js +1 -1
- package/es/components/pointCloudView/PointCloudSideView.js +1 -1
- package/es/components/pointCloudView/PointCloudTopView.js +1 -1
- package/es/components/pointCloudView/components/HighlightVisible/index.js +1 -1
- package/es/components/pointCloudView/hooks/useBoxes.js +1 -1
- package/es/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
- package/es/components/pointCloudView/hooks/useHighlight.js +1 -1
- package/es/components/pointCloudView/hooks/useHistory.js +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/components/pointCloudView/hooks/usePolygon.js +1 -1
- package/es/components/pointCloudView/hooks/useRotate.js +1 -1
- package/es/components/pointCloudView/hooks/useRotateEdge.js +1 -0
- package/es/components/pointCloudView/hooks/useSingleBox.js +1 -1
- package/es/components/pointCloudView/hooks/useStatus.js +1 -1
- package/es/components/pointCloudView/hooks/useTimeoutFunc.js +1 -0
- package/es/components/pointCloudView/hooks/useWindowKeydownListener.js +1 -0
- package/es/components/pointCloudView/index.js +1 -1
- package/es/components/pointCloudView/utils/event-polyfill.js +1 -0
- package/es/components/pointCloudView/utils/map.js +1 -0
- package/es/components/predictTracking/predictTrackingIcon/index.js +1 -1
- package/es/components/predictTracking/previewResult/index.js +1 -1
- package/es/components/subAttributeList/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/index.js +1 -1
- package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
- package/es/hooks/useToolStyle.js +1 -0
- package/es/index.css +161 -12
- package/es/index.js +1 -1
- package/es/store/Actions.js +1 -1
- package/es/store/annotatedBox/index.js +1 -1
- package/es/store/annotation/actionCreators.js +1 -1
- package/es/store/annotation/reducer.js +1 -1
- package/es/store/toolConfig/baseToolConfig.js +1 -0
- package/es/store/toolConfig/index.js +1 -0
- package/es/store/toolConfig/pointCloudToolConfig.js +1 -0
- package/es/utils/AnnotationDataUtils.js +1 -1
- package/es/utils/ToolPointCloudBoxRenderHelper.js +1 -0
- package/es/utils/index.js +1 -1
- package/es/views/MainView/index.js +1 -1
- package/es/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
- package/es/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.js +1 -0
- package/es/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.module.scss.js +1 -0
- package/es/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js +1 -0
- package/es/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.module.scss.js +1 -0
- package/es/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.js +1 -0
- package/es/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.module.scss.js +1 -0
- package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/TagSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
- package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
- package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.js +1 -0
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
- package/es/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
- package/es/views/MainView/toolHeader/index.js +1 -1
- package/package.json +6 -4
- package/dist/assets/annotation/pointCloudTool/rotate180_black.svg.js +0 -1
- package/dist/assets/icons/9d70807.svg +0 -5
- package/es/assets/annotation/pointCloudTool/rotate180_black.svg.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),getWebPcm2Wac=require("../audioAnnotate/utils/getWebPcm2Wac.js"),_=require("lodash"),icons=require("@ant-design/icons"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),index$a=require("../invalidPage/index.js"),index$5=require("../imageError/index.js"),index$9=require("../../utils/index.js"),index$c=require("../videoPlayer/components/SpeedController/index.js"),WaveSurfer=require("@labelbee/wavesurfer"),Region=require("@labelbee/wavesurfer/dist/plugin/wavesurfer.regions.js"),Cursor=require("@labelbee/wavesurfer/dist/plugin/wavesurfer.cursor.js"),index$d=require("./zoomSlider/index.js"),index$e=require("./labelDisplayToggle/index.js"),index$f=require("./clipRegion/index.js"),index=require("../audioAnnotate/audioContext/index.js"),ahooks=require("ahooks"),index$1=require("./useAudioScroll/index.js"),index_module=require("./index.module.scss.js"),audio=require("../../utils/audio.js"),index$b=require("./progressDot/index.js"),index$6=require("./clipTip/index.js"),index$4=require("./useSwitchHotkey/index.js"),index$2=require("./useAudioCombine/index.js"),index$3=require("./useAudioSegment/index.js"),index$7=require("./combineTip/index.js"),index$8=require("./segmentTip/index.js"),index$g=require("../../views/MainView/toolFooter/index.js"),utils=require("../videoPlayer/utils.js");function _interopDefaultLegacy(s){return s&&typeof s=="object"&&"default"in s?s:{default:s}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),WaveSurfer__default=_interopDefaultLegacy(WaveSurfer),Region__default=_interopDefaultLegacy(Region),Cursor__default=_interopDefaultLegacy(Cursor),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(s,l,u)=>l in s?__defProp(s,l,{enumerable:!0,configurable:!0,writable:!0,value:u}):s[l]=u,__spreadValues=(s,l)=>{for(var u in l||(l={}))__hasOwnProp.call(l,u)&&__defNormalProp(s,u,l[u]);if(__getOwnPropSymbols)for(var u of __getOwnPropSymbols(l))__propIsEnum.call(l,u)&&__defNormalProp(s,u,l[u]);return s},__spreadProps=(s,l)=>__defProps(s,__getOwnPropDescs(l));const{EToolName}=lbAnnotation.cTool,EKeyCode=lbAnnotation.cKeyCode.default,PER_PROGRESS=.1,AudioPlayerContext=React__default.default.createContext({count:0,isEdit:!1,toolName:EToolName.Empty,imgIndex:0}),AudioPlayer=({fileData:s={},onLoaded:l,context:u,invalid:$e,height:Ie,hideError:Le,onError:te,updateRegion:x,removeRegion:B,regions:C=[],activeToolPanel:Oe,clipConfigurable:Ne,clipTextConfigurable:We,clipAttributeList:Fe,clipAttributeConfigurable:re,isCheck:E,hoverRegionId:I,footer:ze,drawLayerSlot:ne})=>{var oe,ie;const{url:M,path:ae}=s,[L,O]=React.useState(!1),[le,se]=React.useState(!1),[R,He]=React.useState(0),[Ue,ue]=React.useState(!1),[D,de]=React.useState(0),o=React.useRef(null),S=React.useRef(null),ce=React.useRef(R),N=e=>{ce.current=e,He(e)},[ve,Xe]=React.useState(0),[k,Ze]=React.useState(1),W=React.useRef(null),[fe,Ke]=React.useState({}),{audioClipState:F,setAudioClipState:A}=index.useAudioClipStore(),[z,H]=React.useState(!1),d=ahooks.useLatest(F),me=ahooks.useLatest(fe),Ve=ahooks.useLatest(L),w=ahooks.useLatest(C),pe=ahooks.useUpdate(),[ge,Ge]=React.useState([]),[_e,Ye]=React.useState({}),Je=_.debounce(()=>{lbAnnotation.EventBus.emit("audioZoom")},500),be=e=>{e<index$d.audioZoomInfo.min||e>index$d.audioZoomInfo.max||(Ze(e),audio.dispatchResizeEvent(),Je())};index$1({container:W.current,target:document.querySelector(`[data-id=${(ie=(oe=d.current)==null?void 0:oe.selectedRegion)==null?void 0:ie.id}]`),clipping:z,zoom:k,zoomHandler:be});const $=()=>{let e=w.current;const{attributeLockList:r}=d.current;r.length&&(e=e.filter(t=>r.includes(t.attribute))),X(),e.forEach(t=>{var n;(n=o.current)==null||n.addRegion(__spreadProps(__spreadValues({},t),{drag:!E,resize:!E,color:"rgba(0, 0, 0, 0)"}))}),pe()},v=e=>{var r,t,n,i,a,f,g;const{id:c,loop:m=!0,playImmediately:y=!1}=e;if(c){const T=(n=(t=(r=o.current)==null?void 0:r.regions)==null?void 0:t.list)!=null?n:{};Object.entries(T).forEach(([,p])=>{const{id:P}=p;c===P?p.select():p.cancelSelect()}),A({selectedRegion:{id:c,loop:m},selectedAttribute:(f=(a=(i=w.current)==null?void 0:i.find(p=>p.id===c))==null?void 0:a.attribute)!=null?f:""}),m&&y&&((g=q(c))==null||g.playLoop())}else A({selectedRegion:{}})},{combineInstance:Qe}=index$2({waveRef:o,sortByStartRegions:ge,regionMap:_e,updateRegion:x,removeRegion:B,generateRegions:$,setSelectedRegion:v}),{segmentInstance:et,onRegionMouseMove:tt,segmentTimeTip:rt}=index$3({waveRef:o,regionMap:_e,updateRegion:x,removeRegion:B,generateRegions:$,setSelectedRegion:v}),ye={clipTextConfigurable:We,clipAttributeList:Fe,clipAttributeConfigurable:re,clipConfigurable:Ne};React.useEffect(()=>{A({selectedAttribute:""})},[re]),React.useEffect(()=>{U()},[F.selectedAttribute]),React.useEffect(()=>{$()},[F.attributeLockList]),ahooks.useDeepCompareEffect(()=>{A(ye),setTimeout(()=>{Ee()})},[ye]),ahooks.useDeepCompareEffect(()=>{Ge(_.sortBy(C,["start"])),Ye(C.reduce((e,r)=>{const{id:t}=r;return __spreadProps(__spreadValues({},e),{[t]:r})},{}))},[C]),React.useEffect(()=>{if(I){const e=Ve.current;v({id:I,loop:e,playImmediately:!0})}else v({})},[I]);const Ee=()=>{var e,r;d.current.clipConfigurable?(!E&&o.current&&((e=o.current)==null||e.enableDragSelection({slop:5})),$()):((r=o.current)==null||r.disableDragSelection(),X()),U()},U=()=>{var e,r,t,n,i;let a="";d.current.clipConfigurable?a=audio.getAttributeColor(d.current.selectedAttribute,(e=d.current.clipAttributeList)!=null?e:[]):a="transparent",((t=(r=o==null?void 0:o.current)==null?void 0:r.cursor)==null?void 0:t.cursor)&&((i=(n=o==null?void 0:o.current)==null?void 0:n.cursor)==null||i.setStyle({border:`2px dashed ${a}`}))},q=e=>{var r,t,n;return((n=(t=(r=o.current)==null?void 0:r.regions)==null?void 0:t.list)!=null?n:{})[e]},Re=()=>{var e,r;if(M){const t=((r=(e=ae==null?void 0:ae.split("."))==null?void 0:e.pop())==null?void 0:r.toLowerCase())==="pcm";ue(!1),t?getWebPcm2Wac.getWebPcm2WavBase64(M).then(n=>{Se(n)}):Se(M)}},Se=e=>{var r;e&&(se(!0),N(0),de(0),(r=o==null?void 0:o.current)==null||r.load(e))},X=()=>{var e;(e=o.current)==null||e.clearRegions()},Z=e=>{const r=q(e);r&&(H(!1),r==null||r.remove(),B==null||B(e),v({}))},{run:he}=ahooks.useThrottleFn(v,{wait:500});index$4({sortByStartRegions:ge,setSelectedRegion:v});const nt=e=>{const{start:r,end:t}=me.current;return(r||t)&&e.update(me.current),e},ot=({action:e,id:r,eventDownTime:t})=>{var n,i;if(!d.current.clipConfigurable)return;r&&v({id:r});const a=q((r!=null?r:(n=d.current.selectedRegion)==null?void 0:n.id)||""),f=[];(e==="create"?w.current:(i=w.current)==null?void 0:i.filter(m=>m.id!==a.id)).forEach(m=>{const{start:y,end:T,attribute:p}=m;p===d.current.selectedAttribute&&[y,T].forEach(P=>{f.includes(P)||f.push(P)})});const c=audio.getCanMoveRange(f.sort((m,y)=>m-y),t);o.current.range=c},it=e=>{U(),setTimeout(()=>{H(!1)});const r=nt(e),{id:t,start:n,end:i}=r;v({id:t,playImmediately:!0});const a={id:t,start:utils.decimalReserved(n,3),end:utils.decimalReserved(i,3)};x==null||x(a),pe()},at=()=>{const e=WaveSurfer__default.default.create({container:"#waveform",waveColor:"#999",progressColor:"#999",height:Ie||245,normalize:!0,cursorWidth:2,cursorColor:"white",responsive:0,hideScrollbar:!0,plugins:[Region__default.default.create({regions:C,dragSelection:{slop:5},canMove:!1}),Cursor__default.default.create({opacity:1,customStyle:{border:"2px dashed transparent"}})]}),r=()=>{var t;N(((t=o==null?void 0:o.current)==null?void 0:t.getCurrentTime())||0)};e.on("ready",()=>{var t;const n=((t=o==null?void 0:o.current)==null?void 0:t.getDuration())||0;de(n),r(),l==null||l({duration:Math.round(n)}),se(!1),j(),lbAnnotation.EventBus.on("setCurrentTimeByPosition",V),lbAnnotation.EventBus.on("clearRegions",X),lbAnnotation.EventBus.on("removeRegionById",Z),lbAnnotation.EventBus.on("setSelectedRegion",he),e.on("regions-eventDown",ot),Ee()}),e.on("audioprocess",()=>{r()}),e.on("play",()=>{O(!0)}),e.on("pause",()=>{O(!1)}),e.on("finish",()=>{O(!1)}),e.on("seek",()=>{r()}),e.on("error",()=>{ue(!0),l==null||l({hasError:!0}),te==null||te()}),e.on("region-created",t=>{const{id:n,start:i,end:a}=t;if(w.current.find(g=>g.id===n))return;const f={id:n,start:utils.decimalReserved(i,3),end:utils.decimalReserved(a,3),attribute:d.current.selectedAttribute,text:""};x==null||x(f)}),e.on("region-updated",(t,n)=>{var i,a,f,g,c,m,y,T,p,P;const je=n==null?void 0:n.action;A({combined:!1,segment:!1}),je==="resize"&&((a=(i=o==null?void 0:o.current)==null?void 0:i.cursor)==null||a.setStyle({borderStyle:"solid"})),je==="drag"&&((g=(f=o==null?void 0:o.current)==null?void 0:f.cursor)==null||g.setStyle({borderColor:"transparent"}));const G={},Y=[],J={},bt=(c=w.current)==null?void 0:c.filter(b=>b.id!==t.id),yt=(T=(y=(m=o.current)==null?void 0:m.regions)==null?void 0:y.list)!=null?T:{};bt.forEach(b=>{var Me,De;const{element:Q}=(Me=yt[b.id])!=null?Me:{},{start:St,end:ht}=b;if(Q){const{x:ke,width:Pt}=((De=Q.getBoundingClientRect)==null?void 0:De.call(Q))||{},xt=ke+Pt;[ke,xt].forEach((ee,Ct)=>{Y.includes(ee)||(Y.push(ee),J[ee]=Ct===0?St:ht)})}});const{x:Be,width:Et}=((P=(p=t.element).getBoundingClientRect)==null?void 0:P.call(p))||{},Rt=Be+Et;Y.forEach(b=>{Math.abs(audio.precisionMinus(b,Be))<5&&(G.start=J[b]),Math.abs(audio.precisionMinus(b,Rt))<5&&(G.end=J[b])}),Ke(G),he({id:t.id}),H(!0)}),e.on("region-update-end",t=>{it(t)}),e.on("region-contextmenu",(t,n)=>{if(!E){if(n.preventDefault(),n.stopPropagation(),audio.isDoubleClick(n)){Z(t.id);return}v({id:t.id,playImmediately:!0})}}),e.on("region-click",(t,n,i)=>{if(!E){if(n.preventDefault(),n.stopPropagation(),d.current.combined){Qe(t);return}if(d.current.segment){et(t,i);return}v({id:t.id,playImmediately:!0})}}),e.on("region-mousemove",tt),o.current=e},lt=L?React__default.default.createElement(icons.PauseOutlined,null):React__default.default.createElement(icons.CaretRightOutlined,null),Pe=e=>e?`${parseFloat((e/D*100).toFixed(4))}%`:"0%",xe=Pe(R),st=Pe(ve),h=()=>{if(!le)return o==null?void 0:o.current},ut=()=>{var e;(e=h())==null||e.skipForward(PER_PROGRESS)},dt=()=>{var e;(e=h())==null||e.skipBackward(PER_PROGRESS)},j=()=>{var e;(e=h())==null||e.playPause(),v({})},Ce=e=>{var r;switch(e.keyCode){case EKeyCode.Right:ut();break;case EKeyCode.Left:dt();break;case EKeyCode.Space:e.preventDefault(),j();break;case EKeyCode.Delete:if(!E){const{id:t}=((r=d.current)==null?void 0:r.selectedRegion)||{};t&&Z(t)}break}},ct=e=>{V(e)},we=___default.default.throttle(ct,50);let K=!1;const Te=()=>{K&&(j(),K=!1),document.removeEventListener("mousemove",we),document.removeEventListener("mouseup",Te)},vt=e=>{V(e),L&&(K=!0,j()),document.addEventListener("mousemove",we),document.addEventListener("mouseup",Te)},ft=()=>{Re()};React.useEffect(()=>(at(),()=>{var e;(e=o==null?void 0:o.current)==null||e.destroy(),o.current=null,lbAnnotation.EventBus.unbindAll("setCurrentTimeByPosition"),lbAnnotation.EventBus.unbindAll("clearRegions"),lbAnnotation.EventBus.unbindAll("removeRegionById"),lbAnnotation.EventBus.unbindAll("setSelectedRegion")}),[]);const mt=e=>{var r,t,n;(r=h())==null||r.playPause(),(t=h())==null||t.setPlaybackRate(e),(n=h())==null||n.playPause()};React.useEffect(()=>(document.addEventListener("keydown",Ce),()=>{document.removeEventListener("keydown",Ce)})),React.useEffect(()=>{v({}),Re()},[M]);const Ae=e=>{var r,t,n,i;if((o==null?void 0:o.current)&&(S==null?void 0:S.current)){const a=(t=(r=o==null?void 0:o.current)==null?void 0:r.getDuration())!=null?t:0,f=(n=S==null?void 0:S.current)==null?void 0:n.getBoundingClientRect();let c=(e.clientX-f.left)/(((i=S==null?void 0:S.current)==null?void 0:i.clientWidth)||0)*a;return c>a&&(c=a),c}return 0},V=e=>{var r;const t=Ae(e);(r=o==null?void 0:o.current)==null||r.skip(t-ce.current),N(t)},pt=e=>{Xe(Ae(e))},gt=D?Math.max(D-R,0):0,_t=(u==null?void 0:u.toolName)!==EToolName.Empty&&(u==null?void 0:u.isEdit)!==!0&&(Oe==="remark"||E),qe=React__default.default.createElement("div",{className:index_module.audioPlayer},Ue&&!Le&&React__default.default.createElement(index$5,{fileTypeName:"\u97F3\u9891",ignoreOffsetY:!0,reloadImage:ft,backgroundColor:"#ffffffbb"}),React__default.default.createElement(index$6,{getRegionInstanceById:q,clipping:z}),React__default.default.createElement(index$7,{container:W.current}),React__default.default.createElement(index$8,{segmentTimeTip:rt}),React__default.default.createElement("div",{className:index_module.waveformContainer,ref:W},React__default.default.createElement("div",{id:"waveform",style:{width:`${k*100}%`},className:index$9.classnames({[index_module.waveform]:!0,"bee-audio-combined":d.current.combined,"bee-audio-clip":d.current.clipConfigurable})},$e&&React__default.default.createElement(index$a,{isAudio:!0}),React__default.default.createElement("div",{ref:S,className:index_module.progress,onMouseDown:vt,onMouseMove:pt},React__default.default.createElement("div",{className:index$9.classnames({[index_module.radioTooltip]:!0}),style:{left:xe}},audio.formatTime(R)),React__default.default.createElement("div",{className:index$9.classnames({[index_module.radioTooltip]:!0,[index_module.mouseTooltip]:!0}),style:{left:st}},audio.formatTime(ve)),React__default.default.createElement(index$b,{playPercentage:xe})),_t&&(ne==null?void 0:ne({currentTime:R,remainingTime:gt,audioPlayer:h()})))),React__default.default.createElement("div",{className:index_module.controlBar},React__default.default.createElement(antd.Button,{type:"link",icon:lt,onClick:()=>{j()},className:index$9.classnames({[index_module.playButton]:!0,[index_module.playButtonDisabled]:le})}),React__default.default.createElement("span",{className:index_module.time},`${audio.timeFormat(R,"ss.SSS")} / -${audio.timeFormat(D-R,"ss.SSS")}`),React__default.default.createElement(index$c.default,{playerType:index$c.EPlayerType.Audio,onChange:e=>{mt(e)}}),React__default.default.createElement(index$d.default,{onChange:e=>{be(e)},zoom:k}),React__default.default.createElement(index$e,{EventBus:lbAnnotation.EventBus})));return u?React__default.default.createElement(AudioPlayerContext.Provider,{value:u},qe,C.map(e=>{const{id:r}=e,t=document.querySelector(`[data-id=${r}]`);return t?React__default.default.createElement(index$f,{el:t,key:r,region:e,edgeAdsorption:fe,clipping:z,zoom:k,instance:q(r)}):null}),React__default.default.createElement(index$g.default,{footer:ze})):qe};exports.AudioPlayer=AudioPlayer,exports.AudioPlayerContext=AudioPlayerContext;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),getWebPcm2Wac=require("../audioAnnotate/utils/getWebPcm2Wac.js"),_=require("lodash"),icons=require("@ant-design/icons"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),antd=require("antd"),index$b=require("../invalidPage/index.js"),index$6=require("../imageError/index.js"),index$a=require("../../utils/index.js"),index$d=require("../videoPlayer/components/SpeedController/index.js"),WaveSurfer=require("@labelbee/wavesurfer"),Region=require("@labelbee/wavesurfer/dist/plugin/wavesurfer.regions.js"),Cursor=require("@labelbee/wavesurfer/dist/plugin/wavesurfer.cursor.js"),index=require("./zoomSlider/index.js"),index$e=require("./labelDisplayToggle/index.js"),index$f=require("./clipRegion/index.js"),index$1=require("../audioAnnotate/audioContext/index.js"),ahooks=require("ahooks"),index$2=require("./useAudioScroll/index.js"),index_module=require("./index.module.scss.js"),audio=require("../../utils/audio.js"),index$c=require("./progressDot/index.js"),index$7=require("./clipTip/index.js"),index$5=require("./useSwitchHotkey/index.js"),index$3=require("./useAudioCombine/index.js"),index$4=require("./useAudioSegment/index.js"),index$8=require("./combineTip/index.js"),index$9=require("./segmentTip/index.js"),index$g=require("../../views/MainView/toolFooter/index.js"),utils=require("../videoPlayer/utils.js"),reactI18next=require("react-i18next"),useSize=require("../../hooks/useSize.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),WaveSurfer__default=_interopDefaultLegacy(WaveSurfer),Region__default=_interopDefaultLegacy(Region),Cursor__default=_interopDefaultLegacy(Cursor),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(l,u,d)=>u in l?__defProp(l,u,{enumerable:!0,configurable:!0,writable:!0,value:d}):l[u]=d,__spreadValues=(l,u)=>{for(var d in u||(u={}))__hasOwnProp.call(u,d)&&__defNormalProp(l,d,u[d]);if(__getOwnPropSymbols)for(var d of __getOwnPropSymbols(u))__propIsEnum.call(u,d)&&__defNormalProp(l,d,u[d]);return l},__spreadProps=(l,u)=>__defProps(l,__getOwnPropDescs(u));const{EToolName}=lbAnnotation.cTool,EKeyCode=lbAnnotation.cKeyCode.default,PER_PROGRESS=.1,AudioPlayerContext=React__default.default.createContext({count:0,isEdit:!1,toolName:EToolName.Empty,imgIndex:0}),AudioPlayer=({fileData:l={},onLoaded:u,context:d,invalid:Ne,height:Fe,hideError:ze,onError:re,updateRegion:T,removeRegion:$,regions:x=[],activeToolPanel:Ue,clipConfigurable:Ze,clipTextConfigurable:ne,clipAttributeList:He,clipAttributeConfigurable:oe,secondaryAttributeConfigurable:Ve,subAttributeList:Xe,isCheck:b,hoverRegionId:W,footer:Ke,drawLayerSlot:ie,clipTextList:Ge,lang:ae})=>{var le,se;const{url:O,path:ue}=l,[N,F]=React.useState(!1),[ce,de]=React.useState(!1),[P,Ye]=React.useState(0),[Je,fe]=React.useState(!1),[S,ve]=React.useState(0),o=React.useRef(null),C=React.useRef(null),me=React.useRef(P),z=e=>{me.current=e,Ye(e)},[pe,Qe]=React.useState(0),[j,et]=React.useState(index.audioZoomInfo.defaultValue),y=React.useRef(null),[ge,tt]=React.useState({}),{audioClipState:U,setAudioClipState:B}=index$1.useAudioClipStore(),[Z,H]=React.useState(!1),c=ahooks.useLatest(U),be=ahooks.useLatest(ge);ahooks.useLatest(N);const A=ahooks.useLatest(x),_e=ahooks.useUpdate(),[ye,rt]=React.useState([]),[Ee,nt]=React.useState({}),[ot,Se]=React.useState(""),[he,it]=React.useState({start:0,end:0}),at=useSize(y),lt=React.useMemo(()=>x.filter(e=>{const{start:t,end:r}=he;return e.start>=t&&e.start<=r||e.end>=t&&e.end<=r||e.id===ot}),[x,he]),st=_.debounce(()=>{lbAnnotation.EventBus.emit("audioZoom")},500),Re=e=>{e<index.audioZoomInfo.min||e>index.audioZoomInfo.max||(et(e),audio.dispatchResizeEvent(),st())};index$2({container:y.current,target:document.querySelector(`[data-id=${(se=(le=c.current)==null?void 0:le.selectedRegion)==null?void 0:se.id}]`),clipping:Z,zoom:j,zoomHandler:Re});const L=()=>{let e=A.current;const{attributeLockList:t}=c.current;t.length&&(e=e.filter(r=>t.includes(r.attribute))),X(),e.forEach(r=>{var n;(n=o.current)==null||n.addRegion(__spreadProps(__spreadValues({},r),{drag:!b,resize:!b,color:"rgba(0, 0, 0, 0)"}))}),_e()},m=e=>{var t,r,n,i,s,v,p;const{id:a,loop:f=!0,playImmediately:g=!1,isLoopStatus:I}=e,q=!1;if(a){const w=(n=(r=(t=o.current)==null?void 0:t.regions)==null?void 0:r.list)!=null?n:{};Object.entries(w).forEach(([,R])=>{const{id:k}=R;a===k?R.select():R.cancelSelect()}),B({selectedRegion:{id:a,loop:q},selectedAttribute:(v=(s=(i=A.current)==null?void 0:i.find(R=>R.id===a))==null?void 0:s.attribute)!=null?v:""}),g&&((p=D(a))==null||p.play())}else B({selectedRegion:{}})},{combineInstance:ut}=index$3({waveRef:o,sortByStartRegions:ye,regionMap:Ee,updateRegion:T,removeRegion:$,generateRegions:L,setSelectedRegion:m}),{segmentInstance:ct,onRegionMouseMove:dt,segmentTimeTip:ft}=index$4({waveRef:o,regionMap:Ee,updateRegion:T,removeRegion:$,generateRegions:L,setSelectedRegion:m}),xe={clipTextConfigurable:ne,clipAttributeList:He,clipAttributeConfigurable:oe,clipConfigurable:Ze,secondaryAttributeConfigurable:Ve,subAttributeList:Xe,clipTextList:Ge};React.useEffect(()=>{var e;ae&&((e=lbUtils.i18n)==null||e.changeLanguage(ae))},[]),React.useEffect(()=>{B({selectedAttribute:""})},[oe]),React.useEffect(()=>{V()},[U.selectedAttribute]),React.useEffect(()=>{L()},[U.attributeLockList]),ahooks.useDeepCompareEffect(()=>{B(xe),setTimeout(()=>{Pe()})},[xe]),ahooks.useDeepCompareEffect(()=>{rt(_.sortBy(x,["start"])),nt(x.reduce((e,t)=>{const{id:r}=t;return __spreadProps(__spreadValues({},e),{[r]:t})},{})),b&&L()},[x]),React.useEffect(()=>{m(W?{id:W,loop:!1,playImmediately:!0}:{})},[W]);const Pe=()=>{var e,t;c.current.clipConfigurable?(!b&&o.current&&((e=o.current)==null||e.enableDragSelection({slop:5})),L()):((t=o.current)==null||t.disableDragSelection(),X()),V()},V=()=>{var e,t,r,n,i;let s="";c.current.clipConfigurable?s=audio.getAttributeColor(c.current.selectedAttribute,(e=c.current.clipAttributeList)!=null?e:[]):s="transparent",((r=(t=o==null?void 0:o.current)==null?void 0:t.cursor)==null?void 0:r.cursor)&&((i=(n=o==null?void 0:o.current)==null?void 0:n.cursor)==null||i.setStyle({border:`2px dashed ${s}`}))},D=e=>{var t,r,n;return((n=(r=(t=o.current)==null?void 0:t.regions)==null?void 0:r.list)!=null?n:{})[e]},Ce=()=>{var e,t;if(O){const r=((t=(e=ue==null?void 0:ue.split("."))==null?void 0:e.pop())==null?void 0:t.toLowerCase())==="pcm";fe(!1),r?getWebPcm2Wac.getWebPcm2WavBase64(O).then(n=>{we(n)}):we(O)}},we=e=>{var t;e&&(de(!0),z(0),ve(0),(t=o==null?void 0:o.current)==null||t.load(e))},X=()=>{var e;(e=o.current)==null||e.clearRegions()},K=e=>{const t=D(e);t&&(H(!1),t==null||t.remove(),$==null||$(e),m({}))},{run:Te}=ahooks.useThrottleFn(m,{wait:100});index$5({sortByStartRegions:ye,setSelectedRegion:m});const vt=e=>{const{start:t,end:r}=be.current;return(t||r)&&e.update(be.current),e},mt=({action:e,id:t,eventDownTime:r})=>{var n,i;if(!c.current.clipConfigurable)return;t&&m({id:t});const s=D((t!=null?t:(n=c.current.selectedRegion)==null?void 0:n.id)||""),v=[];(e==="create"?A.current:(i=A.current)==null?void 0:i.filter(f=>f.id!==s.id)).forEach(f=>{const{start:g,end:I,attribute:q}=f;q===c.current.selectedAttribute&&[g,I].forEach(w=>{v.includes(w)||v.push(w)})});const a=audio.getCanMoveRange(v.sort((f,g)=>f-g),r);o.current.range=a},pt=e=>{V(),setTimeout(()=>{H(!1)});const t=vt(e),{id:r,start:n,end:i}=t;m({id:r,playImmediately:!0});const s={id:r,start:utils.decimalReserved(n,3),end:utils.decimalReserved(i,3)};T==null||T(s),_e()},gt=()=>{const e=WaveSurfer__default.default.create({container:"#waveform",waveColor:"#999",progressColor:"#999",height:Fe||245,normalize:!0,cursorWidth:2,cursorColor:"white",responsive:0,hideScrollbar:!0,plugins:[Region__default.default.create({regions:x,dragSelection:{slop:5},canMove:!1}),Cursor__default.default.create({opacity:1,customStyle:{border:"2px dashed transparent"}})]}),t=()=>{var r;z(((r=o==null?void 0:o.current)==null?void 0:r.getCurrentTime())||0)};e.on("ready",()=>{var r;const n=((r=o==null?void 0:o.current)==null?void 0:r.getDuration())||0;ve(n),t(),u==null||u({duration:Math.round(n)}),de(!1),M(),lbAnnotation.EventBus.on("setCurrentTimeByPosition",Y),lbAnnotation.EventBus.on("clearRegions",X),lbAnnotation.EventBus.on("removeRegionById",K),lbAnnotation.EventBus.on("setSelectedRegion",Te),e.on("regions-eventDown",mt),Pe()}),e.on("audioprocess",()=>{t()}),e.on("play",()=>{F(!0)}),e.on("pause",()=>{F(!1)}),e.on("finish",()=>{F(!1)}),e.on("seek",()=>{t()}),e.on("error",()=>{fe(!0),u==null||u({hasError:!0}),re==null||re()}),e.on("region-created",r=>{var n;const{id:i,start:s,end:v}=r;if(A.current.find(a=>a.id===i))return;Se(i);const p={id:i,start:utils.decimalReserved(s,3),end:utils.decimalReserved(v,3),attribute:c.current.selectedAttribute,text:""};if(c.current.secondaryAttributeConfigurable){const a=lbAnnotation.TagUtils.getDefaultResultByConfig((n=c.current.subAttributeList)!=null?n:[]);p.subAttribute=a!=null?a:{}}ne&&c.current.clipTextList.forEach((f,g)=>{g===0?Object.assign(p,{text:f==null?void 0:f.default}):Object.assign(p,{[f.key]:f==null?void 0:f.default})}),T==null||T(p)}),e.on("region-updated",(r,n)=>{var i,s,v,p,a,f,g,I,q,w;const R=n==null?void 0:n.action;B({combined:!1,segment:!1}),R==="resize"&&((s=(i=o==null?void 0:o.current)==null?void 0:i.cursor)==null||s.setStyle({borderStyle:"solid"})),R==="drag"&&((p=(v=o==null?void 0:o.current)==null?void 0:v.cursor)==null||p.setStyle({borderColor:"transparent"}));const k={},J=[],Q={},At=(a=A.current)==null?void 0:a.filter(E=>E.id!==r.id),qt=(I=(g=(f=o.current)==null?void 0:f.regions)==null?void 0:g.list)!=null?I:{};At.forEach(E=>{var $e,Oe;const{element:ee}=($e=qt[E.id])!=null?$e:{},{start:Lt,end:Dt}=E;if(ee){const{x:We,width:Mt}=((Oe=ee.getBoundingClientRect)==null?void 0:Oe.call(ee))||{},It=We+Mt;[We,It].forEach((te,kt)=>{J.includes(te)||(J.push(te),Q[te]=kt===0?Lt:Dt)})}});const{x:ke,width:jt}=((w=(q=r.element).getBoundingClientRect)==null?void 0:w.call(q))||{},Bt=ke+jt;J.forEach(E=>{Math.abs(audio.precisionMinus(E,ke))<5&&(k.start=Q[E]),Math.abs(audio.precisionMinus(E,Bt))<5&&(k.end=Q[E])}),tt(k),Te({id:r.id}),H(!0)}),e.on("region-update-end",r=>{pt(r),Se("")}),e.on("region-contextmenu",(r,n)=>{if(!b){if(n.preventDefault(),n.stopPropagation(),audio.isDoubleClick(n)){K(r.id);return}m({id:r.id,playImmediately:!0})}}),e.on("region-click",(r,n,i)=>{if(!b){if(n.preventDefault(),n.stopPropagation(),c.current.combined){ut(r);return}if(c.current.segment){ct(r,i);return}m({id:r.id,playImmediately:!0})}}),e.on("region-mousemove",dt),o.current=e},bt=N?React__default.default.createElement(icons.PauseOutlined,null):React__default.default.createElement(icons.CaretRightOutlined,null),Ae=e=>e?`${parseFloat((e/S*100).toFixed(4))}%`:"0%",qe=Ae(P),_t=Ae(pe),h=()=>{if(!ce)return o==null?void 0:o.current},yt=()=>{var e;(e=h())==null||e.skipForward(PER_PROGRESS)},Et=()=>{var e;(e=h())==null||e.skipBackward(PER_PROGRESS)},M=()=>{var e;(e=h())==null||e.playPause()},je=e=>{var t;switch(e.keyCode){case EKeyCode.Right:yt();break;case EKeyCode.Left:Et();break;case EKeyCode.Space:e.preventDefault(),M();break;case EKeyCode.Delete:if(!b){const{id:r}=((t=c.current)==null?void 0:t.selectedRegion)||{};r&&K(r)}break}},St=e=>{Y(e)},Be=___default.default.throttle(St,50);let G=!1;const Le=()=>{G&&(M(),G=!1),document.removeEventListener("mousemove",Be),document.removeEventListener("mouseup",Le)},ht=e=>{Y(e),N&&(G=!0,M()),document.addEventListener("mousemove",Be),document.addEventListener("mouseup",Le)},Rt=()=>{Ce()};React.useEffect(()=>(gt(),()=>{var e;(e=o==null?void 0:o.current)==null||e.destroy(),o.current=null,lbAnnotation.EventBus.unbindAll("setCurrentTimeByPosition"),lbAnnotation.EventBus.unbindAll("clearRegions"),lbAnnotation.EventBus.unbindAll("removeRegionById"),lbAnnotation.EventBus.unbindAll("setSelectedRegion")}),[]);const xt=e=>{var t,r,n;(t=h())==null||t.playPause(),(r=h())==null||r.setPlaybackRate(e),(n=h())==null||n.playPause()};React.useEffect(()=>(document.addEventListener("keydown",je),()=>{document.removeEventListener("keydown",je)})),React.useEffect(()=>{m({}),Ce()},[O]),React.useEffect(()=>{De()},[at,S,j]);const Pt=()=>{if(y.current&&S){const e=y.current.scrollLeft,t=y.current.clientWidth,r=e/y.current.scrollWidth*S,n=(e+t)/y.current.scrollWidth*S;it({start:r,end:n})}},{run:De}=ahooks.useThrottleFn(Pt,{wait:300}),Me=e=>{var t,r,n,i;if((o==null?void 0:o.current)&&(C==null?void 0:C.current)){const s=(r=(t=o==null?void 0:o.current)==null?void 0:t.getDuration())!=null?r:0,v=(n=C==null?void 0:C.current)==null?void 0:n.getBoundingClientRect();let a=(e.clientX-v.left)/(((i=C==null?void 0:C.current)==null?void 0:i.clientWidth)||0)*s;return a>s&&(a=s),a}return 0},Y=e=>{var t;const r=Me(e);(t=o==null?void 0:o.current)==null||t.skip(r-me.current),z(r)},Ct=e=>{Qe(Me(e))},wt=S?Math.max(S-P,0):0,Tt=(d==null?void 0:d.toolName)!==EToolName.Empty&&(d==null?void 0:d.isEdit)!==!0&&(Ue==="remark"||b),Ie=React__default.default.createElement("div",{className:index_module.audioPlayer},Je&&!ze&&React__default.default.createElement(index$6,{fileTypeName:"\u97F3\u9891",ignoreOffsetY:!0,reloadImage:Rt,backgroundColor:"#ffffffbb"}),React__default.default.createElement(index$7,{getRegionInstanceById:D,clipping:Z}),React__default.default.createElement(index$8,{container:y.current}),React__default.default.createElement(index$9,{segmentTimeTip:ft}),React__default.default.createElement("div",{className:index_module.waveformContainer,ref:y,onScroll:()=>De()},React__default.default.createElement("div",{id:"waveform",style:{width:`${j*100}%`},className:index$a.classnames({[index_module.waveform]:!0,"bee-audio-combined":c.current.combined,"bee-audio-clip":c.current.clipConfigurable})},Ne&&React__default.default.createElement(index$b,{isAudio:!0}),React__default.default.createElement("div",{ref:C,className:index_module.progress,onMouseDown:ht,onMouseMove:Ct},React__default.default.createElement("div",{className:index$a.classnames({[index_module.radioTooltip]:!0}),style:{left:qe}},audio.formatTime(P)),React__default.default.createElement("div",{className:index$a.classnames({[index_module.radioTooltip]:!0,[index_module.mouseTooltip]:!0}),style:{left:_t}},audio.formatTime(pe)),React__default.default.createElement(index$c,{playPercentage:qe})),Tt&&(ie==null?void 0:ie({currentTime:P,remainingTime:wt,audioPlayer:h()})))),React__default.default.createElement("div",{className:index_module.controlBar},React__default.default.createElement(antd.Button,{type:"link",icon:bt,onClick:()=>{M()},className:index$a.classnames({[index_module.playButton]:!0,[index_module.playButtonDisabled]:ce})}),React__default.default.createElement("span",{className:index_module.time},`${audio.timeFormat(P,"ss.SSS")} / -${audio.timeFormat(S-P,"ss.SSS")}`),React__default.default.createElement(index$d.default,{playerType:index$d.EPlayerType.Audio,onChange:e=>{xt(e)}}),React__default.default.createElement(index.default,{onChange:e=>{var t;(t=h())==null||t.pause(),Re(e)},zoom:j}),React__default.default.createElement(index$e,{EventBus:lbAnnotation.EventBus})));return d?React__default.default.createElement(AudioPlayerContext.Provider,{value:d},Ie,lt.map(e=>{const{id:t}=e,r=document.querySelector(`[data-id=${t}]`);return r?React__default.default.createElement(index$f,{el:r,key:t,region:e,edgeAdsorption:ge,clipping:Z,zoom:j,instance:D(t),isCheck:b}):null}),React__default.default.createElement(index$g.default,{footer:Ke})):Ie},WrapAudioPlayer=l=>React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(AudioPlayer,__spreadValues({},l)));exports.AudioPlayer=AudioPlayer,exports.AudioPlayerContext=AudioPlayerContext,exports.WrapAudioPlayer=WrapAudioPlayer;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
"use strict";var antd=require("antd"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../audioAnnotate/audioContext/index.js"),ahooks=require("ahooks"),React=require("react");const EKeyCode=lbAnnotation.cKeyCode.default,useAudioCombine=
|
|
2
|
-
${
|
|
1
|
+
"use strict";var antd=require("antd"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../audioAnnotate/audioContext/index.js"),ahooks=require("ahooks"),React=require("react"),_=require("lodash");const EKeyCode=lbAnnotation.cKeyCode.default,useAudioCombine=C=>{const{waveRef:v,sortByStartRegions:y,regionMap:m,updateRegion:g,removeRegion:a,generateRegions:p,setSelectedRegion:E}=C,{audioClipState:B,setAudioClipState:b}=index.useAudioClipStore(),{selectedRegion:h,clipConfigurable:A,combined:R,clipTextList:k}=B,{id:u}=h,F=(i,d,c)=>{const e=_.cloneDeep(i);return k.forEach((t,l)=>{const o=d[t.key],s=c[t.key],f=[o,s].includes("")?`${o}${s}`:`${o}
|
|
2
|
+
${s}`;l===0?Object.assign(e,{text:f}):Object.assign(e,{[t.key]:f})}),e},$=ahooks.useMemoizedFn(i=>{var d,c;if(!u)return;const e=m[u],t=m[i.id];if(e.attribute!==t.attribute){antd.message.info("\u8BF7\u9009\u62E9\u76F8\u90BB\u540C\u5C5E\u6027\u7247\u6BB5");return}const l=y.filter(n=>n.attribute===e.attribute),o=l.findIndex(n=>n.id===u),s=l.findIndex(n=>n.id===i.id);if(Math.abs(o-s)!==1){antd.message.info("\u8BF7\u9009\u62E9\u76F8\u90BB\u540C\u5C5E\u6027\u7247\u6BB5");return}const r=[];["start","end"].forEach(n=>{r.push(e[n]),r.push(t[n])});const q=Math.min(...r),w=Math.max(...r),M={id:(d=v.current)==null?void 0:d.util.getId("combined_"),start:q,end:w,attribute:e.attribute,text:[e.text,t.text].includes("")?`${e.text}${t.text}`:`${e.text}
|
|
3
|
+
${t.text}`,subAttribute:(c=t.subAttribute)!=null?c:{}},x=F(M,e,t);g==null||g(x),a==null||a(u),a==null||a(t.id),p(),b({combined:!1}),E({id:x.id,playImmediately:!0})}),I=ahooks.useMemoizedFn(i=>{if(!!A&&i.altKey&&i.keyCode===EKeyCode.Z){if(!u){antd.message.info("\u8BF7\u5148\u9009\u62E9\u9700\u8981\u5408\u5E76\u7684\u533A\u95F4");return}b({combined:!0,segment:!1})}});return React.useEffect(()=>{R&&b({combined:!1})},[u]),ahooks.useEventListener("keydown",I),{combineInstance:$}};module.exports=useAudioCombine;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),audio=require("../../../utils/audio.js"),ahooks=require("ahooks"),index=require("../zoomSlider/index.js");const useAudioScroll=
|
|
1
|
+
"use strict";var React=require("react"),audio=require("../../../utils/audio.js"),ahooks=require("ahooks"),index=require("../zoomSlider/index.js");const useAudioScroll=f=>{const{container:e,target:i,bufferWidth:o=10,clipping:g=!1,zoom:r=1,zoomHandler:c}=f,h=ahooks.useLatest(e),a=ahooks.useLatest(r),u=t=>{var n;t.ctrlKey&&((n=h.current)==null?void 0:n.contains(t.target))&&(t.deltaY>0?c(audio.precisionAdd(a.current,index.audioZoomInfo.ratio)):c(audio.precisionMinus(a.current,index.audioZoomInfo.ratio)))};if(React.useEffect(()=>(document.addEventListener("wheel",u),()=>{document.removeEventListener("wheel",u)}),[]),e&&i&&g&&r>1){const{scrollLeft:t}=e,{right:n,left:s,width:m}=i.getBoundingClientRect(),{right:l,left:d,width:R}=e.getBoundingClientRect();if(m>R)return;d+o>s&&s>d&&window.requestAnimationFrame(()=>{e.scrollLeft=t-20}),n+o>l&&n<l&&window.requestAnimationFrame(()=>{e.scrollLeft=t+20})}};module.exports=useAudioScroll;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),antd=require("antd"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../audioAnnotate/audioContext/index.js"),ahooks=require("ahooks");const EKeyCode=lbAnnotation.cKeyCode.default,useAudioSegment=
|
|
1
|
+
"use strict";var React=require("react"),antd=require("antd"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../audioAnnotate/audioContext/index.js"),ahooks=require("ahooks"),dataTransform=require("../../audioAnnotate/utils/dataTransform.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,e,t)=>e in r?__defProp(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,__spreadValues=(r,e)=>{for(var t in e||(e={}))__hasOwnProp.call(e,t)&&__defNormalProp(r,t,e[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(e))__propIsEnum.call(e,t)&&__defNormalProp(r,t,e[t]);return r},__spreadProps=(r,e)=>__defProps(r,__getOwnPropDescs(e));const EKeyCode=lbAnnotation.cKeyCode.default,useAudioSegment=r=>{const{waveRef:e,regionMap:t,updateRegion:d,removeRegion:y,generateRegions:R,setSelectedRegion:w}=r,{audioClipState:O,setAudioClipState:v}=index.useAudioClipStore(),{selectedRegion:P,clipConfigurable:T,segment:p,clipTextList:C,subAttributeList:A,secondaryAttributeConfigurable:E=!1}=O,{id:n}=P,m=React.useRef(null),g=React.useRef(null);React.useEffect(()=>{var u,o,i,l,c,s,f;if(g.current&&e.current&&p&&n){const a=(s=(i=(o=(u=e.current)==null?void 0:u.regions)==null?void 0:o.util)==null?void 0:i.getRegionSnapToGridValue)==null?void 0:s.call(i,((l=e.current)==null?void 0:l.drawer.handleEvent(g.current))*((c=e.current)==null?void 0:c.getDuration())),_=(f=t[n])!=null?f:{},{start:b,end:B}=_;if(a>b&&a<B){m.current=a;return}}m.current=null},[g.current,p]);const x=ahooks.useMemoizedFn((u,o)=>{var i,l,c;if(!n||n!==u.id){antd.message.info("\u8BF7\u70B9\u51FB\u6240\u9009\u533A\u95F4");return}const s=t[n],f=dataTransform.getClipTextByConfig(s,C),a=__spreadProps(__spreadValues({},f),{id:(i=e.current)==null?void 0:i.util.getId("segment_"),end:o,subAttribute:(l=s.subAttribute)!=null?l:{}}),_=dataTransform.getClipTextByConfig(s,C,!0),b=__spreadProps(__spreadValues({},_),{id:(c=e.current)==null?void 0:c.util.getId("segment_"),start:o,subAttribute:lbAnnotation.TagUtils.getDefaultResultByConfig(E?A!=null?A:[]:[])});d==null||d(a),d==null||d(b),y==null||y(n),R(),v({segment:!1}),w({id:a.id,playImmediately:!0})}),F=ahooks.useMemoizedFn(u=>{if(!!T&&u.altKey&&u.keyCode===EKeyCode.X){if(!n){antd.message.info("\u8BF7\u5148\u9009\u62E9\u9700\u8981\u5206\u5272\u7684\u533A\u95F4");return}v({segment:!0,combined:!1})}}),S=ahooks.useMemoizedFn((u,o)=>{g.current=o});return ahooks.useEventListener("keydown",F),React.useEffect(()=>{p&&v({segment:!1})},[n]),{segmentInstance:x,onRegionMouseMove:S,segmentTimeTip:m.current}};module.exports=useAudioSegment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),icons=require("@ant-design/icons"),antd=require("antd"),audio=require("../../../utils/audio.js"),lbAnnotation=require("@labelbee/lb-annotation"),ahooks=require("ahooks"),index_module=require("./index.module.scss.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const EKeyCode=lbAnnotation.cKeyCode.default,audioZoomInfo={min:1,max:150,ratio:1},ZoomSlider=t=>{const{onChange:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),icons=require("@ant-design/icons"),antd=require("antd"),audio=require("../../../utils/audio.js"),lbAnnotation=require("@labelbee/lb-annotation"),ahooks=require("ahooks"),index_module=require("./index.module.scss.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const EKeyCode=lbAnnotation.cKeyCode.default,audioZoomInfo={min:1,max:150,ratio:1,defaultValue:30},ZoomSlider=t=>{const{onChange:s,zoom:o}=t,{t:l}=reactI18next.useTranslation(),r=ahooks.useLatest(o),n=e=>{s(e)},a={fontSize:14,margin:"0 8px",cursor:"pointer"},i=()=>{const e=audio.precisionAdd(r.current,audioZoomInfo.ratio);n(e)},u=()=>{const e=audio.precisionMinus(r.current,audioZoomInfo.ratio);n(e)},c=e=>{switch(e.keyCode){case EKeyCode.I:e.ctrlKey&&i();break;case EKeyCode.O:e.ctrlKey&&(e.preventDefault(),u());break}};return React.useEffect(()=>(document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c)}),[]),React__default.default.createElement("div",{className:index_module.sliderContainer},React__default.default.createElement("div",null,l("Scale")),React__default.default.createElement(icons.ZoomOutOutlined,{style:a,onClick:u}),React__default.default.createElement("div",{style:{width:120}},React__default.default.createElement(antd.Slider,{min:audioZoomInfo.min,max:audioZoomInfo.max,step:audioZoomInfo.ratio,onChange:n,value:o})),React__default.default.createElement(icons.ZoomInOutlined,{style:a,onClick:i}))};exports.audioZoomInfo=audioZoomInfo,exports.default=ZoomSlider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),antd=require("antd"),ahooks=require("ahooks"),index=require("../../constant/index.js"),icons=require("@ant-design/icons");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const longTextCls=`${index.prefix}-longText`,
|
|
1
|
+
"use strict";var React=require("react"),antd=require("antd"),ahooks=require("ahooks"),index=require("../../constant/index.js"),icons=require("@ant-design/icons");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__objRest=(e,t)=>{var r={};for(var n in e)__hasOwnProp.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&__getOwnPropSymbols)for(var n of __getOwnPropSymbols(e))t.indexOf(n)<0&&__propIsEnum.call(e,n)&&(r[n]=e[n]);return r};const longTextCls=`${index.prefix}-longText`,TextDom=React.forwardRef((e,t)=>{var r=e,{text:n,overflowMaxLines:c,style:o}=r,f=__objRest(r,["text","overflowMaxLines","style"]);const a={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},l={display:"-webkit-box",WebkitLineClamp:c,WebkitBoxOrient:"vertical",overflow:"hidden"},u=c>1?l:a,s=__spreadValues(__spreadValues({},u),o!=null?o:{});return React__default.default.createElement("div",__spreadValues({style:s,ref:t},f),n)}),LongText=e=>{const{text:t,placement:r="bottom",icon:n=React__default.default.createElement(icons.SearchOutlined,null),openByText:c,style:o,isToolTips:f,overflowMaxLines:a=1}=e,l=React.useRef(null),u=ahooks.useSize(l),s=React.useMemo(()=>{var i,d,v,p;return a>1?l.current&&((i=l.current)==null?void 0:i.clientHeight)<((d=l.current)==null?void 0:d.scrollHeight):l.current&&((v=l.current)==null?void 0:v.clientWidth)<((p=l.current)==null?void 0:p.scrollWidth)},[u]);if(c){let i={placement:r,overlayClassName:`${longTextCls}-popover`,content:t,key:`${s}`};return s||Object.assign(i,{open:!1}),f?React__default.default.createElement(antd.Tooltip,__spreadProps(__spreadValues({},i),{title:t}),React__default.default.createElement(TextDom,{overflowMaxLines:a,style:o,ref:l,text:t})):React__default.default.createElement(antd.Popover,__spreadValues({},i),React__default.default.createElement(TextDom,{overflowMaxLines:a,style:o,ref:l,text:t}))}return React__default.default.createElement("div",{className:longTextCls,style:o},React__default.default.createElement(TextDom,{overflowMaxLines:a,style:o,ref:l,text:t}),s&&React__default.default.createElement(antd.Popover,{placement:r,overlayClassName:`${longTextCls}-popover`,content:t},n))};module.exports=LongText;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation"),util=require("./util.js"),useUpdateRectList=require("./useUpdateRectList.js"),_=require("lodash"),useToolStyle=require("../../hooks/useToolStyle.js"),index=require("../../store/toolConfig/index.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(l,u,c)=>u in l?__defProp(l,u,{enumerable:!0,configurable:!0,writable:!0,value:c}):l[u]=c,__spreadValues=(l,u)=>{for(var c in u||(u={}))__hasOwnProp.call(u,c)&&__defNormalProp(l,c,u[c]);if(__getOwnPropSymbols)for(var c of __getOwnPropSymbols(u))__propIsEnum.call(u,c)&&__defNormalProp(l,c,u[c]);return l},__spreadProps=(l,u)=>__defProps(l,__getOwnPropDescs(u)),__async=(l,u,c)=>new Promise((a,p)=>{var I=d=>{try{D(c.next(d))}catch(R){p(R)}},x=d=>{try{D(c.throw(d))}catch(R){p(R)}},D=d=>d.done?a(d.value):Promise.resolve(d.value).then(I,x);D((c=c.apply(l,u)).next())});const PointCloud2DRectOperationView=l=>{var u,c;const{mappingData:a,size:p,config:I,checkMode:x,afterImgOnLoad:D,shouldExcludePointCloudBoxListUpdate:d}=l,{selectBoxVisibleSwitch:R}=index(),P=(u=a==null?void 0:a.url)!=null?u:"",b=(c=a==null?void 0:a.fallbackUrl)!=null?c:"",{pointCloudBoxList:S,setPointCloudResult:L,defaultAttribute:E,rectList:O,addRectIn2DView:Q,updateRectIn2DView:W,removeRectIn2DView:X,updateRectListByReducer:Y,selectedIDs:v,setSelectedIDs:V}=React.useContext(PointCloudContext.PointCloudContext),{value:q}=useToolStyle.useToolStyleContext(),Z=ahooks.useLatest(v),{update2DViewRect:ee,remove2DViewRect:te}=usePointCloudViews.usePointCloudViews(),j=React__default.default.useRef(null),o=React.useRef(null),M=ahooks.useMemoizedFn(ee),w=ahooks.useMemoizedFn(te),y=React.useRef(null),[re,A]=React.useState(!0),[F,T]=React.useState(""),[ne,k]=React.useState(!1),g=React.useMemo(()=>O==null?void 0:O.filter(e=>e.imageName===(a==null?void 0:a.path)),[a==null?void 0:a.path,O]),z=React.useRef(g),C=ahooks.useLatest(a==null?void 0:a.path),B=React.useCallback(e=>__async(void 0,null,function*(){try{const n=Z.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(n.length){const r=new Set(n),i=t.filter(s=>r.has(s.id)).map(s=>s.id);V(i)}return t}catch(n){}}),[V]),H=e=>{const{boxID:n}=e;if(!d&&n){B(()=>{const t=M==null?void 0:M(e);return t?(y.current=t,L(t),t):null});return}W(e,!0)},J=e=>{C.current&&Q(__spreadProps(__spreadValues({},e),{imageName:C.current}))},$=e=>{if(e.length===0)return;if(!d){const t=e.find(r=>r.boxID);if(t){B(()=>{const r=w==null?void 0:w(t);return r?(y.current=r,L(r),h(),r):null});return}}const n=e.find(t=>t.extId);n&&B(()=>{const{imageName:t,extId:r}=n,i=w==null?void 0:w({boxID:r,imageName:t});return i?(y.current=i,L(i),i):null}),X(e)},oe=ahooks.useMemoizedFn(()=>{let e=[];return S.forEach(n=>{const{rects:t=[],id:r,attribute:i,trackID:s}=n,f=t.find(N=>N.imageName===C.current),m=r+"_"+C.current;f&&(e=[...e,__spreadProps(__spreadValues({},f),{boxID:r,id:m,attribute:i,order:s})])}),e}),h=useUpdateRectList.useUpdateRectList(()=>{var e,n,t,r,i;const s=d?[]:oe(),f=(e=o.current)==null?void 0:e.selectedRectID,m=v.slice(0),N=R?util.selectSpecifiedRectsFromTopViewSelectedIds(m,s,g):[...s,...g];let K=[];!R&&(v==null?void 0:v.length)&&(K=s.filter(U=>f?v.includes(U.boxID)&&!f.includes(U.boxID):v.includes(U.boxID))),(n=o.current)==null||n.setHighLightRectList(K),(t=o.current)==null||t.setResult(N),F?((r=o.current)==null||r.setSelectedRectID(F),T("")):ne&&f&&((i=o.current)==null||i.setSelectedRectID(f),k(!1))}),G=({targetId:e,id:n})=>{V(e),T(n)};return React.useEffect(()=>{if(j.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:j.current,size:p,config:__spreadProps(__spreadValues({},I),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:x});return o.current=e,o.current.init(),o.current.on("updateDragResult",H),o.current.on("afterAddingDrawingRect",J),o.current.on("deleteSelectedRects",$),o.current.on("onRightClick",G),()=>{var n,t,r,i,s;(n=o.current)==null||n.unbind("updateDragResult",H),(t=o.current)==null||t.unbind("afterAddingDrawingRect",J),(r=o.current)==null||r.unbind("deleteSelectedRects",$),(i=o.current)==null||i.unbind("onRightClick",G),(s=o.current)==null||s.destroy()}}},[]),React.useEffect(()=>{const e=t=>__async(void 0,null,function*(){try{return yield lbAnnotation.ImgUtils.load(t)}catch(r){return console.error("Error loading image:",r),null}}),n=()=>__async(void 0,null,function*(){var t;A(!0);let r=yield e(P);!r&&b&&(r=yield e(b)),r&&((t=o.current)==null||t.setImgNode(r),D(r)),A(!1)});o.current&&(P||b)&&n()},[P,b]),React.useEffect(()=>{var e;(e=o.current)==null||e.setSize(p)},[p]),React.useEffect(()=>{S!==y.current&&h()},[S]),React.useEffect(()=>{var e,n;const t=g.find(r=>r.id===o.current.selectedRectID);(n=(e=o.current)==null?void 0:e.setDefaultAttribute)==null||n.call(e,E),t&&Y(r=>{var i;const s=[];let f=null;return r.forEach(m=>{m.id!==o.current.selectedRectID?s.push(m):f=m}),t.extId===void 0&&(f=(i=o.current)==null?void 0:i.selectedRect),[...s,__spreadProps(__spreadValues({},f||{}),{attribute:E})]}),k(!0),h()},[E]),React.useEffect(()=>{const e=z.current;___default.default.isEqual(e,g)||(k(!0),h(),z.current=g)},[g]),React.useEffect(()=>{h()},[d]),React.useEffect(()=>{var e,n,t,r;const i=(n=(e=o.current)==null?void 0:e.config)!=null?n:{},s=__spreadProps(__spreadValues({},i),{attributeList:(t=I.attributeList)!=null?t:[]});(r=o.current)==null||r.setConfig(JSON.stringify(s))},[I.attributeList]),React.useEffect(()=>{var e;(e=o.current)==null||e.setEnableAddRect(v.length===0),h()},[v]),React.useEffect(()=>{const{hiddenText:e}=q||{};if(e===void 0)return;const n=o.current;if(!n)return;const t=__spreadValues(__spreadValues({},n.style),q);n.setStyle(t)},[q]),React.useEffect(()=>{h()},[R]),React__default.default.createElement(es.Spin,{spinning:re},React__default.default.createElement("div",{ref:j,style:__spreadValues({position:"relative"},p)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ahooks=require("ahooks");const useUpdateRectList=e=>{const{run:t}=ahooks.useDebounceFn(e,{wait:100});return t};exports.useUpdateRectList=useUpdateRectList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const selectSpecifiedRectsFromTopViewSelectedIds=(t,r,s)=>{if(t.length){const c=new Set(t),o=r.filter(({boxID:e})=>c.has(e)),d=s.filter(e=>e.extId&&c.has(e.extId));return[...o,...d]}return[...r,...s]};exports.selectSpecifiedRectsFromTopViewSelectedIds=selectSpecifiedRectsFromTopViewSelectedIds;
|
|
@@ -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"),index$1=require("../pointCloud2DRectOperationView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,
|
|
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(),x=useSize(t),{url:m,fallbackUrl:p,calib:v,path:j}=e,{toggle2dVisible:q,isHighlightVisible:P}=useHighlight.useHighlight({currentData:i}),[B,k]=React.useState(!1),{highlight2DLoading:_,setHighlight2DLoading:C,cuboidBoxIn2DView:f,cacheImageNodeSize:I,setSelectedIDs:R,pointCloudBoxList:V}=React.useContext(PointCloudContext.PointCloudContext),{value:z}=useToolStyle.useToolStyleContext(),{hiddenText:H}=z||{},O=!e,E=React.useMemo(()=>({zIndex:s?-1:101,is2DView:!f,imageName:e.path}),[s,f,e.path]),{rendered:N,isLinking:T}=useDataLinkSwitch(E),S=n=>{g(),I({path:j,imgNode:n})},g=React.useCallback(()=>{var n,b;const y=(n=o.current)==null?void 0:n.toolInstance;if(u(""),!d||!y)return;const r=e.annotations.find($=>$.annotation.id===d.info.id);let L="";r&&((b=r==null?void 0:r.annotation.pointList)==null?void 0:b.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*(){k(!0),C(!0);try{yield q(m,p!=null?p:"",v)}catch(n){console.error("highlightOnClick error:",n)}finally{k(!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:x,ref:o,globalStyle:{display:O?"none":"block"},afterImgOnLoad:S,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:h,onRightClick:({targetId:n})=>R(n),pointCloudBoxList:V,hiddenText:H}):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{shouldExcludePointCloudBoxListUpdate:!T,mappingData:e,size:x,checkMode:a,afterImgOnLoad:S}),!a&&N),v&&React__default.default.createElement(index$2,{visible:P(m),onClick:U,loading:B,disabled:_,style:{position:"absolute",right:16,top:16,zIndex:s?-1:101}}))};module.exports=PointCloud2DSingleView;
|
|
@@ -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"),
|
|
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
|
-
"use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index$1=require("./components/PointCloudSizeSlider/index.js"),index$2=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index$1=require("./components/PointCloudSizeSlider/index.js"),index$2=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),useToolStyle=require("../../hooks/useToolStyle.js");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(n,a,i)=>a in n?__defProp(n,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[a]=i,__spreadValues=(n,a)=>{for(var i in a||(a={}))__hasOwnProp.call(a,i)&&__defNormalProp(n,i,a[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(a))__propIsEnum.call(a,i)&&__defNormalProp(n,i,a[i]);return n},__spreadProps=(n,a)=>__defProps(n,__getOwnPropDescs(a));const EKeyCode=lbAnnotation.cKeyCode.default,pointCloudID="LABELBEE-POINTCLOUD",PointCloud3DContext=React__default.default.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),PointCloudViewIcon=({perspectiveView:n})=>{const{isActive:a,setTarget3DView:i}=React.useContext(PointCloud3DContext),c=t=>classNames__default.default({[dom.getClassName("point-cloud-3d-view",t)]:!0,active:a});return React__default.default.createElement("span",{onClick:()=>{i(lbUtils.EPerspectiveView[n])},className:c(n.toLocaleLowerCase())})},PointCloud3DSideBar=({isEnlarge:n})=>{const{reset3DView:a,followTopView:i}=React.useContext(PointCloud3DContext),{t:c}=reactI18next.useTranslation(),t=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Top"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Front"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Left"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Back"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Right"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"LFT"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"RBT"})),p=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(antd.Tooltip,{title:c("CameraFollowTopView")},React__default.default.createElement("span",{onClick:()=>{i()},className:dom.getClassName("point-cloud-3d-view","followTop")})),React__default.default.createElement("span",{onClick:()=>{a()},className:dom.getClassName("point-cloud-3d-view","reset")}));return n?React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebarZoom")},p,t):React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebar")},t,p)},PointCloud3D=({currentData:n,config:a,highlightAttribute:i})=>{var c;const t=React.useContext(PointCloudContext.PointCloudContext),[p,T]=React.useState(!0),[m,C]=React.useState(!1),f=React.useRef(null),{initPointCloud3d:P}=usePointCloudViews.usePointCloudViews(),v=useSize(f),{t:V}=reactI18next.useTranslation(),{value:x}=useToolStyle.useToolStyleContext(),{hiddenText:_}=x||{};React.useEffect(()=>{let e=t.mainViewInstance;e&&e.updateHiddenTextAndRender(_,t.pointCloudBoxList)},[x]),React.useEffect(()=>{!t.mainViewInstance||P==null||P(v)},[v]);const{selectedBox:u}=useSingleBox.useSingleBox(),{selectedSphere:w}=useSphere.useSphere(),[y,h]=React.useState(!0),g=e=>{var o,l;const r=u==null?void 0:u.info;if(r){const s=__spreadValues({},r.center);s.x=s.x-.01,s.z=1e3;const d=e===lbUtils.EPerspectiveView.Top;(o=t.mainViewInstance)==null||o.updateCameraByBox(r,e,d?s:void 0)}w&&((l=t.mainViewInstance)==null||l.updateCameraBySphere(w,e))},b=()=>{var e;(e=t.mainViewInstance)==null||e.resetCamera()},N=()=>{var e,o;const l=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance.camera;l&&((o=t.mainViewInstance)==null||o.applyCameraTarget(l))};React.useEffect(()=>{if(f.current&&(n==null?void 0:n.url)){let e=t.mainViewInstance;!e&&v.width&&(e=new lbAnnotation.PointCloud({container:f.current,isOrthographicCamera:!0,orthographicParams:lbUtils.PointCloudUtils.getDefaultOrthographicParams(v),config:a,hiddenText:_}),e.setHandlerPipe({setSelectedIDs:t.setSelectedIDs,setNeedUpdateCenter:h}),t.setMainViewInstance(e))}},[v,n]),React.useEffect(()=>{var e;if(f.current&&(n==null?void 0:n.url)&&n.result&&t.mainViewInstance){let o=t.mainViewInstance;const l=lbUtils.PointCloudUtils.getBoxParamsFromResultList(n.result);l.forEach(s=>{var d;const E=(d=lbUtils.toolStyleConverter.getColorFromConfig({attribute:s.attribute},__spreadProps(__spreadValues({},a),{attributeConfigurable:!0}),{}))==null?void 0:d.hex;o==null||o.addBoxToSense(s,E)}),o.render(),t.setPointCloudResult(l);const r=lbUtils.PointCloudUtils.getRectParamsFromResultList(n.result);t.setRectList(r),t.setPointCloudValid((e=index.jsonParser(n.result))==null?void 0:e.valid)}},[n,t.mainViewInstance]),React.useEffect(()=>{var e,o,l,r,s;const d=(e=u==null?void 0:u.info)==null?void 0:e.id;if(!y){h(!0);return}if(d!==void 0){g(lbUtils.EPerspectiveView.Top);const E=(r=(l=(o=t.topViewInstance)==null?void 0:o.pointCloudInstance)==null?void 0:l.camera.zoom)!=null?r:1;(s=t.mainViewInstance)==null||s.updateCameraZoom(E)}},[(c=u==null?void 0:u.info)==null?void 0:c.id]),React.useEffect(()=>{var e,o,l,r;if(w){g(lbUtils.EPerspectiveView.Top);const s=(l=(o=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:o.camera.zoom)!=null?l:1;(r=t.mainViewInstance)==null||r.updateCameraZoom(s)}},[w]),React.useEffect(()=>(window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I)}),[]);const I=e=>{if(e.keyCode===EKeyCode.Esc){C(!1);return}},S=React.useMemo(()=>({reset3DView:b,setTarget3DView:g,isActive:!!u,followTopView:N}),[u,t.mainViewInstance]);React.useEffect(()=>{var e,o,l;const r=t.pointCloudBoxList.filter(s=>s.attribute===i);(r==null?void 0:r.length)>0&&((e=t.mainViewInstance)==null||e.clearHighlightBoxes(),(o=t.mainViewInstance)==null||o.highlightBoxes(r)),r.length===0&&((l=t.mainViewInstance)==null||l.clearHighlightBoxesAndRender())},[i,t.mainViewInstance]);const B=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{onChange:e=>{var o;(o=t.mainViewInstance)==null||o.updatePointSize({customSize:e})}}),React__default.default.createElement("span",{style:{marginRight:8}},V("ShowArrows")),React__default.default.createElement(antd.Switch,{size:"small",checked:p,onChange:e=>{var o;T(e),(o=t.mainViewInstance)==null||o.setShowDirection(e)}}),m&&React__default.default.createElement(PointCloud3DContext.Provider,{value:S},React__default.default.createElement(PointCloud3DSideBar,{isEnlarge:m})));return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-3d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:m}),title:m?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{C(!1)}}),V("3DView")):React__default.default.createElement(index$2,{title:V("3DView"),onClick:()=>{C(!0)}}),toolbar:B},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-content")},!m&&React__default.default.createElement(PointCloud3DContext.Provider,{value:S},React__default.default.createElement(PointCloud3DSideBar,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-view"),id:pointCloudID,ref:f})))};var PointCloud3DView=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud3D);module.exports=PointCloud3DView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),dom=require("../../utils/dom.js"),PointCloudLayout=require("./PointCloudLayout.js"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),useZoom=require("./hooks/useZoom.js"),PointCloudInfos=require("./PointCloudInfos.js"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js"),index$1=require("./components/EmptyPage/index.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),ToolUtils=require("../../utils/ToolUtils.js"),index=require("./components/TitleButton/index.js");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var React__default=_interopDefaultLegacy(React);const TransferCanvas2WorldOffset=(n,s,l=1)=>{const{width:e,height:o}=s,t={x:n.x+e*l/2,y:n.y+o*l/2},c={x:s.width/2,y:s.height/2};return{offsetX:(c.x-t.x)/l,offsetY:-(c.y-t.y)/l}},updateBackViewByCanvas2D=(n,s,l,e,o)=>{const{offsetX:t,offsetY:c}=TransferCanvas2WorldOffset(n,l,s);if(o.camera.zoom=s,n){const d=Math.cos(e),f=Math.sin(e),x=t*d,C=t*f,{x:v,y:i,z:u}=o.initCameraPosition;o.camera.position.set(v+C,i-x,u+c)}o.camera.updateProjectionMatrix(),o.render()},PointCloudBackView=({currentData:n,config:s,checkMode:l})=>{const e=React__default.default.useContext(PointCloudContext.PointCloudContext),o=React.useRef(null),t=useSize(o),{selectedBox:c}=useSingleBox.useSingleBox(),{selectedSphere:d}=useSphere.useSphere(),{syncBackviewToolZoom:f}=useZoom.useZoom(),{t:x}=reactI18next.useTranslation(),{backViewUpdateBox:C,backViewUpdatePoint:v}=usePointCloudViews.usePointCloudViews();return React.useEffect(()=>{if(o.current){const i={width:o.current.clientWidth,height:o.current.clientHeight},u=new lbAnnotation.PointCloudAnnotation({container:o.current,size:i,extraProps:{showDirectionLine:!1,forbidAddNew:!0,forbidDelete:!0},config:s,checkMode:l,toolName:ToolUtils.getPointCloudToolList()});e.setBackViewInstance(u)}},[]),React.useEffect(()=>{if(!t||!e.backViewInstance)return;const{toolInstance:i,pointCloudInstance:u}=e.backViewInstance;i.singleOn("renderZoom",(r,a)=>{if(e.selectedPointCloudBox){updateBackViewByCanvas2D(a,r,t,e.selectedPointCloudBox.rotation,u),f(a,r,t);return}if(d){updateBackViewByCanvas2D(a,r,t,0,u),f(a,r,t);return}}),i.singleOn("dragMove",({currentPos:r,zoom:a})=>{!e.selectedPointCloudBox&&!d||updateBackViewByCanvas2D(r,a,t,e.selectedPointCloudBox?e.selectedPointCloudBox.rotation:0,u)}),i.singleOn("updatePointByDrag",(r,a)=>{d&&(v==null||v(r,a[0]))}),i.singleOn("updatePolygonByDrag",r=>{if(e.selectedIDs.length===1&&r.length===1){const{newPolygon:a,originPolygon:p}=r[0];a&&p&&C(a,p)}})},[e,t]),React.useEffect(()=>{var i;(i=e==null?void 0:e.backViewInstance)==null||i.initSize(t)},[t]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","back-view"),title:React__default.default.createElement(index,{title:x("BackView")}),titleOnSurface:!0},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","bottom-view-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","core-instance"),ref:o}),!c&&!d&&React__default.default.createElement(index$1,null),React__default.default.createElement(PointCloudInfos.SizeInfoForView,{perspectiveView:lbUtils.EPerspectiveView.Back})))};var PointCloudBackView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudBackView);module.exports=PointCloudBackView$1;
|
|
1
|
+
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),dom=require("../../utils/dom.js"),PointCloudLayout=require("./PointCloudLayout.js"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),useZoom=require("./hooks/useZoom.js"),PointCloudInfos=require("./PointCloudInfos.js"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js"),index$1=require("./components/EmptyPage/index.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),ToolUtils=require("../../utils/ToolUtils.js"),index=require("./components/TitleButton/index.js");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var React__default=_interopDefaultLegacy(React);const TransferCanvas2WorldOffset=(n,s,l=1)=>{const{width:e,height:o}=s,t={x:n.x+e*l/2,y:n.y+o*l/2},c={x:s.width/2,y:s.height/2};return{offsetX:(c.x-t.x)/l,offsetY:-(c.y-t.y)/l}},updateBackViewByCanvas2D=(n,s,l,e,o)=>{const{offsetX:t,offsetY:c}=TransferCanvas2WorldOffset(n,l,s);if(o.camera.zoom=s,n){const d=Math.cos(e),f=Math.sin(e),x=t*d,C=t*f,{x:v,y:i,z:u}=o.initCameraPosition;o.camera.position.set(v+C,i-x,u+c)}o.camera.updateProjectionMatrix(),o.render()},PointCloudBackView=({currentData:n,config:s,checkMode:l})=>{const e=React__default.default.useContext(PointCloudContext.PointCloudContext),o=React.useRef(null),t=useSize(o),{selectedBox:c}=useSingleBox.useSingleBox(),{selectedSphere:d}=useSphere.useSphere(),{syncBackviewToolZoom:f}=useZoom.useZoom(),{t:x}=reactI18next.useTranslation(),{backViewUpdateBox:C,backViewUpdatePoint:v}=usePointCloudViews.usePointCloudViews();return React.useEffect(()=>{if(o.current){const i={width:o.current.clientWidth,height:o.current.clientHeight},u=new lbAnnotation.PointCloudAnnotation({container:o.current,size:i,extraProps:{showDirectionLine:!1,forbidAddNew:!0,forbidDelete:!0},config:s,checkMode:l,toolName:ToolUtils.getPointCloudToolList()});e.setBackViewInstance(u)}},[]),React.useEffect(()=>{if(!t||!e.backViewInstance)return;const{toolInstance:i,pointCloudInstance:u}=e.backViewInstance;i.singleOn("renderZoom",(r,a)=>{if(e.selectedPointCloudBox){updateBackViewByCanvas2D(a,r,t,e.selectedPointCloudBox.rotation,u),f(a,r,t);return}if(d){updateBackViewByCanvas2D(a,r,t,0,u),f(a,r,t);return}}),i.singleOn("dragMove",({currentPos:r,zoom:a})=>{!e.selectedPointCloudBox&&!d||updateBackViewByCanvas2D(r,a,t,e.selectedPointCloudBox?e.selectedPointCloudBox.rotation:0,u)}),i.singleOn("updatePointByDrag",(r,a)=>{d&&(v==null||v(r,a[0]))}),i.singleOn("updatePolygonByDrag",r=>{if(e.selectedIDs.length===1&&r.length===1){const{newPolygon:a,originPolygon:p}=r[0];a&&p&&C(a,p)}})},[e,t]),React.useEffect(()=>{var i;(i=e==null?void 0:e.backViewInstance)==null||i.initSize(t)},[t]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","back-view"),title:React__default.default.createElement(index,{title:x("BackView")}),titleOnSurface:!0,titleNonInteractive:!0},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","bottom-view-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","core-instance"),ref:o}),!c&&!d&&React__default.default.createElement(index$1,null),React__default.default.createElement(PointCloudInfos.SizeInfoForView,{perspectiveView:lbUtils.EPerspectiveView.Back})))};var PointCloudBackView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudBackView);module.exports=PointCloudBackView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../store/annotatedBox/index.js");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(n,e,i)=>e in n?__defProp(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,__spreadValues=(n,e)=>{for(var i in e||(e={}))__hasOwnProp.call(e,i)&&__defNormalProp(n,i,e[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(e))__propIsEnum.call(e,i)&&__defNormalProp(n,i,e[i]);return n},__spreadProps=(n,e)=>__defProps(n,__getOwnPropDescs(e)),__async=(n,e,i)=>new Promise((h,C)=>{var I=P=>{try{f(i.next(P))}catch(s){C(s)}},_=P=>{try{f(i.throw(P))}catch(s){C(s)}},f=P=>P.done?h(P.value):Promise.resolve(P.value).then(I,_);f((i=i.apply(n,e)).next())});const PointCloudContext=React__default.default.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:n=>{},imageSizes:{},cacheImageNodeSize:()=>{}}),PointCloudProvider=({children:n})=>{const[e,i]=React.useState([]),[h,C]=React.useState([]),[I,_]=React.useState([]),[f,P]=React.useState([]),[s,A]=React.useState([]),[m,x]=React.useState([]),[R,$]=React.useState(!0),[j,tt]=React.useState(!0),[z,et]=React.useState(1),[a,N]=React.useState(),[q,M]=React.useState(),[G,T]=React.useState(),[l,F]=React.useState(),[Z,ot]=React.useState(""),[V,nt]=React.useState(lbAnnotation.EToolName.Rect),it=React.useRef(new lbAnnotation.ActionsHistory).current,[c,B]=React.useState([]),[k,st]=React.useState(""),[O,lt]=React.useState(lbUtils.EPointCloudPattern.Detection),[S,U]=React.useState(void 0),[H,rt]=React.useState([]),[E,at]=React.useState([]),p=index(),[J,ut]=React.useState({}),dt=ctx.useDispatch(),ct=r=>{const{imgNode:u,path:d}=r;d&&u&&ut(g=>__spreadProps(__spreadValues({},g),{[d]:{width:u.width,height:u.height}}))},K=React.useMemo(()=>s.length===1?s[0]:"",[s]),D=React.useMemo(()=>{const r=e.find(t=>t.id===K),u=t=>{const o=e.concat(t);return i(o),o},d=t=>{const o=h.concat(t);return C(o),o},g=t=>{$(t!==!1)},v=t=>{t===void 0&&A([]),typeof t=="string"&&A([t]),Array.isArray(t)&&A(Array.from(new Set(t)))},vt=t=>{s.includes(t)?v(s.filter(o=>o!==t)):v([...s,t])},Pt=t=>{m.includes(t)?x([]):x([t])},gt=()=>{if(V===lbAnnotation.EToolName.Rect){const t=e.map(o=>o.id);v(t),a==null||a.pointCloud2dOperation.setSelectedIDs(t)}},ft=t=>{v(e.filter(o=>o.attribute===t).map(o=>o.id))},Q=e.filter(t=>!c.includes(t.attribute)),W=h.filter(t=>!c.includes(t.attribute)),X=f.filter(t=>t.attribute&&!c.includes(t.attribute)),ht=t=>{if(c.includes(t))B(c.filter(o=>o!==t));else{const o=c.concat(t);B(o)}},St=(t=Q,o=I,y=W,w=X,L=H)=>{var b;l==null||l.clearAllBox(),l==null||l.clearAllSphere(),a==null||a.updatePolygonList(t,o),a==null||a.updatePointList(y),a==null||a.updateLineList(w),l==null||l.generateBoxes(t),l==null||l.generateSpheres(y),(b=S==null?void 0:S.store)==null||b.updateCurrentSegment(L),Y(t)},bt=()=>{N(void 0),M(void 0),T(void 0),F(void 0)},Y=(t,o)=>__async(void 0,null,function*(){var y;if(!l)return;const w=l.pointCloudObject;if(!!w)try{const L=yield l.getHighlightIndexByMappingImgList({mappingImgList:o!=null?o:E,points:w.geometry.attributes.position.array}),b=yield l==null?void 0:l.highlightOriginPointCloud(t,L);return b&&((y=a==null?void 0:a.pointCloudInstance)==null||y.updateColor(b)),b}catch(L){console.error(L)}});return{selectedID:K,pointCloudBoxList:e,pointCloudSphereList:h,displayPointCloudList:Q,displaySphereList:W,displayLineList:X,selectedIDs:s,setPointCloudResult:i,setSelectedIDs:v,addPointCloudBox:u,addPointCloudSphere:d,setPointCloudSphereList:C,valid:R,selectedPointCloudBox:r,setPointCloudValid:g,addSelectedID:vt,addHighlightID:Pt,selectedAllBoxes:gt,topViewInstance:a,setTopViewInstance:N,sideViewInstance:q,setSideViewInstance:M,backViewInstance:G,setBackViewInstance:T,mainViewInstance:l,setMainViewInstance:F,polygonList:I,setPolygonList:_,lineList:f,setLineList:P,zoom:z,setZoom:et,history:it,toggleAttributesVisible:ht,hideAttributes:c,setHideAttributes:B,reRender:St,attrPanelLayout:k,setAttrPanelLayout:st,syncAllViewPointCloudColor:Y,defaultAttribute:Z,setDefaultAttribute:ot,pointCloudPattern:V,setPointCloudPattern:nt,selectSpecAttr:ft,globalPattern:O,setGlobalPattern:t=>{O!==t&&(dt(actionCreators.ChangeSave),lt(t),t===lbUtils.EPointCloudPattern.Detection&&U(void 0))},ptSegmentInstance:S,setPtSegmentInstance:U,segmentation:H,setSegmentation:rt,clearAllDetectionInstance:bt,highlight2DDataList:E,setHighlight2DDataList:at,cuboidBoxIn2DView:j,setCuboidBoxIn2DView:tt,imageSizes:J,cacheImageNodeSize:ct,highlightIDs:m,setHighlightIDs:x}},[R,s,e,h,I,f,a,q,G,l,z,c,k,Z,V,O,S,H,E,j,J,m]);React.useEffect(()=>{var r,u,d;(r=p==null?void 0:p.setPointCloudBoxList)==null||r.call(p,e),(u=p==null?void 0:p.setHighlightIDs)==null||u.call(p,m),(d=p==null?void 0:p.setSelectedIDs)==null||d.call(p,s)},[e,s,m]),React.useEffect(()=>{var r;(r=p==null?void 0:p.setPtCtx)==null||r.call(p,D)},[D]);const pt=()=>{const r=e.filter(v=>c.includes(v.attribute)),{setSelectedIDs:u,reRender:d}=D,g=r.map(v=>v.id);g.length>0&&u(s.filter(v=>!g.includes(v))),d()};return React.useEffect(()=>{var r,u,d,g;pt(),(u=(r=a==null?void 0:a.toolInstance)==null?void 0:r.setHiddenAttributes)==null||u.call(r,c),(g=(d=S==null?void 0:S.store)==null?void 0:d.setHiddenAttributes)==null||g.call(d,c)},[c]),React__default.default.createElement(PointCloudContext.Provider,{value:D},n)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),ToolPointCloudBoxRenderHelper=require("../../utils/ToolPointCloudBoxRenderHelper.js"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../store/annotatedBox/index.js"),_=require("lodash"),map=require("./utils/map.js"),useTimeoutFunc=require("./hooks/useTimeoutFunc.js"),useWindowKeydownListener=require("./hooks/useWindowKeydownListener.js");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,i,d)=>i in r?__defProp(r,i,{enumerable:!0,configurable:!0,writable:!0,value:d}):r[i]=d,__spreadValues=(r,i)=>{for(var d in i||(i={}))__hasOwnProp.call(i,d)&&__defNormalProp(r,d,i[d]);if(__getOwnPropSymbols)for(var d of __getOwnPropSymbols(i))__propIsEnum.call(i,d)&&__defNormalProp(r,d,i[d]);return r},__spreadProps=(r,i)=>__defProps(r,__getOwnPropDescs(i)),__async=(r,i,d)=>new Promise((x,D)=>{var A=u=>{try{I(d.next(u))}catch(R){D(R)}},O=u=>{try{I(d.throw(u))}catch(R){D(R)}},I=u=>u.done?x(u.value):Promise.resolve(u.value).then(A,O);I((d=d.apply(r,i)).next())});const pickRectObject=r=>___default.default.pick(r,["id","attribute","width","height","x","y","imageName"]),PointCloudContext=React__default.default.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:r=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:r=>!1,removeRectBySpecifyId:(r,i,d)=>!1,removeRectByPointCloudBoxId:r=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:useWindowKeydownListener.getEmptyUseWindowKeydownListener()}),PointCloudProvider=({children:r})=>{const[i,d]=React.useState([]),[x,D]=React.useState([]),[A,O]=React.useState([]),[I,u]=React.useState([]),[R,Re]=React.useState([]),[v,N]=React.useState([]),[B,j]=React.useState([]),[U,xe]=React.useState(!0),[Z,Le]=React.useState(2),[J,De]=React.useState(!0),[Q,Ae]=React.useState(1),[f,X]=React.useState(),[Y,$]=React.useState(),[ee,te]=React.useState(),[g,oe]=React.useState(),[ne,Be]=React.useState(""),[F,_e]=React.useState(lbAnnotation.EToolName.Rect),q=React.useRef(new lbAnnotation.ActionsHistory).current,[p,T]=React.useState([]),[ie,Ve]=React.useState(""),[z,Ne]=React.useState(lbUtils.EPointCloudPattern.Detection),[L,se]=React.useState(void 0),[W,He]=React.useState([]),[G,Me]=React.useState([]),[re,ke]=React.useState(!1),h=index(),[le,Ee]=React.useState({}),Oe=ctx.useDispatch(),je=o=>{const{imgNode:n,path:t}=o;t&&n&&Ee(a=>__spreadProps(__spreadValues({},a),{[t]:{width:n.width,height:n.height}}))},ae=React.useMemo(()=>v.length===1?v[0]:"",[v]),de=useWindowKeydownListener.default(),H=React.useCallback((o,n,t="extId")=>{const a=t||"id",l=new Set(n);return u(c=>{let S=!1;const P=c.filter(k=>{const K=k[a],E=l.has(K)?k.imageName!==o:!0;return E||(S=!0),E});return S?P:c}),!0},[]),ce=React.useCallback(o=>{const n=i.map(t=>t.id);return H(o,n,"extId")},[i,H]),ue=React.useCallback(o=>{if(!o)return!1;const n=i.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:a,attribute:l,trackID:c}=t,S=t.rects.find(P=>P.imageName===o);if(S){const P=___default.default.pick(S,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},P),{id:lbAnnotation.uuid(),attribute:l,order:c,extId:a,lineDash:[]})}return null}).filter(t=>t!==null);return n.length?(u(t=>{const a=new Set(t.filter(c=>o===c.imageName).map(c=>c.extId)),l=n.filter(c=>a.has(c.extId)===!1);return l.length?[...t,...l]:t}),!0):!1},[i]),ge=React.useMemo(()=>i.filter(n=>Array.isArray(n.rects)&&n.rects.length>0).reduce((n,t)=>{var a;return(a=t.rects)==null||a.forEach(l=>{const{imageName:c}=l;if(!c){console.warn("Missing image name"),console.trace(l,t);return}map.addMapIndirectWeakSetItem(n,c,t.id,t)}),n},new Map),[i]),fe=React.useCallback(o=>{u(n=>o(n,pickRectObject))},[pickRectObject]),pe=React.useMemo(()=>I.filter(o=>o.extId!==void 0&&o.id!==void 0).reduce((o,n)=>{const t=n.imageName;return t?(map.addMapIndirectWeakSetItem(o,t,n.extId,n),o):(console.warn("missing image name"),console.log(n,I),o)},new Map),[I]),{fn:Fe}=useTimeoutFunc.default(o=>{N(n=>{const t=o,a=new Set(t);let l=!1;const c=n.filter(S=>{const P=a.has(S);return P||(l=!0),P});return l?c:n})},200),he=React.useCallback(o=>{const n=o.map(t=>t.id);d(o),Fe(n)},[]),M=React.useMemo(()=>{const o=i.find(e=>e.id===ae),n=e=>{const s=i.concat(e);return he(s),s},t=e=>{const s=x.concat(e);return D(s),s},a=e=>{xe(e!==!1)},l=e=>{e===void 0&&N([]),typeof e=="string"&&N([e]),Array.isArray(e)&&N(Array.from(new Set(e)))},c=e=>{v.includes(e)?l(v.filter(s=>s!==e)):l([...v,e])},S=e=>{const s=pickRectObject(e);u(m=>[...m,s])},P=(e,s=!1)=>{const m=pickRectObject(e);u(C=>C.map(w=>w.id===e.id?s?__spreadValues(__spreadValues({},w),m):m:w))},k=e=>{u(s=>s.filter(m=>!e.find(C=>C.id===m.id)))},K=e=>{B.includes(e)?j([]):j([e])},E=()=>{if(F===lbAnnotation.EToolName.Rect){const e=i.map(s=>s.id);l(e),f==null||f.pointCloud2dOperation.setSelectedIDs(e)}},Te=e=>{l(i.filter(s=>s.attribute===e).map(s=>s.id))},me=i.filter(e=>!p.includes(e.attribute)),ve=x.filter(e=>!p.includes(e.attribute)),Pe=R.filter(e=>e.attribute&&!p.includes(e.attribute)),ze=e=>{if(p.includes(e))T(p.filter(s=>s!==e));else{const s=p.concat(e);T(s)}},We=(e=me,s=A,m=ve,C=Pe,w=W)=>{var V;g==null||g.clearAllBox(),g==null||g.clearAllSphere(),f==null||f.updatePolygonList(e,s),f==null||f.updatePointList(m),f==null||f.updateLineList(C),g==null||g.generateBoxes(e),g==null||g.generateSpheres(m),(V=L==null?void 0:L.store)==null||V.updateCurrentSegment(w),Ie(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,e)},Ge=()=>{X(void 0),$(void 0),te(void 0),oe(void 0)},Ie=(e,s,m)=>__async(void 0,null,function*(){var C,w,V;if(!g)return;const Se=g.pointCloudObject;if(!Se)return;let Ce=[],we=[];try{if(s&&q.record.length){const{record:y,recordIndex:b}=q;let ye=b;b>0&&(e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleToggleValid||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleRotate||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single&&s.length===((C=y[b])==null?void 0:C.pointCloudBoxList.length))&&(ye=b-1);let Ke=(w=y[ye])==null?void 0:w.pointCloudBoxList;const be=ToolPointCloudBoxRenderHelper.calcResetAreasAndBoxIds(e,s,Ke);Ce=be.modifiedBoxIds,we=be.resetAreas}}catch(y){console.error("call calcResetAreasAndBoxIds error",y)}try{const y=yield g.getHighlightIndexByMappingImgList({mappingImgList:m!=null?m:G,points:Se.geometry.attributes.position.array}),b=yield g==null?void 0:g.highlightOriginPointCloud(s,y,{modifiedBoxIds:Ce,resetAreas:we});return b&&((V=f==null?void 0:f.pointCloudInstance)==null||V.updateColor(b)),b}catch(y){console.error("call highlightOriginPointCloud error",y)}});return{selectedID:ae,pointCloudBoxList:i,pointCloudSphereList:x,displayPointCloudList:me,displaySphereList:ve,displayLineList:Pe,selectedIDs:v,setPointCloudResult:he,setSelectedIDs:l,addPointCloudBox:n,addPointCloudSphere:t,setPointCloudSphereList:D,valid:U,selectedPointCloudBox:o,setPointCloudValid:a,addSelectedID:c,addHighlightID:K,selectedAllBoxes:E,topViewInstance:f,setTopViewInstance:X,sideViewInstance:Y,setSideViewInstance:$,backViewInstance:ee,setBackViewInstance:te,mainViewInstance:g,setMainViewInstance:oe,polygonList:A,setPolygonList:O,rectList:I,setRectList:u,addRectIn2DView:S,removeRectIn2DView:k,updateRectIn2DView:P,lineList:R,setLineList:Re,zoom:Q,setZoom:Ae,history:q,toggleAttributesVisible:ze,hideAttributes:p,setHideAttributes:T,reRender:We,attrPanelLayout:ie,setAttrPanelLayout:Ve,syncAllViewPointCloudColor:Ie,defaultAttribute:ne,setDefaultAttribute:Be,pointCloudPattern:F,setPointCloudPattern:_e,selectSpecAttr:Te,globalPattern:z,setGlobalPattern:e=>{z!==e&&(Oe(actionCreators.ChangeSave),Ne(e),e===lbUtils.EPointCloudPattern.Detection&&se(void 0))},ptSegmentInstance:L,setPtSegmentInstance:se,segmentation:W,setSegmentation:He,clearAllDetectionInstance:Ge,highlight2DDataList:G,setHighlight2DDataList:Me,highlight2DLoading:re,setHighlight2DLoading:ke,cuboidBoxIn2DView:J,setCuboidBoxIn2DView:De,imageSizes:le,cacheImageNodeSize:je,highlightIDs:B,setHighlightIDs:j,removeRectByPointCloudBoxId:ce,removeRectBySpecifyId:H,addRectFromPointCloudBoxByImageName:ue,rectRotateSensitivity:Z,setRectRotateSensitivity:Le,imageNamePointCloudBoxMap:ge,linkageImageNameRectMap:pe,updateRectListByReducer:fe,windowKeydownListenerHook:de}},[U,v,i,x,A,R,I,f,Y,ee,g,Q,p,ie,ne,F,z,L,W,G,re,J,le,B,ce,H,ue,Z,ge,pe,fe,de]);React.useEffect(()=>{var o,n,t;(o=h==null?void 0:h.setPointCloudBoxList)==null||o.call(h,i),(n=h==null?void 0:h.setHighlightIDs)==null||n.call(h,B),(t=h==null?void 0:h.setSelectedIDs)==null||t.call(h,v)},[i,v,B]),React.useEffect(()=>{var o;(o=h==null?void 0:h.setPtCtx)==null||o.call(h,M)},[M]);const qe=()=>{const o=i.filter(l=>p.includes(l.attribute)),{setSelectedIDs:n,reRender:t}=M,a=o.map(l=>l.id);a.length>0&&n(v.filter(l=>!a.includes(l))),t()};return React.useEffect(()=>{var o,n,t,a;qe(),(n=(o=f==null?void 0:f.toolInstance)==null?void 0:o.setHiddenAttributes)==null||n.call(o,p),(a=(t=L==null?void 0:L.store)==null?void 0:t.setHiddenAttributes)==null||a.call(t,p)},[p]),React__default.default.createElement(PointCloudContext.Provider,{value:M},r)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useSingleBox=require("./hooks/useSingleBox.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useSingleBox=require("./hooks/useSingleBox.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const DECIMAL_PLACES=2,DEFAULT_BOX_INFO_STYLE={color:"white",backgroundColor:"rgba(153, 153, 153, 0.3)",padding:"8px 10px",zIndex:20,fontSize:12},SizeInfoForView=({perspectiveView:e})=>{const{pointCloudBoxList:t,selectedID:n}=React__default.default.useContext(PointCloudContext.PointCloudContext),u=t.find(a=>a.id===n),l=reactI18next.useTranslation(),{t:i}=l;if(n&&u){const{length:a,width:c,height:r}=lbUtils.PointCloudUtils.transferBox2Kitti(u),f=e===lbUtils.EPerspectiveView.Back?[{label:i("Width"),value:c},{label:i("Height"),value:r}]:[{label:i("Length"),value:a},{label:i("Height"),value:r}];return React__default.default.createElement("div",{style:__spreadProps(__spreadValues({position:"absolute"},DEFAULT_BOX_INFO_STYLE),{bottom:"4%",left:"50%",transform:"translate(-50%, 0)",pointerEvents:"none"})},f.map((s,o)=>React__default.default.createElement("span",{key:o,style:{marginRight:o===0?16:0}},`${s.label}: ${s.value.toFixed(DECIMAL_PLACES)}`)))}return null},BoxInfos=({checkMode:e,config:t,style:n})=>{const u=React__default.default.useContext(PointCloudContext.PointCloudContext),{selectedBox:l}=useSingleBox.useSingleBox(),[i,a]=React.useState([]),c=reactI18next.useTranslation(),{t:r,i18n:f}=c,s=n;return React.useEffect(()=>{var o,p;if(!l)return;const{length:b,width:v,height:x,rotation_y:P}=lbUtils.PointCloudUtils.transferBox2Kitti(l.info),{x:g,y:_,z:h}=l.info.center;let d=[{label:"x",value:g==null?void 0:g.toFixed(DECIMAL_PLACES)},{label:"y",value:_==null?void 0:_.toFixed(DECIMAL_PLACES)},{label:"z",value:h==null?void 0:h.toFixed(DECIMAL_PLACES)},{label:r("Length"),value:b==null?void 0:b.toFixed(DECIMAL_PLACES)},{label:r("Width"),value:v==null?void 0:v.toFixed(DECIMAL_PLACES)},{label:r("Height"),value:x==null?void 0:x.toFixed(DECIMAL_PLACES)},{label:r("Rotation_y"),value:(o=lbAnnotation.UnitUtils.rad2deg(P))==null?void 0:o.toFixed(DECIMAL_PLACES)}];(p=u.mainViewInstance)==null||p.filterPointsByBox(l.info).then(m=>{var y,C;if(!m){a(d);return}d.push({label:r("PointCount"),value:`${(C=(y=l.info)==null?void 0:y.count)!=null?C:0}`}),e===!0&&l.info.subAttribute&&t&&lbUtils.PointCloudUtils.getSubAttributeName(l.info.subAttribute,t).forEach(w=>d.push(w)),a(d)})},[l,f.language]),l?React__default.default.createElement("div",{style:n||__spreadProps(__spreadValues({position:"absolute"},DEFAULT_BOX_INFO_STYLE),{right:8,bottom:8})},i.map(o=>s?React__default.default.createElement("div",{key:o.label,style:{margin:"0px 4px"}},`${o.label}: ${o.value}`):React__default.default.createElement("div",{key:o.label},React__default.default.createElement("span",{style:{width:"38px",display:"inline-block",textAlign:"end"}},o.label),": ",React__default.default.createElement("span",null,o.value)))):null},PointCloudValidity=()=>{const e=React__default.default.useContext(PointCloudContext.PointCloudContext),{t}=reactI18next.useTranslation();return e.valid===!1?React__default.default.createElement("div",{style:{position:"absolute",backgroundColor:"rgb(242, 101, 73)",color:"white",opacity:.7,left:0,top:0,fontSize:30,padding:"8px 16px",zIndex:20,width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},t("Invalid")):null};exports.BoxInfos=BoxInfos,exports.PointCloudValidity=PointCloudValidity,exports.SizeInfoForView=SizeInfoForView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var dom=require("../../utils/dom.js"),classNames=require("classnames"),React=require("react");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React);const PointCloudContainer=({title:e,toolbar:a,children:t,className:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var dom=require("../../utils/dom.js"),classNames=require("classnames"),React=require("react");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React);const PointCloudContainer=({title:e,toolbar:a,children:t,className:n,style:s,titleNonInteractive:l,titleOnSurface:r})=>React__default.default.createElement("div",{className:classNames__default.default([n,dom.getClassName("point-cloud-container")]),style:s},r?React__default.default.createElement("span",{className:dom.getClassName("point-cloud-container","header-title-box"),style:{pointerEvents:l?"none":"auto"}},e):React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","header")},e&&React__default.default.createElement("span",{className:dom.getClassName("point-cloud-container","header-title")},e),a&&React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","header-toolbar")},a)),t);exports.PointCloudContainer=PointCloudContainer;
|
|
@@ -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"),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"),reactI18next=require("react-i18next"),actionCreators=require("../../store/annotation/actionCreators.js"),__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"),reactI18next=require("react-i18next"),actionCreators=require("../../store/annotation/actionCreators.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,r,l)=>r in i?__defProp(i,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[r]=l,__spreadValues=(i,r)=>{for(var l in r||(r={}))__hasOwnProp.call(r,l)&&__defNormalProp(i,l,r[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(r))__propIsEnum.call(r,l)&&__defNormalProp(i,l,r[l]);return i},__spreadProps=(i,r)=>__defProps(i,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:i,config:r,checkMode:l,configString:_,imgIndex:f,toolInstanceRef:u,setResourceLoading:B})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:E,selectNextBox:L,selectPrevBox:q,updateSelectedBox:C,deleteSelectedPointCloudBoxAndPolygon:I}=useSingleBox.useSingleBox(),{selectedSphere:b,updatePointCloudSphere:O}=useSphere.useSphere(),{clearAllResult:w,updatePointCloudPattern:A}=useStatus.useStatus(),{copySelectedBoxes:j,pasteSelectedBoxes:T,copiedBoxes:$}=useBoxes.useBoxes({config:r,currentData:i}),{updateRotate:g}=useRotate.useRotate({currentData:i}),{updateRotateEdge:D}=useRotateEdge.useRotateEdge({currentData:i}),{updatePointCloudData:v,topViewSelectedChanged:m}=usePointCloudViews.usePointCloudViews({setResourceLoading:B}),{redo:h,undo:x,pushHistoryWithList:N,pushHistoryUnderUpdatePolygon:R,pushHistoryUnderUpdateLine:H}=useHistory.useHistory(),K=ctx.useDispatch(),{syncThreeViewsAttribute:S}=useAttribute.useAttribute(),{syncAllViewsConfig:U,reRenderTopViewRange:z}=useConfig.useConfig(),{selectedPolygon:k}=usePolygon.usePolygon(),{selectedLine:V}=useLine.useLine(),{t:y}=reactI18next.useTranslation(),F=ahooks.useLatest(i),P=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},G=(t,o)=>{var s,a;const{topViewInstance:c,mainViewInstance:n}=e;if(!c)return;const{pointCloud2dOperation:d}=c;switch(t){case"q":{g(e.rectRotateSensitivity);break}case"e":g(-Number(e.rectRotateSensitivity));break;case"g":D(-90);break;case"u":{const p=d.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;A(p);const Y={[lbAnnotation.EToolName.Polygon]:y("PolygonPattern"),[lbAnnotation.EToolName.Rect]:y("RectPattern")};antd.message.success(y("ChangePatternMsg",{pattern:Y[p]})),d.clearActiveStatus(),d.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){q();break}L(),o.preventDefault();break;case"f":E();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(F.current);break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const p=lbAnnotation.AttributeUtils.getAttributeByKeycode(o.keyCode,r.attributeList);p!==void 0&&((a=u.current)==null||a.setDefaultAttribute(p))}return}}},M=(t,o)=>{switch(t){case"c":j();break;case"v":T();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?h():x();break}}},W=ahooks.useLatest(t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||l===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){M(o,t);return}G(o,t)});return React.useEffect(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(c=>W.current(c))},[e,e.topViewInstance,e.windowKeydownListenerHook]),React.useEffect(()=>{U(r)},[_]),React.useEffect(()=>{(r==null?void 0:r.radius)&&z(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{v==null||v()},[f,e.mainViewInstance]),React.useEffect(()=>{e.setHideAttributes([])},[f]),React.useEffect(()=>{u.current.setDefaultAttribute=t=>{var o,s,a,c;S(t);const n=e.selectedPointCloudBox;if(n){n.attribute=t;const d=K(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[n],stepConfig:r,action:"viewUpdateBox"}));n.valid=d[0].valid;const p=C(n);(a=(s=(o=e==null?void 0:e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:s.setPolygonValidAndRender)==null||a.call(s,n.id,!0,n.valid),e.mainViewInstance&&(m({newSelectedBox:n,newPointCloudList:p}),e.mainViewInstance.generateBoxes(p))}if(k&&R(__spreadProps(__spreadValues({},k),{attribute:t})),V&&H(__spreadProps(__spreadValues({},V),{attribute:t})),b){const d=O(__spreadProps(__spreadValues({},b),{attribute:t}));e.mainViewInstance&&((c=e.mainViewInstance)==null||c.generateSpheres(d),m({newSelectedSphere:b,newSphereList:d}))}},u.current.setSubAttribute=(t,o)=>{var s;const a=e.selectedPointCloudBox;if(a){const c=(s=a==null?void 0:a.subAttribute)!=null?s:{};a.subAttribute=__spreadProps(__spreadValues({},c),{[t]:o}),C(a),e.mainViewInstance&&e.selectedPointCloudBox&&e.mainViewInstance.generateBox(e.selectedPointCloudBox)}},u.current.clearResult=()=>{w==null||w()},u.current.redo=()=>{h()},u.current.undo=()=>{x()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&w()})},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(()=>{v==null||v(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,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=>{N({pointCloudBoxList:t})},initRecord:()=>{}}},[]),React.useEffect(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||l)return;const s=n=>{S(n)},a=n=>{antd.message.error(n)},c=n=>{antd.message.info(n)};return o.on("syncAttribute",s),o.on("messageError",a),o.on("messageInfo",c),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",a),o.unbind("messageInfo",c)}},[e.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),React=require("react"),index$1=require("../AnnotationView/index.js"),reactRedux=require("react-redux"),PointCloudContext=require("./PointCloudContext.js"),index=require("./components/TitleButton/index.js"),antd=require("antd"),highlightSegmentWorker=require("../../_virtual/highlightSegmentWorker.js"),lbAnnotation=require("@labelbee/lb-annotation"),_=require("lodash");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,
|
|
1
|
+
"use strict";var map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),React=require("react"),index$1=require("../AnnotationView/index.js"),reactRedux=require("react-redux"),PointCloudContext=require("./PointCloudContext.js"),index=require("./components/TitleButton/index.js"),antd=require("antd"),highlightSegmentWorker=require("../../_virtual/highlightSegmentWorker.js"),lbAnnotation=require("@labelbee/lb-annotation"),_=require("lodash");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,r,o)=>r in t?__defProp(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,__spreadValues=(t,r)=>{for(var o in r||(r={}))__hasOwnProp.call(r,o)&&__defNormalProp(t,o,r[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(r))__propIsEnum.call(r,o)&&__defNormalProp(t,o,r[o]);return t},__spreadProps=(t,r)=>__defProps(t,__getOwnPropDescs(r));const PointCloudSegment2DSingleView=({path:t,url:r,fallbackUrl:o,calib:s,pcdUrl:u,highlightAttribute:c})=>{const{ptSegmentInstance:e,cacheImageNodeSize:y,imageSizes:x}=React.useContext(PointCloudContext.PointCloudContext),w=React.useRef(null),p=React.useRef(0),g=React.useRef({}),d=React.useRef(),[v,m]=React.useState([]),[D,P]=React.useState(!1),b=React.useRef(void 0);React.useEffect(()=>()=>{p.current=0,g.current={},d.current=void 0},[u]);const h=React.useCallback(()=>{var n,l,i;if(p.current=p.current+1,p.current===2){const a=(n=e==null?void 0:e.store)==null?void 0:n.originPoints;if(!a||!d.current){console.error("cacheMappingPCD2Img Error",{path:t,points:a,filterSize:d.current});return}g.current=(i=(l=lbAnnotation.pointMappingLidar2image(a,s,d.current))==null?void 0:l.pcdMapping)!=null?i:{}}},[e]),C=React.useMemo(()=>{const n=(l,i)=>{var a,S;if(l&&d.current){b.current&&((S=(a=b.current)==null?void 0:a.terminate)==null||S.call(a));const k=g.current,f=new highlightSegmentWorker;f.current=f,P(!0),f.postMessage({cacheMap:k,indexes:l,defaultRGBA:i}),f.onmessage=O=>{m(O.data.annotations),f.terminate(),P(!1),f.current=void 0}}};return _.debounce(n,100)},[]);React.useEffect(()=>{if(!(e==null?void 0:e.store))return;const n=e.store.getHighlightAttribute(c!=null?c:""),l=e==null?void 0:e.getColorFromConfig(c!=null?c:"");C(n.flat(),l.stroke)},[c,e]),React.useEffect(()=>{if(e){const n=({newAttribute:l})=>{const i=e==null?void 0:e.getColorFromConfig(l);i&&m(v.map(a=>__spreadProps(__spreadValues({},a),{defaultRGBA:i.stroke})))};return e.on("updateDefaultAttribute",n),()=>{e.unbind("updateDefaultAttribute",n)}}},[e,v]),React.useEffect(()=>{if(e){const n=l=>{if(l.cacheSegData){const{cacheSegData:i}=l;if(i==null?void 0:i.indexes){const a=e.getColorFromConfig(i.attribute);C(i==null?void 0:i.indexes,a.stroke)}}else m([])};return e.on("syncPointCloudStatus",n),e.on("loadPCDFileEnd",h),()=>{e.unbind("syncPointCloudStatus",n),e.unbind("loadPCDFileEnd",h)}}},[e,u,x]);const E=n=>{y({path:t,imgNode:n}),d.current={width:n.width,height:n.height},h()};return React__default.default.createElement("div",{key:t,style:{position:"relative"},ref:w},React__default.default.createElement(index,{title:s.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF",position:"absolute",top:10,left:10,zIndex:1}}),React__default.default.createElement(antd.Spin,{spinning:D,delay:1e3},React__default.default.createElement(index$1,{size:{width:300,height:200},key:t,src:r,fallbackSrc:o,annotations:v,afterImgOnLoad:E})))},PointCloudSegment2DView=({currentData:t,highlightAttribute:r})=>{var o;const s=(o=t.mappingImgList)!=null?o:[];return(s==null?void 0:s.length)>0?React__default.default.createElement("div",{style:{position:"absolute",height:"100%",overflowY:"scroll",zIndex:100,width:300}},s==null?void 0:s.map((u,c)=>{var e;return u.calib&&React__default.default.createElement(PointCloudSegment2DSingleView,{key:u.path+c,path:u.path,url:u.url,fallbackUrl:(e=u.fallbackUrl)!=null?e:"",calib:u.calib,pcdUrl:t.url,highlightAttribute:r})})):null};var PointCloudSegment2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSegment2DView);module.exports=PointCloudSegment2DView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),useAttribute=require("./hooks/useAttribute.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../utils/index.js");const PointCloudSegmentListener=({checkMode:v,currentData:l,imgIndex:S,highlightAttribute:a,config:p,toolInstanceRef:
|
|
1
|
+
"use strict";var React=require("react"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),useAttribute=require("./hooks/useAttribute.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../utils/index.js");const PointCloudSegmentListener=({checkMode:v,currentData:l,imgIndex:S,highlightAttribute:a,config:p,toolInstanceRef:s,configString:u})=>{const d=ctx.useDispatch(),{updateSegmentAttribute:b,updateSegmentSubAttribute:g}=useAttribute.useAttribute(),n=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:e,setSegmentation:c}=n;React.useEffect(()=>{var t;if(e&&l.url)return actionCreators.SetAnnotationLoading(d,!0),e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=l==null?void 0:l.url)!=null?t:"").then(()=>{var o,r;const i=lbUtils.PointCloudUtils.getSegmentFromResultList((o=l==null?void 0:l.result)!=null?o:"");(r=e==null?void 0:e.store)==null||r.updateCurrentSegment(i),actionCreators.SetAnnotationLoading(d,!1)}),e.on("syncSegmentData",c),()=>{e.unbind("syncSegmentData",c)}},[S,e]),React.useEffect(()=>{var t;(t=e==null?void 0:e.store)==null||t.highlightPointsByAttribute(a!=null?a:"")},[a,e]),React.useEffect(()=>{e==null||e.setConfig(index.jsonParser(u))},[u]);const C=(t,o)=>{var r,i;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("RectSelector");break;case"k":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Add);break;case"i":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(i=(r=e.store)==null?void 0:r.cacheSegData)==null?void 0:i.id);break}},m=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||v===!0)return;const o=t.key.toLocaleLowerCase();C(o)};return React.useEffect(()=>(window.addEventListener("keydown",m),s.current.setDefaultAttribute=t=>{b(t),e==null||e.emit("updateDefaultAttribute",{newAttribute:t})},s.current.setSubAttribute=(t,o)=>{g(t,o)},()=>{window.removeEventListener("keydown",m)}),[e]),React.useEffect(()=>{s.current.clearResult=()=>{!n.ptSegmentInstance||(n.ptSegmentInstance.emit("clearStash"),n.ptSegmentInstance.emit("clearAllSegmentData"))}},[n.pointCloudBoxList,n.valid,n.polygonList,n.lineList,n.pointCloudSphereList,n.ptSegmentInstance]),null};var PointCloudSegmentListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSegmentListener);module.exports=PointCloudSegmentListener$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),dom=require("../../utils/dom.js"),PointCloudLayout=require("./PointCloudLayout.js"),React=require("react"),lbUtils=require("@labelbee/lb-utils"),PointCloudContext=require("./PointCloudContext.js"),PointCloudInfos=require("./PointCloudInfos.js"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),index$1=require("./components/EmptyPage/index.js"),useSize=require("../../hooks/useSize.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),ToolUtils=require("../../utils/ToolUtils.js"),useZoom=require("./hooks/useZoom.js"),index=require("./components/TitleButton/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const TransferCanvas2WorldOffset=(t,l,e=1)=>{const{width:f,height:s}=l,c={x:t.x+f*e/2,y:t.y+s*e/2},a={x:l.width/2,y:l.height/2};return{offsetX:(a.x-c.x)/e,offsetY:-(a.y-c.y)/e}},updateSideViewByCanvas2D=(t,l,e,f,s)=>{const{offsetX:c,offsetY:a}=TransferCanvas2WorldOffset(t,e,l);if(s.camera.zoom=l,t){const u=Math.cos(f),n=Math.sin(f),x=c*u,v=c*n,{x:i,y:d,z:o}=s.initCameraPosition;s.camera.position.set(i-x,d-v,o+a)}s.camera.updateProjectionMatrix(),s.render()},PointCloudSideView=({config:t,checkMode:l})=>{const e=React__default.default.useContext(PointCloudContext.PointCloudContext),{sideViewUpdateBox:f,sideViewUpdatePoint:s}=usePointCloudViews.usePointCloudViews(),{selectedBox:c}=useSingleBox.useSingleBox(),{selectedSphere:a}=useSphere.useSphere(),u=React.useRef(null),n=useSize(u),{t:x}=reactI18next.useTranslation(),{syncSideviewToolZoom:v}=useZoom.useZoom();return React.useEffect(()=>{if(u.current){const i={width:u.current.clientWidth,height:u.current.clientHeight},d=new lbAnnotation.PointCloudAnnotation({container:u.current,size:i,extraProps:{showDirectionLine:!1,forbidAddNew:!0,forbidDelete:!0},config:t,checkMode:l,toolName:ToolUtils.getPointCloudToolList()});e.setSideViewInstance(d)}},[]),React.useEffect(()=>{if(!n||!e.sideViewInstance)return;const{toolInstance:i,pointCloudInstance:d}=e.sideViewInstance;i.singleOn("renderZoom",(o,r)=>{if(e.selectedPointCloudBox){updateSideViewByCanvas2D(r,o,n,e.selectedPointCloudBox.rotation,d),v(r,o,n);return}a&&(updateSideViewByCanvas2D(r,o,n,0,d),v(r,o,n))}),i.singleOn("dragMove",({currentPos:o,zoom:r})=>{!e.selectedPointCloudBox&&!a||updateSideViewByCanvas2D(o,r,n,e.selectedPointCloudBox?e.selectedPointCloudBox.rotation:0,d)}),i.singleOn("updatePointByDrag",(o,r)=>{a&&(s==null||s(o,r[0]))}),i.singleOn("updatePolygonByDrag",o=>{if(e.selectedIDs.length===1&&o.length===1){const{newPolygon:r,originPolygon:C}=o[0];f(r,C)}})},[e,n]),React.useEffect(()=>{var i;(i=e==null?void 0:e.sideViewInstance)==null||i.initSize(n)},[n]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","side-view"),title:React__default.default.createElement(index,{title:x("SideView")}),titleOnSurface:!0},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","bottom-view-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","core-instance"),ref:u}),!c&&!a&&React__default.default.createElement(index$1,null),React__default.default.createElement(PointCloudInfos.SizeInfoForView,{perspectiveView:lbUtils.EPerspectiveView.Left})))};var PointCloudSideView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSideView);module.exports=PointCloudSideView$1;
|
|
1
|
+
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),dom=require("../../utils/dom.js"),PointCloudLayout=require("./PointCloudLayout.js"),React=require("react"),lbUtils=require("@labelbee/lb-utils"),PointCloudContext=require("./PointCloudContext.js"),PointCloudInfos=require("./PointCloudInfos.js"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),index$1=require("./components/EmptyPage/index.js"),useSize=require("../../hooks/useSize.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),ToolUtils=require("../../utils/ToolUtils.js"),useZoom=require("./hooks/useZoom.js"),index=require("./components/TitleButton/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const TransferCanvas2WorldOffset=(t,l,e=1)=>{const{width:f,height:s}=l,c={x:t.x+f*e/2,y:t.y+s*e/2},a={x:l.width/2,y:l.height/2};return{offsetX:(a.x-c.x)/e,offsetY:-(a.y-c.y)/e}},updateSideViewByCanvas2D=(t,l,e,f,s)=>{const{offsetX:c,offsetY:a}=TransferCanvas2WorldOffset(t,e,l);if(s.camera.zoom=l,t){const u=Math.cos(f),n=Math.sin(f),x=c*u,v=c*n,{x:i,y:d,z:o}=s.initCameraPosition;s.camera.position.set(i-x,d-v,o+a)}s.camera.updateProjectionMatrix(),s.render()},PointCloudSideView=({config:t,checkMode:l})=>{const e=React__default.default.useContext(PointCloudContext.PointCloudContext),{sideViewUpdateBox:f,sideViewUpdatePoint:s}=usePointCloudViews.usePointCloudViews(),{selectedBox:c}=useSingleBox.useSingleBox(),{selectedSphere:a}=useSphere.useSphere(),u=React.useRef(null),n=useSize(u),{t:x}=reactI18next.useTranslation(),{syncSideviewToolZoom:v}=useZoom.useZoom();return React.useEffect(()=>{if(u.current){const i={width:u.current.clientWidth,height:u.current.clientHeight},d=new lbAnnotation.PointCloudAnnotation({container:u.current,size:i,extraProps:{showDirectionLine:!1,forbidAddNew:!0,forbidDelete:!0},config:t,checkMode:l,toolName:ToolUtils.getPointCloudToolList()});e.setSideViewInstance(d)}},[]),React.useEffect(()=>{if(!n||!e.sideViewInstance)return;const{toolInstance:i,pointCloudInstance:d}=e.sideViewInstance;i.singleOn("renderZoom",(o,r)=>{if(e.selectedPointCloudBox){updateSideViewByCanvas2D(r,o,n,e.selectedPointCloudBox.rotation,d),v(r,o,n);return}a&&(updateSideViewByCanvas2D(r,o,n,0,d),v(r,o,n))}),i.singleOn("dragMove",({currentPos:o,zoom:r})=>{!e.selectedPointCloudBox&&!a||updateSideViewByCanvas2D(o,r,n,e.selectedPointCloudBox?e.selectedPointCloudBox.rotation:0,d)}),i.singleOn("updatePointByDrag",(o,r)=>{a&&(s==null||s(o,r[0]))}),i.singleOn("updatePolygonByDrag",o=>{if(e.selectedIDs.length===1&&o.length===1){const{newPolygon:r,originPolygon:C}=o[0];f(r,C)}})},[e,n]),React.useEffect(()=>{var i;(i=e==null?void 0:e.sideViewInstance)==null||i.initSize(n)},[n]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","side-view"),title:React__default.default.createElement(index,{title:x("SideView")}),titleOnSurface:!0,titleNonInteractive:!0},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","bottom-view-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","core-instance"),ref:u}),!c&&!a&&React__default.default.createElement(index$1,null),React__default.default.createElement(PointCloudInfos.SizeInfoForView,{perspectiveView:lbUtils.EPerspectiveView.Left})))};var PointCloudSideView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSideView);module.exports=PointCloudSideView$1;
|