St.Label on the same Baseline



Working on a shell extension, I am trying to inherit from
PopupMenu.PopupBaseMenuItem and in there align two St.Label objects on
the same baseline.

Currently I have the following code:
======================================================================
const FolderMenuItem = new Lang.Class({
    Name: 'FolderMenuItem',
    Extends: PopupMenu.PopupBaseMenuItem,

    _init: function () {
        this.parent();

        let label1 = new St.Label({ text: "Text" });
        this.actor.add_child(label1);

        this.actor.label_actor = label1;

        let label2 = new St.Label({
            text: "Small Text",
            style: 'font-size: 50%;',
            y_align: Clutter.ActorAlign.END      // too low
            //y_align: Clutter.ActorAlign.CENTER // too high
        });
        this.actor.add_child(label2);
    },
});
======================================================================


However, as the comments say, the ActorAlign.END alignment is too low
and the CENTER alignment is too high.
How do you align those two labels on the same baseline?


Jay


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