From 0e0c26fa3b11355a0322741c2db0fd17822df64f Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Wed, 23 Oct 2024 10:48:09 -0700 Subject: [PATCH] Fixing Slider sizing when fully SizeToFit Fixes #197 --- CHANGELOG.md | 2 ++ src/widgets/slider.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 026dd0fdb..1504df3a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -126,6 +126,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 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. +- `Slider` now correctly calculates its width when in a fully `SizeToFit` + layout. ### Added diff --git a/src/widgets/slider.rs b/src/widgets/slider.rs index adfd1b354..3ed6d18de 100644 --- a/src/widgets/slider.rs +++ b/src/widgets/slider.rs @@ -548,7 +548,7 @@ where // user of the slider, a horizontal slider is expected. So, we // set the minimum measurement based on a horizontal // orientation. - Size::new(width.min(minimum_size), static_side) + Size::new(width.max(minimum_size), static_side) } } }