@aaaron
Sure.
The code that happen before this changes the original image x,y reference, then I scale up by 2. Orig content is 320 x 480; thus the hard coded 640;
local function onTouch( event )
if scale == 0 then
local t = event.target
local phase = event.phase
if “began” == phase then
– Make target the top-most object
local parent = t.parent
parent:insert( t )
display.getCurrentStage():setFocus( t, event.id )
– Spurious events can be sent to the target, e.g. the user presses
– elsewhere on the screen and then moves the finger over the target.
– To prevent this, we add this flag. Only when it’s true will “move”
– events be sent to the target.
t.isFocus = true
– Store initial position
t.x0 = event.x - t.x
t.y0 = event.y - t.y
elseif t.isFocus then
if “moved” == phase then
– Make object move (we subtract t.x0,t.y0 so that moves are
– relative to initial grab point, rather than object “snapping”).
if (myTab.contentBounds.xMax) >= 640 then
t.x0 = 320
else
t.x = event.x - t.x0
t.y = event.y - t.y0
end
elseif “ended” == phase or “cancelled” == phase then
display.getCurrentStage():setFocus( t, nil )
t.isFocus = false
end
end
return true
end
end
myTab:addEventListener( “touch”, onTouch )
[import]uid: 31039 topic_id: 9050 reply_id: 35461[/import]