@gustavo-valsechi/client 1.4.43 → 1.4.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -42,17 +42,17 @@ const memory = [];
|
|
|
42
42
|
const TargetProviderContainer = ({ children }) => {
|
|
43
43
|
const [targets, setTargets] = (0, import_react.useState)([]);
|
|
44
44
|
(0, import_react.useEffect)(() => {
|
|
45
|
-
import_lodash.default.forEach(
|
|
45
|
+
import_lodash.default.forEach(memory, (target, index) => {
|
|
46
46
|
var _a;
|
|
47
47
|
const element = (_a = target.ref) == null ? void 0 : _a.current;
|
|
48
48
|
if (!element) return;
|
|
49
49
|
element.addEventListener("click", () => {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
setTargets(
|
|
50
|
+
const coords = getCoords(element);
|
|
51
|
+
memory.splice(index, 1, { ...target, show: !target.show, coords });
|
|
52
|
+
setTargets(memory);
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
|
-
}, [
|
|
55
|
+
}, []);
|
|
56
56
|
const getCoords = (target) => {
|
|
57
57
|
const rect = target.getBoundingClientRect();
|
|
58
58
|
const targetTop = rect.top + window.scrollY;
|
|
@@ -8,17 +8,17 @@ const memory = [];
|
|
|
8
8
|
const TargetProviderContainer = ({ children }) => {
|
|
9
9
|
const [targets, setTargets] = useState([]);
|
|
10
10
|
useEffect(() => {
|
|
11
|
-
_.forEach(
|
|
11
|
+
_.forEach(memory, (target, index) => {
|
|
12
12
|
var _a;
|
|
13
13
|
const element = (_a = target.ref) == null ? void 0 : _a.current;
|
|
14
14
|
if (!element) return;
|
|
15
15
|
element.addEventListener("click", () => {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
setTargets(
|
|
16
|
+
const coords = getCoords(element);
|
|
17
|
+
memory.splice(index, 1, { ...target, show: !target.show, coords });
|
|
18
|
+
setTargets(memory);
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
|
-
}, [
|
|
21
|
+
}, []);
|
|
22
22
|
const getCoords = (target) => {
|
|
23
23
|
const rect = target.getBoundingClientRect();
|
|
24
24
|
const targetTop = rect.top + window.scrollY;
|