Giter Site home page Giter Site logo

Comments (7)

OhadRau avatar OhadRau commented on April 30, 2024

Going to try working on this now that I have a little more free time. Will update here as I go.

from revery.

bryphe avatar bryphe commented on April 30, 2024

@OhadRau - awesome, thank you! Let me know if you need any help.

from revery.

OhadRau avatar OhadRau commented on April 30, 2024

One quick question, is there any specific order that the borders should be resolved in? For example, if I were to make <view style=Style.make(~border=Border.make(~width=1, ()), ~borderLeft=Border.make(~width=2, ()), ())/> would the correct way to resolve this be always applying the most specific border? Or should they overlap if multiple are provided?

from revery.

bryphe avatar bryphe commented on April 30, 2024

One quick question, is there any specific order that the borders should be resolved in?

That is a good question! My expectation would be that the more-specific border overrides the previous settings - so in the <view style=Style.make(~border=Border.make(~width=1, ()), ~borderLeft=Border.make(~width=2, ()), ())/> case, we'd end up with a top/right/bottom border of width 1, and a left border of width 2.

from revery.

OhadRau avatar OhadRau commented on April 30, 2024

Perfect. One more question, for drawing the border quads should I treat all the borders as interior items in the ViewNode (i.e. the main quad starts at (leftWidth, topWidth) instead of (0, 0))? If that's the case my understanding is that I'll have to adjust all positions to be relative to the top left corner of the main quad. The other alternative would be rendering the borders at a negative position (not sure if this would cause problems).

from revery.

OhadRau avatar OhadRau commented on April 30, 2024

Went ahead and implemented triangle geometry. The way I'm calculating the texture coordinates is really bad, I just wasn't sure what the proper math was so I left it WIP.

I also finished rendering the borders: 2018-12-19-230648_800x600_scrot

Still not sure how to approach the inner coordinates for the contents of the view node, so let me know if there's a certain way I should go about it. I couldn't see any obvious way to tell the super class to render inside the actual view area (rather than the entire area including the border) but I might've missed something.

from revery.

bryphe avatar bryphe commented on April 30, 2024

Perfect. One more question, for drawing the border quads should I treat all the borders as interior items in the ViewNode (i.e. the main quad starts at (leftWidth, topWidth) instead of (0, 0))? If that's the case my understanding is that I'll have to adjust all positions to be relative to the top left corner of the main quad. The other alternative would be rendering the borders at a negative position (not sure if this would cause problems).

Ah, this is what i had a question about on the PR (I guess this is the root cause for the text rendering on the border). What I'd recommend for this is to account for the borderLeft/borderTop sizes in the local transform, here:
https://github.com/bryphe/revery/blob/b3c4274f6b5ec20c6847751927f54ea5bab761f7/src/UI/Node.re#L31

In other words, where we add in the top/left position:

 let matrix = Mat4.create();
    Mat4.fromTranslation(
      matrix,
      Vec3.create(
        float_of_int(dimensions.left),
        float_of_int(dimensions.top),
        0.,
      ),
    );

We also account for the borderTop/borderLeft sizes.

This puts all the children in a space where the coordinate system for the interior starts at (0, 0), which will put the children in the correct place - seems like the simplest approach.

However, as you mentioned, this would necessitate rendering the top and left borders at a negative position - that should be fine since those negative values will get adjusted when we transform the element to screen space. I think it's a reasonable price to pay to keep the rest of the transform chain simple.

Hope that helps!

from revery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.