[gnome-characters/bilelmoussaoui/gtk4: 7/7] characters view: don't draw a baseline for emoji categories




commit 885b8df0aa925fff28f94a35d92848d68707b9b1
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Wed Nov 24 18:15:09 2021 +0100

    characters view: don't draw a baseline for emoji categories

 src/charactersView.js | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/charactersView.js b/src/charactersView.js
index c8e0eb1..8335237 100644
--- a/src/charactersView.js
+++ b/src/charactersView.js
@@ -185,6 +185,12 @@ var CharactersView = GObject.registerClass({
             GObject.ParamFlags.READWRITE,
             false,
         ),
+        'baseline': GObject.ParamSpec.boolean(
+            'baseline',
+            'Baseline', 'Whether to draw a baseline or not',
+            GObject.ParamFlags.READWRITE,
+            true,
+        ),
     },
     Implements: [Gtk.Scrollable],
 }, class CharactersView extends Gtk.Widget {
@@ -329,10 +335,12 @@ var CharactersView = GObject.registerClass({
             let y = (index - start) * cellSize;
 
             // Draw baseline.
-            snapshot.append_color(borderColor, new Graphene.Rect({
-                origin: new Graphene.Point({ x: 0, y: y + BASELINE_OFFSET * cellSize }),
-                size: new Graphene.Size({ width: allocatedWidth, height: 1.0 }),
-            }));
+            if (this.baseline) {
+                snapshot.append_color(borderColor, new Graphene.Rect({
+                    origin: new Graphene.Point({ x: 0, y: y + BASELINE_OFFSET * cellSize }),
+                    size: new Graphene.Size({ width: allocatedWidth, height: 1.0 }),
+                }));
+            }
 
             this._rows[index].snapshot(snapshot, this._offsetX, y, pangoContext, styleContext);
         }
@@ -433,6 +441,9 @@ var CharactersView = GObject.registerClass({
 
     searchByCategory(category) {
         this._characters = [];
+        // whether to draw a baseline or not
+        this.baseline = category >= Gc.Category.NONE && category < Gc.Category.EMOJI;
+
         if (category === Gc.Category.LETTER_LATIN) {
             if (!this._scriptsLoaded)
                 this.populateScripts();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]