Hi Brent, we’re using the dmc_gesture file that comes with Kwiksher, but everything works fine except on iPads Mini… here is the code for the Handler…
function swipeTouchHandler( event )
–print( “swipeTouchHandler”, event )
--print (“swipeTouchHandler”, event.x , event.xStart)
local obj = event.target
local dmc = obj.__dmc.gesture
local et, xDelta, yDelta, vector, angle
– create our event to dispatch
local e = {
name = SWIPE_EVENT,
phase = event.phase,
target = obj,
direction = nil,
touch = {}
}
–== Start processing the Corona touch event ==–
if event.phase == ‘began’ then
TouchMgr:setFocus( event.target, event.id )
– fill in event and dispatch
et = e.touch
et.xStart = event.xStart
et.yStart = event.yStart
et.x = event.x
et.y = event.y
if obj.dispatchEvent ~= nil then
obj:dispatchEvent( e )
end
return true
elseif event.phase == ‘moved’ then
if event.isFocused then
xDelta = event.x - event.xStart
yDelta = event.y - event.yStart
vector = vector_given_x_y( xDelta, yDelta )
angle = angle_given_x_y( xDelta, yDelta )
e.swipe = {
angle = angle,
length = vector
}
– fill in rest of event and dispatch
et = e.touch
et.xStart = event.xStart
et.yStart = event.yStart
et.x = event.x
et.y = event.y
if obj.dispatchEvent ~= nil then
obj:dispatchEvent( e )
end
return true
end
elseif ( event.phase == ‘ended’ or event.phase == ‘canceled’ ) then
if event.isFocused then
TouchMgr:unsetFocus( event.target, event.id )
if dmc == nil or obj == nil or obj.dispatchEvent == nil then
return true
end
if dmc.useStrictBounds then
– print (“1”)
local bounds = obj.contentBounds
--print (“Event x ----->>”, event.x …" - " … bounds.xMin … " - " …bounds.xMax)
xDelta = checkBounds( event.x, { bounds.xMin, bounds.xMax } ) - event.xStart
yDelta = checkBounds( event.y, { bounds.yMin, bounds.yMax } ) - event.yStart
else
– print (“2” … " *** " … event.x , event.xStart)
xDelta = event.x - event.xStart
yDelta = event.y - event.yStart
end
--print (“3”)
--print (“xDelta”, xDelta, yDelta)
vector = vector_given_x_y( xDelta, yDelta )
angle = angle_given_x_y( xDelta, yDelta )
e.swipe = {
angle = angle,
length = vector
}
--print (“vector y swipelenght”, vector, dmc.swipeLength)
if vector >= dmc.swipeLength then
e.direction = direction_given_angle( angle, dmc.limitAngle )
end
– fill in rest of event and dispatch
et = e.touch
et.xStart = event.xStart
et.yStart = event.yStart
et.x = event.x
et.y = event.y
if obj.dispatchEvent ~= nil then
obj:dispatchEvent( e )
end
return true
end
end
end