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

Support clipping #9

Closed
JD557 opened this issue Jun 24, 2023 · 0 comments · Fixed by #14
Closed

Support clipping #9

JD557 opened this issue Jun 24, 2023 · 0 comments · Fixed by #14

Comments

@JD557
Copy link
Owner

JD557 commented Jun 24, 2023

MicroUI has 4 types of operation:

  • MU_COMMAND_TEXT
  • MU_COMMAND_RECT
  • MU_COMMAND_ICON
  • MU_COMMAND_CLIP

InterIm already supports text and rectangle, and I think icons are better served by a custom element.

However, there's still the question of clipping, which is required for smooth scrolling inside a box.

I'm not much of a fan of having this as a RenderOp, as it adds some extra complexity to the interpreter - as some backends might not support this natively and it requires keeping some state.

I think it might be viable to move that state logic to the UIState so that:

  • Rectangles are already clipped (or ignored) when added to the list of render ops
  • Text and Custom ops bring both an area and a clip area
  • The draw char conversion ignores chars outside of the clip area.

I'm not sure if I should also add a clip rect to chars, or if I should just keep it simple... maybe I'll add it anyway and let the backend sort that out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant