mirror of
https://github.com/oleid/gnome-shell-teatime.git
synced 2022-04-29 18:53:50 +00:00
Fix vertical alignment, fixes #30
This commit is contained in:
parent
171b506c92
commit
349ab15145
@ -145,7 +145,7 @@ const TeaTime = new Lang.Class({
|
||||
Extends : PanelMenu.Button,
|
||||
|
||||
_init : function() {
|
||||
this.parent(0.0, "TeaTime");
|
||||
this.parent(null, "TeaTime");
|
||||
|
||||
this._settings = Utils.getSettings();
|
||||
|
||||
@ -158,6 +158,7 @@ const TeaTime = new Lang.Class({
|
||||
this._graphicalTimer = new Icon.TwoColorIcon(24, Icon.Pie);
|
||||
|
||||
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._idleTimeout = null;
|
||||
|
10
src/icon.js
10
src/icon.js
@ -22,7 +22,7 @@ const TwoColorIcon = new Lang.Class({
|
||||
Extends: St.DrawingArea,
|
||||
|
||||
_init : function(size, drawingObject) {
|
||||
this.parent({ reactive : true });
|
||||
this.parent({ reactive : true, style: 'padding: 0px 2px' });
|
||||
this.set_width(size);
|
||||
this.set_height(size);
|
||||
this._drawingObject = drawingObject;
|
||||
@ -63,11 +63,13 @@ const TwoColorIcon = new Lang.Class({
|
||||
// layout object in box
|
||||
if (orWdt/orHgt > width/height) {
|
||||
// take full width and center vertically
|
||||
cr.translate(0, height * 0.5);
|
||||
cr.scale(width/orWdt, width/orWdt);
|
||||
cr.translate(0, (orWdt-orHgt)*0.5);
|
||||
cr.translate(0, (height*width/orWdt - orHgt) * 0.5);
|
||||
} else {
|
||||
cr.scale(height/orHgt, height/orHgt)
|
||||
cr.translate(-(orWdt-orHgt)*0.5, 0);;
|
||||
cr.translate(width * 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);
|
||||
|
Loading…
Reference in New Issue
Block a user