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

    ambitious-knife-25690

    02/01/2023, 3:13 PM
    which would be incorrect
  • b

    bright-gpu-74537

    02/01/2023, 3:13 PM
    i think it should be:
    Copy code
    haxe
                if (this.clipQuad == null) {
                    if (this.parentComponent != null) {
                        this.parentComponent.clipQuad = new Quad();
                        this.parentComponent.clipQuad.visible = true;
                        this.parentComponent.visual.add(clipQuad);
                    } else {
                        this.clipQuad = new Quad();
                        this.clipQuad.visible = true;
                        this.visual.add(clipQuad);
                    }
                }
  • b

    bright-gpu-74537

    02/01/2023, 3:14 PM
    im not sure what you mean
  • b

    billowy-waiter-28954

    02/01/2023, 3:14 PM
    I don't know how the rectangle is done for the clipping area
  • b

    billowy-waiter-28954

    02/01/2023, 3:14 PM
    What is the origin of the clipping rectangle Ian?
  • a

    ambitious-knife-25690

    02/01/2023, 3:14 PM
    the parent
    vbox
    clipping rect would be one of the two bounds
  • b

    billowy-waiter-28954

    02/01/2023, 3:15 PM
    is it relative to the parent component or to our own child component?
  • a

    ambitious-knife-25690

    02/01/2023, 3:15 PM
    your code above ian, results in this effect
  • b

    bright-gpu-74537

    02/01/2023, 3:16 PM
    its relative to the current component... so if you have, say, a component of 100x200, and the cliprect is 0,50,100,100, you would expect to see a 100x100 part of it, offset by 50 from the top
  • b

    bright-gpu-74537

    02/01/2023, 3:16 PM
    odd
  • b

    bright-gpu-74537

    02/01/2023, 3:18 PM
    so the clip quad has to be `add`ed to the visual, but the
    .clip
    has to be set on the parent? 🤔
  • b

    billowy-waiter-28954

    02/01/2023, 3:19 PM
    @ambitious-knife-25690 Why to you subtract value.left and value.top on this.x/y in your code?
  • b

    billowy-waiter-28954

    02/01/2023, 3:19 PM
    the contrary
  • b

    bright-gpu-74537

    02/01/2023, 3:19 PM
    ... the clip quad has to be added to the parent, and the .clip property set on the child visual?
  • b

    billowy-waiter-28954

    02/01/2023, 3:20 PM
    @ambitious-knife-25690 why is it not:
    Copy code
    haxe
    this.clipQuad.x = left + value.left;
    this.clipQuad.y = top + value.top;
  • a

    ambitious-knife-25690

    02/01/2023, 3:20 PM
    when the scroll bar moves right, the content needs to move left and vice verse
  • a

    ambitious-knife-25690

    02/01/2023, 3:21 PM
    yeah
  • a

    ambitious-knife-25690

    02/01/2023, 3:21 PM
    that's how i got what i've gotten so far tho
  • b

    bright-gpu-74537

    02/01/2023, 3:21 PM
    but thats not what is happening with your code though
  • a

    ambitious-knife-25690

    02/01/2023, 3:21 PM
    not sure if it's "right"
  • a

    ambitious-knife-25690

    02/01/2023, 3:21 PM
    it is
  • b

    billowy-waiter-28954

    02/01/2023, 3:22 PM
    you add the clipQuad to the parent, so that both the clipQuad and the visual you want to clip are in the same space (same parent)
  • a

    ambitious-knife-25690

    02/01/2023, 3:22 PM
    i set
    this.visual.clip
    to the quad and add the clip rect to
    parent.visual.add(cliprect)
  • b

    billowy-waiter-28954

    02/01/2023, 3:22 PM
    Then you hide the clipQuad (visible = false)
  • b

    billowy-waiter-28954

    02/01/2023, 3:22 PM
    and assign it to the other
    visual.clip
    property
  • b

    billowy-waiter-28954

    02/01/2023, 3:22 PM
    this is correct use of clipping in ceramic
  • b

    billowy-waiter-28954

    02/01/2023, 3:23 PM
    But there is probably a problem with the position of the clip quad, that's all I can say
  • b

    bright-gpu-74537

    02/01/2023, 3:24 PM
    gotcha, yeah
  • b

    bright-gpu-74537

    02/01/2023, 3:24 PM
    and when you want to move the mask... you move the clipQuad?
  • b

    billowy-waiter-28954

    02/01/2023, 3:25 PM
    yes
1...145714581459...1687Latest