@whitesev/pops 4.2.2 → 4.2.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/dist/index.umd.js CHANGED
@@ -4,7 +4,7 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.pops = factory());
5
5
  })(this, (function () { 'use strict';
6
6
 
7
- const version = "4.2.2";
7
+ const version = "4.2.3";
8
8
 
9
9
  const GlobalConfig = {
10
10
  config: {},
@@ -679,6 +679,10 @@
679
679
  if (typeof deviation !== "number" || Number.isNaN(deviation)) {
680
680
  deviation = 10;
681
681
  }
682
+ // 最大值 2147483647
683
+ // const maxZIndex = Math.pow(2, 31) - 1;
684
+ // 比较值 2000000000
685
+ const maxZIndexCompare = 2 * Math.pow(10, 9);
682
686
  /** 坐标偏移 */
683
687
  const positionDistance = 10;
684
688
  const defaultCalcPostion = [];
@@ -773,9 +777,14 @@
773
777
  left: maxRect.left,
774
778
  };
775
779
  }
780
+ const calcZIndex = zIndex + deviation;
781
+ if (calcZIndex >= maxZIndexCompare) {
782
+ // 不要超过最大值
783
+ return;
784
+ }
776
785
  return {
777
786
  /** 计算偏移量后的z-index值 */
778
- zIndex: zIndex + deviation,
787
+ zIndex: calcZIndex,
779
788
  /** 获取到的最大的z-index值 */
780
789
  originZIndex: zIndex,
781
790
  /** 拥有最大z-index的元素 */
@@ -3185,8 +3194,8 @@
3185
3194
  * 获取pops所有弹窗中的最大的z-index
3186
3195
  * @param deviation
3187
3196
  */
3188
- getPopsMaxZIndex(deviation = 1) {
3189
- deviation = Number.isNaN(deviation) ? 1 : deviation;
3197
+ getPopsMaxZIndex(deviation = 10) {
3198
+ deviation = Number.isNaN(deviation) ? 10 : deviation;
3190
3199
  // 最大值 2147483647
3191
3200
  // const browserMaxZIndex = Math.pow(2, 31) - 1;
3192
3201
  // 比较值 2000000000
@@ -3201,8 +3210,7 @@
3201
3210
  const inst = instData[index];
3202
3211
  // 不对position为static和display为none的元素进行获取它们的z-index
3203
3212
  const $elList = [inst.$anim, inst.$pops, inst.$mask].filter((it) => it instanceof HTMLElement);
3204
- const nodeZIndexInfoList = popsUtils.getMaxZIndexNodeInfoFromPoint($elList);
3205
- const maxNodeZIndexInfo = nodeZIndexInfoList[0];
3213
+ const maxNodeZIndexInfo = popsUtils.getMaxZIndexNodeInfoFromPoint($elList)[0];
3206
3214
  if (maxNodeZIndexInfo) {
3207
3215
  const nodeZIndex = maxNodeZIndexInfo.zIndex;
3208
3216
  if (nodeZIndex > zIndex) {