@rc-component/trigger 1.7.2 → 1.7.3
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.
- package/es/hooks/useAlign.js +5 -5
- package/lib/hooks/useAlign.js +5 -5
- package/package.json +1 -1
package/es/hooks/useAlign.js
CHANGED
|
@@ -199,7 +199,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
199
199
|
var visibleT = Math.max(t, visibleArea.top);
|
|
200
200
|
var visibleR = Math.min(r, visibleArea.right);
|
|
201
201
|
var visibleB = Math.min(b, visibleArea.bottom);
|
|
202
|
-
return (visibleR - visibleL) * (visibleB - visibleT);
|
|
202
|
+
return Math.max(0, (visibleR - visibleL) * (visibleB - visibleT));
|
|
203
203
|
}
|
|
204
204
|
var originIntersectionVisibleArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY);
|
|
205
205
|
|
|
@@ -245,7 +245,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
245
245
|
} else {
|
|
246
246
|
tmpNextOffsetY = targetAlignPointTL.y - popupAlignPointBR.y - popupOffsetY;
|
|
247
247
|
}
|
|
248
|
-
if (getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY)
|
|
248
|
+
if (getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY) >= originIntersectionVisibleArea) {
|
|
249
249
|
nextOffsetY = tmpNextOffsetY;
|
|
250
250
|
nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
|
|
251
251
|
}
|
|
@@ -259,7 +259,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
259
259
|
} else {
|
|
260
260
|
_tmpNextOffsetY = targetAlignPointBR.y - popupAlignPointTL.y - popupOffsetY;
|
|
261
261
|
}
|
|
262
|
-
if (getIntersectionVisibleArea(nextOffsetX, _tmpNextOffsetY)
|
|
262
|
+
if (getIntersectionVisibleArea(nextOffsetX, _tmpNextOffsetY) >= originIntersectionVisibleArea) {
|
|
263
263
|
nextOffsetY = _tmpNextOffsetY;
|
|
264
264
|
nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
|
|
265
265
|
}
|
|
@@ -279,7 +279,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
279
279
|
} else {
|
|
280
280
|
tmpNextOffsetX = targetAlignPointTL.x - popupAlignPointBR.x - popupOffsetX;
|
|
281
281
|
}
|
|
282
|
-
if (getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY)
|
|
282
|
+
if (getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY) >= originIntersectionVisibleArea) {
|
|
283
283
|
nextOffsetX = tmpNextOffsetX;
|
|
284
284
|
nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
|
|
285
285
|
}
|
|
@@ -293,7 +293,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
293
293
|
} else {
|
|
294
294
|
_tmpNextOffsetX = targetAlignPointBR.x - popupAlignPointTL.x - popupOffsetX;
|
|
295
295
|
}
|
|
296
|
-
if (getIntersectionVisibleArea(_tmpNextOffsetX, nextOffsetY)
|
|
296
|
+
if (getIntersectionVisibleArea(_tmpNextOffsetX, nextOffsetY) >= originIntersectionVisibleArea) {
|
|
297
297
|
nextOffsetX = _tmpNextOffsetX;
|
|
298
298
|
nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
|
|
299
299
|
}
|
package/lib/hooks/useAlign.js
CHANGED
|
@@ -207,7 +207,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
207
207
|
var visibleT = Math.max(t, visibleArea.top);
|
|
208
208
|
var visibleR = Math.min(r, visibleArea.right);
|
|
209
209
|
var visibleB = Math.min(b, visibleArea.bottom);
|
|
210
|
-
return (visibleR - visibleL) * (visibleB - visibleT);
|
|
210
|
+
return Math.max(0, (visibleR - visibleL) * (visibleB - visibleT));
|
|
211
211
|
}
|
|
212
212
|
var originIntersectionVisibleArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY);
|
|
213
213
|
|
|
@@ -253,7 +253,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
253
253
|
} else {
|
|
254
254
|
tmpNextOffsetY = targetAlignPointTL.y - popupAlignPointBR.y - popupOffsetY;
|
|
255
255
|
}
|
|
256
|
-
if (getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY)
|
|
256
|
+
if (getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY) >= originIntersectionVisibleArea) {
|
|
257
257
|
nextOffsetY = tmpNextOffsetY;
|
|
258
258
|
nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
|
|
259
259
|
}
|
|
@@ -267,7 +267,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
267
267
|
} else {
|
|
268
268
|
_tmpNextOffsetY = targetAlignPointBR.y - popupAlignPointTL.y - popupOffsetY;
|
|
269
269
|
}
|
|
270
|
-
if (getIntersectionVisibleArea(nextOffsetX, _tmpNextOffsetY)
|
|
270
|
+
if (getIntersectionVisibleArea(nextOffsetX, _tmpNextOffsetY) >= originIntersectionVisibleArea) {
|
|
271
271
|
nextOffsetY = _tmpNextOffsetY;
|
|
272
272
|
nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
|
|
273
273
|
}
|
|
@@ -287,7 +287,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
287
287
|
} else {
|
|
288
288
|
tmpNextOffsetX = targetAlignPointTL.x - popupAlignPointBR.x - popupOffsetX;
|
|
289
289
|
}
|
|
290
|
-
if (getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY)
|
|
290
|
+
if (getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY) >= originIntersectionVisibleArea) {
|
|
291
291
|
nextOffsetX = tmpNextOffsetX;
|
|
292
292
|
nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
|
|
293
293
|
}
|
|
@@ -301,7 +301,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
301
301
|
} else {
|
|
302
302
|
_tmpNextOffsetX = targetAlignPointBR.x - popupAlignPointTL.x - popupOffsetX;
|
|
303
303
|
}
|
|
304
|
-
if (getIntersectionVisibleArea(_tmpNextOffsetX, nextOffsetY)
|
|
304
|
+
if (getIntersectionVisibleArea(_tmpNextOffsetX, nextOffsetY) >= originIntersectionVisibleArea) {
|
|
305
305
|
nextOffsetX = _tmpNextOffsetX;
|
|
306
306
|
nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
|
|
307
307
|
}
|