I am trying to add a image below a scrollview using the famous sequentialLayout and im having a problem with the scrollview's height.
This is how i create my scrollview.
var scrollview = new Scrollview({
direction: Utility.Direction.X,
options: {
size: [300, 300]
},
paginated: true
});
When i add surfaces to the scrollview with 250 height, the scrollview's parent DOM container (famous-group) containing these surfaces has a width and height of 0.
When adding this scrollview within a sequentialLayout as the first item, the second item or surface with a height is displayed on top of this scrollview since it has no height.
Any ideas how to fix this using Famo.us?
I am trying to add a image below a scrollview using the famous sequentialLayout and im having a problem with the scrollview's height.
This is how i create my scrollview.
var scrollview = new Scrollview({
direction: Utility.Direction.X,
options: {
size: [300, 300]
},
paginated: true
});
When i add surfaces to the scrollview with 250 height, the scrollview's parent DOM container (famous-group) containing these surfaces has a width and height of 0.
When adding this scrollview within a sequentialLayout as the first item, the second item or surface with a height is displayed on top of this scrollview since it has no height.
Any ideas how to fix this using Famo.us?
Share Improve this question asked Apr 14, 2014 at 10:07 nytrmnytrm 5091 gold badge5 silver badges15 bronze badges1 Answer
Reset to default 9You can't set size like that - use a modifier for this.
This will be the render tree
MainContext
SequentialLayout
Modifier(size)
ScrollView
Modifier(size)
Image
Code snippet:
// Create ponents
var scrollview = new ScrollView();
var image = new ImageSurface({
content: 'content/images/famous_symbol_transparent.png'
});
// Create Size Modifiers
var scrollModifier = new StateModifier({ size: [200,200]});
var imageModifier = new StateModifier({ size: [200,200]});
// Wrap the Modifier in a RenderNode, so we can add the surface
// (you can't add surfaces directly to a modifier)
var scrollNode = new RenderNode(scrollModifier)
scrollNode.add(scrollview);
var imageNode = new RenderNode(imageModifier);
imageNode.add(image);
// Create a SequentialLayout
var sequence = new SequentialLayout();
sequence.sequenceFrom([scrollNode,imageNode]);
And here is an example gist (copy-paste the main.js
after running the yo famous
generator)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744888528a4599263.html
评论列表(0条)