Swipe over native scroller
Sannyasin Brahmanathaswami
brahma at hindu.org
Thu Jan 31 08:18:52 EST 2019
Did you try Terry script? Elanor did something similar this in the Listen module, it not very refined. Terry put time in it with subtle time parameters. I have yet to try it. It here on the list
Terry, do we have a place for a repository for code snippits? Maybe you can put in on the forum.
I don't think you are going to get response to the bug problem. I have been trying to get smooth scrolling for 3 years! I think it is more a question of something deep in the engine that "can't be done", at least not cross platform. Otherwise they would have responded by now.
Here's Terry code from Dec. 20...Terry.... have improved it?
===========
Terry:
So, it seems like this approach works ok. Turned out there was an addition complication in that the items in my scrolling list are also selectable and I needed to prevent them being toggled on or off during a left/right swipe action. Anyway, this is what I ended up doing...
In the card script...
local pLoc, pTime, pV, pScroll
on touchStart pTouchID
put the mouseLoc into pLoc
put the millisecs into pTime
put the scroll of grp "checkList" into pScroll
put the mouseV into pV
end touchStart
on touchMove pTouchID, pTouchX, pTouchY
put pV-pTouchY into tY
put pScroll+tY into tScroll
set the scroll of grp "checkList" to tScroll
end touchMove
on touchEnd pTouchID
put the mouseLoc into pLoc1
put (item 1 of pLoc)-(item 1 of pLoc1) into tX
put (item 2 of pLoc)-(item 2 of pLoc1) into tY
put the millisecs - pTime into tElapsed
if abs(tX)>100 then # horizontal swipe
if abs(tY)< 50 then # small vertical movement
if tElapsed < 500 then # not too slow
if tX > 0 then
send "mouseUp" to grp "nextBtn"
else
send "mouseUp" to grp "backBtn"
end if
end if
end if
end if
end touchEnd
And in the "checklist" script...
local pX
on mouseDown
put the mouseH into pX
end mouseDown
on mouseUp
if abs((the mouseH)-pX) > 50 then exit mouseUp
# list selection code
end mouseUp
BR
On 1/30/19, 7:17 PM, "use-livecode on behalf of J. Landman Gay via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:
Thanks, I was afraid of that. I'll see if I can bump the bug report for
attention.
On 1/30/19 5:49 PM, Terry Judd via use-livecode wrote:
>Not much of a workaround I'm afraid, but for a recent app (iOS and Android) I got rid of the native scroller and used the touch messages to both scroll the object and detect the swipes.
>Terry...
More information about the use-livecode
mailing list