source: imaps-frontend/node_modules/react-use/lib/useMouseHovered.js

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

Update repo after prototype presentation

  • Property mode set to 100644
File size: 805 bytes
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var tslib_1 = require("tslib");
4var useHoverDirty_1 = tslib_1.__importDefault(require("./useHoverDirty"));
5var useMouse_1 = tslib_1.__importDefault(require("./useMouse"));
6var nullRef = { current: null };
7var useMouseHovered = function (ref, options) {
8 if (options === void 0) { options = {}; }
9 var whenHovered = !!options.whenHovered;
10 var bound = !!options.bound;
11 var isHovered = useHoverDirty_1.default(ref, whenHovered);
12 var state = useMouse_1.default(whenHovered && !isHovered ? nullRef : ref);
13 if (bound) {
14 state.elX = Math.max(0, Math.min(state.elX, state.elW));
15 state.elY = Math.max(0, Math.min(state.elY, state.elH));
16 }
17 return state;
18};
19exports.default = useMouseHovered;
Note: See TracBrowser for help on using the repository browser.