Skip to content

Conversation

@ibgreen-openai
Copy link
Collaborator

@ibgreen-openai ibgreen-openai commented Oct 24, 2025

It would be very powerful to be able to use CSS style calc expressions when declaratively specifying view layouts.

Summary

  • replace the simple position struct with a LayoutExpression tree plus parser and evaluator so strings with numbers, percentages, px units, and calc() expressions can be represented and evaluated
  • store the parsed layout expressions on View and evaluate them when resolving viewport dimensions and padding
  • add tape tests that cover literal numbers, percentages, pixels, and calc() combinations as well as direct evaluation of synthetic expression trees

Testing

  • NODE_ENV=test node node_modules/@vis.gl/dev-tools/dist/test.js node

https://chatgpt.com/codex/tasks/task_i_68fb7cdcc1e8832ca8367f01290541fc

Base automatically changed from codex/split-canvas-horizontally-and-add-layer to master October 24, 2025 15:22
Copy link
Collaborator

@chrisgervang chrisgervang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks useful. Backwards compatible, aligns with an existing expression syntax, and would work well in any environment.

I could also see this being useful in viewState's padding property (and any screen space prop)

My testing run book for this would be:

  • try typing an expression in the JSON playground, noodles.gl (or any reactive environment) to see how graceful it is with syntax errors, and how responsive it feels.
  • try it on each view type and each property (the examples you've modified cover this well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants