Skip to content

Commit

Permalink
Fix rotated image crop area aspect ratio (#44425)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Lende authored and michalczaplinski committed Oct 3, 2022
1 parent add234f commit 33f9e9f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function useTransformState( { url, naturalWidth, naturalHeight } ) {
if ( angle === 0 ) {
setEditedUrl();
setRotation( angle );
setAspect( 1 / aspect );
setAspect( naturalWidth / naturalHeight );
setPosition( {
x: -( position.y * naturalAspectRatio ),
y: position.x * naturalAspectRatio,
Expand Down Expand Up @@ -80,7 +80,7 @@ function useTransformState( { url, naturalWidth, naturalHeight } ) {
canvas.toBlob( ( blob ) => {
setEditedUrl( URL.createObjectURL( blob ) );
setRotation( angle );
setAspect( 1 / aspect );
setAspect( canvas.width / canvas.height );
setPosition( {
x: -( position.y * naturalAspectRatio ),
y: position.x * naturalAspectRatio,
Expand Down

0 comments on commit 33f9e9f

Please sign in to comment.