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:
@@ -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">
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user