mirror of
https://github.com/oleid/gnome-shell-teatime.git
synced 2022-04-29 18:53:50 +00:00
Merge pull request #34 from kelunik/master
Fix vertical alignment, fixes #30
This commit is contained in:
commit
eccb722095
@ -54,7 +54,7 @@ const TeaTimeFullscreenNotification = new Lang.Class({
|
|||||||
|
|
||||||
// a table imitating a vertical box layout to hold the texture and
|
// a table imitating a vertical box layout to hold the texture and
|
||||||
// a label underneath it
|
// a label underneath it
|
||||||
this._layout = new St.BoxLayout({vertical:true, y_align:Clutter.ActorAlign.CENTER});
|
this._layout = new St.BoxLayout({ vertical: true, y_align: Clutter.ActorAlign.CENTER });
|
||||||
this._bin.set_child(this._layout);
|
this._bin.set_child(this._layout);
|
||||||
|
|
||||||
// find all the textures
|
// find all the textures
|
||||||
@ -145,7 +145,7 @@ const TeaTime = new Lang.Class({
|
|||||||
Extends : PanelMenu.Button,
|
Extends : PanelMenu.Button,
|
||||||
|
|
||||||
_init : function() {
|
_init : function() {
|
||||||
this.parent(0.0, "TeaTime");
|
this.parent(null, "TeaTime");
|
||||||
|
|
||||||
this._settings = Utils.getSettings();
|
this._settings = Utils.getSettings();
|
||||||
|
|
||||||
@ -158,6 +158,7 @@ const TeaTime = new Lang.Class({
|
|||||||
this._graphicalTimer = new Icon.TwoColorIcon(24, Icon.Pie);
|
this._graphicalTimer = new Icon.TwoColorIcon(24, Icon.Pie);
|
||||||
|
|
||||||
this.actor.add_actor(this._logo);
|
this.actor.add_actor(this._logo);
|
||||||
|
this.actor.add_style_class_name('panel-status-button');
|
||||||
this.actor.connect('style-changed', Lang.bind(this, this._onStyleChanged));
|
this.actor.connect('style-changed', Lang.bind(this, this._onStyleChanged));
|
||||||
|
|
||||||
this._idleTimeout = null;
|
this._idleTimeout = null;
|
||||||
|
14
src/icon.js
14
src/icon.js
@ -22,7 +22,7 @@ const TwoColorIcon = new Lang.Class({
|
|||||||
Extends: St.DrawingArea,
|
Extends: St.DrawingArea,
|
||||||
|
|
||||||
_init : function(size, drawingObject) {
|
_init : function(size, drawingObject) {
|
||||||
this.parent({ reactive : true });
|
this.parent({ reactive : true, style: 'padding: 0px 2px' });
|
||||||
this.set_width(size);
|
this.set_width(size);
|
||||||
this.set_height(size);
|
this.set_height(size);
|
||||||
this._drawingObject = drawingObject;
|
this._drawingObject = drawingObject;
|
||||||
@ -53,21 +53,23 @@ const TwoColorIcon = new Lang.Class({
|
|||||||
this.queue_repaint();
|
this.queue_repaint();
|
||||||
},
|
},
|
||||||
_drawIcon: function() {
|
_drawIcon: function() {
|
||||||
let cr = this.get_context();
|
let cr = this.get_context();
|
||||||
let orWdt = this._drawingObject.width;
|
let orWdt = this._drawingObject.width;
|
||||||
let orHgt = this._drawingObject.height;
|
let orHgt = this._drawingObject.height;
|
||||||
let[width, height] = this.get_surface_size();
|
let[width, height] = this.get_surface_size();
|
||||||
|
|
||||||
cr.save();
|
cr.save();
|
||||||
|
|
||||||
// layout object in box
|
// layout object in box
|
||||||
if (orWdt/orHgt > width/height) {
|
if (orWdt/orHgt > width/height) {
|
||||||
// take full width and center vertically
|
// take full width and center vertically
|
||||||
|
cr.translate(0, height * 0.5);
|
||||||
cr.scale(width/orWdt, width/orWdt);
|
cr.scale(width/orWdt, width/orWdt);
|
||||||
cr.translate(0, (orWdt-orHgt)*0.5);
|
cr.translate(0, (height*width/orWdt - orHgt) * 0.5);
|
||||||
} else {
|
} else {
|
||||||
cr.scale(height/orHgt, height/orHgt)
|
cr.translate(width * 0.5, 0);
|
||||||
cr.translate(-(orWdt-orHgt)*0.5, 0);;
|
cr.scale(height/orHgt, height/orHgt);
|
||||||
|
cr.translate((width*height/orHgt - orWdt) * 0.5, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._drawingObject.draw(cr, this._customStatus, this._primaryColor, this._secundaryColor);
|
this._drawingObject.draw(cr, this._customStatus, this._primaryColor, this._secundaryColor);
|
||||||
|
Loading…
Reference in New Issue
Block a user