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.


git-svn-id: https://develop.svn.wordpress.org/trunk@42818 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Adam Silverstein 2018-03-09 17:26:53 +00:00
parent fd1681f0cf
commit 1b043c1492
2 changed files with 2 additions and 2 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 ) {

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);