mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-12 02:09:05 +00:00
Make HTML viewer and Markdown viewer per monitor DPI aware
This commit is contained in:
@@ -18,7 +18,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using QuickLook.Common.Helpers;
|
using QuickLook.Common.Helpers;
|
||||||
|
|
||||||
@@ -28,7 +30,16 @@ namespace QuickLook.Plugin.HtmlViewer
|
|||||||
{
|
{
|
||||||
public WebpagePanel()
|
public WebpagePanel()
|
||||||
{
|
{
|
||||||
Zoom = (int) (100 * DpiHelper.GetCurrentScaleFactor().Vertical);
|
var factor = VisualTreeHelper.GetDpi(this);
|
||||||
|
Zoom = (int)(factor.DpiScaleX*100);
|
||||||
|
}
|
||||||
|
|
||||||
|
// adjust zoom when DPI changes.
|
||||||
|
protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi)
|
||||||
|
{
|
||||||
|
var ratio = newDpi.DpiScaleX / oldDpi.DpiScaleX;
|
||||||
|
Zoom = (int)(Zoom * ratio);
|
||||||
|
base.OnDpiChanged(oldDpi, newDpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadFile(string path)
|
public void LoadFile(string path)
|
||||||
|
Reference in New Issue
Block a user