mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-12 03:45:34 +00:00
Merge pull request #11178 from keymanapp/fix/web/nearest-key-row-lookup
This commit is contained in:
commit
c48dcbab47
1 changed files with 1 additions and 1 deletions
|
|
@ -198,7 +198,7 @@ export default class OSKLayerGroup {
|
|||
Assumes there is no fine-tuning of the row ranges to be done - each takes a perfect
|
||||
fraction of the overall layer height without any padding above or below.
|
||||
*/
|
||||
const rowIndex = Math.floor(proportionalCoords.y * layer.rows.length);
|
||||
const rowIndex = Math.max(0, Math.min(layer.rows.length-1, Math.floor(proportionalCoords.y * layer.rows.length)));
|
||||
const row = layer.rows[rowIndex];
|
||||
|
||||
// Assertion: row no longer `null`.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue