Skip to content

Commit 41118fd

Browse files
authored
Centre checkmark in checkbox (#2036)
1 parent 2d80ca0 commit 41118fd

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ Bruno Dupuis
1818
Christopher Noel Hesse
1919
Marcin Zając
2020
Laura Gallo
21+
Tim Murison
2122
Manmeet Singh

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ You can find its changes [documented below](#070---2021-01-01).
9393

9494
### Fixed
9595

96+
- Centre checkmark in checkbox ([#2036] by [@agentsim])
9697
- `Notification`s will not be delivered to the widget that sends them ([#1640] by [@cmyr])
9798
- `TextBox` can handle standard keyboard shortcuts without needing menus ([#1660] by [@cmyr])
9899
- GTK Shell: Prevent mangling of newline characters in clipboard ([#1695] by [@ForLoveOfCats])
@@ -526,6 +527,7 @@ Last release without a changelog :(
526527
[@lisael]: https://github.com/lisael
527528
[@jenra-uwu]: https://github.com/jenra-uwu
528529
[@klemensn]: https://github.com/klemensn
530+
[@agentsim]: https://github.com/agentsim
529531
[@jplatte]: https://github.com/jplatte
530532

531533
[#599]: https://github.com/linebender/druid/pull/599
@@ -806,6 +808,7 @@ Last release without a changelog :(
806808
[#1978]: https://github.com/linebender/druid/pull/1978
807809
[#1993]: https://github.com/linebender/druid/pull/1993
808810
[#1996]: https://github.com/linebender/druid/pull/1996
811+
[#2036]: https://github.com/linebender/druid/pull/2036
809812
[#2064]: https://github.com/linebender/druid/pull/2064
810813

811814
[Unreleased]: https://github.com/linebender/druid/compare/v0.7.0...master

druid/src/widget/checkbox.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ impl Widget<bool> for Checkbox {
139139

140140
if *data {
141141
// Paint the checkmark
142+
let x_offset = (rect.width() - 10.0) / 2.0;
143+
let y_offset = (rect.height() - 8.0) / 2.0;
142144
let mut path = BezPath::new();
143-
path.move_to((4.0, 9.0));
144-
path.line_to((8.0, 13.0));
145-
path.line_to((14.0, 5.0));
145+
path.move_to((x_offset, y_offset + 4.0));
146+
path.line_to((x_offset + 4.0, y_offset + 8.0));
147+
path.line_to((x_offset + 10.0, y_offset));
146148

147149
let style = StrokeStyle::new()
148150
.line_cap(LineCap::Round)

0 commit comments

Comments
 (0)