Drag, Pinch, Zoom issues
Posted: Mon Dec 23, 2013 8:34 pm
I'm working on imitating the contact photo picker that Apple's contact list has. You pinch/zoom and drag to get what you want in the center of the screen.
Drag is easy, although with some caveats...
on mouseDown
grab me
end mouse down
Zoom isn't bad either, using the code from the LC lesson
how-do-i-implement-a-multi-touch-pinch-motion
Putting the 2 together has been a nightmare and I still can't see why it's not working properly.
To get them in the same handler, I've modified the lesson code as follows:
This works well for dragging the image.
HOWEVER, now pinch and zoom goes completely wonky when you run in the simulator and hit the alt key to have your two "finger" points on the image. It bounces all over the place, while generally moving to the left on the screen.
Comment out the "grab image "original" and pinch and zoom works fine, even if you have your two "finger" points on the image.
I've attached a sample project to demonstrate. Comment out the line with grab in it to see the difference. Also place the finger points outside of the image and try it.
I realize some folks have used a browser control, but that not what I'm shooting for. I do have a workaround, but would like to understand this issue.
I don't know if this is a bug or a fault of my code, I'd appreciate any help.
Thanks!
Steve
Drag is easy, although with some caveats...
on mouseDown
grab me
end mouse down
Zoom isn't bad either, using the code from the LC lesson
how-do-i-implement-a-multi-touch-pinch-motion
Putting the 2 together has been a nightmare and I still can't see why it's not working properly.
To get them in the same handler, I've modified the lesson code as follows:
Code: Select all
put (pX & comma & pY) into sTouchArray[pId]["currentloc"]
# 1 touch found, move the image.. this is my addition
if the number of lines of the keys of sTouchArray is 1 then
put the number of lines of the keys of sTouchArray into fld "info"
grab image "original"
end if
# 2 touches found, do zoom pinch
if the number of lines of the keys of sTouchArray is 2 then
HOWEVER, now pinch and zoom goes completely wonky when you run in the simulator and hit the alt key to have your two "finger" points on the image. It bounces all over the place, while generally moving to the left on the screen.
Comment out the "grab image "original" and pinch and zoom works fine, even if you have your two "finger" points on the image.
I've attached a sample project to demonstrate. Comment out the line with grab in it to see the difference. Also place the finger points outside of the image and try it.
I realize some folks have used a browser control, but that not what I'm shooting for. I do have a workaround, but would like to understand this issue.
I don't know if this is a bug or a fault of my code, I'd appreciate any help.
Thanks!
Steve