map dragging and scaling

Hi,

I'm a newbie, I've been having a few little issues when it comes to scaling the map and then being able to use drag, or focus, or touch->map translations correctly which is turning into a pain.

to get around the drag issue i do something like the following inside the basic touch handlers before passing it on:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
local scale = map:getScale()
if (event.rescaled == nil) then
        if (scale == 1) then
                -- no scaling required
        else
                event.x = ((event.x - event.xStart) / scale) + (event.xStart / scale)
                event.y = ((event.y - event.yStart) / scale) + (event.yStart / scale)
                event.xStart = event.xStart / scale
                event.yStart = event.yStart / scale                                     
        end
        event.rescaled = true;
end
 
map:drag(event)
views:1372 update:2011/10/20 8:45:16
corona forums © 2003-2011