emberjs-addons / ember-touch

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

touchHoldEnd does not allow webkit scroll #11

Closed kzgolden-pba closed 11 years ago

kzgolden-pba commented 12 years ago

I'm attempting to use the following css properties on a childview:

overflow-y: auto !important; -webkit-overflow-scrolling: touch;

If the parentView has a function for touchHoldEnd, the above property will not work on child views. This is even the case when I used a gestureDelegate to disable the touchHoldEnd at a time when the childview with scrolling is present. I can tell that gestureDelegate is functioning because the touchHoldEnd function does not get called on the parentView when it's disabled. However, only by completely removing the touchHoldEnd method from the parent can I get the touch scrolling functionality on the child view.

ppcano commented 12 years ago

I have made a test for this case and it seems to work properly.

Gestures does not avoid the event to be bubbled up, because they always return undefined. This feature should be implemented.

Webkit scroll works "Ember 0.9.81" on the following test, perhaps the failure is coming from other side.

@kcgolden, may you reproduce your example in order i can test it.

kzgolden-pba commented 12 years ago

I am having trouble reproducing an independent case demonstrating this issue though it is definitely happening in some proprietary code I am dealing with.

The behavior is simple:

  1. If I completely comment out the touchHoldEnd method in the parentView, the touch event on the child element containing the scrollbar works.
  2. If I use gesture delegates or alternatively, write my own logic to set the touchHoldEnd method to 'undefined' dynamically, the 'touch' event on the element containing the scrollbar is not received though the touchHoldEnd functionality on the parent does not occur.

What is the functionaility of a gestureDelegate when it disables the touchHoldEnd method? Does it only set it to undefined or something more?

ppcano commented 12 years ago
  1. Take a look at the test case on my gist and try to adapt it to reproduce your case. I don't implement touchEvent on the child element, the child element has only the -webkit-overflow-scrolling property.
  2. I hope to have some time to write more docs or a gh-page for the project.

You should take a look at the Gesture Manager._invoke_event.

It checks if they are some conditions ( gesture.isEnabled, gestureDelegate, delegateRules, appGestureManager ) to pass the event to the gesture or skip it and bubble the event to the parentView.

If you remove the touchHoldEnd method, the view has not assign any gesture. It seems like the gesture does not allow to bubble up the event, but i tested it and worked well.

You can also debug the EventDispatcher.

ppcano commented 11 years ago

Closing this issue because inactivity.