Fix non-squares can be selected - crossword.koplugin - Unnamed repository; edit this file 'description' to name the repository. (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules (DIR) README (DIR) LICENSE --- (DIR) commit e2519abf8557999332157da7478049bcfa51dc9d (DIR) parent f579e65b951940dcfc3ca3fd910fbf32d86f15c4 (HTM) Author: Scarlett <social@scarlettmcallister.com> Date: Sun, 7 May 2023 10:45:52 -0300 Fix non-squares can be selected Diffstat: M gameview.lua | 5 +++-- M puzzle.lua | 5 ----- 2 files changed, 3 insertions(+), 7 deletions(-) --- (DIR) diff --git a/gameview.lua b/gameview.lua @@ -76,8 +76,9 @@ function GameView:render() grid = self.puzzle:getGrid(), dark_mode = self.dark_mode, on_tap_callback = function(row_num, col_num) - if(self.puzzle:getSquareAtPos(row_num, col_num)) then - return + local maybe_square_index = self.puzzle:getIndexFromCoordinates(row_num, col_num) + if not self.puzzle:getSolveByIndex(maybe_square_index) then + return end self.active_row_num = row_num self.active_col_num = col_num (DIR) diff --git a/puzzle.lua b/puzzle.lua @@ -197,11 +197,6 @@ function Puzzle:resetActiveSquare() self.active_square_index = -1 end -function Puzzle:getSquareAtPos(row, col) - local index = self:getIndexFromCoordinates(row, col) --((row - 1) * self.size.rows) + col - return self.solves[index] -end - function Puzzle:getIndexFromCoordinates(row, col) local index = col + ((row - 1) * self.size.cols) return index