forked from furf/jquery-ui-touch-punch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
major refactor to use simulated events. minification now done using u…
…glify
- Loading branch information
Showing
2 changed files
with
86 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* | ||
* jQuery UI Touch Punch 0.1.2 | ||
/*! | ||
* jQuery UI Touch Punch 0.2.0 | ||
* | ||
* Copyright 2010, Dave Furfero | ||
* Copyright 2011, Dave Furfero | ||
* Dual licensed under the MIT or GPL Version 2 licenses. | ||
* | ||
* Depends: | ||
* jquery.ui.widget.js | ||
* jquery.ui.mouse.js | ||
*/ | ||
(function(d){d.support.touch=typeof Touch==="object";if(!d.support.touch){return;}var b=d(document),c=d.ui.mouse.prototype,e=c._mouseInit,i;function f(k,j){var l=k.originalEvent.changedTouches[0];return d.extend(k,{type:"mouse"+j,which:1,pageX:l.pageX,pageY:l.pageY,screenX:l.screenX,screenY:l.screenY,clientX:l.clientX,clientY:l.clientY});}function a(k){if(i||k.originalEvent.touches.length>1){return;}i=true;var j=this;d(k.target).trigger(f(k,"over"));b.bind("touchmove."+j.widgetName,j._touchMove).bind("touchend."+j.widgetName,j._touchEnd).trigger("mousedown");j._mouseDown(f(k,"down"));}function g(k){var j=this;if(k.originalEvent.touches.length>1){j._touchEnd(k);}else{j._mouseMove(f(k,"move"));}}function h(k){var j=this;j._mouseUp(f(k,"up"));b.unbind("touchmove."+j.widgetName,j._touchMove).unbind("touchend."+j.widgetName,j._touchEnd);i=false;d(k.target).trigger(f(k,"out"));}c._mouseInit=function(){var j=this;j._touchStart=d.proxy(a,j);j._touchMove=d.proxy(g,j);j._touchEnd=d.proxy(h,j);j.element.bind("touchstart."+j.widgetName,j._touchStart);e.call(j);};})(jQuery); | ||
(function(a){function e(a,b){if(a.originalEvent.touches.length>1)return;a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}a.support.touch=typeof Touch=="object";if(!a.support.touch)return;var b=a.ui.mouse.prototype,c=b._mouseInit,d;b._touchStart=function(a){if(d)return;d=!0,this._touchMoved=!1,e(a,"mouseover"),e(a,"mousemove"),e(a,"mousedown")},b._touchMove=function(a){this._touchMoved=!0,e(a,"mousemove")},b._touchEnd=function(a){e(a,"mouseup"),e(a,"mouseout"),this._touchMoved||e(a,"click"),d=!1},b._mouseInit=function(){var b=this;b.element.bind("touchstart",a.proxy(b,"_touchStart")).bind("touchmove",a.proxy(b,"_touchMove")).bind("touchend",a.proxy(b,"_touchEnd")),c.call(b)}})(jQuery); |