Merge branch 'main' into static
This commit is contained in:
commit
d4dae20bcc
@ -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,
|
||||||
@ -83,7 +85,10 @@ export default function CanvasBlurCapture({
|
|||||||
// Store timeout ref to ensure it's closed over
|
// Store timeout ref to ensure it's closed over
|
||||||
// in cleanup function (recommended by exhaustive-deps)
|
// in cleanup function (recommended by exhaustive-deps)
|
||||||
const timeouts = refTimeouts.current;
|
const timeouts = refTimeouts.current;
|
||||||
return () => timeouts.forEach(clearTimeout);
|
return () => {
|
||||||
|
refShouldCapture.current = false;
|
||||||
|
timeouts.forEach(clearTimeout);
|
||||||
|
};
|
||||||
}, [
|
}, [
|
||||||
imageUrl,
|
imageUrl,
|
||||||
onCapture,
|
onCapture,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user