Swipe gestures on a mobile scroller

Scott Morrow scott at elementarysoftware.com
Sun Nov 20 10:19:50 CET 2016


I used touchMove and found it at least partially reliable for horizontal swipes on iOS (not tried on Android)
Something like:

global gHorizontalSwipeDistance
local lMouseStartH
local lMouseStartV


-- put 80 into gHorizontalSwipeDistance -- depending on the resolution during startup

on touchStart pID
   put the mouseV into lMouseStartV
   put the mouseH into lMouseStartH
end touchStart

on touchMove pTouchID, pTouchH, pTouchV
   -- see if there was a horizontal swipe
   if (abs(pTouchH - lMouseStartH) > gHorizontalSwipeDistance) AND\
   (abs(pTouchV - lMouseStartV) < gVerticalSwipeDistance) then
      -- they swiped

   end if
end touch


Scott Morrow

Elementary Software
(Now with 20% less chalk dust!)
web       http://elementarysoftware.com/
email     scott at elementarysoftware.com
office     1-800-615-0867
------------------------------------------------------








> On Nov 19, 2016, at 8:13 PM, J. Landman Gay <jacque at hyperactivesw.com> wrote:
> 
> BTW, there appears to be a related bug that got fixed:
> <http://quality.livecode.com/show_bug.cgi?id=16239>
> 
> MouseUp wasn't being sent when a native scroller was active. It looks like they fixed that one but forgot to check related swipe mouseUps. Hopefully the team can use the same fix again.
> 
> 
> On 11/19/16 10:06 PM, J. Landman Gay wrote:
>> Well, it's good to know I'm not alone I guess. ;) I just wish I'd asked
>> earlier, before I spent some hours tracking down the problem. I'd like
>> to think the omission of mouseUp/touchEnd messages was an oversight,
>> since we do get all the other mouse messages.
>> 
>> I haven't tried Paul's workaround. I'm not sure how it could work, since
>> the horizontal scroll of my field is always zero. It doesn't scroll
>> horizontally at all.
>> 
>> The fix should really be in the engine though.
>> 
>> On 11/19/16 8:53 PM, Terry Judd wrote:
>>> Hi Jacque - I struggled with this for ages on an iOS and android app
>>> earlier in the year (vertical scrolling content with side-to-side
>>> swiping for navigation (a la iCal). After trying a truckload of
>>> different approaches (hacks) I mostly got it to work on iOS (I still
>>> got intermittent failures) and I eventually gave up altogether on
>>> android and used left and right buttons instead. Things might have
>>> improved then but based on your experience it sounds unlikely. Happy
>>> to dig out my hacky iOS code if that helps but engine level fixes
>>> would be better.
>>> 
>>> Terry...
>>> 
>>> Sent from my iPad
>>> 
>>>> On 20 Nov 2016, at 6:39 AM, J. Landman Gay
>>>> <jacque at hyperactivesw.com> wrote:
>>>> 
>>>>> On 11/19/16 2:18 AM, J. Landman Gay wrote: I have a native mobile
>>>>> scroller handling the vertical scroll of a field. I want to add
>>>>> swipe gestures to change cards. When swiping, I get a mouseDown,
>>>>> sporadic mouseMoves (the logging might be interfering, not sure,
>>>>> but after a couple they stop) and no mouseUp at all.
>>>>> 
>>>>> I tried using touchStart/touchMove/touchEnd instead and the
>>>>> result is the same. TouchStart always fires, touchMove is iffy,
>>>>> and touchEnd never happens.
>>>>> 
>>>>> Without the end message I can't calculate the direction. Plain
>>>>> taps work fine with either set of messages, I do get
>>>>> mouseUp/touchEnd if it's a tap. It's only swipes that don't
>>>>> report.
>>>>> 
>>>>> The scroller has its hScroll property set to false if that
>>>>> matters, as I don't want horizontal scrolling but I do want to
>>>>> track the touch direction.
>>>> 
>>>> The problem has apparently been around for quite some time:
>>>> <http://quality.livecode.com/show_bug.cgi?id=12419>
>>>> 
>>>> Anyone have a workaround?
>>>> 
>>>> -- Jacqueline Landman Gay         |     jacque at hyperactivesw.com
>>>> HyperActive Software           |     http://www.hyperactivesw.com
>>>> 
>>>> _______________________________________________ use-livecode
>>>> mailing list use-livecode at lists.runrev.com Please visit this url to
>>>> subscribe, unsubscribe and manage your subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> 
>>> _______________________________________________ use-livecode mailing
>>> list use-livecode at lists.runrev.com Please visit this url to
>>> subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>> 
>> 
> 
> 
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list