[gnome-characters/bilelmoussaoui/gtk4: 60/76] characters view: fix clicked position of edge rows
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-characters/bilelmoussaoui/gtk4: 60/76] characters view: fix clicked position of edge rows
- Date: Fri, 26 Nov 2021 08:59:07 +0000 (UTC)
commit c20332014d8a90e1bd0c5147fc52274e7300e20f
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Wed Nov 24 19:41:12 2021 +0100
characters view: fix clicked position of edge rows
src/charactersView.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/charactersView.js b/src/charactersView.js
index c049383..79aa203 100644
--- a/src/charactersView.js
+++ b/src/charactersView.js
@@ -290,10 +290,10 @@ var CharactersView = GObject.registerClass({
let vadj = this.get_vadjustment();
let cellSize = getCellSize(this._fontDescription);
- x = Math.floor((x + hadj.get_value() - this._offsetX) / cellSize);
+ x = Math.min(this._cellsPerRow - 1, Math.floor((x + hadj.get_value() - this._offsetX) / cellSize));
y = Math.floor((y + vadj.get_value()) / cellSize);
- let index = y * this._cellsPerRow + x;
+ let index = y * this._cellsPerRow + Math.max(0, x);
if (index < this._characters.length)
this._selectedCharacter = this._characters[index];
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]