Skip to content

Commit

Permalink
Fix aspect ratio calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Apr 18, 2023
1 parent 8bcef22 commit 7290e20
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ function ResizableAlignmentControls( {
size,
} ) {
const resizableRef = useRef();
const aspect = useRef( size.height / size.width );
const detectSnapping = useDetectSnapping();
const [ isAlignmentVisualizerVisible, setIsAlignmentVisualizerVisible ] =
useState( false );
Expand Down Expand Up @@ -125,12 +124,13 @@ function ResizableAlignmentControls( {
}

const alignmentRect = snappedAlignment.rect;
const aspect = size.height / size.width;

return {
float: 'left',
height: alignmentRect.width * aspect.current,
height: alignmentRect.width * aspect,
};
}, [ snappedAlignment ] );
}, [ snappedAlignment, size.width, size.height ] );

return (
<>
Expand Down

0 comments on commit 7290e20

Please sign in to comment.