scrollarea scalechildren

  • Hi,
    trying to build a menu with 3 horizontal scrollarea using flowchildren and I would like the cildren element to be scaled inside the scrollarea.
    here is the barebone : https://www.360images.fr/barebone_scrollarea_scalechildren/

    The children elements are not scaled.
    Here is the code :

    any clue would be lovely, thanks !

  • Right, when setting grid_thumb_container scale childrens are scaled.
    scale is not really what I wanted to use...
    there is no way to fit the scrollarea container which is in a container with a percent height value ?
    the goal is to make this menu responsive and always have the 3 scrollareas visible, not sure if I'm clear ?
    and would also need to limit the title width to the thumbnail width.

  • Ok, if I calc the scale onresize it's working now...

    Have to find a better way to calc the ratio but for barebone it's working.

    EDIT: no really in fact... title get hidden when stageheight is small...

    Code
    <events onresize="resize_thumbs()"/>
    <action name="resize_thumbs">
    for(set(i,0), i LT layer.count, inc(i),
    if(layer[get(i)].style === 'grid_thumb_container',
    calc(layer[get(i)].scale,stageheight/1600);
    ));
    </action>
  • There are many possibility, but it also depends on how exactly it should work...

    E.g. here a quick try:

    Code
    <style name="grid_scrollarea_container" type="container" width="100%" height="relink:stageheight:(stageheight-2*50-2*20)/3" bgborder="1 0xFF0000" scalechildren="true" />
    <style name="grid_scrollarea" type="scrollarea" direction="h" flowchildren="h" childflowspacing="20" align="center" height="100%" />
    <style name="grid_thumb_container" type="container" height="100%" flowchildren="v" childflowspacing="20" bgborder="1 0x00FF00" />
    <style name="grid_thumb" bgroundedge="10" flowexpand="true" width="prop" />
    <style name="grid_thumb_title" bgborder="1 0x0000FF" type="text" bg="false" align="center" css="color:#fff;font-family: var(--ff-secondary);font-size:24px;font-weight: var(--fw-bold);"/>

    The grid_scrollarea_container heights now (instead of 33%) links to stageheight, subtracts there the absolute childflowspacing (50) and childmargin (20) sizes from its parent element and then divides by 3 to give the available space to the three rows.

    The grid_thumb_container uses height=100% to take the size within that container.

    The grid_thumb uses flowexpand=true and width=prop to scale the thumb to the available space with the grid_thumb_container.

    The grid_thumb_title text is only remaining problem now, it has always has an absolute size for the moment, here some idea would be still required...

    When given the thumb text some fixed space/height, the layout might be easier to define...

  • i came to this:

    nest the text.


    ..better with relink indeed..

    Tuur*thumbsup*

  • Thanks Klaus, works great for thumbs but text is not scaled

    I know, I wrote about that above.

    Here another approach:

    Code
    <style name="grid_scrollarea_container" type="container" width="100%" height="relink:stageheight:(stageheight-2*50-2*20)/3" bgborder="1 0xFF0000" scalechildren="true" />
    <style name="grid_scrollarea" type="scrollarea" direction="h" flowchildren="h" childflowspacing="20" align="center" height="100%" />
    <style name="grid_thumb_container" type="container" height="100%" flowchildren="v" xchildflowspacing="20" bgborder="1 0x00FF00" />
    <style name="grid_thumb" bgroundedge="10" height="80%" width="prop" />
    <style name="grid_thumb_title" flow="false" width="100%" height="20%" bgborder="1 0x0000FF" type="text" bg="false" maskchildren="true" textalign="center" align="bottom" css="color:#fff;font-family: var(--ff-secondary);font-size:2vh;font-weight: var(--fw-bold);" />

    There the thumb text area gets a fixed 20% height and the font-size is scaled relative to the viewport height (using 2vh). The overflowing text will be cut off in this case.

    As alternative it would be also possible to use 'ellipsis', but I've noticed there is a bug with the text alignment in this case (will check and fix this for the next release):

    Code
    <style name="grid_thumb_title" flow="false" width="100%" height="20%" bgborder="1 0x0000FF" type="text" bg="false" wordwrap="false" ellipsis="true" textalign="center" align="bottom" css="color:#fff;font-family: var(--ff-secondary);font-size:2vh;font-weight: var(--fw-bold);" />
  • Thanks Klaus,
    This community is so great, one problem, 3 solutions with different approach !
    Many many thanks to Klaus and Tuur , always learning with you guys !

    My approach : https://www.360images.fr/barebone_scrollarea_scalechildren/
    Tuur approach : https://www.360images.fr/barebone_scrol…echildren_tuur/
    Klaus approach : https://www.360images.fr/barebone_scrol…children_klaus/

  • It was a nice example to play with *wink**smile*

    Here my last approach:

    Code
    <layer name="gridcontainer" type="container" width="100%" height="100%" align="center" flowchildren="v" childflowspacing="link:stageheight:stageheight*0.03" childmargin="20" >

    The childflowspacing also depends now the stageheight.

    The thumbs now automatically support multiple rows (not just 3) and the rounded thumb edges also scale with the size:

    Code
    <style name="grid_scrollarea_container" type="container" width="100%" height="relink:stageheight:(stageheight-(parentobject.childflowspacing*(parentobject.childobjects.length-1)+2*parentobject.childmargin))/parentobject.childobjects.length" scalechildren="true" />
    <style name="grid_scrollarea" type="scrollarea" direction="h" flowchildren="h" childflowspacing="20" align="center" height="100%" />
    <style name="grid_thumb_container" type="container" height="100%" flowchildren="v" />
    <style name="grid_thumb" bgroundedge="20" onresize.addevent="bgroundedge=pixelheight*0.2;" height="80%" width="prop" />
    <style name="grid_thumb_title" flow="false" width="100%" height="20%" type="text" bg="false" wordwrap="false" ellipsis="true" textalign="center" align="bottom" css="color:#fff;font-family: var(--ff-secondary);font-size:2vh;font-weight: var(--fw-bold);" />


    And the text alignment problem when 'ellipsis' (...) is used on overflowing text, is fixed now for the next release (1.22.3).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!