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

    cool-musician-79004

    05/24/2023, 5:58 PM
    Is for a client ? Personal project ?
  • b

    bright-gpu-74537

    05/24/2023, 6:08 PM
    client
  • b

    bright-yak-48460

    05/24/2023, 7:11 PM
    Looking sweet @bright-gpu-74537
  • b

    bulky-exabyte-6537

    05/25/2023, 6:30 AM
    (forewarning i'm not a webdev) i was looking for a quick n dirty way to show maths in my haxeui-html5 app. i am using the MathJax lib for it and basically just doing
    Copy code
    haxe
    function this_SHOWN(e) {
        #if js
        // rewrites the dom to replace special markup text with math symbols
        mathjax.MathJax.typeset(); 
        #end
    }
    but the sad part is that haxeui doesn't update the layout to the new size and i'm not sure how to tell it to.
    invalidateComponent
    doesn't work in this case.
    Copy code
    xml
    <button text="SADSADASDADSADS"/>
    <label text="`sum_(i=1)^n i^3=((n(n+1))/2)^2`"/>
    <button text="below"/>

    https://cdn.discordapp.com/attachments/565569107701923852/1111179374939611197/image.png▾

  • b

    bulky-exabyte-6537

    05/25/2023, 6:59 AM
    this actually gives me a good size but writing this does make me feel queasy
    Copy code
    haxe
    #if js
    mathjax.MathJax.typeset();
    math.width = math.element.children[0].children[0].children[0].clientWidth;
    math.height = math.element.children[0].children[0].children[0].clientHeight;
    #end
  • b

    bright-gpu-74537

    05/25/2023, 7:37 AM
    i think you would be better off creating a new custom component that handles this, it would fit in much nicer into haxeui (i would expect)... gimme few mins, lemme check out the MathJax lib
  • b

    bright-gpu-74537

    05/25/2023, 7:42 AM
    can you send your project btw? Just wanna see how you are using mathjax mainly
  • b

    bulky-exabyte-6537

    05/25/2023, 7:47 AM
    sure
  • b

    bulky-exabyte-6537

    05/25/2023, 7:54 AM
    https://cdn.discordapp.com/attachments/565569107701923852/1111200504027021392/mathjax.zip
  • b

    bulky-exabyte-6537

    05/25/2023, 7:55 AM
    putting it into a skeleton project reveals the flaws of my design, my method of sizing broke heh
  • b

    bulky-exabyte-6537

    05/25/2023, 8:00 AM
    actually it didn't that was the regular label that has the bad sizing, not the custom control (!)
  • b

    bright-gpu-74537

    05/25/2023, 8:19 AM
    this seems to work fine:
  • b

    bright-gpu-74537

    05/25/2023, 8:19 AM
    https://cdn.discordapp.com/attachments/565569107701923852/1111206986147696690/MJ.hx
  • b

    bright-gpu-74537

    05/25/2023, 8:20 AM
    Copy code
    xml
    <vbox style="padding: 5px;" width="100%" height="100%">
        <button text="SADSADASDADSADS"/>
        <mj text="`sum_(i=1)^n i^3=((n(n+1))/2)^2`" />
        <button text="below"/>
        <mj text="`i^123`"/>
    
        <grid columns="3">
            <button text="TL" />
            <button text="T" width="100%" />
            <button text="TR" />
    
            <button text="L" width="100%" height="100%" />
            <mj text="`sum_(i=1)^n i^3=((n(n+1))/2)^2`" />
            <button text="R" width="100%" height="100%" />
    
            <button text="BL" />
            <button text="B" width="100%" />
            <button text="BR" />
        </grid>
    </vbox>
  • b

    bright-gpu-74537

    05/25/2023, 8:20 AM

    https://cdn.discordapp.com/attachments/565569107701923852/1111207139046850569/image.png▾

  • b

    bulky-exabyte-6537

    05/25/2023, 8:33 AM
    thanks ian! i was pretty close 😁
  • b

    bright-gpu-74537

    05/25/2023, 8:35 AM
    yup, just the "validateComponentLayout"... "shown" would have kinda worked, but validateComponentLayout is the right place and is called at the right time... also means you should be able to change the formula dynamically and everything will work, didnt test that though
  • b

    bulky-exabyte-6537

    05/25/2023, 8:44 AM
    the dynamic resizing doesn't seem to work, but i probably don't need it
  • b

    bright-gpu-74537

    05/25/2023, 9:03 AM
    what other formula are you testing?
  • b

    bright-gpu-74537

    05/25/2023, 9:07 AM
    yeah, i see what you mean though... i think its because haxeui then gives the element a size, and then mathjax honours that
  • b

    bright-gpu-74537

    05/25/2023, 9:09 AM
    feels a little hacky, but this works:
  • b

    bright-gpu-74537

    05/25/2023, 9:09 AM
    Copy code
    haxe
        private override function set_text(value:String):String {
            this.width = null;
            this.height = null;
            this.element.style.removeProperty("width");
            this.element.style.removeProperty("height");
            this.element.innerHTML = value;
            if (isReady) {
                MathJax.typeset();
                this.invalidateComponentLayout();
            }
            return super.set_text(value);
        }
  • b

    bright-gpu-74537

    05/25/2023, 9:13 AM

    https://cdn.discordapp.com/attachments/565569107701923852/1111220592738308107/resize-mathjax.gif▾

  • b

    bulky-exabyte-6537

    05/25/2023, 11:21 PM
    thanks ian, i really appreciate ur help
  • a

    adorable-spring-93492

    05/26/2023, 2:16 AM
    Been awhile since I’ve popped in here but with some good news (and another question) I finally got haxeui working on my machine. I think I have a vague idea of what went wrong but I’m not entirely sure it’s correct. Basically what I did for anyone that had similar issues was manually remove the packaged release of haxeui-core that gets automatically downloaded when using haxeui-flixel. What I should have done was leave that be and manually use haxelib set to just change to the git version. It seems like something went wrong when trying to remove the old packaged version where maybe it didn’t actually switch to git even though it was showing git as being selected. Use haxelib set and it seems to work fine. A whole lot of tinkering for what ended up being a super simple solution.
  • a

    adorable-spring-93492

    05/26/2023, 2:17 AM
    Did want to ask if any progress was made with custom fonts in haxeui-heaps, I saw some messages saying it wasn’t doable, but they were from 2020, so I’m hoping there might be a solution now?
  • b

    bright-gpu-74537

    05/26/2023, 6:25 AM
    pretty sure custom fonts are doable in haxeui-heaps... i defo needed to tweak a few things to allow nice SDF fonts, but 100% sure its possible... .... @early-butcher-76809 i think its a heaps user, and likely uses custom fonts, someone else too, but the name escapes me now
  • b

    bulky-exabyte-6537

    05/26/2023, 9:27 AM
    you can crash the component explorer by switching the selected example too fast

    https://cdn.discordapp.com/attachments/565569107701923852/1111586511465488444/image.png▾

  • b

    bulky-exabyte-6537

    05/26/2023, 9:29 AM
    i think it's specifically switching to "Option Boxes" and then switching away before it loaded?
  • b

    bulky-exabyte-6537

    05/26/2023, 9:31 AM
    actually im wrong it's by clicking "Option Boxes", clicking another, and then coming back to option boxes
1...16831684168516861687Latest