javascript - Famo.us Scrollview height - Stack Overflow

I am trying to add a image below a scrollview using the famous sequentialLayout and im having a problem

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 badges
Add a ment  | 

1 Answer 1

Reset to default 9

You 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

相关推荐

  • javascript - Famo.us Scrollview height - Stack Overflow

    I am trying to add a image below a scrollview using the famous sequentialLayout and im having a problem

    1天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信