Skip to content

Commit

Permalink
perf: currentMaxZIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Nov 21, 2024
1 parent db8c404 commit 93f2969
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/utils/draggable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ export const useDragMove = (xFilter: (x: number) => boolean) => {
};
};

let initValue = 1000;
let currentMaxZIndex = 1000;
export const useZindex = () => {
initValue++;
const zIndex = shallowRef(initValue);
currentMaxZIndex++;
const zIndex = shallowRef(currentMaxZIndex);
const setTop = () => {
zIndex.value = ++initValue;
if (zIndex.value === currentMaxZIndex) return;
currentMaxZIndex++;
zIndex.value = currentMaxZIndex;
};
return {
zIndex,
Expand Down

0 comments on commit 93f2969

Please sign in to comment.