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

    bright-gpu-74537

    03/04/2023, 11:11 AM
    yeah, something is off... i would review and sanity check all the "add/remove child" code
  • b

    bright-gpu-74537

    03/04/2023, 11:12 AM
    whether its depth or X or Y
  • b

    bright-gpu-74537

    03/04/2023, 11:12 AM
    (i just had to google how to spell "whether" 😄 - wheather? weather? whether? ffs)
  • a

    ambitious-knife-25690

    03/04/2023, 11:12 AM
    lol
  • a

    ambitious-knife-25690

    03/04/2023, 11:23 AM
    @bright-gpu-74537Does removeAt, only ever remove the first component in the list? 🤔
  • b

    bright-gpu-74537

    03/04/2023, 12:19 PM
    no, it removes the child at the specified index
  • a

    ambitious-knife-25690

    03/04/2023, 12:28 PM
    this is problematic
  • a

    ambitious-knife-25690

    03/04/2023, 12:28 PM
    @billowy-waiter-28954 is there a way to remove/insert children at specific index's?
  • a

    ambitious-knife-25690

    03/04/2023, 12:28 PM
    the api makes this very >> not okay <<
  • b

    bright-gpu-74537

    03/04/2023, 12:30 PM
    is it all depth based?
  • a

    ambitious-knife-25690

    03/04/2023, 12:31 PM
    it is
  • a

    ambitious-knife-25690

    03/04/2023, 12:31 PM
    and an index won't be "unique"
  • b

    bright-gpu-74537

    03/04/2023, 12:31 PM
    does it also take aprent child into account? I mean, say this tree and depth, will that "work":
  • a

    ambitious-knife-25690

    03/04/2023, 12:32 PM
  • a

    ambitious-knife-25690

    03/04/2023, 12:32 PM
    I think it could
  • a

    ambitious-knife-25690

    03/04/2023, 12:32 PM
    but i'm not sure on how this works
  • b

    bright-gpu-74537

    03/04/2023, 12:32 PM
    Copy code
    A (depth = 1)
        B (depth = 1)
        C (depth = 2)
            X (depth = 1)
            Y (depth = 2)
            Z (depth = 3)
        D (depth = 3)
  • a

    ambitious-knife-25690

    03/04/2023, 12:32 PM
    that's the default behaviour, yeah
  • a

    ambitious-knife-25690

    03/04/2023, 12:33 PM
    except depth doesn't auto increment
  • b

    bright-gpu-74537

    03/04/2023, 12:33 PM
    ok, so, why dont you get the child components, and assign them the depth based on the position in the
    childComponents
    array, eg:
  • a

    ambitious-knife-25690

    03/04/2023, 12:33 PM
    I did mess with that, but, I didn't think about matching it with the childComponents array 😄
  • b

    bright-gpu-74537

    03/04/2023, 12:34 PM
    Copy code
    haxe
    var n = 0;
    for (c in this.childComponents) {
        c.visual.depth = n;
        n++;
    }
  • b

    bright-gpu-74537

    03/04/2023, 12:34 PM
    (not tested, just written blind)
  • a

    ambitious-knife-25690

    03/04/2023, 12:34 PM
    Copy code
    hx
        function getDepthIndex(child:Component) {
            var depth = 0.;
            var children = child.visual.children;
            if (children != null && children.length > 0) {
                depth = children[children.length - 1].depth;
            }
            return cdepth++;
        }
  • a

    ambitious-knife-25690

    03/04/2023, 12:35 PM
    that's somewhat what i'm doing now
  • a

    ambitious-knife-25690

    03/04/2023, 12:35 PM
    but i was basing it off of ceramic's children 😅
  • b

    bright-gpu-74537

    03/04/2023, 12:36 PM
    but the ceramic children might be wrong, no? I mean index wise... also, you are taking the last one and incrementing the depth, not assigning it a fixed value based on array index
  • b

    bright-gpu-74537

    03/04/2023, 12:36 PM
    ... so that bit of code is almost certainly the source of your woes
  • a

    ambitious-knife-25690

    03/04/2023, 12:37 PM
    yeah, i removed most of it and have quite a simple new base that mimics my best version
  • a

    ambitious-knife-25690

    03/04/2023, 12:37 PM
    at one point it did make a difference, but now it goes away 😄
1...156915701571...1687Latest