Skip to content

Commit

Permalink
fix: Audio tool display abnormality
Browse files Browse the repository at this point in the history
  • Loading branch information
lixinghua123 committed Jul 17, 2024
1 parent db450a1 commit 80a9b49
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
height: 100%;
border: 1px solid transparent;
font-size: 12px;
overflow-y: auto;
.loop {
position: absolute;
width: 18px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ interface IProps {
zoom: number;
/** WaveSurfer region 实例 */
instance?: any;
isCheck?: boolean;
}

const { Paragraph } = Typography;
Expand Down Expand Up @@ -83,7 +84,7 @@ const ClipRegion = (props: IProps) => {
} = audioClipState;

const ref = useRef(null);
const { el, region, edgeAdsorption, clipping, instance } = props;
const { el, region, edgeAdsorption, clipping, instance, isCheck } = props;
const { attribute = '', text = '', id, start, end, subAttribute } = region;

const { id: selectedId } = selectedRegion;
Expand All @@ -96,6 +97,7 @@ const ClipRegion = (props: IProps) => {

const style: any = {
border: `2px solid ${attributeColor}`,
overflowY: isCheck ? 'initial' : 'auto', // View mode does not require scroll bars to be displayed
};

if (id === selectedId) {
Expand Down
6 changes: 6 additions & 0 deletions packages/lb-components/src/components/audioPlayer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ export const AudioPlayer = ({

useDeepCompareEffect(() => {
setSortByStartRegions(sortBy(regions, ['start']));

setRegionMap(
regions.reduce((prev, current) => {
const { id } = current;
Expand All @@ -293,6 +294,10 @@ export const AudioPlayer = ({
};
}, {}),
);
// TODO: In view mode, the frame is not displayed when switching tree nodes.
if (isCheck) {
generateRegions();
}
}, [regions]);

useEffect(() => {
Expand Down Expand Up @@ -940,6 +945,7 @@ export const AudioPlayer = ({
clipping={clipping}
zoom={zoom}
instance={getRegionInstanceById(id)}
isCheck={isCheck}
/>
) : null;
})}
Expand Down

0 comments on commit 80a9b49

Please sign in to comment.