-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Fix scaling animation for device previews #66132
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
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add mixin for handling canvas resizing
- Loading branch information
commit b6793e4abc124e98e8c4a635d8c5f2a56249b9f4
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,20 +5,16 @@ | |
|
|
||
| .block-editor-iframe__html { | ||
| transform-origin: top center; | ||
| // 400ms should match the animation speed used in iframe/index.js | ||
| $zoomOutAnimation: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96); | ||
|
|
||
| // We don't want to animate the transform of the translateX because it is used | ||
| // to "center" the canvas. Leaving it on causes the canvas to slide around in | ||
| // odd ways. | ||
| transition: $zoomOutAnimation, transform 0s scale 0s; | ||
| @include reduce-motion("transition"); | ||
| @include editor-canvas-resize-animation( "transform 0s, scale 0s, padding 0s" ); | ||
ajlende marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| &.zoom-out-animation { | ||
| // we only want to animate the scaling when entering zoom out. When sidebars | ||
| // are toggled, the resizing of the iframe handles scaling the canvas as well, | ||
| // and the doubled animations cause very odd animations. | ||
| transition: $zoomOutAnimation, transform 0s; | ||
| @include editor-canvas-resize-animation( "transform 0s" ); | ||
ajlende marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
|
|
@@ -30,7 +26,7 @@ | |
| $outer-container-width: var(--wp-block-editor-iframe-zoom-out-outer-container-width); | ||
| $container-width: var(--wp-block-editor-iframe-zoom-out-container-width, 100vw); | ||
| // Apply an X translation to center the scaled content within the available space. | ||
| transform: translateX(calc(( #{$outer-container-width} - #{ $container-width }) / 2 / #{$scale})); | ||
| transform: translateX(calc((#{$outer-container-width} - #{$container-width}) / 2 / #{$scale})); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Linting. |
||
| scale: #{$scale}; | ||
| background-color: $gray-300; | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.