Skip to content

Commit

Permalink
Improve dom mask
Browse files Browse the repository at this point in the history
  • Loading branch information
frostyfan109 committed Feb 27, 2024
1 parent dac48ed commit 58b879e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/hooks/use-synthetic-dom-mask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { v4 as uuid } from 'uuid'
const prepareMaskContainer = (): HTMLDivElement => {
const mask = document.createElement("div")
mask.id = "mask-" + uuid()
mask.style.position = "relative"
mask.style.position = "absolute"
mask.style.zIndex = "999999"
mask.style.pointerEvents = "none"
mask.style.borderRadius = "4px"
Expand Down Expand Up @@ -69,15 +69,15 @@ export const useSyntheticDOMMask = (
}
}, [selector, selectorInterval])

// Make sure the mask displays properly and maintain proper position/size
// Make sure the mask displays properly and maintains correct position/size
useEffect(() => {
const observers: IntersectionObserver[] = []
let interval: number
let cancelled = false
if (!mask || !elementMasks) return
if (!show) mask.style.display = "none"
else {
mask.style.display = "initial"
mask.style.display = "block"

const resizeMasks = () => {
const elements = Array.from(elementMasks.keys())
Expand All @@ -104,7 +104,6 @@ export const useSyntheticDOMMask = (

Array.from(elementMasks.keys()).forEach((element) => {
const elementMask = elementMasks.get(element)!
elementMask.style.backgroundColor = "red"
})

/*
Expand Down
1 change: 1 addition & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ body {
/* font-family: -apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol,noto color emoji; */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
position: relative;
}

code {
Expand Down

0 comments on commit 58b879e

Please sign in to comment.