Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#40211 closed enhancement (fixed)

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

Reported by: melchoyce's profile melchoyce Owned by: adamsilverstein's profile 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 7 years ago.
40211.2.diff (2.5 KB) - added by adamsilverstein 7 years ago.

Download all attachments as: .zip

Change History (10)

#1 @kirasong
8 years ago

Related: #22786

#2 @kirasong
8 years 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 click to drag and maintain that ratio as well.

Version 0, edited 8 years ago by kirasong (next)

#3 @adamsilverstein
7 years 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
7 years ago

Patch works as expected 👍 Thanks @adamsilverstein!

#5 @melchoyce
7 years ago

  • Keywords reporter-feedback removed

#6 @adamsilverstein
7 years ago

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

#7 @adamsilverstein
7 years ago

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

#8 @adamsilverstein
7 years 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.