Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centre checkmark in checkbox #2036

Merged
merged 5 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ Bruno Dupuis
Christopher Noel Hesse
Marcin Zając
Laura Gallo
Tim Murison
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,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])
Expand Down Expand Up @@ -525,6 +526,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

[#599]: https://github.com/linebender/druid/pull/599
[#611]: https://github.com/linebender/druid/pull/611
Expand Down Expand Up @@ -804,6 +806,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

[Unreleased]: https://github.com/linebender/druid/compare/v0.7.0...master
[0.7.0]: https://github.com/linebender/druid/compare/v0.6.0...v0.7.0
Expand Down
8 changes: 5 additions & 3 deletions druid/src/widget/checkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ impl Widget<bool> 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)
Expand Down