iOS - Pinch,Zoom,Drag Image - iPad - How?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
cenglish
Posts: 34
Joined: Wed May 11, 2011 6:44 pm
Location: LA, USA

iOS - Pinch,Zoom,Drag Image - iPad - How?

Post by cenglish » Mon Feb 27, 2012 9:37 pm

I have exhausted myself trying to figure out how to simply take an image, and allow a user to pinch to zoom in (and out) while rescaling the image to not lose quality. I am pulling image links from a cloud and putting them into an image and then I need that image to be able to *smoothly* be able to be zoomed in (and out) without having it go all over the place. I tried using the code used in the LiveCode Lessons for multitouch, changed the "graphics" to "image" but it was jumpy bad. And even then, I could only zoom into one spot and not move around the zoomed in image. I tried adding a "grab me" along with the zooming, but that made the image jump all over the place. I came across multiple scripts to zoom in and out of an image, but couldn't find anything that would allow the zoom in and out with moving around the image AND not losing image quality. Any feedback or example stacks would be greatly appreciated. Thanks

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: iOS - Pinch,Zoom,Drag Image - iPad - How?

Post by Jellicle » Mon Feb 27, 2012 10:59 pm

Does this do what you want?

Gerry
Attachments
image Example.zip
(92.57 KiB) Downloaded 918 times
14" MacBook Pro
Former LiveCode developer.
Now recovering.

cenglish
Posts: 34
Joined: Wed May 11, 2011 6:44 pm
Location: LA, USA

Re: iOS - Pinch,Zoom,Drag Image - iPad - How?

Post by cenglish » Tue Feb 28, 2012 6:20 pm

EXACTLY! Thanks for the example stack!

JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Re: iOS - Pinch,Zoom,Drag Image - iPad - How?

Post by JosepM » Sat Mar 17, 2012 8:01 pm

Hi,

I testing the presentation of images using the UIWebView control. I want zoom more the image but ever the zoom factor is the same.
I try with images at 2048x1536 with 150p but I can't get more zoom.

I try using the sample stack from this post.

Code: Select all

on preopencard
   global mScrollerId
   iphoneControlCreate "browser"
   put the result into mScrollerId
   iphoneControlSet mScrollerId, "visible", "true"
   iphoneControlSet mScrollerId, "canBounce", "true"
   iphoneControlSet mScrollerId, "autoFit", true  
   iphoneControlSet mScrollerId, "rect", (the left of this card , the top of this card, the right of this card , 724) --the bottom of this card )
   put "file://" & specialFolderPath("engine")&"/MAGAZINE_PAGE_2.jpg"  into  localURL
   replace " " with "%20" in localURL
   iphoneControlSet mScrollerId, "url", localURL
end preopencard
The 724 limit is to left some menu bar and for capture the swipe gesture, so over the browser control I can't trap it.

What is wrong?

Salut,
Josep M

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: iOS - Pinch,Zoom,Drag Image - iPad - How?

Post by FireWorx » Sat Mar 17, 2012 11:43 pm

I haven't tried your stack (dont have the time right now) but I do know that there was a major improvement in IOS system 5.0 and LiveCode 5.0 when it came to zooming in deep on a PDF in a browser. Also major imrovements in the speed of which the image rendered. Are you using LC 5.0 or better?
Dave

JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Re: iOS - Pinch,Zoom,Drag Image - iPad - How?

Post by JosepM » Tue Mar 20, 2012 1:17 am

Hi,

I'm on iOS 4.3 and LC5.0. So better convert the image to PDF?

Salut,
Josep M

Batninja
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 55
Joined: Sat Oct 15, 2011 9:43 am

Re: iOS - Pinch,Zoom,Drag Image - iPad - How?

Post by Batninja » Tue Mar 20, 2012 9:56 pm

Hi

Thanks for the pinch zoom code via browser. It is very smooth but I need to know the final size and location of the zoomed and moved image to use in a print out. I too have had problems getting sample code to work smoothly and not jump.

Any ideas or suggestions would be greatly welcomed.

Thanks

Roger

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: iOS - Pinch,Zoom,Drag Image - iPad - How?

Post by Jellicle » Wed Mar 21, 2012 3:13 am

Batninja wrote:but I need to know the final size and location of the zoomed and moved image to use in a print out. I too have had problems getting sample code to work smoothly and not jump.
Hmmm. I don't know a way of getting the location or the zoom level of an image in a browser.

Are you using the stack I uploaded? Can you tell me what size image you are working with, and on what device?

Gerry
Last edited by Jellicle on Thu Mar 22, 2012 5:23 am, edited 1 time in total.
14" MacBook Pro
Former LiveCode developer.
Now recovering.

Batninja
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 55
Joined: Sat Oct 15, 2011 9:43 am

Re: iOS - Pinch,Zoom,Drag Image - iPad - How?

Post by Batninja » Wed Mar 21, 2012 10:09 pm

Hi, your browser code works great, but I can't see how to get the final image size and coordinates either (and if you can't then there's no hope for me lol)

I'm deploying to an IPhone using images from the picture folder.

Cheers

bmatichuk
Posts: 15
Joined: Tue Oct 12, 2010 7:19 am
Location: Edmonton

Re: iOS - Pinch,Zoom,Drag Image - iPad - How?

Post by bmatichuk » Tue Jul 24, 2012 7:06 am

Thank-you Jellsie for your post. This is exactly what I needed.

-B

Post Reply

Return to “iOS Deployment”