|
3 | 3 |
|
4 | 4 | // ---------------------------------------------------------------------------- |
5 | 5 |
|
6 | | -use std::sync::atomic::{AtomicBool, Ordering}; |
| 6 | +use std::sync::{atomic::{AtomicBool, Ordering}, Arc}; |
7 | 7 | use nih_plug_egui::egui::{ |
8 | | - epaint, pos2, vec2, NumExt, Rect, Response, Sense, Shape, TextStyle, TextureId, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetType |
| 8 | + self, epaint::{self, Brush}, pos2, vec2, NumExt, Response, Sense, Shape, TextStyle, TextureId, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetType |
9 | 9 | }; |
10 | 10 |
|
11 | 11 | // TODO(emilk): allow checkbox without a text label |
@@ -92,12 +92,16 @@ impl<'a> Widget for AtomicSlimCheckbox<'a> { |
92 | 92 | let (small_icon_rect, big_icon_rect) = ui.spacing().icon_rectangles(rect); |
93 | 93 | ui.painter().add(epaint::RectShape { |
94 | 94 | rect: big_icon_rect.expand(visuals.expansion), |
95 | | - rounding: visuals.rounding, |
| 95 | + corner_radius: visuals.corner_radius, |
96 | 96 | fill: visuals.bg_fill, |
97 | 97 | stroke: visuals.bg_stroke, |
98 | | - fill_texture_id: TextureId::default(), |
99 | | - uv: big_icon_rect.expand(visuals.expansion), |
| 98 | + round_to_pixels: Option::None, |
100 | 99 | blur_width: 0.0, |
| 100 | + brush: Option::Some(Arc::new(Brush { |
| 101 | + fill_texture_id: TextureId::default(), |
| 102 | + uv: big_icon_rect.expand(visuals.expansion), |
| 103 | + })), |
| 104 | + stroke_kind: egui::StrokeKind::Middle, |
101 | 105 | }); |
102 | 106 |
|
103 | 107 | if checked.load(Ordering::SeqCst) { |
@@ -185,12 +189,16 @@ impl<'a> Widget for SlimCheckbox<'a> { |
185 | 189 | let (small_icon_rect, big_icon_rect) = ui.spacing().icon_rectangles(rect); |
186 | 190 | ui.painter().add(epaint::RectShape { |
187 | 191 | rect: big_icon_rect.expand(visuals.expansion), |
188 | | - rounding: visuals.rounding, |
| 192 | + corner_radius: visuals.corner_radius, |
189 | 193 | fill: visuals.weak_bg_fill, |
190 | 194 | stroke: visuals.fg_stroke, |
191 | | - fill_texture_id: TextureId::default(), |
192 | | - uv: Rect::ZERO, |
| 195 | + round_to_pixels: Option::None, |
193 | 196 | blur_width: 0.0, |
| 197 | + brush: Option::Some(Arc::new(Brush { |
| 198 | + fill_texture_id: TextureId::default(), |
| 199 | + uv: big_icon_rect.expand(visuals.expansion), |
| 200 | + })), |
| 201 | + stroke_kind: egui::StrokeKind::Middle |
194 | 202 | }); |
195 | 203 |
|
196 | 204 | if *checked { |
|
0 commit comments