fix(input): use elseif conditional logic in adjustTouchSwitchXY

pull/1080/head
Qingping Hou 10 years ago
parent 6eca26f610
commit 8927f901da

@ -155,10 +155,15 @@ end
-- catalogue of predefined hooks:
function Input:adjustTouchSwitchXY(ev)
if ev.type == EV_ABS then
if ev.code == ABS_X then ev.code = ABS_Y end
if ev.code == ABS_Y then ev.code = ABS_X end
if ev.code == ABS_MT_POSITION_X then ev.code = ABS_MT_POSITION_Y end
if ev.code == ABS_MT_POSITION_Y then ev.code = ABS_MT_POSITION_X end
if ev.code == ABS_X then
ev.code = ABS_Y
elseif ev.code == ABS_Y then
ev.code = ABS_X
elseif ev.code == ABS_MT_POSITION_X then
ev.code = ABS_MT_POSITION_Y
elseif ev.code == ABS_MT_POSITION_Y then
ev.code = ABS_MT_POSITION_X
end
end
end
function Input:adjustTouchScale(ev, by)
@ -172,18 +177,16 @@ function Input:adjustTouchScale(ev, by)
end
end
function Input:adjustTouchMirrorX(ev, width)
if ev.type == EV_ABS then
if ev.code == ABS_X or ev.code == ABS_MT_POSITION_X then
if ev.type == EV_ABS
and (ev.code == ABS_X or ev.code == ABS_MT_POSITION_X) then
ev.value = width - ev.value
end
end
end
function Input:adjustTouchMirrorY(ev, height)
if ev.type == EV_ABS then
if ev.code == ABS_Y or ev.code == ABS_MT_POSITION_Y then
if ev.type == EV_ABS
and (ev.code == ABS_Y or ev.code == ABS_MT_POSITION_Y) then
ev.value = height - ev.value
end
end
end
function Input:adjustTouchTranslate(ev, by)
if ev.type == EV_ABS then

Loading…
Cancel
Save