| const BASE_MODAL_Z_INDEX = 1055; |
| const Z_INDEX_INCREMENT = 10; |
|
|
| const openModalZIndices: number[] = []; |
|
|
| |
| |
| |
| |
| |
| export function getNextZIndex(): number { |
| const highestZIndex = openModalZIndices.length > 0 |
| ? Math.max(...openModalZIndices) |
| : BASE_MODAL_Z_INDEX - Z_INDEX_INCREMENT; |
|
|
| const newZIndex = highestZIndex + Z_INDEX_INCREMENT; |
| openModalZIndices.push(newZIndex); |
| return newZIndex; |
| } |
|
|
| |
| |
| |
| |
| |
| export function releaseZIndex(zIndex: number): void { |
| const index = openModalZIndices.indexOf(zIndex); |
| if (index > -1) { |
| openModalZIndices.splice(index, 1); |
| } |
| } |
|
|