Refine blur capture logic

This commit is contained in:
Sam Becker 2024-03-11 18:03:06 -05:00
parent 5cd8054a8d
commit a998880c8d

View File

@ -29,6 +29,8 @@ export default function CanvasBlurCapture({
const refShouldCapture = useRef(true); const refShouldCapture = useRef(true);
useEffect(() => { useEffect(() => {
refShouldCapture.current = true;
const capture = () => { const capture = () => {
if (refShouldCapture.current) { if (refShouldCapture.current) {
if ( if (
@ -44,7 +46,7 @@ export default function CanvasBlurCapture({
if (context) { if (context) {
context.scale(scale, scale); context.scale(scale, scale);
context.filter = context.filter =
'contrast(1.2) saturate(1.2)' + 'contrast(1.2) saturate(1.2) ' +
`blur(${scale * 10}px)`; `blur(${scale * 10}px)`;
context.drawImage( context.drawImage(
refImage.current, refImage.current,