Skip to content

Commit

Permalink
Merge pull request #1384 from gusano/topic/gridlayout_bugfix
Browse files Browse the repository at this point in the history
class library: GridLayout - fix position when using spanning
  • Loading branch information
scztt committed Apr 24, 2015
2 parents cff351a + 2dc264c commit 9954a5f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions SCClassLibrary/Common/GUI/Base/QLayout.sc
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,17 @@ GridLayout : Layout {
var data;
grid = this.new;
rows.do { |row, r|
var offset = 0;
if( row.size > 0 ) {
row.do { |item, c|
var colSpan;
if( item.notNil ) {
data = this.parse( item, r, c );
colSpan = data[4];
data[2] = data[2] + offset;
grid.invokeMethod( \addItem, [data], true );
// If there's spanning, store offset for next elements column
if (colSpan > 1) { offset = offset + (colSpan - 1) };
};
};
};
Expand All @@ -118,11 +124,17 @@ GridLayout : Layout {
var data;
grid = this.new;
cols.do { |col, c|
var offset = 0;
if( col.size > 0 ) {
col.do { |item, r|
var rowSpan;
if( item.notNil ) {
data = this.parse( item, r, c );
rowSpan = data[3];
data[1] = data[1] + offset;
grid.invokeMethod( \addItem, [data], true );
// If there's spanning, store offset for next elements row
if (rowSpan > 1) { offset = offset + (rowSpan - 1) };
};
};
};
Expand Down

0 comments on commit 9954a5f

Please sign in to comment.