Fix tooltip showed out when options overlay was closed

Signed-off-by: esavkin <es@m-labs.hk>
Egor Savkin 2023-09-08 15:39:38 +08:00 committed by esavkin
parent db3a5d298b
commit 3494af9808
1 changed files with 8 additions and 3 deletions

View File

@ -15,7 +15,7 @@ class Radio extends Component {
super(props); super(props);
// Initialize the state object with the initial values from the props // Initialize the state object with the initial values from the props
this.state = { this.state = {
variant: props.outvar in props.data ? props.data[props.outvar] : props.variants[ props.fallback ? props.fallback : 0 ], variant: props.outvar in props.data ? props.data[props.outvar] : props.variants[props.fallback ? props.fallback : 0],
}; };
// Bind the event handler to this // Bind the event handler to this
@ -79,7 +79,8 @@ class Radio extends Component {
} }
function RadioWrapper(target, id, data, {title, variants, outvar, fallback, icon, tip}) { function RadioWrapper(target, id, data, {title, variants, outvar, fallback, icon, tip}) {
return <Radio target={target} title={title} variants={variants} outvar={outvar} icon={icon} tip={tip} key={id} fallback={fallback} return <Radio target={target} title={title} variants={variants} outvar={outvar} icon={icon} tip={tip} key={id}
fallback={fallback}
id={id} data={data}/>; id={id} data={data}/>;
} }
@ -336,7 +337,11 @@ export function ProcessOptions({options, data, target, id}) {
export function OptionsDialogPopup({options, data, target, id, big}) { export function OptionsDialogPopup({options, data, target, id, big}) {
const [show, setShow] = useState(false); const [show, setShow] = useState(false);
const ref = useClickAway(() => setShow(false)); const ref = useClickAway((e) => {
if (e.type === "mousedown") // ignore touchstart
setShow(false)
}
);
let div_classes = "overlayVariant border rounded " + (big ? "overlay-bigcard" : "overlay-smallcard") let div_classes = "overlayVariant border rounded " + (big ? "overlay-bigcard" : "overlay-smallcard")
const handleClick = (event) => { const handleClick = (event) => {