This commit is contained in:
@@ -43,10 +43,11 @@ export function NetworkBackground() {
|
||||
const canvasRef = useRef<HTMLCanvasElement | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const canvas = canvasRef.current;
|
||||
const canvas: HTMLCanvasElement | null = canvasRef.current;
|
||||
if (!canvas) return;
|
||||
const ctx = canvas.getContext("2d");
|
||||
if (!ctx) return;
|
||||
const cvs: HTMLCanvasElement = canvas;
|
||||
|
||||
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
|
||||
@@ -138,10 +139,10 @@ export function NetworkBackground() {
|
||||
dpr = Math.min(window.devicePixelRatio || 1, 2);
|
||||
width = window.innerWidth;
|
||||
height = window.innerHeight;
|
||||
canvas.width = Math.floor(width * dpr);
|
||||
canvas.height = Math.floor(height * dpr);
|
||||
canvas.style.width = `${width}px`;
|
||||
canvas.style.height = `${height}px`;
|
||||
cvs.width = Math.floor(width * dpr);
|
||||
cvs.height = Math.floor(height * dpr);
|
||||
cvs.style.width = `${width}px`;
|
||||
cvs.style.height = `${height}px`;
|
||||
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
||||
build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user