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

Render border above active progress for progress_bar widget. #2443

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

B0ney
Copy link
Contributor

@B0ney B0ney commented May 18, 2024

Before:
Screenshot 2024-05-18 140250

After:
Screenshot 2024-05-18 140125

widget/src/progress_bar.rs Outdated Show resolved Hide resolved
@B0ney
Copy link
Contributor Author

B0ney commented May 20, 2024

Looks like I discovered a transparency bug in tiny-skia:

Screenshot 2024-05-20 133400

wgpu:
Screenshot 2024-05-20 132308

sscce:

use iced::widget::container;
use iced::widget::progress_bar::Style;
use iced::widget::progress_bar;
use iced::{Border, Color, Element, Length};

pub fn main() -> iced::Result {
    iced::program("Progress Bar - Iced", Progress::update, Progress::view)
        .theme(|_| iced::Theme::Light)
        .run()
}

#[derive(Default)]
struct Progress;

impl Progress {
    fn update(&mut self, _: ()) {}

    fn view(&self) -> Element<()> {
        container(progress_bar(0.0..=100.0, 50.0).style(|_| Style {
            background: Color::BLACK.into(),
            bar: Color::from_rgb8(0, 255, 0).into(),

            border: Border {
                color: Color::from_rgba8(0, 0, 127, 0.5),
                width: 4.0,
                ..Default::default()
            },
        }))
        .padding(20)
        .center_x(Length::Fill)
        .center_y(Length::Fill)
        .into()
    }
}

@hecrj hecrj force-pushed the progress-bar-border-fix branch from b0e6523 to be85d9e Compare September 10, 2024 20:48
@hecrj hecrj added this to the 0.13 milestone Sep 10, 2024
@hecrj hecrj added bug Something isn't working fix widget labels Sep 10, 2024
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

Thanks!

@hecrj hecrj enabled auto-merge September 10, 2024 20:51
@hecrj hecrj disabled auto-merge September 10, 2024 20:51
@hecrj hecrj enabled auto-merge (squash) September 10, 2024 20:51
@hecrj hecrj merged commit ae58a40 into iced-rs:master Sep 10, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants