floem icon indicating copy to clipboard operation
floem copied to clipboard

Border radius is ignored when border is set individually

Open dominikwilkowski opened this issue 1 year ago • 2 comments

When the border is set individually via border_top etc and not via border the border radius is ignored.

use floem::{
    peniko::Color,
    view::View,
    views::{label, Decorators},
};

fn app_view() -> impl View {
    label(|| "text").style(|s| {
        s.border_radius(15.0)
            .border_left(20.0)
            .border_top(20.0)
            .width(200.0)
            .height(100.0)
            .margin(100.0)
            .background(Color::RED)
            .border_color(Color::BLUE)
    })
}

fn main() {
    floem::launch(app_view);
}
image

dominikwilkowski avatar Apr 04 '24 18:04 dominikwilkowski

Yes, border radius for different border width has not been implemented yet. It's not easy to implement correctly.

https://drafts.csswg.org/css-backgrounds/#corner-shaping

Long0x0 avatar Apr 05 '24 03:04 Long0x0

https://github.com/lapce/floem/blob/04ee9e7c7786f1ab309b35287ec4a63574cbe9ae/src/view.rs#L466C4-L505C2

Issue appears to be here. Looks like we just need to swap in different kurbo shapes that can apply the border radius

jrmoulton avatar Apr 12 '24 17:04 jrmoulton