publ-echo 0.0.76 → 0.0.78
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.
|
@@ -40,18 +40,18 @@ var GridItem = function (_a) {
|
|
|
40
40
|
var _p = useState(false), isResizing = _p[0], setIsResizing = _p[1];
|
|
41
41
|
var elementRef = useRef(null);
|
|
42
42
|
var _q = useResizeObserver([isDragging, isResizing]), gridItemHeight = _q.gridItemHeight, gridItemWidth = _q.gridItemWidth;
|
|
43
|
-
var
|
|
44
|
-
var isHoveredRef = useRef(isHovered);
|
|
45
|
-
useEffect(function () {
|
|
46
|
-
isHoveredRef.current = isHovered;
|
|
47
|
-
}, [isHovered]);
|
|
43
|
+
var isHoveredRef = useRef(false);
|
|
48
44
|
useEffect(function () {
|
|
49
45
|
var node = elementRef.current;
|
|
50
46
|
if (!node) {
|
|
51
47
|
return;
|
|
52
48
|
}
|
|
53
|
-
var handleMouseEnter = function () {
|
|
54
|
-
|
|
49
|
+
var handleMouseEnter = function () {
|
|
50
|
+
isHoveredRef.current = true;
|
|
51
|
+
};
|
|
52
|
+
var handleMouseLeave = function () {
|
|
53
|
+
isHoveredRef.current = false;
|
|
54
|
+
};
|
|
55
55
|
node.addEventListener('mouseenter', handleMouseEnter);
|
|
56
56
|
node.addEventListener('mouseleave', handleMouseLeave);
|
|
57
57
|
return function () {
|
|
@@ -69,6 +69,10 @@ var GridItem = function (_a) {
|
|
|
69
69
|
if (!elementRef.current || !props.onContentSizeChange) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
+
if (isHoveredRef.current) {
|
|
73
|
+
console.log('early- return hover is true');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
72
76
|
var observer = new ResizeObserver(function (_a) {
|
|
73
77
|
var _b, _c;
|
|
74
78
|
var entry = _a[0];
|
|
@@ -78,8 +82,8 @@ var GridItem = function (_a) {
|
|
|
78
82
|
if (newClientHeight < containerHeight) {
|
|
79
83
|
return;
|
|
80
84
|
}
|
|
81
|
-
console.log(isHoveredRef.current);
|
|
82
85
|
if (isHoveredRef.current) {
|
|
86
|
+
console.log('disconnect from observer');
|
|
83
87
|
return;
|
|
84
88
|
}
|
|
85
89
|
;
|
|
@@ -87,10 +91,15 @@ var GridItem = function (_a) {
|
|
|
87
91
|
props.onContentSizeChange(props.i, { x: x, y: y, w: w, h: h });
|
|
88
92
|
});
|
|
89
93
|
observer.observe(elementRef.current.children[0].children[0].children[0], { box: 'border-box' });
|
|
94
|
+
if (isHoveredRef.current) {
|
|
95
|
+
console.log('disconnect observer');
|
|
96
|
+
observer.disconnect();
|
|
97
|
+
}
|
|
98
|
+
;
|
|
90
99
|
return function () {
|
|
91
100
|
observer.disconnect();
|
|
92
101
|
};
|
|
93
|
-
}, [props.i, props.w, props.h, x, y, activeResizeObserver, isDragging, isResizing
|
|
102
|
+
}, [props.i, props.w, props.h, x, y, activeResizeObserver, isDragging, isResizing]);
|
|
94
103
|
// const moveDroppingItem = (prevProps: GridItemProps) => {
|
|
95
104
|
// const { droppingPosition } = props;
|
|
96
105
|
// if (!droppingPosition) return;
|