Skip to content

Commit

Permalink
fix: adjust canvas, not only off screen renderer on resize
Browse files Browse the repository at this point in the history
  • Loading branch information
Ouwen committed Nov 5, 2022
1 parent e578677 commit a22e2a5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/core/src/RenderingEngine/RenderingEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,12 @@ class RenderingEngine implements IRenderingEngine {

// 3. Reset viewport cameras
vtkDrivenViewports.forEach((vp: IStackViewport | IVolumeViewport) => {
const canvas = getOrCreateCanvas(vp.element);
const rect = canvas.getBoundingClientRect();
const devicePixelRatio = window.devicePixelRatio || 1;
canvas.width = rect.width * devicePixelRatio;
canvas.height = rect.height * devicePixelRatio;

const prevCamera = vp.getCamera();
vp.resetCamera();

Expand Down

0 comments on commit a22e2a5

Please sign in to comment.