relative x and y in pan gesture are relative to first touch events

pull/346/head
chrox 11 years ago
parent 2590cc7ca5
commit ae2462c17e

@ -433,14 +433,14 @@ function GestureDetector:handlePan(tev)
distance = pan_distance, distance = pan_distance,
time = tev.timev, time = tev.timev,
} }
pan_ev.relative.x = tev.x - self.last_tevs[slot].x pan_ev.relative.x = tev.x - self.first_tevs[slot].x
pan_ev.relative.y = tev.y - self.last_tevs[slot].y pan_ev.relative.y = tev.y - self.first_tevs[slot].y
pan_ev.pos = Geom:new{ pan_ev.pos = Geom:new{
x = self.last_tevs[slot].x, x = self.last_tevs[slot].x,
y = self.last_tevs[slot].y, y = self.last_tevs[slot].y,
w = 0, h = 0, w = 0, h = 0,
} }
--DEBUG(pan_ev.ges, pan_ev.pos, pan_ev.direction, pan_ev.distance, "detected") --DEBUG(pan_ev.ges, pan_ev, "detected")
return pan_ev return pan_ev
end end
end end
@ -597,6 +597,9 @@ function GestureDetector:adjustGesCoordinate(ges)
elseif ges.direction == "southwest" then elseif ges.direction == "southwest" then
ges.direction = "northwest" ges.direction = "northwest"
end end
if ges.relative then
ges.relative.x, ges.relative.y = -ges.relative.y, ges.relative.x
end
elseif ges.ges == "pinch" or ges.ges == "spread" elseif ges.ges == "pinch" or ges.ges == "spread"
or ges.ges == "inward_pan" or ges.ges == "inward_pan"
or ges.ges == "outward_pan" then or ges.ges == "outward_pan" then
@ -631,6 +634,9 @@ function GestureDetector:adjustGesCoordinate(ges)
elseif ges.direction == "southwest" then elseif ges.direction == "southwest" then
ges.direction = "southeast" ges.direction = "southeast"
end end
if ges.relative then
ges.relative.x, ges.relative.y = ges.relative.y, -ges.relative.x
end
elseif ges.ges == "pinch" or ges.ges == "spread" elseif ges.ges == "pinch" or ges.ges == "spread"
or ges.ges == "inward_pan" or ges.ges == "inward_pan"
or ges.ges == "outward_pan" then or ges.ges == "outward_pan" then

Loading…
Cancel
Save