Please help - Touch Position

Hello I am having a serious problem with touch positions being offset whilst zoomed in.

The touch coordinates are really offset and making it very hard to drag an object whilst zoomed in.

The code i am using to zoom in is below (all objects including what i am trying to drag are included in localGroup) and i am using the standard drag code from the tutorials. I presume this is just a math issue and it needs to account for an offset when zoomed ?

transition.to(localGroup, {x = localGroup.x - dragTarget.x, y = localGroup.y - dragTarget.y, xScale = 2.0, yScale = 2.0, delay = 200})  

Help is greatly appreciated.

Thank you
[import]uid: 40156 topic_id: 10490 reply_id: 310490[/import]

how much objects are in localGroup

have u chked the fps plz chk i doubt its going very very down

in case u don’t know how to see fps

http://developer.anscamobile.com/code/output-fps-and-texture-memory-usage-your-app
:slight_smile: [import]uid: 12482 topic_id: 10490 reply_id: 38192[/import]

Why would it matter how many objects are in the localGroup? The problem is the offset. I just don’t know what the offset should be. It’s running at 60fps… [import]uid: 40156 topic_id: 10490 reply_id: 38196[/import]

as i had said that’s only my doubt i had think fps is very low say for example 5-6 at the time of zooming but good that’s only my doubt

:slight_smile: [import]uid: 12482 topic_id: 10490 reply_id: 38200[/import]

Anyone have any ideas on this?

My game is ready to be released barring this issue. Willing to pay a small fee for a fix.

Thank you [import]uid: 40156 topic_id: 10490 reply_id: 38276[/import]

After all inserts on the localGroup, put this:

localGroup:setReferencePoint(display.CenterReferencePoint) [import]uid: 8556 topic_id: 10490 reply_id: 38288[/import]

[code]
local x = 0
local y = 0

local a = display.newCircle(40,40,40)
a.x = 150
a.y = 150
local f = function (e)
if e.phase == “moved” then
e.target.parent.x = e.x
e.target.parent.y = e.y
x = e.x
y = e.y
end
end

local g = display.newGroup()
g:insert(a)
g:setReferencePoint(display.CenterReferencePoint)
a:addEventListener(“touch”, f)

transition.to(g, {x = g.x - x, y = g.y - y, xScale = 2.0, yScale = 2.0, delay = 200})
[/code] [import]uid: 8556 topic_id: 10490 reply_id: 38290[/import]

look at “contentToLocal” and “localToContent” in your display group and all your problems will be solved… :slight_smile:
[import]uid: 53578 topic_id: 10490 reply_id: 38716[/import]