SvgPreviewControl: Add Background so that white .svg are visible (#25397)

* SvgPreviewControl: Add checkered background so that white .svg are visible

* SvgPreviewControl: Move preview generation logic into own class

* SvgPreviewControl: Add possibility to configure background of svg preview pane via the settings ui

* SvgPreviewControl: Take user configuration into consideration when generating svg preview

* SvgPreviewControl: Do not generate preview file, if the actual size is under the 2mb limiation of WebView2

* SvgPreviewControl: Introduce SvgPreviewColorMode enumeration instead of using magic values

* SvgPreviewControl: Add additional checkered pattern shades

* SvgPreviewControl: Use newly introduced enums as default values
This commit is contained in:
Sebastian Zanoni
2023-04-21 18:54:57 +02:00
committed by GitHub
parent 3164e03ad4
commit 3a63a088ed
11 changed files with 328 additions and 6 deletions

View File

@@ -115,7 +115,7 @@
IsOn="{x:Bind IsShown, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
OffContent=""
OnContent="" />
<Button
x:Uid="More_Options_Button"
Grid.Column="1"

View File

@@ -22,14 +22,39 @@
IsOpen="True"
IsTabStop="True"
Severity="Warning" />
<labs:SettingsCard
<labs:SettingsExpander
x:Uid="FileExplorerPreview_ToggleSwitch_Preview_SVG"
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xE91B;}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsSVGRenderEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}">
<ToggleSwitch
x:Uid="ToggleSwitch"
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SVGRenderIsEnabled}" />
</labs:SettingsCard>
<labs:SettingsExpander.Items>
<labs:SettingsCard x:Uid="FileExplorerPreview_Preview_SVG_Color_Mode">
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.SVGRenderBackgroundColorMode, Mode=TwoWay}"
IsEnabled="{x:Bind ViewModel.SVGRenderIsEnabled, Mode=OneWay}">
<ComboBoxItem x:Uid="FileExplorerPreview_Preview_SVG_Color_Mode_Default" />
<ComboBoxItem x:Uid="FileExplorerPreview_Preview_SVG_Color_Solid_Color" />
<ComboBoxItem x:Uid="FileExplorerPreview_Preview_SVG_Checkered_Shade" />
</ComboBox>
</labs:SettingsCard>
<labs:SettingsCard x:Uid="FileExplorerPreview_Preview_SVG_Background_Color"
Visibility="{x:Bind ViewModel.IsSvgBackgroundColorVisible, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
<controls:ColorPickerButton
IsEnabled="{x:Bind ViewModel.SVGRenderIsEnabled, Mode=OneWay}"
SelectedColor="{x:Bind Path=ViewModel.SVGRenderBackgroundSolidColor, Mode=TwoWay}" />
</labs:SettingsCard>
<labs:SettingsCard x:Uid="FileExplorerPreview_Preview_SVG_Checkered_Shade_Mode"
Visibility="{x:Bind ViewModel.IsSvgCheckeredShadeVisible, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.SVGRenderBackgroundCheckeredShade, Mode=TwoWay}"
IsEnabled="{x:Bind ViewModel.SVGRenderIsEnabled, Mode=OneWay}">
<ComboBoxItem x:Uid="FileExplorerPreview_Preview_SVG_Checkered_Shade_1" />
<ComboBoxItem x:Uid="FileExplorerPreview_Preview_SVG_Checkered_Shade_2" />
<ComboBoxItem x:Uid="FileExplorerPreview_Preview_SVG_Checkered_Shade_3" />
</ComboBox>
</labs:SettingsCard>
</labs:SettingsExpander.Items>
</labs:SettingsExpander>
<InfoBar
x:Uid="GPO_IsSettingForced"