From 68b94fa3378aa52fd2285dcd322a7270b6fd1e05 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Wed, 7 Mar 2012 17:57:27 +0800 Subject: [PATCH] mod: code clean up for KEY_2 to KEY_9 bindings inspired by commit: 796b42cc3629b755d7e5e458f779bbddb2deb9a7 --- unireader.lua | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/unireader.lua b/unireader.lua index 9d2c26f0f..bb18797c8 100644 --- a/unireader.lua +++ b/unireader.lua @@ -541,22 +541,8 @@ function UniReader:inputloop() self:modify_gamma( 0.8 ) elseif ev.code == KEY_1 then self:goto(1) - elseif ev.code == KEY_2 then - self:goto(math.floor(self.doc:getPages()/90*10)) - elseif ev.code == KEY_3 then - self:goto(math.floor(self.doc:getPages()/90*20)) - elseif ev.code == KEY_4 then - self:goto(math.floor(self.doc:getPages()/90*30)) - elseif ev.code == KEY_5 then - self:goto(math.floor(self.doc:getPages()/90*40)) - elseif ev.code == KEY_6 then - self:goto(math.floor(self.doc:getPages()/90*50)) - elseif ev.code == KEY_7 then - self:goto(math.floor(self.doc:getPages()/90*60)) - elseif ev.code == KEY_8 then - self:goto(math.floor(self.doc:getPages()/90*70)) - elseif ev.code == KEY_9 then - self:goto(math.floor(self.doc:getPages()/90*80)) + elseif ev.code >= KEY_2 and ev.code <= KEY_9 then + self:goto(math.floor(self.doc:getPages()/90*(ev.code-KEY_1)*10)) elseif ev.code == KEY_0 then self:goto(self.doc:getPages()) elseif ev.code == KEY_A then