@rc-component/trigger 2.1.1 → 2.2.0
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 +11 -2
- package/lib/hooks/useAlign.js +11 -2
- package/package.json +3 -3
package/es/hooks/useAlign.js
CHANGED
|
@@ -473,7 +473,15 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
473
473
|
// Additional calculate right & bottom position
|
|
474
474
|
var offsetX4Right = popupMirrorRect.right - popupRect.x - (nextOffsetX + popupRect.width);
|
|
475
475
|
var offsetY4Bottom = popupMirrorRect.bottom - popupRect.y - (nextOffsetY + popupRect.height);
|
|
476
|
-
|
|
476
|
+
if (_scaleX === 1) {
|
|
477
|
+
nextOffsetX = Math.round(nextOffsetX);
|
|
478
|
+
offsetX4Right = Math.round(offsetX4Right);
|
|
479
|
+
}
|
|
480
|
+
if (_scaleY === 1) {
|
|
481
|
+
nextOffsetY = Math.round(nextOffsetY);
|
|
482
|
+
offsetY4Bottom = Math.round(offsetY4Bottom);
|
|
483
|
+
}
|
|
484
|
+
var nextOffsetInfo = {
|
|
477
485
|
ready: true,
|
|
478
486
|
offsetX: nextOffsetX / _scaleX,
|
|
479
487
|
offsetY: nextOffsetY / _scaleY,
|
|
@@ -484,7 +492,8 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
484
492
|
scaleX: _scaleX,
|
|
485
493
|
scaleY: _scaleY,
|
|
486
494
|
align: nextAlignInfo
|
|
487
|
-
}
|
|
495
|
+
};
|
|
496
|
+
setOffsetInfo(nextOffsetInfo);
|
|
488
497
|
}
|
|
489
498
|
});
|
|
490
499
|
var triggerAlign = function triggerAlign() {
|
package/lib/hooks/useAlign.js
CHANGED
|
@@ -481,7 +481,15 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
481
481
|
// Additional calculate right & bottom position
|
|
482
482
|
var offsetX4Right = popupMirrorRect.right - popupRect.x - (nextOffsetX + popupRect.width);
|
|
483
483
|
var offsetY4Bottom = popupMirrorRect.bottom - popupRect.y - (nextOffsetY + popupRect.height);
|
|
484
|
-
|
|
484
|
+
if (_scaleX === 1) {
|
|
485
|
+
nextOffsetX = Math.round(nextOffsetX);
|
|
486
|
+
offsetX4Right = Math.round(offsetX4Right);
|
|
487
|
+
}
|
|
488
|
+
if (_scaleY === 1) {
|
|
489
|
+
nextOffsetY = Math.round(nextOffsetY);
|
|
490
|
+
offsetY4Bottom = Math.round(offsetY4Bottom);
|
|
491
|
+
}
|
|
492
|
+
var nextOffsetInfo = {
|
|
485
493
|
ready: true,
|
|
486
494
|
offsetX: nextOffsetX / _scaleX,
|
|
487
495
|
offsetY: nextOffsetY / _scaleY,
|
|
@@ -492,7 +500,8 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
492
500
|
scaleX: _scaleX,
|
|
493
501
|
scaleY: _scaleY,
|
|
494
502
|
align: nextAlignInfo
|
|
495
|
-
}
|
|
503
|
+
};
|
|
504
|
+
setOffsetInfo(nextOffsetInfo);
|
|
496
505
|
}
|
|
497
506
|
});
|
|
498
507
|
var triggerAlign = function triggerAlign() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rc-component/trigger",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "base abstract trigger component for react",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=8.x"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@rc-component/father-plugin": "^1.0.0",
|
|
44
44
|
"@testing-library/jest-dom": "^6.1.4",
|
|
45
|
-
"@testing-library/react": "^
|
|
45
|
+
"@testing-library/react": "^15.0.4",
|
|
46
46
|
"@types/classnames": "^2.2.10",
|
|
47
47
|
"@types/jest": "^29.5.2",
|
|
48
48
|
"@types/node": "^20.11.6",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"eslint": "^8.51.0",
|
|
55
55
|
"father": "^4.0.0",
|
|
56
56
|
"less": "^4.2.0",
|
|
57
|
-
"np": "^
|
|
57
|
+
"np": "^10.0.5",
|
|
58
58
|
"rc-test": "^7.0.13",
|
|
59
59
|
"react": "^18.0.0",
|
|
60
60
|
"react-dom": "^18.0.0",
|