From 259b4ac95079425fe6279e34d3216921c83df58c Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 15 Jan 2024 19:21:03 +0100 Subject: [PATCH] VirtualKeyboard: Try to include the padding in the key's hitbox Followup to 40d27ac3e59d95ff271478e89d7f040bb2bf418f Re: #11357 --- frontend/ui/widget/virtualkeyboard.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frontend/ui/widget/virtualkeyboard.lua b/frontend/ui/widget/virtualkeyboard.lua index f359320e3..09fb67d01 100644 --- a/frontend/ui/widget/virtualkeyboard.lua +++ b/frontend/ui/widget/virtualkeyboard.lua @@ -310,6 +310,18 @@ function VirtualKey:init() self.flash_keyboard = G_reader_settings:nilOrTrue("flash_keyboard") end +function VirtualKey:paintTo(bb, x ,y) + InputContainer.paintTo(self, bb, x, y) + -- Fudge self.dimen to include the padding, to make sure said padding is covered by our ges_events range... + -- Like Geom, floor coordinates & ceil dims, to fill the gaps without overlaps. + local coords_padding = math.floor(self.keyboard.key_padding / 2) + local dims_padding = self.keyboard.key_padding -- i.e., coords_padding + math.ceil(self.keyboard.key_padding / 2) + self.dimen.x = self.dimen.x - coords_padding + self.dimen.w = self[1].dimen.w + dims_padding + self.dimen.y = self.dimen.y - coords_padding + self.dimen.h = self[1].dimen.h + dims_padding +end + function VirtualKey:genKeyboardLayoutKeyChars() local positions = { "northeast",