diff --git a/src/core/gestures/MdGestureConfig.ts b/src/core/gestures/MdGestureConfig.ts new file mode 100644 index 00000000000..21a7f295fb4 --- /dev/null +++ b/src/core/gestures/MdGestureConfig.ts @@ -0,0 +1,26 @@ +import {Injectable} from 'angular2/core'; +import {HammerGestureConfig} from 'angular2/src/platform/browser_common'; + +/* Adjusts configuration of our gesture library, Hammer. */ +@Injectable() +export class MdGestureConfig extends HammerGestureConfig { + /* List of new event names to add to the gesture support list */ + events: string[] = ['drag', 'longpress']; + + /* + * Overrides default recognizer event names and thresholds. + * + * Our gesture names come from the Material Design gestures spec: + * https://www.google.com/design/spec/patterns/gestures.html#gestures-touch-mechanics + * + * More information on default recognizers can be found in Hammer docs: + * http://hammerjs.github.io/recognizer-pan/ + * http://hammerjs.github.io/recognizer-press/ + * + * TODO: Confirm threshold numbers with Material Design UX Team + * */ + overrides: {[key: string]: Object} = { + 'pan': {event: 'drag', threshold: 6}, + 'press': {event: 'longpress', time: 500} + }; +} diff --git a/src/demo-app/demo-app.html b/src/demo-app/demo-app.html index c7e961ce53b..76a1d72b49e 100644 --- a/src/demo-app/demo-app.html +++ b/src/demo-app/demo-app.html @@ -14,6 +14,7 @@
  • List demo
  • Live Announcer demo
  • Sidenav demo
  • +
  • Gestures demo