[gnome-characters] characterList: Fix width computation
- From: Daiki Ueno <dueno src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-characters] characterList: Fix width computation
- Date: Mon, 2 Mar 2015 13:13:54 +0000 (UTC)
commit 593bdb068ebc6d83f93d2b58eacf66b1e8d3a968
Author: Daiki Ueno <dueno src gnome org>
Date: Mon Mar 2 22:12:04 2015 +0900
characterList: Fix width computation
src/characterList.js | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/characterList.js b/src/characterList.js
index 599c9c9..e2fdb74 100644
--- a/src/characterList.js
+++ b/src/characterList.js
@@ -32,6 +32,7 @@ const Util = imports.util;
const BASELINE_OFFSET = 0.85;
const CELLS_PER_ROW = 5;
const NUM_ROWS = 5;
+const NUM_COLUMNS = 5;
const CELL_SIZE = 50;
function getCellSize(fontDescription) {
@@ -121,7 +122,8 @@ const CharacterListWidget = new Lang.Class({
},
vfunc_get_preferred_height_for_width: function(width) {
- let height = Math.max(this._rows.length, NUM_ROWS) * getCellSize(this._fontDescription);
+ let height = Math.max(this._rows.length, NUM_ROWS) *
+ getCellSize(this._fontDescription);
return [height, height];
},
@@ -130,8 +132,10 @@ const CharacterListWidget = new Lang.Class({
},
vfunc_get_preferred_width_for_height: function(height) {
- let width = this._cellsPerRow * getCellSize(this._fontDescription);
- return [width, width];
+ let cellSize = getCellSize(this._fontDescription);
+ let minWidth = NUM_COLUMNS * cellSize;
+ let natWidth = Math.max(this._cellsPerRow, NUM_COLUMNS) * cellSize;
+ return [minWidth, natWidth];
},
vfunc_size_allocate: function(allocation) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]