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.
Fixes #41242.

Built from https://develop.svn.wordpress.org/trunk@42818


git-svn-id: http://core.svn.wordpress.org/trunk@42648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Adam Silverstein 2018-03-09 17:27:31 +00:00
parent 6751be3561
commit e70caa19a1
4 changed files with 4 additions and 4 deletions

View File

@ -653,7 +653,7 @@
*
* @returns {void}
*/
parent.children().mousedown(function(e){
parent.children().on( 'mousedown, touchstart', function(e){
var ratio = false, sel, defRatio;
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) {
/* 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();
startX = x1 = evX(event);

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-42817';
$wp_version = '5.0-alpha-42818';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.