|
|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
//
|
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
|
|
import React, { ReactPortal, useEffect } from 'react';
|
|
|
|
|
import React, { ReactPortal, useEffect, useRef } from 'react';
|
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
|
import Tag from 'antd/lib/tag';
|
|
|
|
|
import { CheckOutlined, CloseCircleOutlined } from '@ant-design/icons';
|
|
|
|
|
@ -25,6 +25,8 @@ export default function HiddenIssueLabel(props: Props): ReactPortal {
|
|
|
|
|
id, message, top, left, resolved, onClick, highlight, blur,
|
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
const ref = useRef<HTMLElement>(null);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
setTimeout(highlight);
|
|
|
|
|
@ -37,10 +39,21 @@ export default function HiddenIssueLabel(props: Props): ReactPortal {
|
|
|
|
|
return ReactDOM.createPortal(
|
|
|
|
|
<CVATTooltip title={message}>
|
|
|
|
|
<Tag
|
|
|
|
|
ref={ref}
|
|
|
|
|
id={elementID}
|
|
|
|
|
onClick={onClick}
|
|
|
|
|
onMouseEnter={highlight}
|
|
|
|
|
onMouseLeave={blur}
|
|
|
|
|
onWheel={(event: React.WheelEvent) => {
|
|
|
|
|
if (ref.current !== null) {
|
|
|
|
|
const selfElement = ref.current;
|
|
|
|
|
if (event.deltaX > 0) {
|
|
|
|
|
selfElement.parentElement?.appendChild(selfElement);
|
|
|
|
|
} else {
|
|
|
|
|
selfElement.parentElement?.prepend(selfElement);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
style={{ top, left }}
|
|
|
|
|
className='cvat-hidden-issue-label'
|
|
|
|
|
>
|
|
|
|
|
|