Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bump version to 0.0.7.

  • Loading branch information...
commit 72f77a52a57070532d6ab85dd7af7889523e68ae 1 parent 54cffe6
@ngryman authored
View
3  README.md
@@ -49,6 +49,9 @@ _(Coming soon)_
## Release History
+### v0.0.7
+ - various cross browsers fixes.
+
### v0.0.6
- updated description.
View
21 dist/jquery.finger.js
@@ -1,4 +1,4 @@
-/*! jquery.finger - v0.0.6 - 2013-02-28
+/*! jquery.finger - v0.0.7 - 2013-03-12
* https://github.com/ngryman/jquery.finger
* Copyright (c) 2013 Nicolas Gryman; Licensed MIT */
@@ -6,7 +6,7 @@
var hasTouch = 'ontouchstart' in window,
startEvent = hasTouch ? 'touchstart' : 'mousedown',
- stopEvent = hasTouch ? 'touchend touchcancel' : 'mouseup',
+ stopEvent = hasTouch ? 'touchend touchcancel' : 'mouseup mouseleave',
moveEvent = hasTouch ? 'touchmove' : 'mousemove';
$.Finger = {
@@ -35,6 +35,10 @@
$.event[action](el, stopEvent, stopHandler, null, handleObj.selector);
}
+ function page(coord, e) {
+ return (hasTouch ? e.originalEvent.touches[0] : e)['page' + coord.toUpperCase()];
+ }
+
function fire(evtName, event, f) {
if (f[evtName] && !f[evtName].canceled) {
$.extend(event, f.move);
@@ -49,7 +53,7 @@
function startHandler(event) {
var f = finger(event.delegateTarget);
- f.move = { x: event.pageX, y: event.pageY };
+ f.move = { x: page('x', event), y: page('y', event) };
f.start = $.extend({ time: event.timeStamp }, f.move);
}
@@ -60,10 +64,10 @@
if (!f.start) return;
// motion data
- f.move.x = event.pageX;
- f.move.y = event.pageY;
- f.move.dx = event.pageX - f.start.x;
- f.move.dy = event.pageY - f.start.y;
+ f.move.x = page('x', event);
+ f.move.y = page('y', event);
+ f.move.dx = f.move.x - f.start.x;
+ f.move.dy = f.move.y - f.start.y;
f.move.adx = Math.abs(f.move.dx);
f.move.ady = Math.abs(f.move.dy);
@@ -94,6 +98,9 @@
now = event.timeStamp,
evtName;
+ // no start event fired, do nothing
+ if (!f.start) return;
+
// tap-like events
evtName = now - f.start.time < $.Finger.pressDuration ? 'tap' : 'press';
// is it a double tap ?
View
4 dist/jquery.finger.min.js
@@ -1,4 +1,4 @@
-/*! jquery.finger - v0.0.6 - 2013-02-28
+/*! jquery.finger - v0.0.7 - 2013-03-12
* https://github.com/ngryman/jquery.finger
* Copyright (c) 2013 Nicolas Gryman; Licensed MIT */
-(function(e){function t(t){return e._data(t,"events").finger}function n(e,t,n){return 3!=arguments.length?e?e[t]:void 0:(e&&(e[t]=n),void 0)}function a(t,n,a){e.event[t](n,v,r,null,a.selector),e.event[t](n,u,i,null,a.selector),e.event[t](n,s,d,null,a.selector)}function o(t,n,a){if(a[t]&&!a[t].canceled){e.extend(n,a.move);var o=a[t].handlers;for(var r in o)e.isFunction(o[r])&&o[r].call(n.currentTarget,n)}}function r(n){var a=t(n.delegateTarget);a.move={x:n.pageX,y:n.pageY},a.start=e.extend({time:n.timeStamp},a.move)}function i(a){var r=t(a.delegateTarget);r.start&&(r.move.x=a.pageX,r.move.y=a.pageY,r.move.dx=a.pageX-r.start.x,r.move.dy=a.pageY-r.start.y,r.move.adx=Math.abs(r.move.dx),r.move.ady=Math.abs(r.move.dy),r.move.adx<e.Finger.motionThreshold&&r.move.ady<e.Finger.motionThreshold||(r.move.orientation||(r.move.adx>r.move.ady?(r.move.orientation="horizontal",r.move.direction=r.move.dx>0?1:-1):(r.move.orientation="vertical",r.move.direction=r.move.dy>0?1:-1)),o("drag",a,r),n(r.tap,"canceled",!0),n(r.press,"canceled",!0)))}function d(a){var r,i=t(a.delegateTarget),d=a.timeStamp;r=d-i.start.time<e.Finger.pressDuration?"tap":"press","tap"==r&&i.doubletap&&(d-i.doubletap.prev<e.Finger.doubleTapInterval?r="doubletap":i.doubletap.prev=d),o(r,a,i),r=d-i.start.time<e.Finger.flickDuration?"flick":"drag",o(r,a,i),i.start=null,n(i.tap,"canceled",!1),n(i.press,"canceled",!1)}var l="ontouchstart"in window,v=l?"touchstart":"mousedown",s=l?"touchend touchcancel":"mouseup",u=l?"touchmove":"mousemove";e.Finger={pressDuration:300,doubleTapInterval:300,flickDuration:150,motionThreshold:5};var c={add:function(t){var n=e._data(this,"events");n.finger=n.finger||{};var o=n.finger;o.refCount||(a("add",this,t),o.refCount=0),o.refCount++,o[t.type]=o[t.type]||{handlers:[]},o[t.type].handlers[t.handler.guid]=t.handler},remove:function(t){var n=e._data(this,"events"),o=n.finger;return o.refCount--,0===o.refCount?(a("remove",this,t),n.finger=null,void 0):(o[t.type].handlers[t.handler.guid]=null,void 0)}};e.event.special.tap=c,e.event.special.press=c,e.event.special.doubletap=c,e.event.special.drag=c,e.event.special.flick=c})(jQuery);
+(function(e){function t(t){return e._data(t,"events").finger}function n(e,t,n){return 3!=arguments.length?e?e[t]:void 0:(e&&(e[t]=n),void 0)}function o(t,n,o){e.event[t](n,s,i,null,o.selector),e.event[t](n,c,d,null,o.selector),e.event[t](n,u,v,null,o.selector)}function a(e,t){return(l?t.originalEvent.touches[0]:t)["page"+e.toUpperCase()]}function r(t,n,o){if(o[t]&&!o[t].canceled){e.extend(n,o.move);var a=o[t].handlers;for(var r in a)e.isFunction(a[r])&&a[r].call(n.currentTarget,n)}}function i(n){var o=t(n.delegateTarget);o.move={x:a("x",n),y:a("y",n)},o.start=e.extend({time:n.timeStamp},o.move)}function d(o){var i=t(o.delegateTarget);i.start&&(i.move.x=a("x",o),i.move.y=a("y",o),i.move.dx=i.move.x-i.start.x,i.move.dy=i.move.y-i.start.y,i.move.adx=Math.abs(i.move.dx),i.move.ady=Math.abs(i.move.dy),i.move.adx<e.Finger.motionThreshold&&i.move.ady<e.Finger.motionThreshold||(i.move.orientation||(i.move.adx>i.move.ady?(i.move.orientation="horizontal",i.move.direction=i.move.dx>0?1:-1):(i.move.orientation="vertical",i.move.direction=i.move.dy>0?1:-1)),r("drag",o,i),n(i.tap,"canceled",!0),n(i.press,"canceled",!0)))}function v(o){var a,i=t(o.delegateTarget),d=o.timeStamp;i.start&&(a=d-i.start.time<e.Finger.pressDuration?"tap":"press","tap"==a&&i.doubletap&&(d-i.doubletap.prev<e.Finger.doubleTapInterval?a="doubletap":i.doubletap.prev=d),r(a,o,i),a=d-i.start.time<e.Finger.flickDuration?"flick":"drag",r(a,o,i),i.start=null,n(i.tap,"canceled",!1),n(i.press,"canceled",!1))}var l="ontouchstart"in window,s=l?"touchstart":"mousedown",u=l?"touchend touchcancel":"mouseup mouseleave",c=l?"touchmove":"mousemove";e.Finger={pressDuration:300,doubleTapInterval:300,flickDuration:150,motionThreshold:5};var m={add:function(t){var n=e._data(this,"events");n.finger=n.finger||{};var a=n.finger;a.refCount||(o("add",this,t),a.refCount=0),a.refCount++,a[t.type]=a[t.type]||{handlers:[]},a[t.type].handlers[t.handler.guid]=t.handler},remove:function(t){var n=e._data(this,"events"),a=n.finger;return a.refCount--,0===a.refCount?(o("remove",this,t),n.finger=null,void 0):(a[t.type].handlers[t.handler.guid]=null,void 0)}};e.event.special.tap=m,e.event.special.press=m,e.event.special.doubletap=m,e.event.special.drag=m,e.event.special.flick=m})(jQuery);
View
8 finger.jquery.json
@@ -2,7 +2,7 @@
"name": "finger",
"title": "jQuery Finger",
"description": "jQuery Finger unifies click and touch events by removing the 300ms delay on touch devices. It also provide a common set of events to handle basic gestures such as drag and pinch. Small (< 1kb gzipped), it is focused on performance, is well tested and ... also supports jQuery delegated events.",
- "version": "0.0.6",
+ "version": "0.0.7",
"homepage": "https://github.com/ngryman/jquery.finger",
"bugs": "https://github.com/ngryman/jquery.finger/issues",
"author": {
@@ -32,8 +32,12 @@
"swipe",
"flick",
"drag",
+ "move",
"gestures",
"touch",
- "mobile"
+ "tappable",
+ "event",
+ "mobile",
+ "tablet"
]
}
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "jquery.finger",
- "version": "0.0.6",
+ "version": "0.0.7",
"author": {
"name": "Nicolas Gryman",
"email": "ngryman@gmail.com"
Please sign in to comment.
Something went wrong with that request. Please try again.