Media: Fix image cropping on touch screen devices.

* In initCrop, handle touch events in addition to mouse events.
* In imageSelect jQuery plugin, accept event.which of 0 as provided by touch events.

Props yahil, alexgso, joemcgill.
Merges [42818] to the 4.9 branch.
Fixes #41242.


Built from https://develop.svn.wordpress.org/branches/4.9@42874


git-svn-id: http://core.svn.wordpress.org/branches/4.9@42704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Adam Silverstein 2018-03-24 20:26:42 +00:00
parent 61be857c95
commit 4650753c6b
4 changed files with 4 additions and 4 deletions

View File

@ -627,7 +627,7 @@
* *
* @returns {void} * @returns {void}
*/ */
parent.children().mousedown(function(e){ parent.children().on( 'mousedown, touchstart', function(e){
var ratio = false, sel, defRatio; var ratio = false, sel, defRatio;
if ( e.shiftKey ) { if ( e.shiftKey ) {

File diff suppressed because one or more lines are too long

View File

@ -748,7 +748,7 @@ $.imgAreaSelect = function (img, options) {
*/ */
function imgMouseDown(event) { function imgMouseDown(event) {
/* Ignore the event if animation is in progress */ /* Ignore the event if animation is in progress */
if (event.which != 1 || $outer.is(':animated')) return false; if (event.which > 1 || $outer.is(':animated')) return false;
adjust(); adjust();
startX = x1 = evX(event); startX = x1 = evX(event);

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9.5-beta1-42869'; $wp_version = '4.9.5-beta1-42874';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.