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

    bright-gpu-74537

    03/04/2023, 12:38 PM
    well, put simply, the depth should reflect the position it is in the childComponents array
  • a

    ambitious-knife-25690

    03/04/2023, 12:38 PM
    tbh, i could just make depth == childComponents.length 🤔
  • b

    bright-gpu-74537

    03/04/2023, 12:38 PM
    well, no... because then you are basically saying "always put this and the end" (depth wise)... you'll need to reassign depth based on array index
  • a

    ambitious-knife-25690

    03/04/2023, 12:39 PM
    ahhh good point
  • a

    ambitious-knife-25690

    03/04/2023, 12:39 PM
    but haxeui may reconfigure the childComponents array, no?
  • b

    bright-gpu-74537

    03/04/2023, 12:40 PM
    only via add/remove component, it wont do it internally by screwing with the array
  • b

    bright-gpu-74537

    03/04/2023, 12:41 PM
    if it did, all backends would act all strange
  • b

    bright-gpu-74537

    03/04/2023, 12:41 PM
    basically the childComponents array is the "gold standard" for the order of the children, which for ceramic also indicates its depth
  • a

    ambitious-knife-25690

    03/04/2023, 12:42 PM
    so essentially if i sort out the addcomponentat I can deduce the remove from the index
  • a

    ambitious-knife-25690

    03/04/2023, 12:42 PM
    nice, thank you!
  • b

    bright-gpu-74537

    03/04/2023, 12:45 PM
    well, its not really about addcomponent, addcomponentat, removecomponent or removecomponentat... its: when you add or remove a component (handleAddComponent, handleAddComponentAt, handleRemoveComponent, handleRemoveComponentAt) you will need to reorder the depths in order to refect the new state of things... same goes for addComponent / removeComponent on Screen.instance
  • a

    ambitious-knife-25690

    03/04/2023, 12:56 PM
    is there a place where I can flag a state update?
  • b

    bright-gpu-74537

    03/04/2023, 12:56 PM
    im not sure what you mean
  • a

    ambitious-knife-25690

    03/04/2023, 12:56 PM
    these guys seem to be one step before actually updating the core list, so i need to update the list after the return of these - no?
  • a

    ambitious-knife-25690

    03/04/2023, 12:57 PM
    hmm, i guess not because i know what has changed before i return lol
  • a

    ambitious-knife-25690

    03/04/2023, 12:57 PM
    nvm thanks for the rubber duck 😄
  • b

    bright-gpu-74537

    03/04/2023, 12:57 PM
    no: https://github.com/haxeui/haxeui-core/blob/master/haxe/ui/core/Component.hx#L401-L403
  • b

    bright-gpu-74537

    03/04/2023, 1:00 PM
    psuedo code:
  • a

    ambitious-knife-25690

    03/04/2023, 1:00 PM
    ohhh nicee
  • b

    bright-gpu-74537

    03/04/2023, 1:00 PM
    Copy code
    haxe
    function handleAddComponent {
        // do stuff
        reasignDepths();
    }
    
    function handleAddComponentAt {
        // do stuff
        reasignDepths();
    }
    
    function handleRemoveComponent {
        // do stuff
        reasignDepths();
    }
    
    function handleRemoveComponentAt {
        // do stuff
        reasignDepths();
    }
    
    function reasignDepths {
        var n = 0;
        for (c in this.childComponents) {
            c.visual.depth = n;
            n++;
        }
    }
  • a

    ambitious-knife-25690

    03/04/2023, 1:00 PM
    nice thanks 😄
  • a

    ambitious-knife-25690

    03/04/2023, 1:12 PM
    Screen instance one isn't necessary no?
  • a

    ambitious-knife-25690

    03/04/2023, 1:12 PM
    its directly removing a component
  • b

    bright-gpu-74537

    03/04/2023, 1:12 PM
    it will be yeah
  • b

    bright-gpu-74537

    03/04/2023, 1:12 PM
    it doesnt matter 😄 Its about the depths being wrong...
  • a

    ambitious-knife-25690

    03/04/2023, 1:13 PM
    hmm, maybe this means i'll have to have a root passed to toolkit
  • a

    ambitious-knife-25690

    03/04/2023, 1:13 PM
    I guess that's fine, now that I understand ceramic a bit better that isn't a big deal
  • b

    bright-gpu-74537

    03/04/2023, 1:13 PM
    why?
  • a

    ambitious-knife-25690

    03/04/2023, 1:14 PM
    thinking in reverse again, i'm still following ceramic hierarchy - not haxeui's
  • b

    bright-gpu-74537

    03/04/2023, 1:15 PM
    its not a bad idea to have that as an option anyway, but in this case, it doest mean anything... the version in screen is exactly the same as the psudo above, just instead of "childComponents" you would use "rootComponents"
1...157015711572...1687Latest