WordPress.org

Make WordPress Core

Opened 7 months ago

Closed 5 weeks ago

#40211 closed enhancement (fixed)

Media cropping: retain aspect ration when you shift+click/drag

Reported by: melchoyce Owned by: adamsilverstein
Milestone: 4.9 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch commit
Focuses: Cc:

Description

In many image editing apps, holding shift while you click/drag a selection "locks" the selection to a square aspect ratio. I keep trying to do this while cropping images in the Customizer (for example, logos), but holding shift doesn't do anything. Any way we could add this enhancement to cropping in the media modal?

Attachments (2)

40211.diff (2.1 KB) - added by adamsilverstein 3 months ago.
40211.2.diff (2.5 KB) - added by adamsilverstein 5 weeks ago.

Download all attachments as: .zip

Change History (10)

#2 @mikeschroder
7 months ago

Tested, and this is working for me in all contexts besides the customizer (editing images from posts/media modal/etc).

You can do things like choose a ratio (on the right) when resizing, then shift-click to drag and maintain that ratio as well.

Last edited 7 months ago by mikeschroder (previous) (diff)

#3 @adamsilverstein
3 months ago

  • Keywords has-patch reporter-feedback added

In 40211.diff: Adjust cropper tool used in customizer so that shift locks the aspect ratio at '1:1'

  • When using the cropper view, set a ration of 1:1 when the shift key is held when dragging.

This seems intuitive to work this way to me. Might be worth looking at how any plugins are using the cropper view in case we want to make the default ratio configurable.

@melchoyce can you please give this a test and see if it works as you expected? I tested in twentyseventeen customizer editing the logo image.

#4 @melchoyce
3 months ago

Patch works as expected 👍 Thanks @adamsilverstein!

#5 @melchoyce
3 months ago

  • Keywords reporter-feedback removed

#6 @adamsilverstein
5 weeks ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 4.9

#7 @adamsilverstein
5 weeks ago

  • Owner set to adamsilverstein
  • Status changed from new to assigned

#8 @adamsilverstein
5 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 41557:

Customizer: retain aspect ration when cropping media w/ shift+click/drag.

Enforce a 1:1 ratio when holding the shift key and dragging in the image cropping tool in the customizer context.

Props melchoyce, mikeschroder.
Fixes #40211.

Note: See TracTickets for help on using tickets.