How to give swiping precedence over scrolling on mobile?

Sannyasin Brahmanathaswami brahma at hindu.org
Thu Dec 20 07:52:23 EST 2018


Terry, I'm interested in this also.

Get the SivaSiva app ( no space... from iOS and Google Play)

In the Listen Module, with Elanor's help, I tried to set up a "Spotify" UX with categories of audio scroll and up and down, and within on categories, left to right.

I also get, what is a probably the same as you get, a "conflict" between Elanor touch events -- from scrolling left with right and up and down. 

In this case we don’t use the mobileScroller at all in mobile, both up and down, left and right,  are implement with touch. But I think it is the same thing as you have... 

What I am seeing is: when the up and down in active, the left to right touch is disabled. It "kinda" works for the user but is very "clunky". I tried playing with touch startx and y numbers. It gets "worse" as you go down in size.

The script is small enough to put here. Would be nice of this were fixed but I don’t seeing how the engine would do it. It would seem that the pTouchX and pTouchY are managing the scroll independently. 

So you try a "swipe" gesture with your thumb that goes "diagonally"  that is, changes is location on the  both "x" and "y" axes ... the engine is going to focus on say just the "y" cords -- you get an up to down scroll or vice-versa-- but "x" coord are not "seen" and  you don't get any left of right behavior -- in you case, a card swipe, in my case a group swipe left to right fails. 

Until you stop and "focus" carefully on "x" axes gesture (left to right, or vice versa). then you get you Card/Group swipe horizontally...

on touchStart pTouchID
   put empty into sStartX
   put empty into sStartY
   
   put the vScroll of grp "all-collections" into sStartYScroll
   
   put the long owner of the target into tHGroup  
   put the hScroll of tHGroup into sStartHScroll
end touchStart

on touchMove pTouchID, pTouchX, pTouchY
      if sStartY is empty then 
         put pTouchY into sStartY
      end if
      
      if sStartX is empty then
         put pTouchX into sStartX
      end if
      
      // Check for vertical scroll
      
      if pTouchY > (sStartY + 20) or pTouchY < (sStartY - 20) then
         set the vScroll of group "all-collections" to sStartYScroll + (sStartY-pTouchY)
      else
         
         if pTouchX > (sStartX + 10) or pTouchX < (sStartX - 10) then
            // Check for horizontal scroll
            
            put the long owner of the target into tHGroup  
            set the hScroll of tHGroup to sStartHScroll + (sStartX-pTouchX)
            
         end if
      end if
      
   end touchMove

on touchEnd pTouchID
  -- code
end touchEnd

on touchRelease pTouchID
   -- code
end touchRelease


I wish there was are easy fix...but I suspect "not"

Brahmanathaswami
 

On 12/19/18, 2:58 PM, "use-livecode on behalf of Terry Judd via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:

    This is a problem that I have run into before and have never been able to solve satisfactorily. I’m using touchStart and touchEnd handlers to detect the direction and speed of a finger movement and if it is within certain bounds (large enough x, small enough y, and fast enough) then the user can swipe back and forwards through a series of cards. Good so far except when the area they are swiping on also includes a mobile scroller (to scroll a list selection widget/thingy). In that situation the swiping becomes a bit of a hit and miss thing – works sometimes but not others. On iOS there are a few scroller parameters look potentially useful (canCancelTouches, delayTouches, and lockDirection) but it’s not really clear (to me at least) which of these might help and if so whether I should be setting them to true or false.
    
    Any ideas?
    
    Terry...



More information about the Use-livecode mailing list