Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement CSS3 basic arithemetic functions #691

Open
hyblocker opened this issue Oct 9, 2024 · 1 comment
Open

Implement CSS3 basic arithemetic functions #691

hyblocker opened this issue Oct 9, 2024 · 1 comment
Labels
discussion Meta talk and feedback enhancement New feature or request

Comments

@hyblocker
Copy link

Implementing CSS3 arithmetic functions would improve one's ability to do dynamic complex layouts using RmlUI (eg dynamically scaling elements based on viewport dimensions). For instance, one could use CSS such as the following:

div#my-cool-div {
    width: calc(100% - 32px); /* We need a constant width of 32px from the right */
}

We would have to start with defining a parser to parse the arithmetic grammar properly and likely also implement an expression cache (to avoid evaluating them every frame) whenever possible.

The definition of these arithmetic functions is defined here.

Is such a feature beyond the scope of this project or not, given it does not aim to implement the entirety of CSS3?

@mikke89 mikke89 added enhancement New feature or request discussion Meta talk and feedback labels Oct 9, 2024
@mikke89
Copy link
Owner

mikke89 commented Oct 9, 2024

I think there are some things you can express neatly with calc expressions. Although, at the same time, the equivalent things can be achieved through other means (at least usually), e.g. using nested boxes, or things like flexbox layout or relative positioning. And for that, it's not something I would put very high up on the priority list. But it would be a nice to have feature.

I would certainly consider it if I saw a draft implementation, but it depends on its complexity and performance I would say. We can't accept a solution that impacts performance for users that don't opt to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Meta talk and feedback enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants