@rc-component/trigger 1.7.0 → 1.7.1

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.
@@ -212,14 +212,16 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
212
212
 
213
213
  // ============== Intersection ===============
214
214
  // Get area by position. Used for check if flip area is better
215
- function getIntersectionVisibleArea(x, y) {
216
- var r = x + popupWidth;
217
- var b = y + popupHeight;
218
- var visibleX = Math.max(x, visibleArea.left);
219
- var visibleY = Math.max(y, visibleArea.top);
215
+ function getIntersectionVisibleArea(offsetX, offsetY) {
216
+ var l = popupRect.x + offsetX;
217
+ var t = popupRect.y + offsetY;
218
+ var r = l + popupWidth;
219
+ var b = t + popupHeight;
220
+ var visibleL = Math.max(l, visibleArea.left);
221
+ var visibleT = Math.max(t, visibleArea.top);
220
222
  var visibleR = Math.min(r, visibleArea.right);
221
223
  var visibleB = Math.min(b, visibleArea.bottom);
222
- return (visibleR - visibleX) * (visibleB - visibleY);
224
+ return (visibleR - visibleL) * (visibleB - visibleT);
223
225
  }
224
226
  var originIntersectionVisibleArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY);
225
227
 
@@ -220,14 +220,16 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
220
220
 
221
221
  // ============== Intersection ===============
222
222
  // Get area by position. Used for check if flip area is better
223
- function getIntersectionVisibleArea(x, y) {
224
- var r = x + popupWidth;
225
- var b = y + popupHeight;
226
- var visibleX = Math.max(x, visibleArea.left);
227
- var visibleY = Math.max(y, visibleArea.top);
223
+ function getIntersectionVisibleArea(offsetX, offsetY) {
224
+ var l = popupRect.x + offsetX;
225
+ var t = popupRect.y + offsetY;
226
+ var r = l + popupWidth;
227
+ var b = t + popupHeight;
228
+ var visibleL = Math.max(l, visibleArea.left);
229
+ var visibleT = Math.max(t, visibleArea.top);
228
230
  var visibleR = Math.min(r, visibleArea.right);
229
231
  var visibleB = Math.min(b, visibleArea.bottom);
230
- return (visibleR - visibleX) * (visibleB - visibleY);
232
+ return (visibleR - visibleL) * (visibleB - visibleT);
231
233
  }
232
234
  var originIntersectionVisibleArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY);
233
235
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/trigger",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "base abstract trigger component for react",
5
5
  "engines": {
6
6
  "node": ">=8.x"