Skip to content

Simultaneously Feature

ppcano edited this page Jan 10, 2012 · 3 revisions

Simultaneously

Currently, views can set up on its gesture options if its gesture can be recognized simultaneously with other gestures or not.

A view with simultaneously property false will automatically block the gesture recognizer (when its event get recognized) only to the views with simultaneously property false.

The blocker view is in charge of unblocking the gesture recognizer, commonly either on its gestureCancel or gestureEnd call via the unblockGestureRecognizer method. Unblocking at the view layer can be useful to create complex user interfaces.

SwipeSliderView = Ember.ContainerView.extend({

swipeOptions: {
	direction: Em.OneGestureDirection.Left | Em.OneGestureDirection.Right,
	cancelPeriod: 100,
       simultaneously: false,
	swipeThreshold: 30,
	initThreshold: 15 
},
swipeCancel: function(recognizer) {
       this.unblockGestureRecognizer();
},

swipeEnd: function(recognizer) {
      var that = this;
      if ( recognizer.swipeDirection === Em.OneGestureDirection.Left ) {
         this.moveNext( function() {
             that.unblockGestureRecognizer();
          });
      } else if ( recognizer.swipeDirection === Em.OneGestureDirection.Right ) {
         this.moveBack( function() {
              that.unblockGestureRecognizer();
          });
      }
},
    ...........

By default, all the gestures can be recognized simultaneously.

The current implementation is a first approach, and its API will evolve based on gesture recognition requirements on multi-touch devices.

Clone this wiki locally