From 9403e8590149c13ff8be224db3cd1e23c4c17b35 Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Sun, 19 Nov 2023 14:29:21 -0800 Subject: [PATCH] MSAA + outlines are now inset Inset outlines may not be the right approach, but it simplifies potential alignment issues caused by insetting all filled background drawing by half the width of the focus ring. --- Cargo.lock | 2 +- src/context.rs | 4 ++-- src/styles/components.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee72b9f..58df162 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1089,7 +1089,7 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" [[package]] name = "kludgine" version = "0.1.0" -source = "git+https://github.com/khonsulabs/kludgine#0530299bbe79431b5fa398182991c63e06d94b90" +source = "git+https://github.com/khonsulabs/kludgine#f286d7de3f37ec7430890f6eeeb5d98a1ff0314e" dependencies = [ "ahash", "alot", diff --git a/src/context.rs b/src/context.rs index a8b6be2..61b9623 100644 --- a/src/context.rs +++ b/src/context.rs @@ -546,10 +546,10 @@ impl<'context, 'window, 'clip, 'gfx, 'pass> GraphicsContext<'context, 'window, ' { if color.alpha() > 0 { let options = options.colored(color).into_px(self.gfx.scale()); - let inset = options.line_width; + let inset = options.line_width / 2; let visible_rect = Rect::new( Point::squared(inset), - self.gfx.region().size - Point::new(inset * 2, inset * 2), + self.gfx.region().size - Point::squared(inset), ); let radii = self.get(&CornerRadius); diff --git a/src/styles/components.rs b/src/styles/components.rs index c5da2da..371ed87 100644 --- a/src/styles/components.rs +++ b/src/styles/components.rs @@ -136,6 +136,6 @@ define_components! { OpaqueWidgetColor(Color, "opaque_color", .surface.opaque_widget) /// A set of radius descriptions for how much roundness to apply to the /// shapes of widgets. - CornerRadius(CornerRadii, "corner_radius", CornerRadii::from(Dimension::Lp(Lp::points(100)))) + CornerRadius(CornerRadii, "corner_radius", CornerRadii::from(Dimension::Lp(Lp::points(7)))) } }