Skip to content

Commit 3e7d9f6

Browse files
committed
[layout] fixing grid rendering with larger pixel ratios
1 parent eefc001 commit 3e7d9f6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/views/graphPage/controllers/GridController.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,16 @@ export const GridController: FC<{ size: number; opacity: number; color: string }
9898
const canvas = canvasRef.current;
9999
if (!canvas) return;
100100

101-
const { width, height } = sigma.getDimensions();
101+
let { width, height } = sigma.getDimensions();
102102
const pixelRatio = getPixelRatio();
103+
104+
width *= pixelRatio;
105+
height *= pixelRatio;
106+
103107
canvas.style.width = width + "px";
104108
canvas.style.height = height + "px";
105-
canvas.setAttribute("width", width * pixelRatio + "px");
106-
canvas.setAttribute("height", height * pixelRatio + "px");
109+
canvas.setAttribute("width", width + "px");
110+
canvas.setAttribute("height", height + "px");
107111
}, [sigma]);
108112

109113
useEffect(() => {

0 commit comments

Comments
 (0)