Skip to content

Commit

Permalink
fix: adjust canvas, not only off screen renderer on resize (cornersto…
Browse files Browse the repository at this point in the history
  • Loading branch information
Ouwen authored and NeilMacPhee committed Nov 22, 2022
1 parent c43d0ea commit 0cfe963
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 0cfe963

Please sign in to comment.