Re: How to give swiping precedence over scrolling on mobile?

2018-12-20 Thread Terry Judd via use-livecode
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

On 21/12/2018 9:18 am, "use-livecode on behalf of Terry Judd via use-livecode" 
 wrote:

Thanks Brahmanathaswami - was thinking about this again last night and in 
my case I think I might be able to get it to work for me if I just use 
touchmove (and only track the y delta) for the vertical scrolling and touchend 
for the swiping, which is for card to card navigation rather than horizontal 
scrolling.

Regards,

Terry...

On 20/12/2018 11:53 pm, "use-livecode on behalf of Sannyasin 
Brahmanathaswami via use-livecode"  wrote:

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

 

Re: How to give swiping precedence over scrolling on mobile?

2018-12-20 Thread Terry Judd via use-livecode
Thanks Brahmanathaswami - was thinking about this again last night and in my 
case I think I might be able to get it to work for me if I just use touchmove 
(and only track the y delta) for the vertical scrolling and touchend for the 
swiping, which is for card to card navigation rather than horizontal scrolling.

Regards,

Terry...

On 20/12/2018 11:53 pm, "use-livecode on behalf of Sannyasin Brahmanathaswami 
via use-livecode"  wrote:

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"  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...

___
use-livecode mailing list
use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: How to give swiping precedence over scrolling on mobile?

2018-12-20 Thread Sannyasin Brahmanathaswami via use-livecode
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" 
 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...

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

How to give swiping precedence over scrolling on mobile?

2018-12-19 Thread Terry Judd via use-livecode
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...
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode