Skip to content

Commit

Permalink
Fix scaling the canvas when sidebars open/close
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Nov 13, 2024
1 parent 5290a40 commit f0f90e8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/block-editor/src/components/iframe/use-scale-canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,19 @@ export function useScaleCanvas( {
return;
}

// Set the value that we want to animate from.
// We will update them after we add the animation class on next render.
iframeDocument.documentElement.style.setProperty(
'--wp-block-editor-iframe-zoom-out-scale',
scale
);

// frameSize has to be a px value for the scaling and frame size to be computed correctly.
iframeDocument.documentElement.style.setProperty(
'--wp-block-editor-iframe-zoom-out-frame-size',
`${ frameSize }px`
);

iframeDocument.documentElement.style.setProperty(
'--wp-block-editor-iframe-zoom-out-content-height',
`${ contentHeight }px`
Expand Down

0 comments on commit f0f90e8

Please sign in to comment.