From 41118fdfcf343783824548751dc04696a6a9594a Mon Sep 17 00:00:00 2001 From: agentsim <2792224+agentsim@users.noreply.github.com> Date: Tue, 7 Dec 2021 13:24:35 -0500 Subject: [PATCH] Centre checkmark in checkbox (#2036) --- AUTHORS | 1 + CHANGELOG.md | 3 +++ druid/src/widget/checkbox.rs | 8 +++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index a0ed9c4c3b..a748c7fe56 100644 --- a/AUTHORS +++ b/AUTHORS @@ -18,4 +18,5 @@ Bruno Dupuis Christopher Noel Hesse Marcin ZajÄ…c Laura Gallo +Tim Murison Manmeet Singh diff --git a/CHANGELOG.md b/CHANGELOG.md index aa1aaddcab..92b5c18ed4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,6 +93,7 @@ You can find its changes [documented below](#070---2021-01-01). ### Fixed +- Centre checkmark in checkbox ([#2036] by [@agentsim]) - `Notification`s will not be delivered to the widget that sends them ([#1640] by [@cmyr]) - `TextBox` can handle standard keyboard shortcuts without needing menus ([#1660] by [@cmyr]) - GTK Shell: Prevent mangling of newline characters in clipboard ([#1695] by [@ForLoveOfCats]) @@ -526,6 +527,7 @@ Last release without a changelog :( [@lisael]: https://github.com/lisael [@jenra-uwu]: https://github.com/jenra-uwu [@klemensn]: https://github.com/klemensn +[@agentsim]: https://github.com/agentsim [@jplatte]: https://github.com/jplatte [#599]: https://github.com/linebender/druid/pull/599 @@ -806,6 +808,7 @@ Last release without a changelog :( [#1978]: https://github.com/linebender/druid/pull/1978 [#1993]: https://github.com/linebender/druid/pull/1993 [#1996]: https://github.com/linebender/druid/pull/1996 +[#2036]: https://github.com/linebender/druid/pull/2036 [#2064]: https://github.com/linebender/druid/pull/2064 [Unreleased]: https://github.com/linebender/druid/compare/v0.7.0...master diff --git a/druid/src/widget/checkbox.rs b/druid/src/widget/checkbox.rs index a6e767b674..0cf3c251f9 100644 --- a/druid/src/widget/checkbox.rs +++ b/druid/src/widget/checkbox.rs @@ -139,10 +139,12 @@ impl Widget for Checkbox { if *data { // Paint the checkmark + let x_offset = (rect.width() - 10.0) / 2.0; + let y_offset = (rect.height() - 8.0) / 2.0; let mut path = BezPath::new(); - path.move_to((4.0, 9.0)); - path.line_to((8.0, 13.0)); - path.line_to((14.0, 5.0)); + path.move_to((x_offset, y_offset + 4.0)); + path.line_to((x_offset + 4.0, y_offset + 8.0)); + path.line_to((x_offset + 10.0, y_offset)); let style = StrokeStyle::new() .line_cap(LineCap::Round)