mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-31 21:48:36 +01:00
Media: Store and reuse image cropper ratio settings if available, instead of overwriting.
Props adamsilverstein. Merges [42595] to the 4.9 branch. Fixes #42646. Built from https://develop.svn.wordpress.org/branches/4.9@42596 git-svn-id: http://core.svn.wordpress.org/branches/4.9@42425 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f29bf78748
commit
4224f6e214
@ -8957,18 +8957,28 @@ Cropper = View.extend(/** @lends wp.media.view.Cropper.prototype */{
|
||||
imgOptions = _.extend(imgOptions, {
|
||||
parent: this.$el,
|
||||
onInit: function() {
|
||||
this.parent.children().on( 'mousedown touchstart', function( e ){
|
||||
|
||||
if ( e.shiftKey ) {
|
||||
// Store the set ratio.
|
||||
var setRatio = imgSelect.getOptions().aspectRatio;
|
||||
|
||||
// On mousedown, if no ratio is set and the Shift key is down, use a 1:1 ratio.
|
||||
this.parent.children().on( 'mousedown touchstart', function( e ) {
|
||||
|
||||
// If no ratio is set and the shift key is down, use a 1:1 ratio.
|
||||
if ( ! setRatio && e.shiftKey ) {
|
||||
imgSelect.setOptions( {
|
||||
aspectRatio: '1:1'
|
||||
} );
|
||||
} else {
|
||||
imgSelect.setOptions( {
|
||||
aspectRatio: false
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
this.parent.children().on( 'mouseup touchend', function( e ) {
|
||||
|
||||
// Restore the set ratio.
|
||||
imgSelect.setOptions( {
|
||||
aspectRatio: setRatio ? setRatio : false
|
||||
} );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
this.trigger('image-loaded');
|
||||
|
2
wp-includes/js/media-views.min.js
vendored
2
wp-includes/js/media-views.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9.3-alpha-42593';
|
||||
$wp_version = '4.9.3-alpha-42596';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user