source: imaps-frontend/node_modules/react-use/esm/useMouseHovered.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 613 bytes
RevLine 
[d565449]1import useHoverDirty from './useHoverDirty';
2import useMouse from './useMouse';
3var nullRef = { current: null };
4var useMouseHovered = function (ref, options) {
5 if (options === void 0) { options = {}; }
6 var whenHovered = !!options.whenHovered;
7 var bound = !!options.bound;
8 var isHovered = useHoverDirty(ref, whenHovered);
9 var state = useMouse(whenHovered && !isHovered ? nullRef : ref);
10 if (bound) {
11 state.elX = Math.max(0, Math.min(state.elX, state.elW));
12 state.elY = Math.max(0, Math.min(state.elY, state.elH));
13 }
14 return state;
15};
16export default useMouseHovered;
Note: See TracBrowser for help on using the repository browser.