From b480968d9bb32a9de071bbd9404fe01ebe152ad8 Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Mon, 20 Jul 2015 19:01:19 +0000 Subject: [PATCH] Site Icon: Center initial crop position. Starting out at the center of the image makes for a better user experience. Props iseulde. Fixes #33050. git-svn-id: https://develop.svn.wordpress.org/trunk@33333 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/customize-controls.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index 70652477d0..a5ca3bd14e 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -1934,7 +1934,7 @@ ratio = xInit / yInit, xImg = realWidth, yImg = realHeight, - imgSelectOptions; + x1, y1, imgSelectOptions; controller.set( 'canSkipCrop', ! control.mustBeCropped( flexWidth, flexHeight, xInit, yInit, realWidth, realHeight ) ); @@ -1946,6 +1946,9 @@ yInit = xInit / ratio; } + x1 = ( xImg - xInit ) / 2; + y1 = ( yImg - yInit ) / 2; + imgSelectOptions = { handles: true, keys: true, @@ -1953,10 +1956,10 @@ persistent: true, imageWidth: realWidth, imageHeight: realHeight, - x1: 0, - y1: 0, - x2: xInit, - y2: yInit + x1: x1, + y1: y1, + x2: xInit + x1, + y2: yInit + y1 }; if ( flexHeight === false && flexWidth === false ) {