Swiping left and right in LC 6.5

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

Post Reply
marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Swiping left and right in LC 6.5

Post by marcelloe » Wed Nov 13, 2013 7:21 pm

I have used the following code in my stack and it works great. When I add the script to scale(fullScreenMode = exact fit) to ipad it doesn't work anymore. Any idea why it stopped working?

# the event id and initial swipe time and position
local sTouchId, sInitTime, sInitX

# maximum swipe time in millisecs
local sSwipeTime

# minimum swipe distance
local sSwipeDistance

on openStack
# set up swipe values - experiment with these for required effect
put 500 into sSwipeTime
put 150 into sSwipeDistance
end openStack

on touchMove pId, pX, pY
if pId <> sTouchId then
# record initial values for start of swipe
put pId into sTouchId
put the millisecs into sInitTime
put pX into sInitX
end if

# check the action was fast enough for a swipe
if the millisecs - sInitTime <= sSwipeTime then
# check we have covered enough distance
put pX - sInitX into tDistanceX
if abs(tDistanceX) > sSwipeDistance then
if tDistanceX < 0 then
# finger is swiping left
send "swipeLeft" to me in 0 millisecs
else
# finger is swiping right
send "swipeRight" to me in 0 millisecs
end if
end if
end if
end touchMove

command swipeLeft
visual effect scroll left normal
go next card
end swipeLeft

command swipeRight
visual effect scroll right normal
go prev card
end swipeRight

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Swiping left and right in LC 6.5

Post by LCNeil » Thu Nov 14, 2013 1:56 pm

Hi Mark,

I have tested your script in LiveCode 6.5 RC3 with the scale mode set to "exact fit" and, for me, it still works as expected.

Please see the attached sample stack that should show this working.

If you still experience the issue after trying the sample stack, please get back in touch and we will happily investigate further

Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding
--
Attachments
moveTEst.livecode.zip
(2.06 KiB) Downloaded 106 times

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Swiping left and right in LC 6.5

Post by marcelloe » Thu Nov 14, 2013 4:09 pm

I tested your sample stack and it works great. I made a simple change to my stack. I put the script of fullScreenMode into openStack instead of preOpenStack. The swiping works now. I am still having issues with my cards not scaling right. The 1st card scales fine, but the rest of the cards don't scale right. Everything is in the bottom left hand corner. what am I doing wrong?

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Swiping left and right in LC 6.5

Post by LCNeil » Thu Nov 14, 2013 4:45 pm

This could be a bug that you are experiencing especially with 6.5. not being an official release yet.

If you send me you stack, I will be able to investigate the issue and advise further.

Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding
--

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Swiping left and right in LC 6.5

Post by LCNeil » Fri Nov 15, 2013 3:09 pm

Hi Mark,

This looks like a bug related to mobGui.

If you replace all of the preOpenCard handlers that mobGui creates with openCard then your stack should work as expected.

I will be reporting this bug to our quality control team who should be able to investigate it further.

http://quality.runrev.com/show_bug.cgi?id=11448
Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding
--

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Swiping left and right in LC 6.5

Post by marcelloe » Fri Nov 15, 2013 6:32 pm

Neil:

Thanks for your help. I also, noticed on lower case letters like "g,y,and j" the bottom part of the letter is cut off. Any idea what is going on?

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Swiping left and right in LC 6.5

Post by LCNeil » Tue Nov 19, 2013 4:29 pm

Hi Mark,

This again could be a bug in 6.5. Could you supply a screenshot of the issue and If needed, I will submit a bug report on the issue.

Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Swiping left and right in LC 6.5

Post by marcelloe » Tue Nov 19, 2013 5:01 pm

It was fixed when I upgraded to 6.5 rc4.

Thanks for your help

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Swiping left and right in LC 6.5

Post by marcelloe » Wed Jan 22, 2014 11:03 pm

I am using the following script to swipe left and right. It worked after upgrading to LC 6.5. Now with LC 6.5.1 only the top right corner will switch cards. Is there something I am doing wrong? I have also tried to use the script that is in the swiping lesson, but I couldn't get it to work either.

Code: Select all

# the event id and initial swipe time and position
local sTouchId, sInitTime, sInitX


# maximum swipe time in millisecs
local sSwipeTime


# minimum swipe distance
local sSwipeDistance


on openStack
      # set up swipe values - experiment with these for required effect
    set the fullScreenMode of this stack to "exactFit"
   put 400 into sSwipeTime
   put 100 into sSwipeDistance
  end openStack


on touchMove pId, pX, pY
   if pId <> sTouchId then
      # record initial values for start of swipe
      put pId into sTouchId
      put the millisecs into sInitTime
      put pX into sInitX
   end if
   
   # check the action was fast enough for a swipe
   if the millisecs - sInitTime <= sSwipeTime then
      # check we have covered enough distance
      put pX - sInitX into tDistanceX
      if abs(tDistanceX) > sSwipeDistance then
         if tDistanceX < 0 then
            # finger is swiping left
            send "swipeLeft" to me in 0 millisecs
         else
            # finger is swiping right
            send "swipeRight" to me in 0 millisecs
         end if
      end if
   end if
end touchMove


command swipeLeft
   --visual effect scroll left normal
   go next card
end swipeLeft


command swipeRight
   --visual effect scroll right normal
   go prev card
end swipeRight

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Swiping left and right in LC 6.5

Post by LCNeil » Thu Jan 23, 2014 5:35 pm

Hi Mark,

I just created a new stack with your script and the swiping works as expected when navigating between cards.

if possible, could you supply a sample script and we will be able to investigate the issue further.

Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com

Post Reply

Return to “idea2app and Coding School”