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

SequentialLayout can't be align to bottom #67

Open
guppyplopp opened this issue May 11, 2017 · 7 comments
Open

SequentialLayout can't be align to bottom #67

guppyplopp opened this issue May 11, 2017 · 7 comments

Comments

@guppyplopp
Copy link

guppyplopp commented May 11, 2017

SequentialLayout behave unpredicted when it's origin: [0, 1] and when it's added to a align: [0, 1] node.
And direction: SequentialLayout.DIRECTION.Y
Even worse if items hight is set to TRUE.

In direction: SequentialLayout.DIRECTION.X everything is fine and acting as predicted.

var a1 = new Surface({ content: 'alt 1 ', size: [undefined, true], origin: [1, 1] }); var a2 = new Surface({ content: 'alt 2 ', size: [undefined, true], origin: [1, 1] }); var a3 = new Surface({ content: 'alt 3 ', size: [undefined, true], origin: [1, 1] }); var test = new SequentialLayout({ direction: SequentialLayout.DIRECTION.Y, spacing: 3, size: [true, true], origin: [1, 1] }); test.push(a1); test.push(a2); test.push(a3); var context = new Context(); context.add({align: [1, 1]}).add(test); // Mount the context to a DOM node context.mount(document.body);

@frh3ddy
Copy link

frh3ddy commented May 11, 2017

Nodes can't take true size, David Valdman is planing to fix that, also sequentialLayout calculates its on size from the content. so in a way that could be the true size, so if you set the direction X, then the width will be the sum of the item's with in that direction, and for the y so it will be the sum of the item's hight.
what are you trying to achieve? maybe I could help you.

@guppyplopp
Copy link
Author

Nodes? Isn't Seq.Layout a View?

Well, I'm building a View which contains some surfaces with unknown amount of text, so they need to be "true" height. These surfaces are layout with Seq.Layout. And this Seq.Layout with the surfaces is supposed to be align to the bottom of the View.
It's a quiz with a question and x number of alternatives.

@frh3ddy
Copy link

frh3ddy commented May 13, 2017

A View is basically a Node but its used to encapsulate a part of the render tree.
give me a few minutes to try to do what you describe.

@dmvaldman
Copy link
Owner

Sorry, this isn't currently possible with true sized surfaces. If you know the total height of all the surfaces, you can get this effect by explicitly setting the SequentialLayout's size to that.

@frh3ddy
Copy link

frh3ddy commented May 13, 2017

I was able to do what you described, setting true size for hight on the surface,
and then adding aligning [0, 1] to sequentialLayout, also adding a transformY to bring the content up,

check this codepen if you interested, also if @dmvaldman wants to look at it to see if he has better way

@dmvaldman
Copy link
Owner

Ah nice trick. Yes that works for now.

@guppyplopp
Copy link
Author

Thanks. Nice trick!
But I can't say I fully understand how it works. :) Streams and "map" is still confusing things for me.

I just found the google Group. I have some more important questions that would not be suitable to put as "issues" here, so I put them there under the name "Paul". It would be very nice to get some help there from you guys if you got the time.

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

No branches or pull requests

3 participants