@v-c/trigger 1.0.8 → 1.0.10
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/dist/hooks/useAlign.js +7 -2
- package/package.json +3 -3
package/dist/hooks/useAlign.js
CHANGED
|
@@ -72,6 +72,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
72
72
|
prevFlipRef.value = {};
|
|
73
73
|
};
|
|
74
74
|
let cacheTargetRect = null;
|
|
75
|
+
let cacheScale = null;
|
|
75
76
|
const _onAlign = (cache = false) => {
|
|
76
77
|
if (cache && !cacheTargetRect) return;
|
|
77
78
|
if (popupEle.value && target.value && open.value && !mobile?.value) {
|
|
@@ -166,8 +167,12 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
166
167
|
const popupHeight = popupRect.height;
|
|
167
168
|
const popupWidth = popupRect.width;
|
|
168
169
|
const popupMirrorRect = rawPopupMirrorRect;
|
|
169
|
-
const scaleX$1 = toNum(Math.round(popupWidth / parseFloat(width) * 1e3) / 1e3);
|
|
170
|
-
const scaleY$1 = toNum(Math.round(popupHeight / parseFloat(height) * 1e3) / 1e3);
|
|
170
|
+
const scaleX$1 = cache && cacheScale ? cacheScale?.scaleX : toNum(Math.round(popupWidth / parseFloat(width) * 1e3) / 1e3);
|
|
171
|
+
const scaleY$1 = cache && cacheScale ? cacheScale?.scaleY : toNum(Math.round(popupHeight / parseFloat(height) * 1e3) / 1e3);
|
|
172
|
+
if (!cache) cacheScale = {
|
|
173
|
+
scaleX: scaleX$1,
|
|
174
|
+
scaleY: scaleY$1
|
|
175
|
+
};
|
|
171
176
|
if (scaleX$1 === 0 || scaleY$1 === 0 || isDOM(target) && !isVisible(target)) return;
|
|
172
177
|
const { offset, targetOffset } = placementInfo;
|
|
173
178
|
let [popupOffsetX, popupOffsetY] = getNumberOffset(popupRect, offset);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/trigger",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.10",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"vue": "^3.0.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@v-c/portal": "^1.0.
|
|
32
|
+
"@v-c/portal": "^1.0.7",
|
|
33
33
|
"@v-c/resize-observer": "^1.0.8",
|
|
34
|
-
"@v-c/util": "^1.0.
|
|
34
|
+
"@v-c/util": "^1.0.13"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "vite build",
|