GraphicsContext::fill fix

Fixes #193

Not really sure why this existed -- all attempts at reasoning at this
choice today are met with me scratching my head.
This commit is contained in:
Jonathan Johnson 2024-10-22 08:09:11 -07:00
parent 6cf3039983
commit 62dded16ef
No known key found for this signature in database
GPG key ID: A66D6A34D6620579
2 changed files with 3 additions and 2 deletions

View file

@ -125,6 +125,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
drawing them. By making this change, the bars now have input priority over the
contents. This means that the scroll bars are now clickable even in areas
where interactive widgets are beneath them.
- `GraphicsContext::fill` now properly fills the entire region of the widget.
### Added

View file

@ -3,7 +3,7 @@ use std::borrow::Cow;
use std::ops::{Deref, DerefMut};
use figures::units::{Lp, Px, UPx};
use figures::{IntoSigned, Point, Px2D, Rect, Round, ScreenScale, Size, Zero};
use figures::{IntoSigned, Point, Rect, Round, ScreenScale, Size, Zero};
use kludgine::app::winit::event::{Ime, MouseButton, MouseScrollDelta, TouchPhase};
use kludgine::app::winit::window::Cursor;
use kludgine::cosmic_text::FamilyOwned;
@ -626,7 +626,7 @@ impl<'context, 'clip, 'gfx, 'pass> GraphicsContext<'context, 'clip, 'gfx, 'pass>
/// If the alpha channel of `color` is 0, this function does nothing.
pub fn fill(&mut self, color: Color) {
if color.alpha() > 0 {
let visible_rect = Rect::from(self.gfx.region().size - Size::px(1, 1));
let visible_rect = Rect::from(self.gfx.region().size);
let radii = self.get(&CornerRadius);
let radii = radii.map(|r| r.into_px(self.gfx.scale()));