Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve zoom transition #64179

Merged
merged 8 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/base-styles/_animations.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
animation-fill-mode: forwards;
@include reduce-motion("animation");
}

@mixin editor-canvas-resize-animation() {
transition: all 0.5s cubic-bezier(0.65, 0, 0.45, 1);
@include reduce-motion("transition");
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ iframe[name="editor-canvas"] {
height: 100%;
display: block;
background-color: transparent;
@include editor-canvas-resize-animation;
}
4 changes: 2 additions & 2 deletions packages/block-editor/src/components/iframe/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
}

.block-editor-iframe__html {
border: 0 solid $gray-300;
richtabor marked this conversation as resolved.
Show resolved Hide resolved
transform-origin: top center;
transition: transform 0.3s;
@include reduce-motion("transition");
@include editor-canvas-resize-animation;
}

.block-editor-iframe__html.is-zoomed-out {
Expand Down
4 changes: 1 addition & 3 deletions packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ function Iframe( {

iframeDocument.documentElement.classList.add( 'is-zoomed-out' );

const maxWidth = 800;
const maxWidth = 750;
iframeDocument.documentElement.style.setProperty(
'--wp-block-editor-iframe-zoom-out-scale',
scale === 'default'
Expand Down Expand Up @@ -378,10 +378,8 @@ function Iframe( {
<iframe
{ ...props }
style={ {
border: 0,
...props.style,
height: props.style?.height,
transition: 'all .3s',
} }
ref={ useMergeRefs( [ ref, setRef ] ) }
tabIndex={ tabIndex }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function useResizeCanvas( deviceType ) {
return deviceWidth < actualWidth ? deviceWidth : actualWidth;
};

const marginValue = () => ( window.innerHeight < 800 ? 36 : 72 );
const marginValue = () => ( window.innerHeight < 800 ? 36 : 64 );

const contentInlineStyles = ( device ) => {
const height = device === 'Mobile' ? '768px' : '1024px';
Expand All @@ -62,8 +62,6 @@ export default function useResizeCanvas( deviceType ) {
marginLeft: marginHorizontal,
marginRight: marginHorizontal,
height,
borderRadius: '2px 2px 2px 2px',
border: '1px solid #ddd',
overflowY: 'auto',
};
default:
Expand Down
Loading