mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[File Explorer Add-ons] Fix file preview pane flickering on file selection and resizing (#26660)
* Move color values to constant * Fix MonacoPreview flickering on file selection and resizing * Fix MarkdownPreview flickering on file selection and resizing * Fix SvgPreview flickering on file selection and resizing * Create Settings class and standardize background setting for MarkdownPreview * Replace ColorTranslator.FromHtml with Color.FromArgb for constant color settings * Use existing SetBackground * Remove duplicate GetTheme function * Update src/modules/previewpane/MarkdownPreviewHandler/Settings.cs
This commit is contained in:
@@ -77,6 +77,11 @@ namespace Microsoft.PowerToys.PreviewHandler.Monaco
|
||||
/// </summary>
|
||||
private string _base64FileCode;
|
||||
|
||||
public MonacoPreviewHandlerControl()
|
||||
{
|
||||
this.SetBackground();
|
||||
}
|
||||
|
||||
[STAThread]
|
||||
public override void DoPreview<T>(T dataSource)
|
||||
{
|
||||
@@ -95,14 +100,12 @@ namespace Microsoft.PowerToys.PreviewHandler.Monaco
|
||||
|
||||
base.DoPreview(dataSource);
|
||||
|
||||
// Sets background color
|
||||
SetBackground();
|
||||
|
||||
// Starts loading screen
|
||||
InitializeLoadingScreen();
|
||||
|
||||
// New webview2 element
|
||||
_webView = new WebView2();
|
||||
_webView.DefaultBackgroundColor = Color.Transparent;
|
||||
|
||||
// Checks if dataSource is a string
|
||||
if (!(dataSource is string filePath))
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Monaco
|
||||
{
|
||||
if (GetTheme() == "dark")
|
||||
{
|
||||
return System.Drawing.ColorTranslator.FromHtml("#1e1e1e");
|
||||
return Color.FromArgb(30, 30, 30); // #1e1e1e
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user