Render borders correctly when only a subset of the border is visible

This commit is contained in:
Antonio Scandurra 2021-03-31 13:30:07 +02:00
parent 073ff96a9f
commit d853dbb048
2 changed files with 11 additions and 5 deletions

View file

@ -81,11 +81,17 @@ fragment float4 quad_fragment(
float2 rounded_edge_to_point = abs(center_to_point) - half_size + input.corner_radius;
float distance = length(max(0., rounded_edge_to_point)) + min(0., max(rounded_edge_to_point.x, rounded_edge_to_point.y)) - input.corner_radius;
float border_width = 0.;
if (edge_to_point.x > edge_to_point.y) {
border_width = center_to_point.x <= 0. ? input.border_left : input.border_right;
float vertical_border = center_to_point.x <= 0. ? input.border_left : input.border_right;
float horizontal_border = center_to_point.y <= 0. ? input.border_top : input.border_bottom;
float2 inset_size = half_size - input.corner_radius - float2(vertical_border, horizontal_border);
float2 point_to_inset_corner = abs(center_to_point) - inset_size;
float border_width;
if (point_to_inset_corner.x < 0. && point_to_inset_corner.y < 0.) {
border_width = 0.;
} else if (point_to_inset_corner.y > point_to_inset_corner.x) {
border_width = horizontal_border;
} else {
border_width = center_to_point.y <= 0. ? input.border_top : input.border_bottom;
border_width = vertical_border;
}
float4 color;

View file

@ -173,7 +173,7 @@ impl Pane {
ctx.emit(Event::Split(direction));
}
fn render_tabs<'a>(&self, app: &AppContext) -> ElementBox {
fn render_tabs(&self, app: &AppContext) -> ElementBox {
let settings = smol::block_on(self.settings.read());
let border_color = ColorU::from_u32(0xdbdbdcff);