mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-11 22:49:54 +00:00
Ensure canvas dimensions are integers (#64949)
This commit is contained in:
@@ -103,7 +103,13 @@ export const CanvasRenderer = forwardRef<
|
||||
canvas.getContext('2d').clearRect(0, 0, canvas.width, canvas.height);
|
||||
},
|
||||
focus: () => canvasRef.current.focus(),
|
||||
getSize: () => canvasRef.current.getBoundingClientRect(),
|
||||
getSize: () => {
|
||||
const rect = canvasRef.current.getBoundingClientRect();
|
||||
return {
|
||||
height: Math.round(rect.height),
|
||||
width: Math.round(rect.width),
|
||||
};
|
||||
},
|
||||
};
|
||||
}, []);
|
||||
|
||||
@@ -120,8 +126,8 @@ export const CanvasRenderer = forwardRef<
|
||||
const observer = new ResizeObserver(([entry]) => {
|
||||
if (entry && entry.contentRect.height !== 0) {
|
||||
debouncedOnResize({
|
||||
height: entry.contentRect.height,
|
||||
width: entry.contentRect.width,
|
||||
height: Math.round(entry.contentRect.height),
|
||||
width: Math.round(entry.contentRect.width),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user