Remove unused button width and height arguments and specify button height explicitly
minWidth and minHeight arguments of the Button class were not used. Panel buttons need their height to be explicitly specified as PANEL_HEIGHT to take up full panel height. This fixes the problem with the user not being able to click at the very top edge of the panel to activate the button.
This commit is contained in:
parent
21ef33df65
commit
babb13f603
@ -22,12 +22,12 @@ const DEFAULT_FONT = 'Sans Bold 16px';
|
|||||||
// Padding on the left and right side of the button.
|
// Padding on the left and right side of the button.
|
||||||
const SIDE_PADDING = 14;
|
const SIDE_PADDING = 14;
|
||||||
|
|
||||||
function Button(widget, buttonColor, pressedButtonColor, textColor, staysPressed, minWidth, minHeight, font) {
|
function Button(widget, buttonColor, pressedButtonColor, textColor, staysPressed, font) {
|
||||||
this._init(widget, buttonColor, pressedButtonColor, textColor, staysPressed, minWidth, minHeight, font);
|
this._init(widget, buttonColor, pressedButtonColor, textColor, staysPressed, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
Button.prototype = {
|
Button.prototype = {
|
||||||
_init : function(widgetOrText, buttonColor, pressedButtonColor, textColor, staysPressed, minWidth, minHeight, font) {
|
_init : function(widgetOrText, buttonColor, pressedButtonColor, textColor, staysPressed, font) {
|
||||||
let me = this;
|
let me = this;
|
||||||
|
|
||||||
this._buttonColor = buttonColor
|
this._buttonColor = buttonColor
|
||||||
@ -50,11 +50,6 @@ Button.prototype = {
|
|||||||
if (font == null)
|
if (font == null)
|
||||||
this._font = DEFAULT_FONT;
|
this._font = DEFAULT_FONT;
|
||||||
|
|
||||||
if (minWidth == null)
|
|
||||||
minWidth = 0;
|
|
||||||
if (minHeight == null)
|
|
||||||
minHeight = 0;
|
|
||||||
|
|
||||||
// if this._staysPressed is true, this._active will be true past the first release of a button, until a subsequent one (the button
|
// if this._staysPressed is true, this._active will be true past the first release of a button, until a subsequent one (the button
|
||||||
// is unpressed) or until release() is called explicitly
|
// is unpressed) or until release() is called explicitly
|
||||||
this._active = false;
|
this._active = false;
|
||||||
@ -78,9 +73,6 @@ Button.prototype = {
|
|||||||
|
|
||||||
this.button.append(this._widget, Big.BoxPackFlags.EXPAND);
|
this.button.append(this._widget, Big.BoxPackFlags.EXPAND);
|
||||||
|
|
||||||
this._minWidth = minWidth;
|
|
||||||
this._minHeight = minHeight;
|
|
||||||
|
|
||||||
this.button.connect('button-press-event',
|
this.button.connect('button-press-event',
|
||||||
function(o, event) {
|
function(o, event) {
|
||||||
me._isBetweenPressAndRelease = true;
|
me._isBetweenPressAndRelease = true;
|
||||||
|
@ -252,7 +252,8 @@ Panel.prototype = {
|
|||||||
/* left side */
|
/* left side */
|
||||||
|
|
||||||
this.button = new Button.Button("Activities", PANEL_BUTTON_COLOR, PRESSED_BUTTON_BACKGROUND_COLOR,
|
this.button = new Button.Button("Activities", PANEL_BUTTON_COLOR, PRESSED_BUTTON_BACKGROUND_COLOR,
|
||||||
PANEL_FOREGROUND_COLOR, true, null, PANEL_HEIGHT, DEFAULT_FONT);
|
PANEL_FOREGROUND_COLOR, true, DEFAULT_FONT);
|
||||||
|
this.button.button.height = PANEL_HEIGHT;
|
||||||
|
|
||||||
this._leftBox.append(this.button.button, Big.BoxPackFlags.NONE);
|
this._leftBox.append(this.button.button, Big.BoxPackFlags.NONE);
|
||||||
|
|
||||||
@ -336,7 +337,8 @@ Panel.prototype = {
|
|||||||
PANEL_BUTTON_COLOR,
|
PANEL_BUTTON_COLOR,
|
||||||
PRESSED_BUTTON_BACKGROUND_COLOR,
|
PRESSED_BUTTON_BACKGROUND_COLOR,
|
||||||
PANEL_FOREGROUND_COLOR,
|
PANEL_FOREGROUND_COLOR,
|
||||||
true, null, PANEL_HEIGHT);
|
true);
|
||||||
|
statusbutton.button.height = PANEL_HEIGHT;
|
||||||
statusbutton.button.connect('button-press-event', function (b, e) {
|
statusbutton.button.connect('button-press-event', function (b, e) {
|
||||||
statusmenu.toggle(e);
|
statusmenu.toggle(e);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user