https://linen.dev logo
Join Discord
Powered by
# haxe-ui
  • e

    early-butcher-76809

    02/20/2023, 7:54 AM
    But it's not in a real project ^^
  • e

    early-butcher-76809

    02/20/2023, 7:54 AM
    So I can try the ``calc`` thing
  • e

    early-butcher-76809

    02/20/2023, 7:54 AM
    <3
  • e

    early-butcher-76809

    02/20/2023, 8:08 AM
    Also, reading that post : and Removal of hscript! made me think it wasn't supported anymore :P
  • e

    early-butcher-76809

    02/20/2023, 9:03 AM
    I haven't found any resource using ``calc``. The styling guide mentions it but doesn't give any use case. Has anyone ever used it ? What even is the syntax ? Should it be ``calc(myComponentId.height)`` or ``calc(myFunctionDefinedInScriptTags())`` ? Or something else ? I can't make it work with the online builder (but maybe hscript is not active there ?)
  • e

    early-butcher-76809

    02/20/2023, 9:19 AM
    Oh, it does seem hscript is not active on the builder. Using ``calc(40+5)`` does something on my project but doesn't do anything on the builder
  • f

    full-journalist-82607

    02/20/2023, 9:20 AM
    I think calc just used hscript so you have to use write like it was some normal hscript. But I don't think I(ve ever used it.
  • e

    early-butcher-76809

    02/20/2023, 9:21 AM
    Yeah, I'm not sure it's possible to get access to components variables from calc, though. I don't really know what the scope is and I don't get it from reading the code ^^'
  • e

    early-butcher-76809

    02/20/2023, 9:21 AM
    It may not be the solution for my dynamic sized font :P
  • e

    early-butcher-76809

    02/20/2023, 9:21 AM
    Thank you, though
  • b

    bright-gpu-74537

    02/20/2023, 9:25 AM
    do you have an example?
  • b

    bright-gpu-74537

    02/20/2023, 9:25 AM
    is "calc" a thing?
  • e

    early-butcher-76809

    02/20/2023, 9:26 AM
    I guess so, alongside ``min``, ``max``, ``clamp``... in ValueTools.call ^^
  • b

    bright-gpu-74537

    02/20/2023, 9:26 AM
    Copy code
    haxe
                case "calc":
                    #if hscript
    
                    var parser = new hscript.Parser();
                    var program = parser.parseString(string(vl[0]));
    
                    var interp = new hscript.Interp();
                    return interp.expr(program);
    
                    #else
    
                    return null;
    
                    #end
  • b

    bright-gpu-74537

    02/20/2023, 9:26 AM
    so it is
  • e

    early-butcher-76809

    02/20/2023, 9:27 AM
    Yeah, it seems the builder doesn't use hscript anymore
  • e

    early-butcher-76809

    02/20/2023, 9:27 AM
    I do, though
  • b

    bright-gpu-74537

    02/20/2023, 9:27 AM
    yeah, when i said removal of hscript, i meant more that its not used "by everything" anymore... i think calc is still a valid use
  • b

    bright-gpu-74537

    02/20/2023, 9:28 AM
    one pretty big gotcha about calc (and any css functions) is that they run once iirc... i think i have it on a list to fix this... esp for responsive layouts its important
  • b

    bright-gpu-74537

    02/20/2023, 9:29 AM
    i think thats the case anyway... ill have to check, but im pretty sure its the case, that the style needs to be invalidated for it to re-calc
  • e

    early-butcher-76809

    02/20/2023, 9:29 AM
    Would know, off the top of your head, how you'd make a dynamic font size, so a text would be bigger if it's displayed in a bigger box ? :P
  • e

    early-butcher-76809

    02/20/2023, 9:30 AM
    Just filling the parent's height, really
  • b

    bright-gpu-74537

    02/20/2023, 9:31 AM
    so you mean like the size of the font changes as the height of the component changes?
  • e

    early-butcher-76809

    02/20/2023, 9:31 AM
    Yes
  • f

    full-journalist-82607

    02/20/2023, 9:32 AM
    can't you do some min(50%, 10px) or something like this ?
  • b

    bright-gpu-74537

    02/20/2023, 9:32 AM
    i think a pure css solution might not be doable... at least not at the moment
  • b

    bright-gpu-74537

    02/20/2023, 9:33 AM
    i dont think that'll work, and if it did (which i dont think it will), it wouldnt invalidate itself when the component changes size
  • b

    bright-gpu-74537

    02/20/2023, 9:34 AM
    how would you do that in "normal" css?
  • e

    early-butcher-76809

    02/20/2023, 9:34 AM
    % doesn't seem to be used for font sizes.
  • e

    early-butcher-76809

    02/20/2023, 9:35 AM
    I have no idea, I don't know CSS :D
1...152715281529...1687Latest