Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

class library: GridLayout - fix position when using spanning #1384

Merged
merged 1 commit into from
Apr 24, 2015

Conversation

gusano
Copy link
Member

@gusano gusano commented Mar 28, 2015

Fix #1383

(
g = GridLayout.rows(
    [[Button(), c: 2], [Button(), c: 2], Button()],
    [[Button(), c: 5]]
);
w = Window("", 200@100).layout_(g).front();
)

qtbugfixed01

(
g = GridLayout.columns(
    [Slider2D(), Slider2D(), Slider2D(), Slider2D(), Slider2D()],
    [[Slider2D(), r: 2], [Slider2D(), r: 2], Slider2D()],
    [[Slider2D(), r: 5]]
);
w = Window("", 200@100).layout_(g).front();
)

qtbugfixed02

Re supercollider#1383

Signed-off-by: Yvan Volochine <yvan.volochine@gmail.com>
@gusano
Copy link
Member Author

gusano commented Apr 6, 2015

Just a question: shouldn't all this happen in the parse method?

I thought so as well at first sight, but because the offset has to be applied to the next element (and depending wether *rows or *cols is called to the column or row index respectively), that would mean parsing item before calling *parse() to know if there's any spanning that need to be aplied to next elements, ... [1]
So I chose a cleaner approach ;)

[1] https://github.com/gusano/supercollider/blob/2dc264c2f71717459b2e4141f35aed66ce51deb5/SCClassLibrary/Common/GUI/Base/QLayout.sc#L107-110

@scztt
Copy link
Contributor

scztt commented Apr 24, 2015

Nice fix @gusano. Merging.

scztt added a commit that referenced this pull request Apr 24, 2015
class library: GridLayout - fix position when using spanning
@scztt scztt merged commit 9954a5f into supercollider:master Apr 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants