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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

B0ney
Copy link

@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
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()
    }
}

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 this pull request may close these issues.

None yet

2 participants