Navigation Menu

Skip to content

Commit

Permalink
class library: GridLayout - fix position when using spanning
Browse files Browse the repository at this point in the history
Re supercollider#1383

Signed-off-by: Yvan Volochine <yvan.volochine@gmail.com>
  • Loading branch information
gusano committed Mar 28, 2015
1 parent de5be6f commit 2dc264c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions SCClassLibrary/Common/GUI/Base/QLayout.sc
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

1 comment on commit 2dc264c

@telephon
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thank you. Just a question: shouldn't all this happen in the parse method?

Please sign in to comment.