Skip to content

Commit

Permalink
Fix TextBox to not paint outside its paint_rect. (#1007)
Browse files Browse the repository at this point in the history
  • Loading branch information
jneem authored Jun 2, 2020
1 parent 6a42914 commit 35f32cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ You can find its changes [documented below](#060---2020-06-01).

### Visual

- `TextBox` stroke remains inside its `paint_rect`. ([#1007] by [@jneem])

### Docs

- Fixed a link in `druid::command` documentation. ([#1008] by [@covercash2])
Expand Down Expand Up @@ -309,6 +311,7 @@ Last release without a changelog :(
[#997]: https://github.com/xi-editor/druid/pull/997
[#1001]: https://github.com/xi-editor/druid/pull/1001
[#1003]: https://github.com/xi-editor/druid/pull/1003
[#1007]: https://github.com/xi-editor/druid/pull/1007
[#1008]: https://github.com/xi-editor/druid/pull/1008

[Unreleased]: https://github.com/xi-editor/druid/compare/v0.6.0...master
Expand Down
9 changes: 4 additions & 5 deletions druid/src/widget/textbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,10 @@ impl Widget<String> for TextBox {
};

// Paint the background
let clip_rect = RoundedRect::from_origin_size(
Point::ORIGIN,
Size::new(self.width - BORDER_WIDTH, height).to_vec2(),
env.get(theme::TEXTBOX_BORDER_RADIUS),
);
let clip_rect = Size::new(self.width - BORDER_WIDTH, height)
.to_rect()
.inset(-BORDER_WIDTH / 2.0)
.to_rounded_rect(env.get(theme::TEXTBOX_BORDER_RADIUS));

ctx.fill(clip_rect, &background_color);

Expand Down

0 comments on commit 35f32cd

Please sign in to comment.