Skip to content

Commit

Permalink
Improve zoom transition (#64179)
Browse files Browse the repository at this point in the history
* add transition to transitioning properties

* remove border and radius from tablet/mobile

* zoom out a little more

* scope properties

* update mobile/tablet transition

* move mobile/tablet up a little

* use all transition

* Move editor canvas and iframe sizing transitions to shared mixin

---------

Co-authored-by: richtabor <[email protected]>
Co-authored-by: jeryj <[email protected]>
Co-authored-by: dereksmart <[email protected]>
Co-authored-by: stokesman <[email protected]>
Co-authored-by: jasmussen <[email protected]>
  • Loading branch information
6 people authored Aug 2, 2024
1 parent 517fc81 commit 823f474
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
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;
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

1 comment on commit 823f474

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 823f474.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10221513112
📝 Reported issues:

Please sign in to comment.