mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
replace Screen.width/Screen.height with accessor methods
Screen.width and Screen.height are now gone, use the methods getWidth() and getHeight() to get the relevant data. They will take blitbuffer/framebuffer rotation into account.
This commit is contained in:
@@ -575,7 +575,7 @@ function GestureDetector:adjustGesCoordinate(ges)
|
||||
if Screen.cur_rotation_mode == 1 then
|
||||
-- in landscape mode rotated 270
|
||||
if ges.pos then
|
||||
ges.pos.x, ges.pos.y = (Screen.width - ges.pos.y), (ges.pos.x)
|
||||
ges.pos.x, ges.pos.y = (Screen:getWidth() - ges.pos.y), (ges.pos.x)
|
||||
end
|
||||
if ges.ges == "swipe" or ges.ges == "pan"
|
||||
or ges.ges == "two_finger_swipe"
|
||||
@@ -612,7 +612,7 @@ function GestureDetector:adjustGesCoordinate(ges)
|
||||
elseif Screen.cur_rotation_mode == 3 then
|
||||
-- in landscape mode rotated 90
|
||||
if ges.pos then
|
||||
ges.pos.x, ges.pos.y = (ges.pos.y), (Screen.height - ges.pos.x)
|
||||
ges.pos.x, ges.pos.y = (ges.pos.y), (Screen:getHeight() - ges.pos.x)
|
||||
end
|
||||
if ges.ges == "swipe" or ges.ges == "pan"
|
||||
or ges.ges == "two_finger_swipe"
|
||||
|
||||
@@ -330,10 +330,10 @@ function Input:init()
|
||||
ev.code = ABS_X
|
||||
-- We always have to substract from the physical x,
|
||||
-- regardless of the orientation
|
||||
if (Screen.width<Screen.height) then
|
||||
ev.value = Screen.width - ev.value
|
||||
if (Screen:getWidth()<Screen:getHeight()) then
|
||||
ev.value = Screen:getWidth() - ev.value
|
||||
else
|
||||
ev.value = Screen.height - ev.value
|
||||
ev.value = Screen:getHeight() - ev.value
|
||||
end
|
||||
end
|
||||
-- same thing for multitouch events (phoenix)
|
||||
@@ -343,10 +343,10 @@ function Input:init()
|
||||
ev.code = ABS_MT_POSITION_X
|
||||
-- We always have to substract from the physical x,
|
||||
-- regardless of the orientation
|
||||
if (Screen.width<Screen.height) then
|
||||
ev.value = Screen.width - ev.value
|
||||
if (Screen:getWidth()<Screen:getHeight()) then
|
||||
ev.value = Screen:getWidth() - ev.value
|
||||
else
|
||||
ev.value = Screen.height - ev.value
|
||||
ev.value = Screen:getHeight() - ev.value
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -359,10 +359,10 @@ function Input:init()
|
||||
if ev.code == ABS_X then
|
||||
-- We always have to substract from the physical x,
|
||||
-- regardless of the orientation
|
||||
if (Screen.width<Screen.height) then
|
||||
ev.value = Screen.width - ev.value
|
||||
if (Screen:getWidth()<Screen:getHeight()) then
|
||||
ev.value = Screen:getWidth() - ev.value
|
||||
else
|
||||
ev.value = Screen.height - ev.value
|
||||
ev.value = Screen:getHeight() - ev.value
|
||||
end
|
||||
end
|
||||
return ev
|
||||
|
||||
Reference in New Issue
Block a user