GithubHelp home page GithubHelp logo

Comments (6)

IjzerenHein avatar IjzerenHein commented on August 16, 2024

Hi, you have to specify the size for layoutController1:

var layoutController1 = new LayoutController({
    size: [undefined, 90],
    ...
});  

The size is never automatically derived from the children.
You can also add a custom getSize function to the LayoutController in which you yourself calculate the desired height:

var layoutController1 = new LayoutController({...});
layoutController.getSize = function() {
   // calculate height...
   return [undefined, 90];
};

from famous-flex.

christianvoigt avatar christianvoigt commented on August 16, 2024

thanks for the quick reply! I already feared that that would be the case. The sublists for each item contain a varying number of surfaces with their height set to true, so I have to add up all their sizes (plus the space between elements if there is any), right?

I think it would be cool to allow auto sizing for the LayoutController as an option so that its size is derived from its children.

from famous-flex.

IjzerenHein avatar IjzerenHein commented on August 16, 2024

I like the idea of letting the LayoutController use the size of the child renderables. I'll see whether I can come up with an elegant solution for it.

from famous-flex.

IjzerenHein avatar IjzerenHein commented on August 16, 2024

Hi, I've implemented this feature. I've added the ability to specify size: [undefined, true] to a LayoutController. It will then calculate the height of all the child renderables, which is then returned by the layoutController.getSize function.

Example:

var layoutController = new LayoutController({
   layout: ListLayout,
   size: [undefined, true], // tell the LayoutController to derive the height from the child-renderables
   dataSource: [
      new Surface({
         size: [undefined, true],
         content: 'sample text'
      }),
      new Surface({
         size: [undefined, true],
         content: 'sample text<br><br>testing'
      })
    ]
});

I've created a demo project for it here:
https://github.com/IjzerenHein/famous-flex-truesize-layoutcontroller-demo

Let me know whether this solves your problem.
Cheers!

from famous-flex.

christianvoigt avatar christianvoigt commented on August 16, 2024

This solved my problem. Thank you for your great work and a happy new year!

from famous-flex.

IjzerenHein avatar IjzerenHein commented on August 16, 2024

Awesome, great to hear!
Happy new year to you too.

from famous-flex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.