-
Notifications
You must be signed in to change notification settings - Fork 0
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
Progress bar element #132
Comments
I'm giving this a try If the user of this element tries to set the percent to a value outside of the range, should it return an error or just silently clamp the value? I would default to the latter, but I thought I should ask |
It should just silently clamp the value. Oh and by the way, I'm currently in the process of writing (and re-writing) the guide on custom elements in the Yarrow book. Someone else has attempted the progress bar element before, and we realized a bunch of improvements to the API we could make. |
I guess I should have also moved this task to "in progress". My bad. |
Ah, I gotcha Have those API improvements been made already, or are they planned/in-progress? And, is that implementation going to be completed and merged, or should I continue working on mine? |
The API improvements have been made, but I haven't updated the book yet. |
Cool cool!! I've been piecing it together from just reading through the codebase, I would hardly claim to be an expert after like four hours of this but I think I understand enough to put some functional elements together |
I pushed my initial progress bar implementation to a branch on my fork. I think that an optional border and tooltip could be useful additions, but I haven't added those as of yet. |
I implemented tooltips. As for a border, and in particular a border radius, I haven't been able to find a good way of clipping the fill rectangle so that it does not spill over beyond the bounds of a given border radius. In most cases, simply drawing the fill rectangle with the specified border radius works, but when the width of the fill rectangle is less than the sum of the left and right border radii, RootVG uses a smaller border radius instead, which results in the fill rectangle spilling over. This could be addressed using compositing operations, but those are not currently implemented in RootVG. It could also be addressed using shaders or a custom mesh, but to me, both of those approaches seem needlessly complex for the problem. |
I'm actually in the process of rewriting RootVG since I'm not happy with the API, the functionality, and the rendering quality. I'm now basing it off of NanoVG and translating it to Rust and wgpu. I'll post an update when it's ready. |
This is a simple element that simply displays a horizontal progress bar.
The element's style struct should include:
The style should not include any sizing information, rather the element should simply expand to fill whatever bounding rectangle the user has set.
The shared state will only include a single
f32
value called "percent", which ranges from[0.0, 100.0]
.The text was updated successfully, but these errors were encountered: