@rc-component/trigger 1.4.0 → 1.4.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.
- package/es/hooks/useAlign.js +5 -0
- package/lib/hooks/useAlign.js +5 -0
- package/package.json +1 -1
package/es/hooks/useAlign.js
CHANGED
|
@@ -145,6 +145,11 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
145
145
|
eleInnerWidth = ele.clientWidth;
|
|
146
146
|
var scaleX = toNum(Math.round(eleRect.width / eleOutWidth * 1000) / 1000);
|
|
147
147
|
var scaleY = toNum(Math.round(eleRect.height / eleOutHeight * 1000) / 1000);
|
|
148
|
+
|
|
149
|
+
// No need to align since it's not visible in view
|
|
150
|
+
if (scaleX === 0 || scaleY === 0) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
148
153
|
var eleScrollWidth = (eleOutWidth - eleInnerWidth) * scaleX;
|
|
149
154
|
var eleScrollHeight = (eleOutHeight - eleInnerHeight) * scaleY;
|
|
150
155
|
var eleRight = eleRect.x + eleRect.width - eleScrollWidth;
|
package/lib/hooks/useAlign.js
CHANGED
|
@@ -153,6 +153,11 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
153
153
|
eleInnerWidth = ele.clientWidth;
|
|
154
154
|
var scaleX = toNum(Math.round(eleRect.width / eleOutWidth * 1000) / 1000);
|
|
155
155
|
var scaleY = toNum(Math.round(eleRect.height / eleOutHeight * 1000) / 1000);
|
|
156
|
+
|
|
157
|
+
// No need to align since it's not visible in view
|
|
158
|
+
if (scaleX === 0 || scaleY === 0) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
156
161
|
var eleScrollWidth = (eleOutWidth - eleInnerWidth) * scaleX;
|
|
157
162
|
var eleScrollHeight = (eleOutHeight - eleInnerHeight) * scaleY;
|
|
158
163
|
var eleRight = eleRect.x + eleRect.width - eleScrollWidth;
|