fix(socials): the bar disappeared from the preview when the plate was off

My own regression from the previous commit: the plate Border WRAPPED the bar's content and its
Visibility was bound to BarBackgroundEnabled — so with the plate off (the default) the preview
collapsed the entire social bar. Nothing was wrong with the data; the element was there and
invisible.

Fix: the wrapper is always laid out. "Plate off" now means a TRANSPARENT background
(`SocialBarBackgroundBrush` returns Transparent when disabled) and zero padding, "on" means the
colour/opacity plate with 18,6 padding — which also matches what the renderer bakes for the
output, so preview and broadcast agree.

Guard (new fact in SocialBarAppearanceTests): the preview must never visibility-gate the bar on
BarBackgroundEnabled, the wrapper must bind SocialBarBackgroundBrush, and the plate's switching
must be Padding.
This commit is contained in:
2026-10-30 09:06:53 -07:00
parent c1212644b0
commit 51d9dd09c7
3 changed files with 31 additions and 6 deletions
+12 -4
View File
@@ -351,10 +351,18 @@
<DropShadowEffect Color="{Binding SocialBarGlowBrush.Color}"
BlurRadius="18" ShadowDepth="0" Opacity="0.9"/>
</Grid.Effect>
<Border HorizontalAlignment="Center" Margin="40,8"
CornerRadius="20" Padding="18,6"
Background="{Binding SocialBarBackgroundBrush}"
Visibility="{Binding Socials.BarBackgroundEnabled, Converter={StaticResource BoolToVis}}">
<Border HorizontalAlignment="Center" Margin="40,8" CornerRadius="20"
Background="{Binding SocialBarBackgroundBrush}">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Padding" Value="0"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Socials.BarBackgroundEnabled}" Value="True">
<Setter Property="Padding" Value="18,6"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<ItemsControl ItemsSource="{Binding Socials.Entries}"
HorizontalAlignment="Center"
IsHitTestVisible="False">
+5 -2
View File
@@ -35,8 +35,11 @@ public partial class MainViewModel
/// so the two cannot drift apart (creator request 2026-10-30).</summary>
public SolidColorBrush SocialBarTextBrush => SocialBarStyle.From(_socials).TextBrush;
/// <summary>The preview's plate: same colour AND same opacity the renderer bakes in.</summary>
public SolidColorBrush SocialBarBackgroundBrush => SocialBarStyle.From(_socials).BackgroundBrush;
/// <summary>The preview's plate: same colour AND same opacity the renderer bakes in.
/// Transparent when the plate is off — "off" means no plate, never no bar.</summary>
public SolidColorBrush SocialBarBackgroundBrush => _socials?.BarBackgroundEnabled == true
? SocialBarStyle.From(_socials).BackgroundBrush
: Brushes.Transparent;
/// <summary>The global socials config (entries + bar settings), or null.</summary>
public SocialsConfig? Socials => _socials;
+14
View File
@@ -65,6 +65,20 @@ public class SocialBarAppearanceTests
Assert.Null(failure);
}
[Fact]
public void The_preview_bar_is_never_hidden_by_the_plate_switch()
{
// Regression, 2026-10-30: the plate Border wrapped the whole bar and its Visibility was
// bound to BarBackgroundEnabled, so turning the plate off (the default) removed the bar
// from the preview entirely. "Plate off" must mean a transparent plate.
var preview = SourceAssert.Text("Controls", "PreviewPane.xaml");
Assert.DoesNotContain("Socials.BarBackgroundEnabled, Converter={StaticResource BoolToVis}", preview);
Assert.Contains("{Binding SocialBarBackgroundBrush}", preview);
// The plate's PADDING is what switches with the toggle, not the element's presence.
Assert.Contains("<Setter Property=\"Padding\" Value=\"18,6\"/>", preview);
}
private static VideoFrame? Render(SocialBarStyle style) => SocialBarRenderer.Render(Entries, style);
private static int Count(VideoFrame frame, Func<int, int, int, int, bool> predicate)