emberjs-addons / ember-touch

A lightweight library for building and using touch gestures with Ember Applications
MIT License
182 stars 28 forks source link

mobiscroll is not working with ember-touch #16

Closed dhinesh03 closed 10 years ago

ppcano commented 11 years ago

You would need to setup your ember views to work as Mobiscroll UI controls. Then, touch events can be delegated to ember-touch package through ember views.

I have never used Mobiscroll, but I would be willing to look at it, if you provide a gist and a detailed description of your use case.

dhinesh03 commented 11 years ago

Here is the gist link https://gist.github.com/dhinesh03/5387358 . There I have a select view to which I m applying mobiscroll. The select view directly appended inside the div(id = "testView") is working properly but the same created as a childView of an Ember.ContainerView(appended inside div id="testContainer") is not working properly. In normal web browsers it will work fine but not in mobile browsers. Ember version Im using is 0.9.8.1 ,mobiscroll version is 2.5.0 and the ember touch tag ver is support 0.9.7.1

dhinesh03 commented 10 years ago

Mobiscroll has its own touch functionality so it doesn't work with ember touch .I used the following changes on _dispatchEvent function on ember.js file to solve this issue.

/* @private / _dispatchEvent: function(object, evt, eventName, view) { var result = true;

var handler = object[eventName]; 
var MOBISCROLL = false;
if(typeof evt.originalEvent !=="undefined" && Ember.typeOf(evt.originalEvent.srcElement) !== "undefined") {
    if(evt.originalEvent.srcElement.className == "dwwo") {
        MOBISCROLL = true;
    }
}
if (Ember.typeOf(handler) === 'function' && !MOBISCROLL) {
  result = handler.call(object, evt, view);
  // Do not preventDefault in eventManagers.
  evt.stopPropagation();
} ...