mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 10:45:21 +03:00
add 0.5s delay before switching
This commit is contained in:
parent
ca09f5d2d3
commit
186e6a4a34
@ -101,12 +101,19 @@ function Camera({ name, config }) {
|
||||
);
|
||||
|
||||
const [isHovered, setIsHovered] = useState(false); // Add a state to track if the mouse is over the card
|
||||
const [timerId, setTimerId] = useState(null); // Add a state to keep track of the timer
|
||||
|
||||
const handleMouseEnter = () => {
|
||||
setIsHovered(true);
|
||||
// Set a timer to change the state after 0.5 seconds
|
||||
const id = setTimeout(() => {
|
||||
setIsHovered(true);
|
||||
}, 500);
|
||||
setTimerId(id);
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
// Clear the timer if the mouse leaves before the 0.5 seconds are up
|
||||
clearTimeout(timerId);
|
||||
setIsHovered(false);
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user