@whitesev/utils 2.11.9 → 2.11.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/index.esm.js CHANGED
@@ -237,7 +237,7 @@ const clearTimeout$1 = (timerId) => loadOrReturnBroker().clearTimeout(timerId);
237
237
  const setInterval$1 = (...args) => loadOrReturnBroker().setInterval(...args);
238
238
  const setTimeout$1 = (...args) => loadOrReturnBroker().setTimeout(...args);
239
239
 
240
- const version = "2.11.9";
240
+ const version = "2.11.10";
241
241
 
242
242
  /* eslint-disable */
243
243
  // ==UserScript==
@@ -6206,6 +6206,10 @@ class Utils {
6206
6206
  if (typeof deviation !== "number" || Number.isNaN(deviation)) {
6207
6207
  deviation = 10;
6208
6208
  }
6209
+ // 最大值 2147483647
6210
+ // const maxZIndex = Math.pow(2, 31) - 1;
6211
+ // 比较值 2000000000
6212
+ const maxZIndexCompare = 2 * Math.pow(10, 9);
6209
6213
  /** 坐标偏移 */
6210
6214
  const positionDistance = 10;
6211
6215
  const defaultCalcPostion = [];
@@ -6300,9 +6304,14 @@ class Utils {
6300
6304
  left: maxRect.left,
6301
6305
  };
6302
6306
  }
6307
+ let calcZIndex = zIndex + deviation;
6308
+ if (calcZIndex >= maxZIndexCompare) {
6309
+ // 不要超过最大值
6310
+ calcZIndex = maxZIndexCompare;
6311
+ }
6303
6312
  return {
6304
6313
  /** 计算偏移量后的z-index值 */
6305
- zIndex: zIndex + deviation,
6314
+ zIndex: calcZIndex,
6306
6315
  /** 获取到的最大的z-index值 */
6307
6316
  originZIndex: zIndex,
6308
6317
  /** 拥有最大z-index的元素 */