Dictionary Entry For TouchMove

Brian Milby brian at milby7.com
Mon Mar 12 18:24:26 EDT 2018


Short answer, you need to track the location of each touch yourself and do
the math.

Check out this piece of code:
https://raw.githubusercontent.com/bwmilby/lc-misc/master/PinchZoom/pinchzoom.livecodescript

That is a piece of code that I translated into LCS that deals with tracking
two touch points to zoom an object.  Depending on what you want to
accomplish, you won't need anything that complicated.

Looking at the Netflix app, you can either go vertical or horizontal.
First movement direction locks it until all touches are released.  So you
would need to capture the touchStart to get the ID and then 2 touchMove
messages to establish direction (I didn't try using mouseloc to get the
touchStart location).  You may want to pair the direction detection with a
minimum to ensure you capture the correct direction.

Hope this helps,
Brian

On Mon, Mar 12, 2018 at 4:39 PM, Sannyasin Brahmanathaswami via
use-livecode <use-livecode at lists.runrev.com> wrote:

> I have a group control (made up smaller groups) they I want users to
> scroll vertically. And the sub-groups, which want the user to scroller
> horizontally. My current thinking is to turn off scrollers until we get
> swipe direction, and turn them on, "mid-swipe"
>
> simply: how do you know if touchMove is a horizontal or vertical swipe?
>
> in the dictionary, it says (another cryptic entry!)
>
> touchMove pTouchID, pTouchX, pTouchY
>
> Summary
>
> Sent when the point at which the user is touching the screen changes.
> Example
>
> on touchMove pTouchID, pX, pY
>      if pX > lastX then
>      -- user has moved to the right
>      end if
> end touchMove
>
> where does "lastX"  come from? It is not localized as a variable.
>
> Other touch handlers do not record the X,Y coords of touchRelease.
>
> should we
>
> local sLastMouseUp
>
> end touchRelease
>   put the mouseloc to sLastMouseUp
> end touchRelease
>
> on touchMove pTouchID, pX, pY
>      if pX > (item 1 of sLastMouseUp) then
>      -- user has moved to the right
>      end if
> end touchMove
>
> But this relative to the last swipe -  this is not "runtime" as the
> dictionary says:
>
> "Handle the touchMove message if you want to perform some action when
> the user changes the touch position without ending the touch or if you
> want to keep continuous track of the touch position."
>
> BR
>
>
>
>
>
>
>
>
> _______________________________________________
> 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