Fix UI polish: scrollbar deselect, web source inline buttons, countdown in Sources, volume click-to-position, meter decay

- Elements scrollbar no longer deselects element on click (check ScrollViewer, not StackPanel)
- Web source: URI + check/revert buttons merged into single DockPanel row, consistent order (✓ rightmost)
- Countdown timer moved from Elements panel to inline in source list row, range clamped to 1-30 min
- Volume slider click-to-position restored: e.Handled prevents IncreaseLarge from overriding position, Thumb drag still works
- Desktop audio meter: asymmetric smoothing (attack 0.2, decay 0.08) for faster response to silence
- 207 tests passing, 0 warnings
This commit is contained in:
2026-08-17 17:36:00 -07:00
parent 28054da70a
commit dc91c855ef
6 changed files with 65 additions and 48 deletions
+18 -3
View File
@@ -83,8 +83,11 @@ public partial class MainWindow : Window
private void VolumeSlider_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (sender is Slider slider)
if (sender is Slider slider && ClickIsOnTrackBackground(slider, e))
{
SetSliderValueFromClick(slider, e);
e.Handled = true;
}
if (sender is FrameworkElement { DataContext: MainViewModel vm })
vm.SetVolumeAdjusting(true);
}
@@ -103,8 +106,11 @@ public partial class MainWindow : Window
private void GameVolumeSlider_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (sender is Slider slider)
if (sender is Slider slider && ClickIsOnTrackBackground(slider, e))
{
SetSliderValueFromClick(slider, e);
e.Handled = true;
}
if (sender is FrameworkElement { DataContext: MainViewModel vm })
vm.SetGameVolumeAdjusting(true);
}
@@ -121,6 +127,15 @@ public partial class MainWindow : Window
vm.SetGameVolumeAdjusting(false);
}
private static bool ClickIsOnTrackBackground(Slider slider, MouseButtonEventArgs e)
{
var track = slider.Template.FindName("PART_Track", slider) as System.Windows.Controls.Primitives.Track;
if (track == null) return false;
if (track.Thumb != null && IsDescendantOf(e.OriginalSource as DependencyObject, track.Thumb))
return false;
return true;
}
private static void SetSliderValueFromClick(Slider slider, MouseButtonEventArgs e)
{
var track = slider.Template.FindName("PART_Track", slider) as System.Windows.Controls.Primitives.Track;
@@ -209,7 +224,7 @@ public partial class MainWindow : Window
if (e.OriginalSource is not DependencyObject original) return;
if (IsDescendantOf(original, PreviewGrid)) return;
if (IsDescendantOf(original, SourceList)) return;
if (IsDescendantOf(original, ElementsPanel)) return;
if (IsDescendantOf(original, ElementsScrollViewer)) return;
_viewModel.SelectedElement = null;
}