Skip to content

fix rounded borders on buttons #13541

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

Merged
merged 2 commits into from
May 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/bevy_ui/src/render/ui.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ fn draw(in: VertexOutput) -> vec4<f32> {
let t = select(1.0 - step(0.0, border_distance), antialias(border_distance), external_distance < internal_distance);

// Blend mode ALPHA_BLENDING is used for UI elements, so we don't premultiply alpha here.
return vec4(color.rgb, color.a * t);
return vec4(color.rgb, saturate(color.a * t));
}

fn draw_background(in: VertexOutput) -> vec4<f32> {
Expand All @@ -168,7 +168,7 @@ fn draw_background(in: VertexOutput) -> vec4<f32> {
// When drawing the background only draw the internal area and not the border.
let internal_distance = sd_inset_rounded_box(in.point, in.size, in.radius, in.border);
let t = antialias(internal_distance);
return vec4(color.rgb, color.a * t);
return vec4(color.rgb, saturate(color.a * t));
}

@fragment
Expand Down