I really need to write the new implementation of swipe I've been thinking 
about for a while - it will be a billion times more awesome :)

About your problem: Given that you are using Mobile, you are using 
Custom-Event too (= you are a PowerTools! user, heh!) and those two in 
conjunction provide you with everything you need. Note that you'll need 
Mobile/Click and normal anchors with normal links (ie. without click events) 
will likely still fire, if everything is handled through the mootools event 
system and Custom-Event you can do something like this:

el.addEvent('swipe', function(){
  // swipe occurred, block all other custom events for a bit
  Element.disableCustomEvents();
  
  // Enable again after touchend was fired (ie. right in the next execution 
chain through a delay).
  (function(){
    Element.enableCustomEvents();
  }).delay(1);
});

If you use Mobile/Click, the 'click' event in MooTools becomes a custom 
event based on touchend. With the feature in Custom-Event to disable a 
custom event, you can disable all custom events that have an onEnable and 
onDisable method. The custom touchend in mootools-mobile handles this 
properly. See the bottom of the README 
here: https://github.com/cpojer/mootools-custom-event 
and https://github.com/cpojer/mootools-mobile/blob/master/Source/Touch/Touch.js 
for more information on how this is actually implemented.

Your problem is exactly why implemented the above APIs. I'm not set on them, 
they might not be the cleanest and best implementations for this, but I have 
found them to work pretty good. Please let me know if it works :)

Reply via email to